libmp3splt
|
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 } splt_tags; 00252 00259 typedef struct { 00263 long value; 00267 char *name; 00272 int type; 00273 } splt_point; 00274 00275 /*****************************/ 00276 /* Structure for the silence */ 00277 00278 struct splt_ssplit { 00279 double begin_position; 00280 double end_position; 00281 long len; 00282 struct splt_ssplit *next; 00283 }; 00284 00285 /**********************************/ 00286 /* Structure for the split */ 00287 00297 typedef struct splt_progres { 00302 int progress_text_max_char; 00304 char filename_shorted[512]; 00306 float percent_progress; 00308 int current_split; 00310 int max_splits; 00318 int progress_type; 00320 int silence_found_tracks; 00322 float silence_db_level; 00328 int user_data; 00330 void (*progress)(struct splt_progres*); 00331 } splt_progress; 00332 00334 typedef struct { 00336 int use_proxy; 00338 char hostname[256]; 00340 int port; 00342 int authentification; 00344 char user[256]; 00346 char password[256]; 00347 } splt_proxy; 00348 00350 typedef enum { 00354 SPLT_MESSAGE_INFO, 00358 SPLT_MESSAGE_DEBUG 00359 } splt_message_type; 00360 00362 typedef struct { 00364 long total_time; 00366 int current_split; 00368 int current_split_file_number; 00376 int splitnumber; 00378 int real_splitnumber; 00386 void (*file_split)(const char *,int); 00388 splt_progress *p_bar; 00390 void (*get_silence_level)(long time, float level, void *user_data); 00392 void *silence_level_client_data; 00394 void (*put_message)(const char *, splt_message_type ); 00396 splt_point *points; 00398 int real_tagsnumber; 00400 splt_tags *tags; 00401 splt_tags tags_like_x; 00402 } splt_struct; 00403 00404 /**********************************/ 00405 /* Options structure */ 00406 00412 typedef enum { 00416 SPLT_OPTION_NORMAL_MODE, 00420 SPLT_OPTION_WRAP_MODE, 00424 SPLT_OPTION_SILENCE_MODE, 00430 SPLT_OPTION_ERROR_MODE, 00435 SPLT_OPTION_TIME_MODE, 00440 SPLT_OPTION_LENGTH_MODE, 00441 } splt_split_mode_options; 00442 00448 typedef enum { 00450 SPLT_OUTPUT_FORMAT, 00452 SPLT_OUTPUT_DEFAULT, 00458 SPLT_OUTPUT_CUSTOM 00459 } splt_output_filenames_options; 00460 00464 #define SPLT_DEFAULT_PARAM_THRESHOLD -48.0 00465 00468 #define SPLT_DEFAULT_PARAM_OFFSET 0.8 00469 00472 #define SPLT_DEFAULT_PARAM_MINIMUM_LENGTH 0.0 00473 00476 #define SPLT_DEFAULT_PARAM_GAP 30 00477 00480 #define SPLT_DEFAULT_PARAM_TRACKS 0 00481 00487 typedef enum { 00491 SPLT_TAGS_ORIGINAL_FILE, 00496 SPLT_CURRENT_TAGS, 00500 SPLT_NO_TAGS, 00505 SPLT_TAGS_FROM_FILENAME_REGEX, 00506 } splt_tags_options; 00507 00508 #define SPLT_ORIGINAL_TAGS_DEFAULT "%[@o,@N=1]" 00509 00510 #define SPLT_DEFAULT_OUTPUT "@f_@mm_@ss_@hh__@Mm_@Ss_@Hh" 00511 00516 #define SPLT_DEFAULT_CDDB_CUE_OUTPUT "@A - @n - @t" 00517 00521 #define SPLT_DEFAULT_SYNCERROR_OUTPUT "@f_error_@n" 00522 00526 #define SPLT_DEFAULT_SILENCE_OUTPUT "@f_silence_@n" 00527 00529 typedef struct { 00537 splt_split_mode_options split_mode; 00538 00546 splt_tags_options tags; 00547 00548 int xing; 00549 00551 splt_output_filenames_options output_filenames; 00552 00554 int quiet_mode; 00555 00560 int pretend_to_split; 00561 00567 int option_frame_mode; 00569 float split_time; 00570 long overlap_time; 00572 int option_auto_adjust; 00581 int option_input_not_seekable; 00582 00589 int create_dirs_from_filenames; 00590 00591 //PARAMETERS--------------------------------------- 00592 //PARAMETERS for option_auto_adjust and option_silence_mode: 00596 float parameter_threshold; 00605 float parameter_offset; 00606 00607 //PARAMETERS for option_silence_mode: 00613 int parameter_number_tracks; 00619 float parameter_minimum_length; 00620 00622 int artist_tag_format; 00624 int album_tag_format; 00626 int title_tag_format; 00628 int comment_tag_format; 00629 00631 int replace_underscores_tag_format; 00632 00634 int set_file_from_cue_if_file_tag_found; 00635 00637 int parameter_remove_silence; 00638 00639 //PARAMETERS for option_auto_adjust: 00646 int parameter_gap; 00647 00652 int remaining_tags_like_x; 00653 00655 int auto_increment_tracknumber_tags; 00656 00660 int enable_silence_log; 00661 00668 int force_tags_version; 00672 int length_split_file_number; 00673 int replace_tags_in_tags; 00674 } splt_options; 00675 00676 /**********************************/ 00677 /* Main structure */ 00678 00679 //internal structures 00680 typedef struct 00681 { 00683 int frame_mode_enabled; 00685 int current_refresh_rate; 00687 int messages_locked; 00689 int library_locked; 00691 char *new_filename_path; 00692 } splt_internal; 00693 00698 typedef struct 00699 { 00700 float version; 00701 char *name; 00702 char *extension; 00703 char *upper_extension; 00704 } splt_plugin_info; 00705 00707 typedef struct { 00708 int (*check_plugin_is_for_file)(void *state, int *error); 00709 void (*set_plugin_info)(splt_plugin_info *info, int *error); 00710 void (*search_syncerrors)(void *state, int *error); 00711 void (*dewrap)(void *state, int listonly, const char *dir, int *error); 00712 void (*set_total_time)(void *state, int *error); 00713 int (*simple_split)(void *state, const char *output_fname, off_t begin, off_t end); 00714 double (*split)(void *state, const char *final_fname, double begin_point, 00715 double end_point, int *error, int save_end_point); 00716 int (*scan_silence)(void *state, int *error); 00717 void (*set_original_tags)(void *state, int *error); 00718 void (*init)(void *state, int *error); 00719 void (*end)(void *state, int *error); 00720 } splt_plugin_func; 00721 00723 typedef struct 00724 { 00725 splt_plugin_info info; 00727 char *plugin_filename; 00729 void *plugin_handle; 00731 splt_plugin_func *func; 00732 } splt_plugin_data; 00733 00735 typedef struct 00736 { 00738 char **plugins_scan_dirs; 00739 int number_of_dirs_to_scan; 00741 int number_of_plugins_found; 00743 splt_plugin_data *data; 00744 } splt_plugins; 00745 00747 typedef struct 00748 { 00749 char *error_data; 00750 char *strerror_msg; 00751 } splt_error; 00752 00754 typedef struct { 00755 00757 int cancel_split; 00759 char *fname_to_split; 00761 char *path_of_split; 00762 00763 //if this is non null, we write a m3u from the split files 00764 char *m3u_filename; 00765 00767 char *input_fname_regex; 00768 00769 char *default_comment_tag; 00770 char *default_genre_tag; 00771 00773 splt_tags original_tags; 00774 00776 splt_options options; 00778 splt_struct split; 00780 splt_oformat oformat; 00782 splt_wrap *wrap; 00784 splt_syncerrors *serrors; 00791 unsigned long syncerrors; 00793 splt_freedb fdb; 00794 00796 splt_internal iopts; 00797 00799 struct splt_ssplit *silence_list; 00800 00801 //proxy infos 00802 //splt_proxy proxy; 00803 00805 void *codec; 00806 00808 splt_error err; 00809 00811 splt_plugins *plug; 00812 int current_plugin; 00813 00815 char *silence_log_fname; 00816 } splt_state; 00817 00818 /*****************************************/ 00819 /* Confirmations, errors and messages */ 00820 00822 typedef enum { 00823 SPLT_OK = 0, 00824 00825 SPLT_OK_SPLIT = 1, 00826 SPLT_SPLITPOINT_BIGGER_THAN_LENGTH = 4, 00827 SPLT_SILENCE_OK = 5, 00828 SPLT_TIME_SPLIT_OK = 6, 00829 SPLT_NO_SILENCE_SPLITPOINTS_FOUND = 7, 00830 SPLT_OK_SPLIT_EOF = 8, 00831 SPLT_LENGTH_SPLIT_OK = 9, 00832 00833 SPLT_FREEDB_OK = 100, 00834 SPLT_FREEDB_FILE_OK = 101, 00835 SPLT_CDDB_OK = 102, 00836 SPLT_CUE_OK = 103, 00837 SPLT_FREEDB_MAX_CD_REACHED = 104, 00838 SPLT_AUDACITY_OK = 105, 00839 00840 SPLT_DEWRAP_OK = 200, 00841 00842 SPLT_SYNC_OK = 300, 00843 SPLT_MIGHT_BE_VBR = 301, 00844 00845 SPLT_ERR_SYNC = -300, 00846 SPLT_ERR_NO_SYNC_FOUND = -301, 00847 SPLT_ERR_TOO_MANY_SYNC_ERR = -302, 00848 00849 SPLT_OUTPUT_FORMAT_OK = 400, 00850 SPLT_OUTPUT_FORMAT_AMBIGUOUS = 401, 00851 00852 SPLT_REGEX_OK = 800, 00853 00854 SPLT_ERROR_SPLITPOINTS = -1, 00855 SPLT_ERROR_CANNOT_OPEN_FILE = -2, 00856 SPLT_ERROR_INVALID = -3, 00857 SPLT_ERROR_EQUAL_SPLITPOINTS = -5, 00858 SPLT_ERROR_SPLITPOINTS_NOT_IN_ORDER = -6, 00859 SPLT_ERROR_NEGATIVE_SPLITPOINT = -7, 00860 SPLT_ERROR_INCORRECT_PATH = -8, 00861 SPLT_ERROR_INCOMPATIBLE_OPTIONS = -10, 00862 SPLT_ERROR_INPUT_OUTPUT_SAME_FILE = -12, 00863 SPLT_ERROR_CANNOT_ALLOCATE_MEMORY = -15, 00864 SPLT_ERROR_CANNOT_OPEN_DEST_FILE = -16, 00865 SPLT_ERROR_CANT_WRITE_TO_OUTPUT_FILE = -17, 00866 SPLT_ERROR_WHILE_READING_FILE = -18, 00867 SPLT_ERROR_SEEKING_FILE = -19, 00868 SPLT_ERROR_BEGIN_OUT_OF_FILE = -20, 00869 SPLT_ERROR_INEXISTENT_FILE = -21, 00870 SPLT_SPLIT_CANCELLED = -22, 00871 SPLT_ERROR_LIBRARY_LOCKED = -24, 00872 SPLT_ERROR_STATE_NULL = -25, 00873 SPLT_ERROR_NEGATIVE_TIME_SPLIT = -26, 00874 SPLT_ERROR_CANNOT_CREATE_DIRECTORY = -27, 00875 SPLT_ERROR_CANNOT_CLOSE_FILE = -28, 00876 SPLT_ERROR_NO_PLUGIN_FOUND = -29, 00877 SPLT_ERROR_CANNOT_INIT_LIBLTDL = -30, 00878 SPLT_ERROR_CRC_FAILED = -31, 00879 SPLT_ERROR_NO_PLUGIN_FOUND_FOR_FILE = -32, 00880 SPLT_ERROR_PLUGIN_ERROR = -33, 00881 SPLT_ERROR_TIME_SPLIT_VALUE_INVALID = -34, 00882 SPLT_ERROR_LENGTH_SPLIT_VALUE_INVALID = -35, 00883 SPLT_ERROR_CANNOT_GET_TOTAL_TIME = -36, 00884 00885 SPLT_FREEDB_ERROR_INITIALISE_SOCKET = -101, 00886 SPLT_FREEDB_ERROR_CANNOT_GET_HOST = -102, 00887 SPLT_FREEDB_ERROR_CANNOT_OPEN_SOCKET = -103, 00888 SPLT_FREEDB_ERROR_CANNOT_CONNECT = -104, 00889 SPLT_FREEDB_ERROR_CANNOT_SEND_MESSAGE = -105, 00890 SPLT_FREEDB_ERROR_INVALID_SERVER_ANSWER = -106, 00891 SPLT_FREEDB_ERROR_SITE_201 = -107, 00892 SPLT_FREEDB_ERROR_SITE_200 = -108, 00893 SPLT_FREEDB_ERROR_BAD_COMMUNICATION = -109, 00894 SPLT_FREEDB_ERROR_GETTING_INFOS = -110, 00895 SPLT_FREEDB_NO_CD_FOUND = -111, 00896 SPLT_FREEDB_ERROR_CANNOT_RECV_MESSAGE = -112, 00897 SPLT_INVALID_CUE_FILE = -115, 00898 SPLT_INVALID_CDDB_FILE = -116, 00899 SPLT_FREEDB_NO_SUCH_CD_IN_DATABASE = -118, 00900 SPLT_FREEDB_ERROR_SITE = -119, 00901 00902 SPLT_DEWRAP_ERR_FILE_LENGTH = -200, 00903 SPLT_DEWRAP_ERR_VERSION_OLD = -201, 00904 SPLT_DEWRAP_ERR_NO_FILE_OR_BAD_INDEX = -202, 00905 SPLT_DEWRAP_ERR_FILE_DAMAGED_INCOMPLETE = -203, 00906 SPLT_DEWRAP_ERR_FILE_NOT_WRAPED_DAMAGED = -204, 00907 00908 SPLT_OUTPUT_FORMAT_ERROR = -400, 00909 00910 SPLT_ERROR_INEXISTENT_SPLITPOINT = -500, 00911 00912 SPLT_PLUGIN_ERROR_UNSUPPORTED_FEATURE = -600, 00913 00914 SPLT_INVALID_AUDACITY_FILE = -700, 00915 00916 SPLT_INVALID_REGEX = -800, 00917 SPLT_REGEX_NO_MATCH = -801, 00918 } splt_code; 00919 00920 //internal 00921 #define SPLT_INTERNAL_PROGRESS_RATE 1 00922 #define SPLT_INTERNAL_FRAME_MODE_ENABLED 2 00923 00924 //progress messages 00930 typedef enum { 00934 SPLT_PROGRESS_PREPARE, 00938 SPLT_PROGRESS_CREATE, 00942 SPLT_PROGRESS_SEARCH_SYNC, 00946 SPLT_PROGRESS_SCAN_SILENCE 00947 } splt_progress_messages; 00948 00957 typedef enum { 00962 SPLT_OPT_PRETEND_TO_SPLIT, 00963 /* 00964 * If quiet; we don't do CRC check or human interaction 00965 */ 00966 SPLT_OPT_QUIET_MODE, 00974 SPLT_OPT_DEBUG_MODE, 00982 SPLT_OPT_SPLIT_MODE, 00990 SPLT_OPT_TAGS, 00994 SPLT_OPT_XING, 01006 SPLT_OPT_CREATE_DIRS_FROM_FILENAMES, 01012 SPLT_OPT_OUTPUT_FILENAMES, 01022 SPLT_OPT_FRAME_MODE, 01033 SPLT_OPT_AUTO_ADJUST, 01043 SPLT_OPT_INPUT_NOT_SEEKABLE, 01053 SPLT_OPT_PARAM_NUMBER_TRACKS, 01062 SPLT_OPT_PARAM_REMOVE_SILENCE, 01071 SPLT_OPT_PARAM_GAP, 01075 SPLT_OPT_ALL_REMAINING_TAGS_LIKE_X, 01079 SPLT_OPT_AUTO_INCREMENT_TRACKNUMBER_TAGS, 01083 SPLT_OPT_ENABLE_SILENCE_LOG, 01087 SPLT_OPT_FORCE_TAGS_VERSION, 01091 SPLT_OPT_LENGTH_SPLIT_FILE_NUMBER, 01095 SPLT_OPT_REPLACE_TAGS_IN_TAGS, 01099 SPLT_OPT_OVERLAP_TIME, 01108 SPLT_OPT_SPLIT_TIME, 01119 SPLT_OPT_PARAM_THRESHOLD, 01130 SPLT_OPT_PARAM_OFFSET, 01139 SPLT_OPT_PARAM_MIN_LENGTH, 01144 SPLT_OPT_ARTIST_TAG_FORMAT, 01149 SPLT_OPT_ALBUM_TAG_FORMAT, 01154 SPLT_OPT_TITLE_TAG_FORMAT, 01159 SPLT_OPT_COMMENT_TAG_FORMAT, 01164 SPLT_OPT_REPLACE_UNDERSCORES_TAG_FORMAT, 01169 SPLT_OPT_SET_FILE_FROM_CUE_IF_FILE_TAG_FOUND, 01170 } splt_int_options; 01171 01172 typedef enum { 01173 SPLT_NO_CONVERSION, 01174 SPLT_TO_LOWERCASE, 01175 SPLT_TO_UPPERCASE, 01176 SPLT_TO_FIRST_UPPERCASE, 01177 SPLT_TO_WORD_FIRST_UPPERCASE 01178 } splt_str_format; 01179 01184 typedef enum { 01185 /* a regular splitpoint */ 01186 SPLT_SPLITPOINT, 01187 /* a skippoint */ 01188 SPLT_SKIPPOINT, 01189 } splt_type_of_splitpoint; 01190 01191 01192 #define SPLT_UNDEFINED_GENRE "Other" 01193 01194 #define SPLT_ID3V1_NUMBER_OF_GENRES 127 01195 01198 static const char splt_id3v1_genres[SPLT_ID3V1_NUMBER_OF_GENRES][25] = { 01199 {"Blues"}, 01200 {"Classic Rock"}, {"Country"}, {"Dance"}, 01201 {"Disco"},{"Funk"},{"Grunge"},{"Hip-Hop"},{"Jazz"}, 01202 {"Metal"},{"New Age"},{"Oldies"}, {"Other"}, {"Pop"}, 01203 {"R&B"}, {"Rap"}, {"Reggae"}, {"Rock"}, {"Techno"}, 01204 {"Industrial"}, {"Alternative"}, {"Ska"}, {"Death metal"}, 01205 {"Pranks"}, {"Soundtrack"}, {"Euro-Techno"}, 01206 {"Ambient"}, {"Trip-hop"}, {"Vocal"}, {"Jazz+Funk"}, 01207 {"Fusion"}, {"Trance"}, {"Classical"}, {"Instrumental"}, 01208 {"Acid"}, {"House"}, {"Game"}, {"Sound clip"}, {"Gospel"}, 01209 {"Noise"}, {"Alt. Rock"}, {"Bass"}, {"Soul"}, {"Punk"}, 01210 {"Space"}, {"Meditative"}, {"Instrumental pop"}, 01211 {"Instrumental rock"}, {"Ethnic"}, {"Gothic"},{"Darkwave"}, 01212 {"Techno-Industrial"},{"Electronic"},{"Pop-Folk"},{"Eurodance"}, 01213 {"Dream"},{"Southern Rock"},{"Comedy"}, {"Cult"},{"Gangsta"}, 01214 {"Top 40"},{"Christian Rap"},{"Pop/Funk"}, {"Jungle"}, 01215 {"Native American"},{"Cabaret"},{"New Wave"}, {"Psychedelic"}, 01216 {"Rave"},{"Showtunes"},{"Trailer"}, {"Lo-Fi"},{"Tribal"}, 01217 {"Acid Punk"},{"Acid Jazz"}, {"Polka"}, {"Retro"}, 01218 {"Musical"},{"Rock & Roll"},{"Hard Rock"}, 01219 01220 {"Folk"}, {"Folk-Rock"}, {"National Folk"}, {"Swing"}, 01221 {"Fast Fusion"}, {"Bebob"}, {"Latin"}, {"Revival"}, 01222 {"Celtic"}, {"Bluegrass"}, {"Avantgarde"}, {"Gothic Rock"}, 01223 {"Progressive Rock"}, {"Psychedelic Rock"}, {"Symphonic Rock"}, 01224 {"Slow Rock"}, {"Big Band"}, {"Chorus"}, {"Easy Listening"}, 01225 {"Acoustic"}, {"Humour"}, {"Speech"}, {"Chanson"}, {"Opera"}, 01226 {"Chamber Music"}, {"Sonata"}, {"Symphony"}, {"Booty Bass"}, 01227 {"Primus"}, {"Porn Groove"}, {"Satire"}, {"Slow Jam"}, 01228 {"Club"}, {"Tango"}, {"Samba"}, {"Folklore"}, {"Ballad"}, 01229 {"Power Ballad"}, {"Rhythmic Soul"}, {"Freestyle"}, {"Duet"}, 01230 {"Punk Rock"}, {"Drum Solo"}, {"A capella"}, {"Euro-House"}, 01231 {"Dance Hall"}, 01232 01233 {"misc"}, 01234 }; 01235 01240 /* 01241 * freedb2 search type 01242 */ 01243 #define SPLT_FREEDB_SEARCH_TYPE_CDDB_CGI 1 01244 /* 01245 * freedb search type 01246 */ 01247 #define SPLT_FREEDB_SEARCH_TYPE_CDDB 2 01248 /* 01249 * freedb get file type 01250 * we retrieve the file by using the cddb.cgi script 01251 * (usually on port 80) 01252 */ 01253 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI 3 01254 /* 01255 * we retrieve the file by using the freedb cddb protocol 01256 * (usually on port 8880) 01257 */ 01258 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB 4 01259 01262 #define SPLT_FREEDB_CDDB_CGI_PORT 80 01263 01266 #define SPLT_FREEDB_CDDB_PORT 8880 01267 01270 #define SPLT_FREEDB_CGI_SITE "freedb.org/~cddb/cddb.cgi" 01271 #define SPLT_FREEDB2_CGI_SITE "tracktype.org/~cddb/cddb.cgi" 01272 01273 //package information constants 01274 #ifndef SPLT_PACKAGE_NAME 01275 01278 #define SPLT_PACKAGE_NAME "libmp3splt" 01279 #endif 01280 #ifndef SPLT_PACKAGE_VERSION 01281 01284 #define SPLT_PACKAGE_VERSION "0.6.1a" 01285 #endif 01286 01289 #define SPLT_AUTHOR "Matteo Trotta | Munteanu Alexandru" 01290 #define SPLT_EMAIL "<mtrotta@users.sourceforge.net> | <io_fx@yahoo.fr>" 01291 01294 #define SPLT_WEBSITE "http://mp3splt.sourceforge.net" 01295 01296 /* other useful variables */ 01297 01298 #define MP3SPLT_LIB_GETTEXT_DOMAIN "libmp3splt" 01299 01300 //backslash character 01301 #ifndef SPLT_DIRCHAR 01302 #ifdef __WIN32__ 01303 #define SPLT_DIRCHAR '\\' 01304 #define SPLT_DIRSTR "\\" 01305 #define SPLT_NDIRCHAR '/' 01306 #else 01307 #define SPLT_DIRCHAR '/' 01308 #define SPLT_DIRSTR "/" 01309 #define SPLT_NDIRCHAR '\\' 01310 #endif 01311 #endif 01312 01330 splt_state *mp3splt_new_state(int *error); 01331 01332 //find plugins 01333 int mp3splt_find_plugins(splt_state *state); 01334 01335 //this function frees the left variables in the library 01336 //don't forget to call this function ONLY at the end of the program 01337 //returns possible error 01338 void mp3splt_free_state(splt_state *state, int *error); 01339 01340 /************************************/ 01352 int mp3splt_set_path_of_split(splt_state *state, const char *path); 01353 01360 int mp3splt_set_filename_to_split(splt_state *state, const char *filename); 01361 01371 char *mp3splt_get_filename_to_split(splt_state *state); 01372 01373 int mp3splt_set_m3u_filename(splt_state *state, const char *filename); 01374 int mp3splt_set_silence_log_filename(splt_state *state, const char *filename); 01375 01383 int mp3splt_set_input_filename_regex(splt_state *state, const char *regex); 01384 01385 int mp3splt_set_default_comment_tag(splt_state *state, const char *default_comment_tag); 01386 01387 int mp3splt_set_default_genre_tag(splt_state *state, const char *default_genre_tag); 01388 01390 01391 /************************************/ 01403 int mp3splt_set_message_function(splt_state *state, 01404 void (*message_cb)(const char *, splt_message_type)); 01405 01412 int mp3splt_set_split_filename_function(splt_state *state, 01413 void (*file_cb)(const char *,int)); 01414 01421 int mp3splt_set_progress_function(splt_state *state, 01422 void (*progress_cb)(splt_progress *p_bar)); 01423 01424 int mp3splt_set_silence_level_function(splt_state *state, 01425 void (*get_silence_cb)(long time, float level, void *user_data), 01426 void *user_data); 01427 01429 01430 /************************************/ 01443 int mp3splt_append_splitpoint(splt_state *state, 01444 long split_value, const char *name, int type); 01445 01454 const splt_point *mp3splt_get_splitpoints(splt_state *state, 01455 int *splitpoints_number, int *error); 01456 01462 void mp3splt_erase_all_splitpoints(splt_state *state, 01463 int *error); 01465 01466 /************************************/ 01467 /* Tags */ 01468 01469 //puts a tag 01470 int mp3splt_append_tags(splt_state *state, 01471 const char *title, const char *artist, 01472 const char *album, const char *performer, 01473 const char *year, const char *comment, 01474 int track, const char *genre); 01475 01476 //returns a pointer to all the current tags 01477 const splt_tags *mp3splt_get_tags(splt_state *state, 01478 int *tags_number, int *error); 01479 01480 //puts tags from a string 01481 int mp3splt_put_tags_from_string(splt_state *state, const char *tags, 01482 int *error); 01483 01484 void mp3splt_erase_all_tags(splt_state *state, 01485 int *error); 01486 01487 /************************************/ 01488 /* Options */ 01489 01490 int mp3splt_set_int_option(splt_state *state, int option_name, int value); 01491 int mp3splt_set_long_option(splt_state *state, int option_name, long value); 01492 int mp3splt_set_float_option(splt_state *state, int option_name, float value); 01493 01494 int mp3splt_get_int_option(splt_state *state, int option_name, int *error); 01495 long mp3splt_get_long_option(splt_state *state, int option_name, int *error); 01496 float mp3splt_get_float_option(splt_state *state, int option_name, int *error); 01497 01498 /************************************/ 01499 /* Split functions */ 01500 01501 //split a ogg or mp3 file 01502 //returns possible error 01503 int mp3splt_split(splt_state *state); 01504 01505 //cancel split function 01506 //returns possible error 01507 void mp3splt_stop_split(splt_state *state, 01508 int *error); 01509 01510 /************************************/ 01511 /* Cddb and Cue functions */ 01512 01513 //get the cue splitpoints from a file and puts them in the state 01514 void mp3splt_put_cue_splitpoints_from_file(splt_state *state, 01515 const char *cue_file, int *error); 01516 01517 //read cddb splitpoints from file and puts them in the state 01518 void mp3splt_put_cddb_splitpoints_from_file(splt_state *state, 01519 const char *cddb_file, int *error); 01520 01521 void mp3splt_put_audacity_labels_splitpoints_from_file(splt_state *state, 01522 const char *file, int *error); 01523 01524 /************************************/ 01525 /* Freedb functions */ 01526 01527 //returns the freedb results and possible eerror 01531 const splt_freedb_results *mp3splt_get_freedb_search(splt_state *state, 01532 const char *searched_string, 01533 int *error, 01534 int search_type, 01535 const char *search_server, 01536 int port); 01537 01538 void mp3splt_write_freedb_file_result(splt_state *state, 01539 int disc_id, 01540 const char *cddb_file, 01541 int *error, 01542 int cddb_get_type, 01543 const char *cddb_get_server, 01544 int port); 01545 01546 void mp3splt_export_to_cue(splt_state *state, const char *out_file, 01547 short stop_at_total_time, int *error); 01548 01549 void mp3splt_set_oformat(splt_state *state, 01550 const char *format_string, int *error); 01551 01552 /************************************/ 01553 /* Other utilities */ 01554 01555 //counts the number of tracks found with silence detection 01556 int mp3splt_count_silence_points(splt_state *state, int *error); 01557 01558 int mp3splt_set_silence_points(splt_state *state, int *error); 01559 01560 //returns the version of libmp3splt 01561 void mp3splt_get_version(char *version); 01562 01563 //result must be freed 01564 char *mp3splt_get_strerror(splt_state *state, int error_code); 01565 01566 //returns the number of syncerrors 01567 //puts possible error in error variable 01568 const splt_syncerrors *mp3splt_get_syncerrors(splt_state *state, 01569 int *error); 01570 01571 //returns the wrapped files found 01572 const splt_wrap *mp3splt_get_wrap_files(splt_state *state, int *error); 01573 01574 int mp3splt_append_plugins_scan_dir(splt_state *state, char *dir); 01575 01576 #ifdef __WIN32__ 01577 char *mp3splt_win32_utf16_to_utf8(const wchar_t *source); 01578 #endif 01579 01580 char **mp3splt_find_filenames(splt_state *state, const char *filename, 01581 int *num_of_files_found, int *error); 01582 01583 int mp3splt_u_check_if_directory(const char *fname); 01584 01585 void mp3splt_free_one_tag(splt_tags *tags); 01586 splt_tags *mp3splt_parse_filename_regex(splt_state *state, int *error); 01587 01588 #define MP3SPLT_MP3SPLT_H 01589 01590 #endif 01591