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-2011 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 
00502 typedef enum {
00506   SPLT_TAGS_ORIGINAL_FILE,
00511   SPLT_CURRENT_TAGS,
00515   SPLT_NO_TAGS,
00520   SPLT_TAGS_FROM_FILENAME_REGEX,
00521 } splt_tags_options;
00522 
00523 #define SPLT_ORIGINAL_TAGS_DEFAULT "%[@o,@N=1]"
00524 
00525 #define SPLT_DEFAULT_OUTPUT "@f_@mm_@ss_@hh__@Mm_@Ss_@Hh"
00526 
00531 #define SPLT_DEFAULT_CDDB_CUE_OUTPUT "@A - @n - @t"
00532 
00536 #define SPLT_DEFAULT_SYNCERROR_OUTPUT "@f_error_@n"
00537 
00541 #define SPLT_DEFAULT_SILENCE_OUTPUT "@f_silence_@n"
00542 
00546 #define SPLT_DEFAULT_TRIM_SILENCE_OUTPUT "@f_trimmed"
00547 
00549 typedef struct {
00558   splt_split_mode_options split_mode;
00559 
00567   splt_tags_options tags;
00568 
00569   int xing;
00570 
00572   splt_output_filenames_options output_filenames;
00573 
00575   int quiet_mode;
00576 
00581   int pretend_to_split;
00582 
00588   int option_frame_mode;
00590   float split_time;
00591   long overlap_time;
00593   int option_auto_adjust;
00602   int option_input_not_seekable;
00603 
00610   int create_dirs_from_filenames;
00611 
00612   //PARAMETERS---------------------------------------
00613   //PARAMETERS for option_auto_adjust and option_silence_mode:
00617   float parameter_threshold;
00626   float parameter_offset;
00627 
00628   //PARAMETERS for option_silence_mode:
00634   int parameter_number_tracks;
00640   float parameter_minimum_length;
00646   float parameter_min_track_length;
00647 
00649   int artist_tag_format;
00651   int album_tag_format;
00653   int title_tag_format;
00655   int comment_tag_format;
00656 
00658   int replace_underscores_tag_format;
00659 
00661   int set_file_from_cue_if_file_tag_found;
00662 
00664   int parameter_remove_silence;
00665 
00666   //PARAMETERS for option_auto_adjust:
00673   int parameter_gap;
00674 
00679   int remaining_tags_like_x;
00680 
00682   int auto_increment_tracknumber_tags;
00683 
00687   int enable_silence_log;
00688 
00695   int force_tags_version;
00699   int length_split_file_number;
00700   int replace_tags_in_tags;
00701 } splt_options;
00702 
00703 /**********************************/
00704 /* Main structure                 */
00705 
00706 //internal structures
00707 typedef struct
00708 {
00710   int frame_mode_enabled;
00712   int current_refresh_rate;
00714   int messages_locked;
00716   int library_locked;
00718   char *new_filename_path;
00719 } splt_internal;
00720 
00725 typedef struct
00726 {
00727   float version;
00728   char *name;
00729   char *extension;
00730   char *upper_extension;
00731 } splt_plugin_info;
00732 
00734 typedef struct {
00735   int (*check_plugin_is_for_file)(void *state, int *error);
00736   void (*set_plugin_info)(splt_plugin_info *info, int *error);
00737   void (*search_syncerrors)(void *state, int *error);
00738   void (*dewrap)(void *state, int listonly, const char *dir, int *error);
00739   void (*set_total_time)(void *state, int *error);
00740   int (*simple_split)(void *state, const char *output_fname, off_t begin, off_t end);
00741   double (*split)(void *state, const char *final_fname, double begin_point,
00742       double end_point, int *error, int save_end_point);
00743   int (*scan_silence)(void *state, int *error);
00744   int (*scan_trim_silence)(void *state, int *error);
00745   void (*set_original_tags)(void *state, int *error);
00746   void (*clear_original_tags)(splt_original_tags *original_tags);
00747   void (*init)(void *state, int *error);
00748   void (*end)(void *state, int *error);
00749 } splt_plugin_func;
00750 
00752 typedef struct
00753 {
00754   splt_plugin_info info;
00756   char *plugin_filename;
00758   void *plugin_handle;
00760   splt_plugin_func *func;
00761 } splt_plugin_data;
00762 
00764 typedef struct
00765 {
00767   char **plugins_scan_dirs;
00768   int number_of_dirs_to_scan;
00770   int number_of_plugins_found;
00772   splt_plugin_data *data;
00773 } splt_plugins;
00774 
00776 typedef struct
00777 {
00778   char *error_data;
00779   char *strerror_msg;
00780 } splt_error;
00781 
00783 typedef struct {
00784 
00786   int cancel_split;
00788   char *fname_to_split;
00790   char *path_of_split;
00791 
00792   //if this is non null, we write a m3u from the split files
00793   char *m3u_filename;
00794   
00796   char *input_fname_regex;
00797 
00798   char *default_comment_tag;
00799   char *default_genre_tag;
00800 
00802   splt_original_tags original_tags;
00803 
00805   splt_options options;
00807   splt_struct split;
00809   splt_oformat oformat;
00811   splt_wrap *wrap;
00813   splt_syncerrors *serrors;
00820   unsigned long syncerrors;
00822   splt_freedb fdb;
00823 
00825   splt_internal iopts;
00826 
00828   struct splt_ssplit *silence_list;
00829 
00830   //proxy infos
00831   //splt_proxy proxy;
00832 
00834   void *codec;
00835 
00837   splt_error err;
00838 
00840   splt_plugins *plug;
00841   int current_plugin;
00842 
00844   char *silence_log_fname;
00845 } splt_state;
00846 
00847 /*****************************************/
00848 /* Confirmations, errors and messages    */
00849 
00851 typedef enum {
00852   SPLT_OK = 0,
00853 
00854   SPLT_OK_SPLIT = 1,
00855   SPLT_SPLITPOINT_BIGGER_THAN_LENGTH = 4,
00856   SPLT_SILENCE_OK = 5,
00857   SPLT_TIME_SPLIT_OK = 6,
00858   SPLT_NO_SILENCE_SPLITPOINTS_FOUND = 7,
00859   SPLT_OK_SPLIT_EOF = 8,
00860   SPLT_LENGTH_SPLIT_OK = 9,
00861   SPLT_TRIM_SILENCE_OK = 10,
00862 
00863   SPLT_FREEDB_OK = 100,
00864   SPLT_FREEDB_FILE_OK = 101,
00865   SPLT_CDDB_OK = 102,
00866   SPLT_CUE_OK = 103,
00867   SPLT_FREEDB_MAX_CD_REACHED = 104,
00868   SPLT_AUDACITY_OK = 105,
00869 
00870   SPLT_DEWRAP_OK = 200,
00871 
00872   SPLT_SYNC_OK = 300,
00873   SPLT_MIGHT_BE_VBR = 301,
00874 
00875   SPLT_ERR_SYNC = -300,
00876   SPLT_ERR_NO_SYNC_FOUND = -301,
00877   SPLT_ERR_TOO_MANY_SYNC_ERR = -302,
00878 
00879   SPLT_OUTPUT_FORMAT_OK = 400,
00880   SPLT_OUTPUT_FORMAT_AMBIGUOUS = 401,
00881 
00882   SPLT_REGEX_OK = 800,
00883 
00884   SPLT_ERROR_SPLITPOINTS = -1,
00885   SPLT_ERROR_CANNOT_OPEN_FILE = -2,
00886   SPLT_ERROR_INVALID = -3,
00887   SPLT_ERROR_EQUAL_SPLITPOINTS = -5,
00888   SPLT_ERROR_SPLITPOINTS_NOT_IN_ORDER = -6,
00889   SPLT_ERROR_NEGATIVE_SPLITPOINT = -7,
00890   SPLT_ERROR_INCORRECT_PATH = -8,
00891   SPLT_ERROR_INCOMPATIBLE_OPTIONS = -10,
00892   SPLT_ERROR_INPUT_OUTPUT_SAME_FILE = -12,
00893   SPLT_ERROR_CANNOT_ALLOCATE_MEMORY = -15,
00894   SPLT_ERROR_CANNOT_OPEN_DEST_FILE = -16,
00895   SPLT_ERROR_CANT_WRITE_TO_OUTPUT_FILE = -17,
00896   SPLT_ERROR_WHILE_READING_FILE = -18,
00897   SPLT_ERROR_SEEKING_FILE = -19,
00898   SPLT_ERROR_BEGIN_OUT_OF_FILE = -20,
00899   SPLT_ERROR_INEXISTENT_FILE = -21,
00900   SPLT_SPLIT_CANCELLED = -22,
00901   SPLT_ERROR_LIBRARY_LOCKED = -24,
00902   SPLT_ERROR_STATE_NULL = -25,
00903   SPLT_ERROR_NEGATIVE_TIME_SPLIT = -26,
00904   SPLT_ERROR_CANNOT_CREATE_DIRECTORY = -27,
00905   SPLT_ERROR_CANNOT_CLOSE_FILE = -28,
00906   SPLT_ERROR_NO_PLUGIN_FOUND = -29,
00907   SPLT_ERROR_CANNOT_INIT_LIBLTDL = -30,
00908   SPLT_ERROR_CRC_FAILED = -31,
00909   SPLT_ERROR_NO_PLUGIN_FOUND_FOR_FILE = -32,
00910   SPLT_ERROR_PLUGIN_ERROR = -33,
00911   SPLT_ERROR_TIME_SPLIT_VALUE_INVALID = -34,
00912   SPLT_ERROR_LENGTH_SPLIT_VALUE_INVALID = -35,
00913   SPLT_ERROR_CANNOT_GET_TOTAL_TIME = -36,
00914   SPLT_ERROR_LIBID3 = -37,
00915 
00916   SPLT_FREEDB_ERROR_INITIALISE_SOCKET = -101,
00917   SPLT_FREEDB_ERROR_CANNOT_GET_HOST = -102,
00918   SPLT_FREEDB_ERROR_CANNOT_OPEN_SOCKET = -103,
00919   SPLT_FREEDB_ERROR_CANNOT_CONNECT = -104,
00920   SPLT_FREEDB_ERROR_CANNOT_SEND_MESSAGE = -105,
00921   SPLT_FREEDB_ERROR_INVALID_SERVER_ANSWER = -106,
00922   SPLT_FREEDB_ERROR_SITE_201 = -107,
00923   SPLT_FREEDB_ERROR_SITE_200 = -108,
00924   SPLT_FREEDB_ERROR_BAD_COMMUNICATION = -109,
00925   SPLT_FREEDB_ERROR_GETTING_INFOS = -110,
00926   SPLT_FREEDB_NO_CD_FOUND = -111,
00927   SPLT_FREEDB_ERROR_CANNOT_RECV_MESSAGE = -112,
00928   SPLT_INVALID_CUE_FILE = -115,
00929   SPLT_INVALID_CDDB_FILE = -116,
00930   SPLT_FREEDB_NO_SUCH_CD_IN_DATABASE = -118,
00931   SPLT_FREEDB_ERROR_SITE = -119,
00932   SPLT_FREEDB_ERROR_CANNOT_DISCONNECT = -120,
00933 
00934   SPLT_DEWRAP_ERR_FILE_LENGTH = -200,
00935   SPLT_DEWRAP_ERR_VERSION_OLD = -201,
00936   SPLT_DEWRAP_ERR_NO_FILE_OR_BAD_INDEX = -202,
00937   SPLT_DEWRAP_ERR_FILE_DAMAGED_INCOMPLETE = -203,
00938   SPLT_DEWRAP_ERR_FILE_NOT_WRAPED_DAMAGED = -204,
00939 
00940   SPLT_OUTPUT_FORMAT_ERROR = -400,
00941 
00942   SPLT_ERROR_INEXISTENT_SPLITPOINT = -500,
00943 
00944   SPLT_PLUGIN_ERROR_UNSUPPORTED_FEATURE = -600,
00945 
00946   SPLT_INVALID_AUDACITY_FILE = -700,
00947 
00948   SPLT_INVALID_REGEX = -800,
00949   SPLT_REGEX_NO_MATCH = -801,
00950 } splt_code;
00951 
00952 //internal
00953 #define SPLT_INTERNAL_PROGRESS_RATE 1
00954 #define SPLT_INTERNAL_FRAME_MODE_ENABLED 2
00955 
00956 //progress messages
00962 typedef enum {
00966   SPLT_PROGRESS_PREPARE,
00970   SPLT_PROGRESS_CREATE,
00974   SPLT_PROGRESS_SEARCH_SYNC,
00978   SPLT_PROGRESS_SCAN_SILENCE
00979 } splt_progress_messages;
00980 
00989 typedef enum {
00994   SPLT_OPT_PRETEND_TO_SPLIT,
00995   /*
00996    * If quiet; we don't do CRC check or human interaction
00997    */
00998   SPLT_OPT_QUIET_MODE,
01006   SPLT_OPT_DEBUG_MODE,
01014   SPLT_OPT_SPLIT_MODE,
01022   SPLT_OPT_TAGS,
01026   SPLT_OPT_XING,
01038   SPLT_OPT_CREATE_DIRS_FROM_FILENAMES,
01044   SPLT_OPT_OUTPUT_FILENAMES,
01054   SPLT_OPT_FRAME_MODE,
01065   SPLT_OPT_AUTO_ADJUST,
01075   SPLT_OPT_INPUT_NOT_SEEKABLE,
01085   SPLT_OPT_PARAM_NUMBER_TRACKS,
01094   SPLT_OPT_PARAM_REMOVE_SILENCE,
01103   SPLT_OPT_PARAM_GAP,
01107   SPLT_OPT_ALL_REMAINING_TAGS_LIKE_X,
01111   SPLT_OPT_AUTO_INCREMENT_TRACKNUMBER_TAGS,
01115   SPLT_OPT_ENABLE_SILENCE_LOG,
01119   SPLT_OPT_FORCE_TAGS_VERSION,
01123   SPLT_OPT_LENGTH_SPLIT_FILE_NUMBER,
01127   SPLT_OPT_REPLACE_TAGS_IN_TAGS,
01131   SPLT_OPT_OVERLAP_TIME,
01140   SPLT_OPT_SPLIT_TIME,
01151   SPLT_OPT_PARAM_THRESHOLD,
01162   SPLT_OPT_PARAM_OFFSET,
01171   SPLT_OPT_PARAM_MIN_LENGTH,
01180   SPLT_OPT_PARAM_MIN_TRACK_LENGTH,
01185   SPLT_OPT_ARTIST_TAG_FORMAT,
01190   SPLT_OPT_ALBUM_TAG_FORMAT,
01195   SPLT_OPT_TITLE_TAG_FORMAT,
01200   SPLT_OPT_COMMENT_TAG_FORMAT,
01205   SPLT_OPT_REPLACE_UNDERSCORES_TAG_FORMAT,
01210   SPLT_OPT_SET_FILE_FROM_CUE_IF_FILE_TAG_FOUND,
01211 } splt_int_options;
01212 
01213 typedef enum {
01214   SPLT_NO_CONVERSION,
01215   SPLT_TO_LOWERCASE,
01216   SPLT_TO_UPPERCASE,
01217   SPLT_TO_FIRST_UPPERCASE,
01218   SPLT_TO_WORD_FIRST_UPPERCASE
01219 } splt_str_format;
01220 
01225 typedef enum {
01226   /* a regular splitpoint */
01227   SPLT_SPLITPOINT,
01228   /* a skippoint */
01229   SPLT_SKIPPOINT,
01230 } splt_type_of_splitpoint;
01231 
01232 
01233 #define SPLT_UNDEFINED_GENRE "Other"
01234 
01235 #define SPLT_ID3V1_NUMBER_OF_GENRES 127
01236 
01239 static const char splt_id3v1_genres[SPLT_ID3V1_NUMBER_OF_GENRES][25] = {
01240   {"Blues"},
01241   {"Classic Rock"}, {"Country"}, {"Dance"}, 
01242   {"Disco"},{"Funk"},{"Grunge"},{"Hip-Hop"},{"Jazz"},
01243   {"Metal"},{"New Age"},{"Oldies"}, {"Other"}, {"Pop"},
01244   {"R&B"}, {"Rap"}, {"Reggae"}, {"Rock"}, {"Techno"},
01245   {"Industrial"}, {"Alternative"}, {"Ska"}, {"Death metal"},
01246   {"Pranks"}, {"Soundtrack"}, {"Euro-Techno"},
01247   {"Ambient"}, {"Trip-hop"}, {"Vocal"}, {"Jazz+Funk"},
01248   {"Fusion"}, {"Trance"}, {"Classical"}, {"Instrumental"},
01249   {"Acid"}, {"House"}, {"Game"}, {"Sound clip"}, {"Gospel"},
01250   {"Noise"}, {"Alt. Rock"}, {"Bass"}, {"Soul"}, {"Punk"}, 
01251   {"Space"}, {"Meditative"}, {"Instrumental pop"}, 
01252   {"Instrumental rock"}, {"Ethnic"}, {"Gothic"},{"Darkwave"},
01253   {"Techno-Industrial"},{"Electronic"},{"Pop-Folk"},{"Eurodance"},
01254   {"Dream"},{"Southern Rock"},{"Comedy"}, {"Cult"},{"Gangsta"},
01255   {"Top 40"},{"Christian Rap"},{"Pop/Funk"}, {"Jungle"},
01256   {"Native American"},{"Cabaret"},{"New Wave"}, {"Psychedelic"},
01257   {"Rave"},{"Showtunes"},{"Trailer"}, {"Lo-Fi"},{"Tribal"},
01258   {"Acid Punk"},{"Acid Jazz"}, {"Polka"}, {"Retro"},
01259   {"Musical"},{"Rock & Roll"},{"Hard Rock"},
01260 
01261   {"Folk"}, {"Folk-Rock"}, {"National Folk"}, {"Swing"},
01262   {"Fast Fusion"}, {"Bebob"}, {"Latin"}, {"Revival"},
01263   {"Celtic"}, {"Bluegrass"}, {"Avantgarde"}, {"Gothic Rock"},
01264   {"Progressive Rock"}, {"Psychedelic Rock"}, {"Symphonic Rock"},
01265   {"Slow Rock"}, {"Big Band"}, {"Chorus"}, {"Easy Listening"},
01266   {"Acoustic"}, {"Humour"}, {"Speech"}, {"Chanson"}, {"Opera"},
01267   {"Chamber Music"}, {"Sonata"}, {"Symphony"}, {"Booty Bass"},
01268   {"Primus"}, {"Porn Groove"}, {"Satire"}, {"Slow Jam"},
01269   {"Club"}, {"Tango"}, {"Samba"}, {"Folklore"}, {"Ballad"},
01270   {"Power Ballad"}, {"Rhythmic Soul"}, {"Freestyle"}, {"Duet"},
01271   {"Punk Rock"}, {"Drum Solo"}, {"A capella"}, {"Euro-House"},
01272   {"Dance Hall"},
01273 
01274   {"misc"},
01275 };
01276 
01281 /*
01282  * freedb2 search type
01283  */
01284 #define SPLT_FREEDB_SEARCH_TYPE_CDDB_CGI 1
01285 /*
01286  * freedb search type
01287  */
01288 #define SPLT_FREEDB_SEARCH_TYPE_CDDB 2
01289 /*
01290  * freedb get file type
01291  * we retrieve the file by using the cddb.cgi script
01292  * (usually on port 80)
01293  */
01294 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI 3
01295 /*
01296  * we retrieve the file by using the freedb cddb protocol 
01297  * (usually on port 8880)
01298  */
01299 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB 4
01300 
01303 #define SPLT_FREEDB_CDDB_CGI_PORT 80
01304 
01307 #define SPLT_FREEDB_CDDB_PORT 8880
01308 
01311 #define SPLT_FREEDB_CGI_SITE "freedb.org/~cddb/cddb.cgi"
01312 #define SPLT_FREEDB2_CGI_SITE "tracktype.org/~cddb/cddb.cgi"
01313 
01314 //package information constants
01315 #ifndef SPLT_PACKAGE_NAME
01316 
01319 #define SPLT_PACKAGE_NAME "libmp3splt"
01320 #endif
01321 #ifndef SPLT_PACKAGE_VERSION
01322 
01325 #define SPLT_PACKAGE_VERSION "0.7.1"
01326 #endif
01327 
01330 #define SPLT_AUTHOR "Matteo Trotta | Munteanu Alexandru"
01331 #define SPLT_EMAIL "<mtrotta@users.sourceforge.net> | <io_fx@yahoo.fr>"
01332 
01335 #define SPLT_WEBSITE "http://mp3splt.sourceforge.net"
01336 
01337 /* other useful variables */
01338 
01339 #define MP3SPLT_LIB_GETTEXT_DOMAIN "libmp3splt"
01340 
01341 //backslash character
01342 #ifndef SPLT_DIRCHAR
01343 #ifdef __WIN32__
01344 #define SPLT_DIRCHAR '\\'
01345 #define SPLT_DIRSTR "\\"
01346 #define SPLT_NDIRCHAR '/'
01347 #else
01348 #define SPLT_DIRCHAR '/'
01349 #define SPLT_DIRSTR "/"
01350 #define SPLT_NDIRCHAR '\\'
01351 #endif
01352 #endif
01353 
01371 splt_state *mp3splt_new_state(int *error);
01372 
01373 //find plugins
01374 int mp3splt_find_plugins(splt_state *state);
01375 
01376 //this function frees the left variables in the library
01377 //don't forget to call this function ONLY at the end of the program
01378 //returns possible error
01379 void mp3splt_free_state(splt_state *state, int *error);
01380 
01381 /************************************/
01393 int mp3splt_set_path_of_split(splt_state *state, const char *path);
01394 
01401 int mp3splt_set_filename_to_split(splt_state *state, const char *filename);
01402 
01412 char *mp3splt_get_filename_to_split(splt_state *state);
01413 
01414 int mp3splt_set_m3u_filename(splt_state *state, const char *filename);
01415 int mp3splt_set_silence_log_filename(splt_state *state, const char *filename);
01416 
01424 int mp3splt_set_input_filename_regex(splt_state *state, const char *regex);
01425 
01426 int mp3splt_set_default_comment_tag(splt_state *state, const char *default_comment_tag);
01427 
01428 int mp3splt_set_default_genre_tag(splt_state *state, const char *default_genre_tag);
01429 
01431 
01432 /************************************/
01444 int mp3splt_set_message_function(splt_state *state, 
01445     void (*message_cb)(const char *, splt_message_type));
01446 
01453 int mp3splt_set_split_filename_function(splt_state *state,
01454     void (*file_cb)(const char *,int));
01455 
01462 int mp3splt_set_progress_function(splt_state *state,
01463     void (*progress_cb)(splt_progress *p_bar));
01464 
01465 int mp3splt_set_silence_level_function(splt_state *state,
01466   void (*get_silence_cb)(long time, float level, void *user_data),
01467   void *user_data);
01468 
01470 
01471 /************************************/
01484 int mp3splt_append_splitpoint(splt_state *state,
01485     long split_value, const char *name, int type);
01486 
01495 const splt_point *mp3splt_get_splitpoints(splt_state *state,
01496     int *splitpoints_number, int *error);
01497 
01503 void mp3splt_erase_all_splitpoints(splt_state *state,
01504     int *error);
01506 
01507 /************************************/
01508 /* Tags                             */
01509 
01510 //puts a tag
01511 int mp3splt_append_tags(splt_state *state, 
01512     const char *title, const char *artist,
01513     const char *album, const char *performer,
01514     const char *year, const char *comment,
01515     int track, const char *genre);
01516 
01517 //returns a pointer to all the current tags
01518 const splt_tags *mp3splt_get_tags(splt_state *state,
01519     int *tags_number, int *error);
01520 
01521 //puts tags from a string
01522 int mp3splt_put_tags_from_string(splt_state *state, const char *tags,
01523     int *error);
01524 
01525 void mp3splt_erase_all_tags(splt_state *state,
01526     int *error);
01527 
01528 /************************************/
01529 /* Options                          */
01530 
01531 int mp3splt_set_int_option(splt_state *state, int option_name, int value);
01532 int mp3splt_set_long_option(splt_state *state, int option_name, long value);
01533 int mp3splt_set_float_option(splt_state *state, int option_name, float value);
01534 
01535 int mp3splt_get_int_option(splt_state *state, int option_name, int *error);
01536 long mp3splt_get_long_option(splt_state *state, int option_name, int *error);
01537 float mp3splt_get_float_option(splt_state *state, int option_name, int *error);
01538 
01539 /************************************/
01540 /* Split functions                  */
01541 
01542 //split a ogg or mp3 file
01543 //returns possible error
01544 int mp3splt_split(splt_state *state);
01545 
01546 //cancel split function
01547 //returns possible error
01548 void mp3splt_stop_split(splt_state *state,
01549     int *error);
01550 
01551 /************************************/
01552 /*    Cddb and Cue functions        */
01553 
01554 //get the cue splitpoints from a file and puts them in the state
01555 void mp3splt_put_cue_splitpoints_from_file(splt_state *state,
01556     const char *cue_file, int *error);
01557 
01558 //read cddb splitpoints from file and puts them in the state
01559 void mp3splt_put_cddb_splitpoints_from_file(splt_state *state,
01560     const char *cddb_file, int *error);
01561 
01562 void mp3splt_put_audacity_labels_splitpoints_from_file(splt_state *state,
01563     const char *file, int *error);
01564 
01565 /************************************/
01566 /*    Freedb functions              */
01567 
01568 //returns the freedb results and possible eerror
01572 const splt_freedb_results *mp3splt_get_freedb_search(splt_state *state,
01573     const char *searched_string,
01574     int *error,
01575     int search_type,
01576     const char *search_server,
01577     int port);
01578 
01579 void mp3splt_write_freedb_file_result(splt_state *state,
01580     int disc_id,
01581     const char *cddb_file,
01582     int *error,
01583     int cddb_get_type,
01584     const char *cddb_get_server,
01585     int port);
01586 
01587 void mp3splt_export_to_cue(splt_state *state, const char *out_file,
01588     short stop_at_total_time, int *error);
01589 
01590 void mp3splt_set_oformat(splt_state *state,
01591     const char *format_string, int *error);
01592 
01593 /************************************/
01594 /* Other utilities                  */
01595 
01596 //counts the number of tracks found with silence detection
01597 int mp3splt_count_silence_points(splt_state *state, int *error);
01598 
01599 int mp3splt_set_silence_points(splt_state *state, int *error);
01600 void mp3splt_set_trim_silence_points(splt_state *state, int *error);
01601 
01602 //returns the version of libmp3splt
01603 void mp3splt_get_version(char *version);
01604 
01605 //result must be freed
01606 char *mp3splt_get_strerror(splt_state *state, int error_code);
01607 
01608 //returns the number of syncerrors
01609 //puts possible error in error variable
01610 const splt_syncerrors *mp3splt_get_syncerrors(splt_state *state,
01611     int *error);
01612 
01613 //returns the wrapped files found
01614 const splt_wrap *mp3splt_get_wrap_files(splt_state *state, int *error);
01615 
01616 int mp3splt_append_plugins_scan_dir(splt_state *state, char *dir);
01617 
01618 #ifdef __WIN32__
01619 char *mp3splt_win32_utf16_to_utf8(const wchar_t *source);
01620 #endif
01621 
01622 char **mp3splt_find_filenames(splt_state *state, const char *filename,
01623     int *num_of_files_found, int *error);
01624 
01625 int mp3splt_u_check_if_directory(const char *fname);
01626 
01627 void mp3splt_free_one_tag(splt_tags *tags);
01628 splt_tags *mp3splt_parse_filename_regex(splt_state *state, int *error);
01629 
01630 #define MP3SPLT_MP3SPLT_H
01631 
01632 #endif
01633