mp3splt-gtk
mp3splt.h
Go to the documentation of this file.
00001 /**********************************************************
00002  *
00003  * libmp3splt -- library based on mp3splt,
00004  *               for mp3/ogg splitting without decoding
00005  *
00006  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
00007  * Copyright (c) 2005-2012 Alexandru Munteanu - io_fx@yahoo.fr
00008  *
00009  * http://mp3splt.sourceforge.net
00010  *
00011  *********************************************************/
00012 
00013 /**********************************************************
00014  *
00015  * This program is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU General Public License
00017  * as published by the Free Software Foundation; either version 2
00018  * of the License, or (at your option) any later version.
00019  *
00020  * This program is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License
00026  * along with this program; if not, write to the Free Software
00027  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00028  * 02111-1307,
00029  * USA.
00030  *
00031  *********************************************************/
00032 
00033 #ifndef MP3SPLT_MP3SPLT_H
00034 
00035 #include <sys/types.h>
00036 #include <stdlib.h>
00037 #include <stdio.h>
00038 
00039 //libtool 1.4e is buggy on mingw if we include ltdl.h
00040 #ifndef __WIN32__
00041 #include <ltdl.h>
00042 #endif
00043 
00059 #define SPLT_TRUE 1
00060 
00063 #define SPLT_FALSE 0
00064 
00065 /******************************/
00066 /* Structures for the freedb  */
00067 
00074 typedef struct {
00078   char *name;
00082   int id;
00089   int revision_number;
00096   int *revisions;
00097 } splt_freedb_one_result;
00098 
00105 typedef struct {
00109   splt_freedb_one_result *results;
00113   int number;
00114 } splt_freedb_results;
00115 
00119 #define SPLT_MAXCD 512
00120 
00121 //maximum length of the disc id
00122 #define SPLT_DISCIDLEN 8
00123 
00124 //structure for the freedb search
00125 struct splt_cd {
00126   char discid[SPLT_DISCIDLEN+1];
00127   char category[20];
00128 };
00129 
00130 typedef struct {
00131   struct splt_cd discs[SPLT_MAXCD];
00132   int foundcd;
00133 } splt_cd_state;
00134 
00135 //structure containing everything used for the
00136 //freedb search
00137 typedef struct {
00138   //we stock here the results of the freedb search
00139   splt_freedb_results *search_results;
00140   //we stock the state of the CD
00141   //(for the freedb search)
00142   splt_cd_state *cdstate;
00143 } splt_freedb;
00144 
00145 /******************************/
00146 /* Structures for the wrap    */
00147 
00153 typedef struct {
00157   int wrap_files_num;
00161   char **wrap_files;
00162 } splt_wrap;
00163 
00164 /************************************/
00165 /* Structures for the syncerrors    */
00166 
00172 typedef struct {
00173   off_t *serrors_points;
00177   long int serrors_points_num;
00178 } splt_syncerrors;
00179 
00180 /***************************************/
00181 /* Structures for the output format    */
00182 
00183 #define SPLT_MAXOLEN 255
00184 #define SPLT_OUTNUM  20
00185 
00186 //structure defining the output format
00187 typedef struct {
00188   //format as @n_@t.. as a string
00189   char *format_string;
00190   //when we have @n option on output format
00191   char output_format_digits;
00192   int output_alpha_format_digits;
00193   //format for the cddb cue output
00194   char format[SPLT_OUTNUM+1][SPLT_MAXOLEN];
00195 } splt_oformat;
00196 
00197 /***************************/
00198 /* Structures for the tags */
00199 
00209 typedef struct {
00213   char *title;
00217   char *artist;
00221   char *album;
00229   char *performer;
00233   char *year;
00237   char *comment;
00241   int track;
00245   char *genre;
00246 
00247   /*
00248    * @brief tags version (for mp3): 1 or 2 or 1 & 2
00249    */
00250   int tags_version;
00251 
00252   int set_original_tags;
00253 } splt_tags;
00254 
00255 typedef struct {
00256   splt_tags tags;
00257   void *all_original_tags;
00258 } splt_original_tags;
00259 
00266 typedef struct {
00270   long value;
00274   char *name;
00279   int type;
00280 } splt_point;
00281 
00282 /*****************************/
00283 /* Structure for the silence */
00284 
00285 struct splt_ssplit {
00286   double begin_position;
00287   double end_position;
00288   long len;
00289   struct splt_ssplit *next;
00290 };
00291 
00292 /**********************************/
00293 /* Structure for the split        */
00294 
00304 typedef struct splt_progres {
00309   int progress_text_max_char;
00311   char filename_shorted[512];
00313   float percent_progress;
00315   int current_split;
00317   int max_splits;
00325   int progress_type;
00327   int silence_found_tracks;
00329   float silence_db_level;
00335   int user_data;
00337   void (*progress)(struct splt_progres*);
00338 } splt_progress;
00339 
00341 typedef struct {
00343   int use_proxy;
00345   char hostname[256];
00347   int port;
00349   int authentification;
00351   char user[256];
00353   char password[256];
00354 } splt_proxy;
00355 
00357 typedef enum {
00361   SPLT_MESSAGE_INFO,
00365   SPLT_MESSAGE_DEBUG
00366 } splt_message_type;
00367 
00369 typedef struct {
00371   long total_time;
00373   int current_split;
00375   int current_split_file_number;
00383   int splitnumber;
00385   int real_splitnumber;
00393   void (*file_split)(const char *,int);
00395   splt_progress *p_bar;
00397   void (*get_silence_level)(long time, float level, void *user_data);
00399   void *silence_level_client_data;
00401   void (*put_message)(const char *, splt_message_type );
00403   splt_point *points;
00405   int real_tagsnumber;
00407   splt_tags *tags;
00408   splt_tags tags_like_x;
00409 } splt_struct;
00410 
00411 /**********************************/
00412 /* Options structure              */
00413 
00419 typedef enum {
00423   SPLT_OPTION_NORMAL_MODE,
00427   SPLT_OPTION_WRAP_MODE,
00431   SPLT_OPTION_SILENCE_MODE,
00435   SPLT_OPTION_TRIM_SILENCE_MODE,
00441   SPLT_OPTION_ERROR_MODE,
00446   SPLT_OPTION_TIME_MODE,
00451   SPLT_OPTION_LENGTH_MODE,
00452 } splt_split_mode_options;
00453 
00459 typedef enum {
00461   SPLT_OUTPUT_FORMAT,
00463   SPLT_OUTPUT_DEFAULT,
00469   SPLT_OUTPUT_CUSTOM
00470 } splt_output_filenames_options;
00471 
00475 #define SPLT_DEFAULT_PARAM_THRESHOLD -48.0
00476 
00479 #define SPLT_DEFAULT_PARAM_OFFSET 0.8
00480 
00483 #define SPLT_DEFAULT_PARAM_MINIMUM_LENGTH 0.0
00484 
00487 #define SPLT_DEFAULT_PARAM_MINIMUM_TRACK_LENGTH 0.0
00488 
00491 #define SPLT_DEFAULT_PARAM_GAP 30
00492 
00495 #define SPLT_DEFAULT_PARAM_TRACKS 0
00496 
00499 #define SPLT_DEFAULT_PARAM_SHOTS 25
00500 
00506 typedef enum {
00510   SPLT_TAGS_ORIGINAL_FILE,
00515   SPLT_CURRENT_TAGS,
00519   SPLT_NO_TAGS,
00524   SPLT_TAGS_FROM_FILENAME_REGEX,
00525 } splt_tags_options;
00526 
00527 #define SPLT_ORIGINAL_TAGS_DEFAULT "%[@o,@N=1]"
00528 
00529 #define SPLT_DEFAULT_OUTPUT "@f_@mm_@ss_@hh__@Mm_@Ss_@Hh"
00530 
00535 #define SPLT_DEFAULT_CDDB_CUE_OUTPUT "@A - @n - @t"
00536 
00540 #define SPLT_DEFAULT_SYNCERROR_OUTPUT "@f_error_@n"
00541 
00545 #define SPLT_DEFAULT_SILENCE_OUTPUT "@f_silence_@n"
00546 
00550 #define SPLT_DEFAULT_TRIM_SILENCE_OUTPUT "@f_trimmed"
00551 
00553 typedef struct {
00562   splt_split_mode_options split_mode;
00563 
00571   splt_tags_options tags;
00572 
00573   int xing;
00574 
00576   splt_output_filenames_options output_filenames;
00577 
00579   int quiet_mode;
00580 
00585   int pretend_to_split;
00586 
00592   int option_frame_mode;
00594   float split_time;
00595   long overlap_time;
00597   int option_auto_adjust;
00606   int option_input_not_seekable;
00607 
00614   int create_dirs_from_filenames;
00615 
00616   //PARAMETERS---------------------------------------
00617   //PARAMETERS for option_auto_adjust and option_silence_mode:
00621   float parameter_threshold;
00630   float parameter_offset;
00631 
00632   //PARAMETERS for option_silence_mode:
00638   int parameter_number_tracks;
00645   int parameter_shots;
00651   float parameter_minimum_length;
00657   float parameter_min_track_length;
00658 
00660   int artist_tag_format;
00662   int album_tag_format;
00664   int title_tag_format;
00666   int comment_tag_format;
00667 
00669   int replace_underscores_tag_format;
00670 
00672   int set_file_from_cue_if_file_tag_found;
00673 
00675   int parameter_remove_silence;
00676 
00677   //PARAMETERS for option_auto_adjust:
00684   int parameter_gap;
00685 
00690   int remaining_tags_like_x;
00691 
00693   int auto_increment_tracknumber_tags;
00694 
00698   int enable_silence_log;
00699 
00706   int force_tags_version;
00710   int length_split_file_number;
00711   int replace_tags_in_tags;
00712 } splt_options;
00713 
00714 /**********************************/
00715 /* Main structure                 */
00716 
00717 //internal structures
00718 typedef struct
00719 {
00721   int frame_mode_enabled;
00723   int current_refresh_rate;
00725   int messages_locked;
00727   int library_locked;
00729   char *new_filename_path;
00730 } splt_internal;
00731 
00736 typedef struct
00737 {
00738   float version;
00739   char *name;
00740   char *extension;
00741   char *upper_extension;
00742 } splt_plugin_info;
00743 
00745 typedef struct {
00746   int (*check_plugin_is_for_file)(void *state, int *error);
00747   void (*set_plugin_info)(splt_plugin_info *info, int *error);
00748   void (*search_syncerrors)(void *state, int *error);
00749   void (*dewrap)(void *state, int listonly, const char *dir, int *error);
00750   void (*set_total_time)(void *state, int *error);
00751   int (*simple_split)(void *state, const char *output_fname, off_t begin, off_t end);
00752   double (*split)(void *state, const char *final_fname, double begin_point,
00753       double end_point, int *error, int save_end_point);
00754   int (*scan_silence)(void *state, int *error);
00755   int (*scan_trim_silence)(void *state, int *error);
00756   void (*set_original_tags)(void *state, int *error);
00757   void (*clear_original_tags)(splt_original_tags *original_tags);
00758   void (*init)(void *state, int *error);
00759   void (*end)(void *state, int *error);
00760 } splt_plugin_func;
00761 
00763 typedef struct
00764 {
00765   splt_plugin_info info;
00767   char *plugin_filename;
00769   void *plugin_handle;
00771   splt_plugin_func *func;
00772 } splt_plugin_data;
00773 
00775 typedef struct
00776 {
00778   char **plugins_scan_dirs;
00779   int number_of_dirs_to_scan;
00781   int number_of_plugins_found;
00783   splt_plugin_data *data;
00784 } splt_plugins;
00785 
00787 typedef struct
00788 {
00789   char *error_data;
00790   char *strerror_msg;
00791 } splt_error;
00792 
00794 typedef struct {
00795 
00797   int cancel_split;
00799   char *fname_to_split;
00801   char *path_of_split;
00802 
00803   //if this is non null, we write a m3u from the split files
00804   char *m3u_filename;
00805   
00807   char *input_fname_regex;
00808 
00809   char *default_comment_tag;
00810   char *default_genre_tag;
00811 
00813   splt_original_tags original_tags;
00814 
00816   splt_options options;
00818   splt_struct split;
00820   splt_oformat oformat;
00822   splt_wrap *wrap;
00824   splt_syncerrors *serrors;
00831   unsigned long syncerrors;
00833   splt_freedb fdb;
00834 
00836   splt_internal iopts;
00837 
00839   struct splt_ssplit *silence_list;
00840 
00841   //proxy infos
00842   //splt_proxy proxy;
00843 
00845   void *codec;
00846 
00848   splt_error err;
00849 
00851   splt_plugins *plug;
00852   int current_plugin;
00853 
00855   char *silence_log_fname;
00856 } splt_state;
00857 
00858 /*****************************************/
00859 /* Confirmations, errors and messages    */
00860 
00862 typedef enum {
00863   SPLT_OK = 0,
00864 
00865   SPLT_OK_SPLIT = 1,
00866   SPLT_SPLITPOINT_BIGGER_THAN_LENGTH = 4,
00867   SPLT_SILENCE_OK = 5,
00868   SPLT_TIME_SPLIT_OK = 6,
00869   SPLT_NO_SILENCE_SPLITPOINTS_FOUND = 7,
00870   SPLT_OK_SPLIT_EOF = 8,
00871   SPLT_LENGTH_SPLIT_OK = 9,
00872   SPLT_TRIM_SILENCE_OK = 10,
00873 
00874   SPLT_FREEDB_OK = 100,
00875   SPLT_FREEDB_FILE_OK = 101,
00876   SPLT_CDDB_OK = 102,
00877   SPLT_CUE_OK = 103,
00878   SPLT_FREEDB_MAX_CD_REACHED = 104,
00879   SPLT_AUDACITY_OK = 105,
00880 
00881   SPLT_DEWRAP_OK = 200,
00882 
00883   SPLT_SYNC_OK = 300,
00884   SPLT_MIGHT_BE_VBR = 301,
00885 
00886   SPLT_ERR_SYNC = -300,
00887   SPLT_ERR_NO_SYNC_FOUND = -301,
00888   SPLT_ERR_TOO_MANY_SYNC_ERR = -302,
00889 
00890   SPLT_OUTPUT_FORMAT_OK = 400,
00891   SPLT_OUTPUT_FORMAT_AMBIGUOUS = 401,
00892 
00893   SPLT_REGEX_OK = 800,
00894 
00895   SPLT_ERROR_SPLITPOINTS = -1,
00896   SPLT_ERROR_CANNOT_OPEN_FILE = -2,
00897   SPLT_ERROR_INVALID = -3,
00898   SPLT_ERROR_EQUAL_SPLITPOINTS = -5,
00899   SPLT_ERROR_SPLITPOINTS_NOT_IN_ORDER = -6,
00900   SPLT_ERROR_NEGATIVE_SPLITPOINT = -7,
00901   SPLT_ERROR_INCORRECT_PATH = -8,
00902   SPLT_ERROR_INCOMPATIBLE_OPTIONS = -10,
00903   SPLT_ERROR_INPUT_OUTPUT_SAME_FILE = -12,
00904   SPLT_ERROR_CANNOT_ALLOCATE_MEMORY = -15,
00905   SPLT_ERROR_CANNOT_OPEN_DEST_FILE = -16,
00906   SPLT_ERROR_CANT_WRITE_TO_OUTPUT_FILE = -17,
00907   SPLT_ERROR_WHILE_READING_FILE = -18,
00908   SPLT_ERROR_SEEKING_FILE = -19,
00909   SPLT_ERROR_BEGIN_OUT_OF_FILE = -20,
00910   SPLT_ERROR_INEXISTENT_FILE = -21,
00911   SPLT_SPLIT_CANCELLED = -22,
00912   SPLT_ERROR_LIBRARY_LOCKED = -24,
00913   SPLT_ERROR_STATE_NULL = -25,
00914   SPLT_ERROR_NEGATIVE_TIME_SPLIT = -26,
00915   SPLT_ERROR_CANNOT_CREATE_DIRECTORY = -27,
00916   SPLT_ERROR_CANNOT_CLOSE_FILE = -28,
00917   SPLT_ERROR_NO_PLUGIN_FOUND = -29,
00918   SPLT_ERROR_CANNOT_INIT_LIBLTDL = -30,
00919   SPLT_ERROR_CRC_FAILED = -31,
00920   SPLT_ERROR_NO_PLUGIN_FOUND_FOR_FILE = -32,
00921   SPLT_ERROR_PLUGIN_ERROR = -33,
00922   SPLT_ERROR_TIME_SPLIT_VALUE_INVALID = -34,
00923   SPLT_ERROR_LENGTH_SPLIT_VALUE_INVALID = -35,
00924   SPLT_ERROR_CANNOT_GET_TOTAL_TIME = -36,
00925   SPLT_ERROR_LIBID3 = -37,
00926 
00927   SPLT_FREEDB_ERROR_INITIALISE_SOCKET = -101,
00928   SPLT_FREEDB_ERROR_CANNOT_GET_HOST = -102,
00929   SPLT_FREEDB_ERROR_CANNOT_OPEN_SOCKET = -103,
00930   SPLT_FREEDB_ERROR_CANNOT_CONNECT = -104,
00931   SPLT_FREEDB_ERROR_CANNOT_SEND_MESSAGE = -105,
00932   SPLT_FREEDB_ERROR_INVALID_SERVER_ANSWER = -106,
00933   SPLT_FREEDB_ERROR_SITE_201 = -107,
00934   SPLT_FREEDB_ERROR_SITE_200 = -108,
00935   SPLT_FREEDB_ERROR_BAD_COMMUNICATION = -109,
00936   SPLT_FREEDB_ERROR_GETTING_INFOS = -110,
00937   SPLT_FREEDB_NO_CD_FOUND = -111,
00938   SPLT_FREEDB_ERROR_CANNOT_RECV_MESSAGE = -112,
00939   SPLT_INVALID_CUE_FILE = -115,
00940   SPLT_INVALID_CDDB_FILE = -116,
00941   SPLT_FREEDB_NO_SUCH_CD_IN_DATABASE = -118,
00942   SPLT_FREEDB_ERROR_SITE = -119,
00943   SPLT_FREEDB_ERROR_CANNOT_DISCONNECT = -120,
00944 
00945   SPLT_DEWRAP_ERR_FILE_LENGTH = -200,
00946   SPLT_DEWRAP_ERR_VERSION_OLD = -201,
00947   SPLT_DEWRAP_ERR_NO_FILE_OR_BAD_INDEX = -202,
00948   SPLT_DEWRAP_ERR_FILE_DAMAGED_INCOMPLETE = -203,
00949   SPLT_DEWRAP_ERR_FILE_NOT_WRAPED_DAMAGED = -204,
00950 
00951   SPLT_OUTPUT_FORMAT_ERROR = -400,
00952 
00953   SPLT_ERROR_INEXISTENT_SPLITPOINT = -500,
00954 
00955   SPLT_PLUGIN_ERROR_UNSUPPORTED_FEATURE = -600,
00956 
00957   SPLT_INVALID_AUDACITY_FILE = -700,
00958 
00959   SPLT_INVALID_REGEX = -800,
00960   SPLT_REGEX_NO_MATCH = -801,
00961   SPLT_REGEX_UNAVAILABLE = -802,
00962 } splt_code;
00963 
00964 //internal
00965 #define SPLT_INTERNAL_PROGRESS_RATE 1
00966 #define SPLT_INTERNAL_FRAME_MODE_ENABLED 2
00967 
00968 //progress messages
00974 typedef enum {
00978   SPLT_PROGRESS_PREPARE,
00982   SPLT_PROGRESS_CREATE,
00986   SPLT_PROGRESS_SEARCH_SYNC,
00990   SPLT_PROGRESS_SCAN_SILENCE
00991 } splt_progress_messages;
00992 
01001 typedef enum {
01006   SPLT_OPT_PRETEND_TO_SPLIT,
01007   /*
01008    * If quiet; we don't do CRC check or human interaction
01009    */
01010   SPLT_OPT_QUIET_MODE,
01018   SPLT_OPT_DEBUG_MODE,
01026   SPLT_OPT_SPLIT_MODE,
01034   SPLT_OPT_TAGS,
01038   SPLT_OPT_XING,
01050   SPLT_OPT_CREATE_DIRS_FROM_FILENAMES,
01056   SPLT_OPT_OUTPUT_FILENAMES,
01066   SPLT_OPT_FRAME_MODE,
01077   SPLT_OPT_AUTO_ADJUST,
01087   SPLT_OPT_INPUT_NOT_SEEKABLE,
01097   SPLT_OPT_PARAM_NUMBER_TRACKS,
01109   SPLT_OPT_PARAM_SHOTS,
01118   SPLT_OPT_PARAM_REMOVE_SILENCE,
01127   SPLT_OPT_PARAM_GAP,
01131   SPLT_OPT_ALL_REMAINING_TAGS_LIKE_X,
01135   SPLT_OPT_AUTO_INCREMENT_TRACKNUMBER_TAGS,
01139   SPLT_OPT_ENABLE_SILENCE_LOG,
01143   SPLT_OPT_FORCE_TAGS_VERSION,
01147   SPLT_OPT_LENGTH_SPLIT_FILE_NUMBER,
01151   SPLT_OPT_REPLACE_TAGS_IN_TAGS,
01155   SPLT_OPT_OVERLAP_TIME,
01164   SPLT_OPT_SPLIT_TIME,
01175   SPLT_OPT_PARAM_THRESHOLD,
01186   SPLT_OPT_PARAM_OFFSET,
01195   SPLT_OPT_PARAM_MIN_LENGTH,
01204   SPLT_OPT_PARAM_MIN_TRACK_LENGTH,
01209   SPLT_OPT_ARTIST_TAG_FORMAT,
01214   SPLT_OPT_ALBUM_TAG_FORMAT,
01219   SPLT_OPT_TITLE_TAG_FORMAT,
01224   SPLT_OPT_COMMENT_TAG_FORMAT,
01229   SPLT_OPT_REPLACE_UNDERSCORES_TAG_FORMAT,
01234   SPLT_OPT_SET_FILE_FROM_CUE_IF_FILE_TAG_FOUND,
01235 } splt_int_options;
01236 
01237 typedef enum {
01238   SPLT_NO_CONVERSION,
01239   SPLT_TO_LOWERCASE,
01240   SPLT_TO_UPPERCASE,
01241   SPLT_TO_FIRST_UPPERCASE,
01242   SPLT_TO_WORD_FIRST_UPPERCASE
01243 } splt_str_format;
01244 
01249 typedef enum {
01250   /* a regular splitpoint */
01251   SPLT_SPLITPOINT,
01252   /* a skippoint */
01253   SPLT_SKIPPOINT,
01254 } splt_type_of_splitpoint;
01255 
01256 
01257 #define SPLT_UNDEFINED_GENRE "Other"
01258 
01259 #define SPLT_ID3V1_NUMBER_OF_GENRES 127
01260 
01263 static const char splt_id3v1_genres[SPLT_ID3V1_NUMBER_OF_GENRES][25] = {
01264   {"Blues"},
01265   {"Classic Rock"}, {"Country"}, {"Dance"}, 
01266   {"Disco"},{"Funk"},{"Grunge"},{"Hip-Hop"},{"Jazz"},
01267   {"Metal"},{"New Age"},{"Oldies"}, {"Other"}, {"Pop"},
01268   {"R&B"}, {"Rap"}, {"Reggae"}, {"Rock"}, {"Techno"},
01269   {"Industrial"}, {"Alternative"}, {"Ska"}, {"Death metal"},
01270   {"Pranks"}, {"Soundtrack"}, {"Euro-Techno"},
01271   {"Ambient"}, {"Trip-hop"}, {"Vocal"}, {"Jazz+Funk"},
01272   {"Fusion"}, {"Trance"}, {"Classical"}, {"Instrumental"},
01273   {"Acid"}, {"House"}, {"Game"}, {"Sound clip"}, {"Gospel"},
01274   {"Noise"}, {"Alt. Rock"}, {"Bass"}, {"Soul"}, {"Punk"}, 
01275   {"Space"}, {"Meditative"}, {"Instrumental pop"}, 
01276   {"Instrumental rock"}, {"Ethnic"}, {"Gothic"},{"Darkwave"},
01277   {"Techno-Industrial"},{"Electronic"},{"Pop-Folk"},{"Eurodance"},
01278   {"Dream"},{"Southern Rock"},{"Comedy"}, {"Cult"},{"Gangsta"},
01279   {"Top 40"},{"Christian Rap"},{"Pop/Funk"}, {"Jungle"},
01280   {"Native American"},{"Cabaret"},{"New Wave"}, {"Psychedelic"},
01281   {"Rave"},{"Showtunes"},{"Trailer"}, {"Lo-Fi"},{"Tribal"},
01282   {"Acid Punk"},{"Acid Jazz"}, {"Polka"}, {"Retro"},
01283   {"Musical"},{"Rock & Roll"},{"Hard Rock"},
01284 
01285   {"Folk"}, {"Folk-Rock"}, {"National Folk"}, {"Swing"},
01286   {"Fast Fusion"}, {"Bebob"}, {"Latin"}, {"Revival"},
01287   {"Celtic"}, {"Bluegrass"}, {"Avantgarde"}, {"Gothic Rock"},
01288   {"Progressive Rock"}, {"Psychedelic Rock"}, {"Symphonic Rock"},
01289   {"Slow Rock"}, {"Big Band"}, {"Chorus"}, {"Easy Listening"},
01290   {"Acoustic"}, {"Humour"}, {"Speech"}, {"Chanson"}, {"Opera"},
01291   {"Chamber Music"}, {"Sonata"}, {"Symphony"}, {"Booty Bass"},
01292   {"Primus"}, {"Porn Groove"}, {"Satire"}, {"Slow Jam"},
01293   {"Club"}, {"Tango"}, {"Samba"}, {"Folklore"}, {"Ballad"},
01294   {"Power Ballad"}, {"Rhythmic Soul"}, {"Freestyle"}, {"Duet"},
01295   {"Punk Rock"}, {"Drum Solo"}, {"A capella"}, {"Euro-House"},
01296   {"Dance Hall"},
01297 
01298   {"misc"},
01299 };
01300 
01305 /*
01306  * freedb2 search type
01307  */
01308 #define SPLT_FREEDB_SEARCH_TYPE_CDDB_CGI 1
01309 /*
01310  * freedb search type
01311  */
01312 #define SPLT_FREEDB_SEARCH_TYPE_CDDB 2
01313 /*
01314  * freedb get file type
01315  * we retrieve the file by using the cddb.cgi script
01316  * (usually on port 80)
01317  */
01318 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI 3
01319 /*
01320  * we retrieve the file by using the freedb cddb protocol 
01321  * (usually on port 8880)
01322  */
01323 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB 4
01324 
01327 #define SPLT_FREEDB_CDDB_CGI_PORT 80
01328 
01331 #define SPLT_FREEDB_CDDB_PORT 8880
01332 
01335 #define SPLT_FREEDB_CGI_SITE "freedb.org/~cddb/cddb.cgi"
01336 #define SPLT_FREEDB2_CGI_SITE "tracktype.org/~cddb/cddb.cgi"
01337 
01338 //package information constants
01339 #ifndef SPLT_PACKAGE_NAME
01340 
01343 #define SPLT_PACKAGE_NAME "libmp3splt"
01344 #endif
01345 #ifndef SPLT_PACKAGE_VERSION
01346 
01349 #define SPLT_PACKAGE_VERSION "0.7.2"
01350 #endif
01351 
01354 #define SPLT_AUTHOR "Matteo Trotta | Munteanu Alexandru"
01355 #define SPLT_EMAIL "<mtrotta@users.sourceforge.net> | <io_fx@yahoo.fr>"
01356 
01359 #define SPLT_WEBSITE "http://mp3splt.sourceforge.net"
01360 
01361 /* other useful variables */
01362 
01363 #define MP3SPLT_LIB_GETTEXT_DOMAIN "libmp3splt"
01364 
01365 //backslash character
01366 #ifndef SPLT_DIRCHAR
01367 #ifdef __WIN32__
01368 #define SPLT_DIRCHAR '\\'
01369 #define SPLT_DIRSTR "\\"
01370 #define SPLT_NDIRCHAR '/'
01371 #else
01372 #define SPLT_DIRCHAR '/'
01373 #define SPLT_DIRSTR "/"
01374 #define SPLT_NDIRCHAR '\\'
01375 #endif
01376 #endif
01377 
01395 splt_state *mp3splt_new_state(int *error);
01396 
01397 //find plugins
01398 int mp3splt_find_plugins(splt_state *state);
01399 
01400 //this function frees the left variables in the library
01401 //don't forget to call this function ONLY at the end of the program
01402 //returns possible error
01403 void mp3splt_free_state(splt_state *state, int *error);
01404 
01405 /************************************/
01417 int mp3splt_set_path_of_split(splt_state *state, const char *path);
01418 
01425 int mp3splt_set_filename_to_split(splt_state *state, const char *filename);
01426 
01436 char *mp3splt_get_filename_to_split(splt_state *state);
01437 
01438 int mp3splt_set_m3u_filename(splt_state *state, const char *filename);
01439 int mp3splt_set_silence_log_filename(splt_state *state, const char *filename);
01440 
01448 int mp3splt_set_input_filename_regex(splt_state *state, const char *regex);
01449 
01450 int mp3splt_set_default_comment_tag(splt_state *state, const char *default_comment_tag);
01451 
01452 int mp3splt_set_default_genre_tag(splt_state *state, const char *default_genre_tag);
01453 
01455 
01456 /************************************/
01468 int mp3splt_set_message_function(splt_state *state, 
01469     void (*message_cb)(const char *, splt_message_type));
01470 
01477 int mp3splt_set_split_filename_function(splt_state *state,
01478     void (*file_cb)(const char *,int));
01479 
01486 int mp3splt_set_progress_function(splt_state *state,
01487     void (*progress_cb)(splt_progress *p_bar));
01488 
01489 int mp3splt_set_silence_level_function(splt_state *state,
01490   void (*get_silence_cb)(long time, float level, void *user_data),
01491   void *user_data);
01492 
01494 
01495 /************************************/
01508 int mp3splt_append_splitpoint(splt_state *state,
01509     long split_value, const char *name, int type);
01510 
01519 const splt_point *mp3splt_get_splitpoints(splt_state *state,
01520     int *splitpoints_number, int *error);
01521 
01527 void mp3splt_erase_all_splitpoints(splt_state *state,
01528     int *error);
01530 
01531 /************************************/
01532 /* Tags                             */
01533 
01534 //puts a tag
01535 int mp3splt_append_tags(splt_state *state, 
01536     const char *title, const char *artist,
01537     const char *album, const char *performer,
01538     const char *year, const char *comment,
01539     int track, const char *genre);
01540 
01541 //returns a pointer to all the current tags
01542 const splt_tags *mp3splt_get_tags(splt_state *state,
01543     int *tags_number, int *error);
01544 
01545 //puts tags from a string
01546 int mp3splt_put_tags_from_string(splt_state *state, const char *tags,
01547     int *error);
01548 
01549 void mp3splt_erase_all_tags(splt_state *state,
01550     int *error);
01551 
01552 /************************************/
01553 /* Options                          */
01554 
01555 int mp3splt_set_int_option(splt_state *state, int option_name, int value);
01556 int mp3splt_set_long_option(splt_state *state, int option_name, long value);
01557 int mp3splt_set_float_option(splt_state *state, int option_name, float value);
01558 
01559 int mp3splt_get_int_option(splt_state *state, int option_name, int *error);
01560 long mp3splt_get_long_option(splt_state *state, int option_name, int *error);
01561 float mp3splt_get_float_option(splt_state *state, int option_name, int *error);
01562 
01563 /************************************/
01564 /* Split functions                  */
01565 
01566 //split a ogg or mp3 file
01567 //returns possible error
01568 int mp3splt_split(splt_state *state);
01569 
01570 //cancel split function
01571 //returns possible error
01572 void mp3splt_stop_split(splt_state *state,
01573     int *error);
01574 
01575 /************************************/
01576 /*    Cddb and Cue functions        */
01577 
01578 //get the cue splitpoints from a file and puts them in the state
01579 void mp3splt_put_cue_splitpoints_from_file(splt_state *state,
01580     const char *cue_file, int *error);
01581 
01582 //read cddb splitpoints from file and puts them in the state
01583 void mp3splt_put_cddb_splitpoints_from_file(splt_state *state,
01584     const char *cddb_file, int *error);
01585 
01586 void mp3splt_put_audacity_labels_splitpoints_from_file(splt_state *state,
01587     const char *file, int *error);
01588 
01589 /************************************/
01590 /*    Freedb functions              */
01591 
01592 //returns the freedb results and possible eerror
01596 const splt_freedb_results *mp3splt_get_freedb_search(splt_state *state,
01597     const char *searched_string,
01598     int *error,
01599     int search_type,
01600     const char *search_server,
01601     int port);
01602 
01603 void mp3splt_write_freedb_file_result(splt_state *state,
01604     int disc_id,
01605     const char *cddb_file,
01606     int *error,
01607     int cddb_get_type,
01608     const char *cddb_get_server,
01609     int port);
01610 
01611 void mp3splt_export_to_cue(splt_state *state, const char *out_file,
01612     short stop_at_total_time, int *error);
01613 
01614 void mp3splt_set_oformat(splt_state *state,
01615     const char *format_string, int *error);
01616 
01617 /************************************/
01618 /* Other utilities                  */
01619 
01620 //counts the number of tracks found with silence detection
01621 int mp3splt_count_silence_points(splt_state *state, int *error);
01622 
01623 int mp3splt_set_silence_points(splt_state *state, int *error);
01624 void mp3splt_set_trim_silence_points(splt_state *state, int *error);
01625 
01626 //returns the version of libmp3splt
01627 void mp3splt_get_version(char *version);
01628 
01629 //result must be freed
01630 char *mp3splt_get_strerror(splt_state *state, int error_code);
01631 
01632 //returns the number of syncerrors
01633 //puts possible error in error variable
01634 const splt_syncerrors *mp3splt_get_syncerrors(splt_state *state,
01635     int *error);
01636 
01637 //returns the wrapped files found
01638 const splt_wrap *mp3splt_get_wrap_files(splt_state *state, int *error);
01639 
01640 int mp3splt_append_plugins_scan_dir(splt_state *state, char *dir);
01641 
01642 #ifdef __WIN32__
01643 char *mp3splt_win32_utf16_to_utf8(const wchar_t *source);
01644 #endif
01645 
01646 char **mp3splt_find_filenames(splt_state *state, const char *filename,
01647     int *num_of_files_found, int *error);
01648 
01649 int mp3splt_u_check_if_directory(const char *fname);
01650 
01651 void mp3splt_free_one_tag(splt_tags *tags);
01652 splt_tags *mp3splt_parse_filename_regex(splt_state *state, int *error);
01653 
01654 #define MP3SPLT_MP3SPLT_H
01655 
01656 #endif
01657