mp3splt-gtk

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

mp3splt.h
Go to the documentation of this file.
1 /**********************************************************
2 *
3 * libmp3splt -- library based on mp3splt,
4 * for mp3/ogg splitting without decoding
5 *
6 * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
7 * Copyright (c) 2005-2012 Alexandru Munteanu - io_fx@yahoo.fr
8 *
9 * http://mp3splt.sourceforge.net
10 *
11 *********************************************************/
12
13 /**********************************************************
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 * 02111-1307,
29 * USA.
30 *
31 *********************************************************/
32
33 #ifndef MP3SPLT_MP3SPLT_H
34
35 #include <sys/types.h>
36 #include <stdlib.h>
37 #include <stdio.h>
38
39 //libtool 1.4e is buggy on mingw if we include ltdl.h
40 #ifndef __WIN32__
41 #include <ltdl.h>
42 #endif
43
59 #define SPLT_TRUE 1
60
63 #define SPLT_FALSE 0
64
65 /******************************/
66 /* Structures for the freedb */
67
74 typedef struct {
78 char *name;
82 int id;
89 int revision_number;
96 int *revisions;
97 } splt_freedb_one_result;
98
105 typedef struct {
109 splt_freedb_one_result *results;
113 int number;
114 } splt_freedb_results;
115
119 #define SPLT_MAXCD 512
120
121 //maximum length of the disc id
122 #define SPLT_DISCIDLEN 8
123
124 //structure for the freedb search
125 struct splt_cd {
126 char discid[SPLT_DISCIDLEN+1];
127 char category[20];
128 };
129
130 typedef struct {
131 struct splt_cd discs[SPLT_MAXCD];
132 int foundcd;
133 } splt_cd_state;
134
135 //structure containing everything used for the
136 //freedb search
137 typedef struct {
138 //we stock here the results of the freedb search
139 splt_freedb_results *search_results;
140 //we stock the state of the CD
141 //(for the freedb search)
142 splt_cd_state *cdstate;
143 } splt_freedb;
144
145 /******************************/
146 /* Structures for the wrap */
147
153 typedef struct {
157 int wrap_files_num;
161 char **wrap_files;
162 } splt_wrap;
163
164 /************************************/
165 /* Structures for the syncerrors */
166
172 typedef struct {
173 off_t *serrors_points;
177 long int serrors_points_num;
178 } splt_syncerrors;
179
180 /***************************************/
181 /* Structures for the output format */
182
183 #define SPLT_MAXOLEN 255
184 #define SPLT_OUTNUM 20
185
186 //structure defining the output format
187 typedef struct {
188 //format as @n_@t.. as a string
189 char *format_string;
190 //when we have @n option on output format
191 char output_format_digits;
192 int output_alpha_format_digits;
193 //format for the cddb cue output
194 char format[SPLT_OUTNUM+1][SPLT_MAXOLEN];
195 } splt_oformat;
196
197 /***************************/
198 /* Structures for the tags */
199
209 typedef struct {
213 char *title;
217 char *artist;
221 char *album;
229 char *performer;
233 char *year;
237 char *comment;
241 int track;
245 char *genre;
246
247 /*
248 * @brief tags version (for mp3): 1 or 2 or 1 & 2
249 */
250 int tags_version;
251
252 int set_original_tags;
253 } splt_tags;
254
255 typedef struct {
256 splt_tags tags;
257 void *all_original_tags;
258 } splt_original_tags;
259
266 typedef struct {
270 long value;
274 char *name;
279 int type;
280 } splt_point;
281
282 /*****************************/
283 /* Structure for the silence */
284
285 struct splt_ssplit {
286 double begin_position;
287 double end_position;
288 long len;
289 struct splt_ssplit *next;
290 };
291
292 /**********************************/
293 /* Structure for the split */
294
304 typedef struct splt_progres {
309 int progress_text_max_char;
311 char filename_shorted[512];
313 float percent_progress;
315 int current_split;
317 int max_splits;
325 int progress_type;
327 int silence_found_tracks;
329 float silence_db_level;
335 int user_data;
337 void (*progress)(struct splt_progres*);
338 } splt_progress;
339
341 typedef struct {
343 int use_proxy;
345 char hostname[256];
347 int port;
349 int authentification;
351 char user[256];
353 char password[256];
354 } splt_proxy;
355
357 typedef enum {
361 SPLT_MESSAGE_INFO,
365 SPLT_MESSAGE_DEBUG
366 } splt_message_type;
367
369 typedef struct {
371 long total_time;
373 int current_split;
375 int current_split_file_number;
383 int splitnumber;
385 int real_splitnumber;
393 void (*file_split)(const char *,int);
395 splt_progress *p_bar;
397 void (*get_silence_level)(long time, float level, void *user_data);
399 void *silence_level_client_data;
401 void (*put_message)(const char *, splt_message_type );
403 splt_point *points;
405 int real_tagsnumber;
407 splt_tags *tags;
408 splt_tags tags_like_x;
409 } splt_struct;
410
411 /**********************************/
412 /* Options structure */
413
419 typedef enum {
423 SPLT_OPTION_NORMAL_MODE,
427 SPLT_OPTION_WRAP_MODE,
431 SPLT_OPTION_SILENCE_MODE,
435 SPLT_OPTION_TRIM_SILENCE_MODE,
441 SPLT_OPTION_ERROR_MODE,
446 SPLT_OPTION_TIME_MODE,
451 SPLT_OPTION_LENGTH_MODE,
452 } splt_split_mode_options;
453
459 typedef enum {
461 SPLT_OUTPUT_FORMAT,
463 SPLT_OUTPUT_DEFAULT,
469 SPLT_OUTPUT_CUSTOM
470 } splt_output_filenames_options;
471
475 #define SPLT_DEFAULT_PARAM_THRESHOLD -48.0
476
479 #define SPLT_DEFAULT_PARAM_OFFSET 0.8
480
483 #define SPLT_DEFAULT_PARAM_MINIMUM_LENGTH 0.0
484
487 #define SPLT_DEFAULT_PARAM_MINIMUM_TRACK_LENGTH 0.0
488
491 #define SPLT_DEFAULT_PARAM_GAP 30
492
495 #define SPLT_DEFAULT_PARAM_TRACKS 0
496
499 #define SPLT_DEFAULT_PARAM_SHOTS 25
500
506 typedef enum {
510 SPLT_TAGS_ORIGINAL_FILE,
515 SPLT_CURRENT_TAGS,
519 SPLT_NO_TAGS,
524 SPLT_TAGS_FROM_FILENAME_REGEX,
525 } splt_tags_options;
526
527 #define SPLT_ORIGINAL_TAGS_DEFAULT "%[@o,@N=1]"
528
529 #define SPLT_DEFAULT_OUTPUT "@f_@mm_@ss_@hh__@Mm_@Ss_@Hh"
530
535 #define SPLT_DEFAULT_CDDB_CUE_OUTPUT "@A - @n - @t"
536
540 #define SPLT_DEFAULT_SYNCERROR_OUTPUT "@f_error_@n"
541
545 #define SPLT_DEFAULT_SILENCE_OUTPUT "@f_silence_@n"
546
550 #define SPLT_DEFAULT_TRIM_SILENCE_OUTPUT "@f_trimmed"
551
553 typedef struct {
562 splt_split_mode_options split_mode;
563
571 splt_tags_options tags;
572
573 int xing;
574
576 splt_output_filenames_options output_filenames;
577
579 int quiet_mode;
580
585 int pretend_to_split;
586
592 int option_frame_mode;
594 float split_time;
595 long overlap_time;
597 int option_auto_adjust;
606 int option_input_not_seekable;
607
614 int create_dirs_from_filenames;
615
616 //PARAMETERS---------------------------------------
617 //PARAMETERS for option_auto_adjust and option_silence_mode:
621 float parameter_threshold;
630 float parameter_offset;
631
632 //PARAMETERS for option_silence_mode:
638 int parameter_number_tracks;
645 int parameter_shots;
651 float parameter_minimum_length;
657 float parameter_min_track_length;
658
660 int artist_tag_format;
662 int album_tag_format;
664 int title_tag_format;
666 int comment_tag_format;
667
669 int replace_underscores_tag_format;
670
672 int set_file_from_cue_if_file_tag_found;
673
675 int parameter_remove_silence;
676
677 //PARAMETERS for option_auto_adjust:
684 int parameter_gap;
685
690 int remaining_tags_like_x;
691
693 int auto_increment_tracknumber_tags;
694
698 int enable_silence_log;
699
706 int force_tags_version;
710 int length_split_file_number;
711 int replace_tags_in_tags;
712 } splt_options;
713
714 /**********************************/
715 /* Main structure */
716
717 //internal structures
718 typedef struct
719 {
721 int frame_mode_enabled;
723 int current_refresh_rate;
725 int messages_locked;
727 int library_locked;
729 char *new_filename_path;
730 } splt_internal;
731
736 typedef struct
737 {
738 float version;
739 char *name;
740 char *extension;
741 char *upper_extension;
742 } splt_plugin_info;
743
745 typedef struct {
746 int (*check_plugin_is_for_file)(void *state, int *error);
747 void (*set_plugin_info)(splt_plugin_info *info, int *error);
748 void (*search_syncerrors)(void *state, int *error);
749 void (*dewrap)(void *state, int listonly, const char *dir, int *error);
750 void (*set_total_time)(void *state, int *error);
751 int (*simple_split)(void *state, const char *output_fname, off_t begin, off_t end);
752 double (*split)(void *state, const char *final_fname, double begin_point,
753 double end_point, int *error, int save_end_point);
754 int (*scan_silence)(void *state, int *error);
755 int (*scan_trim_silence)(void *state, int *error);
756 void (*set_original_tags)(void *state, int *error);
757 void (*clear_original_tags)(splt_original_tags *original_tags);
758 void (*init)(void *state, int *error);
759 void (*end)(void *state, int *error);
760 } splt_plugin_func;
761
763 typedef struct
764 {
765 splt_plugin_info info;
767 char *plugin_filename;
769 void *plugin_handle;
771 splt_plugin_func *func;
772 } splt_plugin_data;
773
775 typedef struct
776 {
778 char **plugins_scan_dirs;
779 int number_of_dirs_to_scan;
781 int number_of_plugins_found;
783 splt_plugin_data *data;
784 } splt_plugins;
785
787 typedef struct
788 {
789 char *error_data;
790 char *strerror_msg;
791 } splt_error;
792
794 typedef struct {
795
797 int cancel_split;
799 char *fname_to_split;
801 char *path_of_split;
802
803 //if this is non null, we write a m3u from the split files
804 char *m3u_filename;
805
807 char *input_fname_regex;
808
809 char *default_comment_tag;
810 char *default_genre_tag;
811
813 splt_original_tags original_tags;
814
816 splt_options options;
818 splt_struct split;
820 splt_oformat oformat;
822 splt_wrap *wrap;
824 splt_syncerrors *serrors;
831 unsigned long syncerrors;
833 splt_freedb fdb;
834
836 splt_internal iopts;
837
839 struct splt_ssplit *silence_list;
840
841 //proxy infos
842 //splt_proxy proxy;
843
845 void *codec;
846
848 splt_error err;
849
851 splt_plugins *plug;
852 int current_plugin;
853
855 char *silence_log_fname;
856 } splt_state;
857
858 /*****************************************/
859 /* Confirmations, errors and messages */
860
862 typedef enum {
863 SPLT_OK = 0,
864
865 SPLT_OK_SPLIT = 1,
866 SPLT_SPLITPOINT_BIGGER_THAN_LENGTH = 4,
867 SPLT_SILENCE_OK = 5,
868 SPLT_TIME_SPLIT_OK = 6,
869 SPLT_NO_SILENCE_SPLITPOINTS_FOUND = 7,
870 SPLT_OK_SPLIT_EOF = 8,
871 SPLT_LENGTH_SPLIT_OK = 9,
872 SPLT_TRIM_SILENCE_OK = 10,
873
874 SPLT_FREEDB_OK = 100,
875 SPLT_FREEDB_FILE_OK = 101,
876 SPLT_CDDB_OK = 102,
877 SPLT_CUE_OK = 103,
878 SPLT_FREEDB_MAX_CD_REACHED = 104,
879 SPLT_AUDACITY_OK = 105,
880
881 SPLT_DEWRAP_OK = 200,
882
883 SPLT_SYNC_OK = 300,
884 SPLT_MIGHT_BE_VBR = 301,
885
886 SPLT_ERR_SYNC = -300,
887 SPLT_ERR_NO_SYNC_FOUND = -301,
888 SPLT_ERR_TOO_MANY_SYNC_ERR = -302,
889
890 SPLT_OUTPUT_FORMAT_OK = 400,
891 SPLT_OUTPUT_FORMAT_AMBIGUOUS = 401,
892
893 SPLT_REGEX_OK = 800,
894
895 SPLT_ERROR_SPLITPOINTS = -1,
896 SPLT_ERROR_CANNOT_OPEN_FILE = -2,
897 SPLT_ERROR_INVALID = -3,
898 SPLT_ERROR_EQUAL_SPLITPOINTS = -5,
899 SPLT_ERROR_SPLITPOINTS_NOT_IN_ORDER = -6,
900 SPLT_ERROR_NEGATIVE_SPLITPOINT = -7,
901 SPLT_ERROR_INCORRECT_PATH = -8,
902 SPLT_ERROR_INCOMPATIBLE_OPTIONS = -10,
903 SPLT_ERROR_INPUT_OUTPUT_SAME_FILE = -12,
904 SPLT_ERROR_CANNOT_ALLOCATE_MEMORY = -15,
905 SPLT_ERROR_CANNOT_OPEN_DEST_FILE = -16,
906 SPLT_ERROR_CANT_WRITE_TO_OUTPUT_FILE = -17,
907 SPLT_ERROR_WHILE_READING_FILE = -18,
908 SPLT_ERROR_SEEKING_FILE = -19,
909 SPLT_ERROR_BEGIN_OUT_OF_FILE = -20,
910 SPLT_ERROR_INEXISTENT_FILE = -21,
911 SPLT_SPLIT_CANCELLED = -22,
912 SPLT_ERROR_LIBRARY_LOCKED = -24,
913 SPLT_ERROR_STATE_NULL = -25,
914 SPLT_ERROR_NEGATIVE_TIME_SPLIT = -26,
915 SPLT_ERROR_CANNOT_CREATE_DIRECTORY = -27,
916 SPLT_ERROR_CANNOT_CLOSE_FILE = -28,
917 SPLT_ERROR_NO_PLUGIN_FOUND = -29,
918 SPLT_ERROR_CANNOT_INIT_LIBLTDL = -30,
919 SPLT_ERROR_CRC_FAILED = -31,
920 SPLT_ERROR_NO_PLUGIN_FOUND_FOR_FILE = -32,
921 SPLT_ERROR_PLUGIN_ERROR = -33,
922 SPLT_ERROR_TIME_SPLIT_VALUE_INVALID = -34,
923 SPLT_ERROR_LENGTH_SPLIT_VALUE_INVALID = -35,
924 SPLT_ERROR_CANNOT_GET_TOTAL_TIME = -36,
925 SPLT_ERROR_LIBID3 = -37,
926
927 SPLT_FREEDB_ERROR_INITIALISE_SOCKET = -101,
928 SPLT_FREEDB_ERROR_CANNOT_GET_HOST = -102,
929 SPLT_FREEDB_ERROR_CANNOT_OPEN_SOCKET = -103,
930 SPLT_FREEDB_ERROR_CANNOT_CONNECT = -104,
931 SPLT_FREEDB_ERROR_CANNOT_SEND_MESSAGE = -105,
932 SPLT_FREEDB_ERROR_INVALID_SERVER_ANSWER = -106,
933 SPLT_FREEDB_ERROR_SITE_201 = -107,
934 SPLT_FREEDB_ERROR_SITE_200 = -108,
935 SPLT_FREEDB_ERROR_BAD_COMMUNICATION = -109,
936 SPLT_FREEDB_ERROR_GETTING_INFOS = -110,
937 SPLT_FREEDB_NO_CD_FOUND = -111,
938 SPLT_FREEDB_ERROR_CANNOT_RECV_MESSAGE = -112,
939 SPLT_INVALID_CUE_FILE = -115,
940 SPLT_INVALID_CDDB_FILE = -116,
941 SPLT_FREEDB_NO_SUCH_CD_IN_DATABASE = -118,
942 SPLT_FREEDB_ERROR_SITE = -119,
943 SPLT_FREEDB_ERROR_CANNOT_DISCONNECT = -120,
944
945 SPLT_DEWRAP_ERR_FILE_LENGTH = -200,
946 SPLT_DEWRAP_ERR_VERSION_OLD = -201,
947 SPLT_DEWRAP_ERR_NO_FILE_OR_BAD_INDEX = -202,
948 SPLT_DEWRAP_ERR_FILE_DAMAGED_INCOMPLETE = -203,
949 SPLT_DEWRAP_ERR_FILE_NOT_WRAPED_DAMAGED = -204,
950
951 SPLT_OUTPUT_FORMAT_ERROR = -400,
952
953 SPLT_ERROR_INEXISTENT_SPLITPOINT = -500,
954
955 SPLT_PLUGIN_ERROR_UNSUPPORTED_FEATURE = -600,
956
957 SPLT_INVALID_AUDACITY_FILE = -700,
958
959 SPLT_INVALID_REGEX = -800,
960 SPLT_REGEX_NO_MATCH = -801,
961 SPLT_REGEX_UNAVAILABLE = -802,
962 } splt_code;
963
964 //internal
965 #define SPLT_INTERNAL_PROGRESS_RATE 1
966 #define SPLT_INTERNAL_FRAME_MODE_ENABLED 2
967
968 //progress messages
974 typedef enum {
978 SPLT_PROGRESS_PREPARE,
982 SPLT_PROGRESS_CREATE,
986 SPLT_PROGRESS_SEARCH_SYNC,
990 SPLT_PROGRESS_SCAN_SILENCE
991 } splt_progress_messages;
992
1001 typedef enum {
1006 SPLT_OPT_PRETEND_TO_SPLIT,
1007 /*
1008 * If quiet; we don't do CRC check or human interaction
1009 */
1010 SPLT_OPT_QUIET_MODE,
1018 SPLT_OPT_DEBUG_MODE,
1026 SPLT_OPT_SPLIT_MODE,
1034 SPLT_OPT_TAGS,
1038 SPLT_OPT_XING,
1050 SPLT_OPT_CREATE_DIRS_FROM_FILENAMES,
1056 SPLT_OPT_OUTPUT_FILENAMES,
1066 SPLT_OPT_FRAME_MODE,
1077 SPLT_OPT_AUTO_ADJUST,
1087 SPLT_OPT_INPUT_NOT_SEEKABLE,
1097 SPLT_OPT_PARAM_NUMBER_TRACKS,
1109 SPLT_OPT_PARAM_SHOTS,
1118 SPLT_OPT_PARAM_REMOVE_SILENCE,
1127 SPLT_OPT_PARAM_GAP,
1131 SPLT_OPT_ALL_REMAINING_TAGS_LIKE_X,
1135 SPLT_OPT_AUTO_INCREMENT_TRACKNUMBER_TAGS,
1139 SPLT_OPT_ENABLE_SILENCE_LOG,
1143 SPLT_OPT_FORCE_TAGS_VERSION,
1147 SPLT_OPT_LENGTH_SPLIT_FILE_NUMBER,
1151 SPLT_OPT_REPLACE_TAGS_IN_TAGS,
1155 SPLT_OPT_OVERLAP_TIME,
1164 SPLT_OPT_SPLIT_TIME,
1175 SPLT_OPT_PARAM_THRESHOLD,
1186 SPLT_OPT_PARAM_OFFSET,
1195 SPLT_OPT_PARAM_MIN_LENGTH,
1204 SPLT_OPT_PARAM_MIN_TRACK_LENGTH,
1209 SPLT_OPT_ARTIST_TAG_FORMAT,
1214 SPLT_OPT_ALBUM_TAG_FORMAT,
1219 SPLT_OPT_TITLE_TAG_FORMAT,
1224 SPLT_OPT_COMMENT_TAG_FORMAT,
1229 SPLT_OPT_REPLACE_UNDERSCORES_TAG_FORMAT,
1234 SPLT_OPT_SET_FILE_FROM_CUE_IF_FILE_TAG_FOUND,
1235 } splt_int_options;
1236
1237 typedef enum {
1238 SPLT_NO_CONVERSION,
1239 SPLT_TO_LOWERCASE,
1240 SPLT_TO_UPPERCASE,
1241 SPLT_TO_FIRST_UPPERCASE,
1242 SPLT_TO_WORD_FIRST_UPPERCASE
1243 } splt_str_format;
1244
1249 typedef enum {
1250 /* a regular splitpoint */
1251 SPLT_SPLITPOINT,
1252 /* a skippoint */
1253 SPLT_SKIPPOINT,
1254 } splt_type_of_splitpoint;
1255
1256
1257 #define SPLT_UNDEFINED_GENRE "Other"
1258
1259 #define SPLT_ID3V1_NUMBER_OF_GENRES 127
1260
1263 static const char splt_id3v1_genres[SPLT_ID3V1_NUMBER_OF_GENRES][25] = {
1264 {"Blues"},
1265 {"Classic Rock"}, {"Country"}, {"Dance"},
1266 {"Disco"},{"Funk"},{"Grunge"},{"Hip-Hop"},{"Jazz"},
1267 {"Metal"},{"New Age"},{"Oldies"}, {"Other"}, {"Pop"},
1268 {"R&B"}, {"Rap"}, {"Reggae"}, {"Rock"}, {"Techno"},
1269 {"Industrial"}, {"Alternative"}, {"Ska"}, {"Death metal"},
1270 {"Pranks"}, {"Soundtrack"}, {"Euro-Techno"},
1271 {"Ambient"}, {"Trip-hop"}, {"Vocal"}, {"Jazz+Funk"},
1272 {"Fusion"}, {"Trance"}, {"Classical"}, {"Instrumental"},
1273 {"Acid"}, {"House"}, {"Game"}, {"Sound clip"}, {"Gospel"},
1274 {"Noise"}, {"Alt. Rock"}, {"Bass"}, {"Soul"}, {"Punk"},
1275 {"Space"}, {"Meditative"}, {"Instrumental pop"},
1276 {"Instrumental rock"}, {"Ethnic"}, {"Gothic"},{"Darkwave"},
1277 {"Techno-Industrial"},{"Electronic"},{"Pop-Folk"},{"Eurodance"},
1278 {"Dream"},{"Southern Rock"},{"Comedy"}, {"Cult"},{"Gangsta"},
1279 {"Top 40"},{"Christian Rap"},{"Pop/Funk"}, {"Jungle"},
1280 {"Native American"},{"Cabaret"},{"New Wave"}, {"Psychedelic"},
1281 {"Rave"},{"Showtunes"},{"Trailer"}, {"Lo-Fi"},{"Tribal"},
1282 {"Acid Punk"},{"Acid Jazz"}, {"Polka"}, {"Retro"},
1283 {"Musical"},{"Rock & Roll"},{"Hard Rock"},
1284
1285 {"Folk"}, {"Folk-Rock"}, {"National Folk"}, {"Swing"},
1286 {"Fast Fusion"}, {"Bebob"}, {"Latin"}, {"Revival"},
1287 {"Celtic"}, {"Bluegrass"}, {"Avantgarde"}, {"Gothic Rock"},
1288 {"Progressive Rock"}, {"Psychedelic Rock"}, {"Symphonic Rock"},
1289 {"Slow Rock"}, {"Big Band"}, {"Chorus"}, {"Easy Listening"},
1290 {"Acoustic"}, {"Humour"}, {"Speech"}, {"Chanson"}, {"Opera"},
1291 {"Chamber Music"}, {"Sonata"}, {"Symphony"}, {"Booty Bass"},
1292 {"Primus"}, {"Porn Groove"}, {"Satire"}, {"Slow Jam"},
1293 {"Club"}, {"Tango"}, {"Samba"}, {"Folklore"}, {"Ballad"},
1294 {"Power Ballad"}, {"Rhythmic Soul"}, {"Freestyle"}, {"Duet"},
1295 {"Punk Rock"}, {"Drum Solo"}, {"A capella"}, {"Euro-House"},
1296 {"Dance Hall"},
1297
1298 {"misc"},
1299 };
1300
1305 /*
1306 * freedb2 search type
1307 */
1308 #define SPLT_FREEDB_SEARCH_TYPE_CDDB_CGI 1
1309 /*
1310 * freedb search type
1311 */
1312 #define SPLT_FREEDB_SEARCH_TYPE_CDDB 2
1313 /*
1314 * freedb get file type
1315 * we retrieve the file by using the cddb.cgi script
1316 * (usually on port 80)
1317 */
1318 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI 3
1319 /*
1320 * we retrieve the file by using the freedb cddb protocol
1321 * (usually on port 8880)
1322 */
1323 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB 4
1324
1327 #define SPLT_FREEDB_CDDB_CGI_PORT 80
1328
1331 #define SPLT_FREEDB_CDDB_PORT 8880
1332
1335 #define SPLT_FREEDB_CGI_SITE "freedb.org/~cddb/cddb.cgi"
1336 #define SPLT_FREEDB2_CGI_SITE "tracktype.org/~cddb/cddb.cgi"
1337
1338 //package information constants
1339 #ifndef SPLT_PACKAGE_NAME
1340
1343 #define SPLT_PACKAGE_NAME "libmp3splt"
1344 #endif
1345 #ifndef SPLT_PACKAGE_VERSION
1346
1349 #define SPLT_PACKAGE_VERSION "0.7.2"
1350 #endif
1351
1354 #define SPLT_AUTHOR "Matteo Trotta | Munteanu Alexandru"
1355 #define SPLT_EMAIL "<mtrotta@users.sourceforge.net> | <io_fx@yahoo.fr>"
1356
1359 #define SPLT_WEBSITE "http://mp3splt.sourceforge.net"
1360
1361 /* other useful variables */
1362
1363 #define MP3SPLT_LIB_GETTEXT_DOMAIN "libmp3splt"
1364
1365 //backslash character
1366 #ifndef SPLT_DIRCHAR
1367 #ifdef __WIN32__
1368 #define SPLT_DIRCHAR '\\'
1369 #define SPLT_DIRSTR "\\"
1370 #define SPLT_NDIRCHAR '/'
1371 #else
1372 #define SPLT_DIRCHAR '/'
1373 #define SPLT_DIRSTR "/"
1374 #define SPLT_NDIRCHAR '\\'
1375 #endif
1376 #endif
1377
1395 splt_state *mp3splt_new_state(int *error);
1396
1397 //find plugins
1398 int mp3splt_find_plugins(splt_state *state);
1399
1400 //this function frees the left variables in the library
1401 //don't forget to call this function ONLY at the end of the program
1402 //returns possible error
1403 void mp3splt_free_state(splt_state *state, int *error);
1404
1405 /************************************/
1417 int mp3splt_set_path_of_split(splt_state *state, const char *path);
1418
1425 int mp3splt_set_filename_to_split(splt_state *state, const char *filename);
1426
1436 char *mp3splt_get_filename_to_split(splt_state *state);
1437
1438 int mp3splt_set_m3u_filename(splt_state *state, const char *filename);
1439 int mp3splt_set_silence_log_filename(splt_state *state, const char *filename);
1440
1448 int mp3splt_set_input_filename_regex(splt_state *state, const char *regex);
1449
1450 int mp3splt_set_default_comment_tag(splt_state *state, const char *default_comment_tag);
1451
1452 int mp3splt_set_default_genre_tag(splt_state *state, const char *default_genre_tag);
1453
1455
1456 /************************************/
1468 int mp3splt_set_message_function(splt_state *state,
1469 void (*message_cb)(const char *, splt_message_type));
1470
1477 int mp3splt_set_split_filename_function(splt_state *state,
1478 void (*file_cb)(const char *,int));
1479
1486 int mp3splt_set_progress_function(splt_state *state,
1487 void (*progress_cb)(splt_progress *p_bar));
1488
1489 int mp3splt_set_silence_level_function(splt_state *state,
1490 void (*get_silence_cb)(long time, float level, void *user_data),
1491 void *user_data);
1492
1494
1495 /************************************/
1508 int mp3splt_append_splitpoint(splt_state *state,
1509 long split_value, const char *name, int type);
1510
1519 const splt_point *mp3splt_get_splitpoints(splt_state *state,
1520 int *splitpoints_number, int *error);
1521
1527 void mp3splt_erase_all_splitpoints(splt_state *state,
1528 int *error);
1530
1531 /************************************/
1532 /* Tags */
1533
1534 //puts a tag
1535 int mp3splt_append_tags(splt_state *state,
1536 const char *title, const char *artist,
1537 const char *album, const char *performer,
1538 const char *year, const char *comment,
1539 int track, const char *genre);
1540
1541 //returns a pointer to all the current tags
1542 const splt_tags *mp3splt_get_tags(splt_state *state,
1543 int *tags_number, int *error);
1544
1545 //puts tags from a string
1546 int mp3splt_put_tags_from_string(splt_state *state, const char *tags,
1547 int *error);
1548
1549 void mp3splt_erase_all_tags(splt_state *state,
1550 int *error);
1551
1552 /************************************/
1553 /* Options */
1554
1555 int mp3splt_set_int_option(splt_state *state, int option_name, int value);
1556 int mp3splt_set_long_option(splt_state *state, int option_name, long value);
1557 int mp3splt_set_float_option(splt_state *state, int option_name, float value);
1558
1559 int mp3splt_get_int_option(splt_state *state, int option_name, int *error);
1560 long mp3splt_get_long_option(splt_state *state, int option_name, int *error);
1561 float mp3splt_get_float_option(splt_state *state, int option_name, int *error);
1562
1563 /************************************/
1564 /* Split functions */
1565
1566 //split a ogg or mp3 file
1567 //returns possible error
1568 int mp3splt_split(splt_state *state);
1569
1570 //cancel split function
1571 //returns possible error
1572 void mp3splt_stop_split(splt_state *state,
1573 int *error);
1574
1575 /************************************/
1576 /* Cddb and Cue functions */
1577
1578 //get the cue splitpoints from a file and puts them in the state
1579 void mp3splt_put_cue_splitpoints_from_file(splt_state *state,
1580 const char *cue_file, int *error);
1581
1582 //read cddb splitpoints from file and puts them in the state
1583 void mp3splt_put_cddb_splitpoints_from_file(splt_state *state,
1584 const char *cddb_file, int *error);
1585
1586 void mp3splt_put_audacity_labels_splitpoints_from_file(splt_state *state,
1587 const char *file, int *error);
1588
1589 /************************************/
1590 /* Freedb functions */
1591
1592 //returns the freedb results and possible eerror
1596 const splt_freedb_results *mp3splt_get_freedb_search(splt_state *state,
1597 const char *searched_string,
1598 int *error,
1599 int search_type,
1600 const char *search_server,
1601 int port);
1602
1603 void mp3splt_write_freedb_file_result(splt_state *state,
1604 int disc_id,
1605 const char *cddb_file,
1606 int *error,
1607 int cddb_get_type,
1608 const char *cddb_get_server,
1609 int port);
1610
1611 void mp3splt_export_to_cue(splt_state *state, const char *out_file,
1612 short stop_at_total_time, int *error);
1613
1614 void mp3splt_set_oformat(splt_state *state,
1615 const char *format_string, int *error);
1616
1617 /************************************/
1618 /* Other utilities */
1619
1620 //counts the number of tracks found with silence detection
1621 int mp3splt_count_silence_points(splt_state *state, int *error);
1622
1623 int mp3splt_set_silence_points(splt_state *state, int *error);
1624 void mp3splt_set_trim_silence_points(splt_state *state, int *error);
1625
1626 //returns the version of libmp3splt
1627 void mp3splt_get_version(char *version);
1628
1629 //result must be freed
1630 char *mp3splt_get_strerror(splt_state *state, int error_code);
1631
1632 //returns the number of syncerrors
1633 //puts possible error in error variable
1634 const splt_syncerrors *mp3splt_get_syncerrors(splt_state *state,
1635 int *error);
1636
1637 //returns the wrapped files found
1638 const splt_wrap *mp3splt_get_wrap_files(splt_state *state, int *error);
1639
1640 int mp3splt_append_plugins_scan_dir(splt_state *state, char *dir);
1641
1642 #ifdef __WIN32__
1643 char *mp3splt_win32_utf16_to_utf8(const wchar_t *source);
1644 #endif
1645
1646 char **mp3splt_find_filenames(splt_state *state, const char *filename,
1647 int *num_of_files_found, int *error);
1648
1649 int mp3splt_u_check_if_directory(const char *fname);
1650
1651 void mp3splt_free_one_tag(splt_tags *tags);
1652 splt_tags *mp3splt_parse_filename_regex(splt_state *state, int *error);
1653
1654 #define MP3SPLT_MP3SPLT_H
1655
1656 #endif
1657