81 #ifndef MP3SPLT_MP3SPLT_H
83 #include <sys/types.h>
111 SPLT_SPLITPOINT_BIGGER_THAN_LENGTH = 4,
113 SPLT_TIME_SPLIT_OK = 6,
114 SPLT_NO_SILENCE_SPLITPOINTS_FOUND = 7,
115 SPLT_OK_SPLIT_EOF = 8,
116 SPLT_LENGTH_SPLIT_OK = 9,
117 SPLT_TRIM_SILENCE_OK = 10,
119 SPLT_FREEDB_OK = 100,
120 SPLT_FREEDB_FILE_OK = 101,
123 SPLT_FREEDB_MAX_CD_REACHED = 104,
124 SPLT_AUDACITY_OK = 105,
126 SPLT_DEWRAP_OK = 200,
129 SPLT_MIGHT_BE_VBR = 301,
131 SPLT_ERR_SYNC = -300,
132 SPLT_ERR_NO_SYNC_FOUND = -301,
133 SPLT_ERR_TOO_MANY_SYNC_ERR = -302,
135 SPLT_OUTPUT_FORMAT_OK = 400,
136 SPLT_OUTPUT_FORMAT_AMBIGUOUS = 401,
140 SPLT_ERROR_SPLITPOINTS = -1,
141 SPLT_ERROR_CANNOT_OPEN_FILE = -2,
142 SPLT_ERROR_INVALID = -3,
143 SPLT_ERROR_EQUAL_SPLITPOINTS = -5,
144 SPLT_ERROR_SPLITPOINTS_NOT_IN_ORDER = -6,
145 SPLT_ERROR_NEGATIVE_SPLITPOINT = -7,
146 SPLT_ERROR_INCORRECT_PATH = -8,
147 SPLT_ERROR_INCOMPATIBLE_OPTIONS = -10,
148 SPLT_ERROR_INPUT_OUTPUT_SAME_FILE = -12,
149 SPLT_ERROR_CANNOT_ALLOCATE_MEMORY = -15,
150 SPLT_ERROR_CANNOT_OPEN_DEST_FILE = -16,
151 SPLT_ERROR_CANT_WRITE_TO_OUTPUT_FILE = -17,
152 SPLT_ERROR_WHILE_READING_FILE = -18,
153 SPLT_ERROR_SEEKING_FILE = -19,
154 SPLT_ERROR_BEGIN_OUT_OF_FILE = -20,
155 SPLT_ERROR_INEXISTENT_FILE = -21,
156 SPLT_SPLIT_CANCELLED = -22,
157 SPLT_ERROR_LIBRARY_LOCKED = -24,
158 SPLT_ERROR_STATE_NULL = -25,
159 SPLT_ERROR_NEGATIVE_TIME_SPLIT = -26,
160 SPLT_ERROR_CANNOT_CREATE_DIRECTORY = -27,
161 SPLT_ERROR_CANNOT_CLOSE_FILE = -28,
162 SPLT_ERROR_NO_PLUGIN_FOUND = -29,
163 SPLT_ERROR_CANNOT_INIT_LIBLTDL = -30,
164 SPLT_ERROR_CRC_FAILED = -31,
165 SPLT_ERROR_NO_PLUGIN_FOUND_FOR_FILE = -32,
166 SPLT_ERROR_PLUGIN_ERROR = -33,
167 SPLT_ERROR_TIME_SPLIT_VALUE_INVALID = -34,
168 SPLT_ERROR_LENGTH_SPLIT_VALUE_INVALID = -35,
169 SPLT_ERROR_CANNOT_GET_TOTAL_TIME = -36,
170 SPLT_ERROR_LIBID3 = -37,
171 SPLT_ERROR_FAILED_BITRESERVOIR = -38,
173 SPLT_FREEDB_ERROR_INITIALISE_SOCKET = -101,
174 SPLT_FREEDB_ERROR_CANNOT_GET_HOST = -102,
175 SPLT_FREEDB_ERROR_CANNOT_OPEN_SOCKET = -103,
176 SPLT_FREEDB_ERROR_CANNOT_CONNECT = -104,
177 SPLT_FREEDB_ERROR_CANNOT_SEND_MESSAGE = -105,
178 SPLT_FREEDB_ERROR_INVALID_SERVER_ANSWER = -106,
179 SPLT_FREEDB_ERROR_SITE_201 = -107,
180 SPLT_FREEDB_ERROR_SITE_200 = -108,
181 SPLT_FREEDB_ERROR_BAD_COMMUNICATION = -109,
182 SPLT_FREEDB_ERROR_GETTING_INFOS = -110,
183 SPLT_FREEDB_NO_CD_FOUND = -111,
184 SPLT_FREEDB_ERROR_CANNOT_RECV_MESSAGE = -112,
185 SPLT_INVALID_CUE_FILE = -115,
186 SPLT_INVALID_CDDB_FILE = -116,
187 SPLT_FREEDB_NO_SUCH_CD_IN_DATABASE = -118,
188 SPLT_FREEDB_ERROR_SITE = -119,
189 SPLT_FREEDB_ERROR_CANNOT_DISCONNECT = -120,
190 SPLT_FREEDB_ERROR_PROXY_NOT_SUPPORTED = -121,
191 SPLT_ERROR_INTERNAL_SHEET = -122,
192 SPLT_ERROR_INTERNAL_SHEET_TYPE_NOT_SUPPORTED = -123,
194 SPLT_DEWRAP_ERR_FILE_LENGTH = -200,
195 SPLT_DEWRAP_ERR_VERSION_OLD = -201,
196 SPLT_DEWRAP_ERR_NO_FILE_OR_BAD_INDEX = -202,
197 SPLT_DEWRAP_ERR_FILE_DAMAGED_INCOMPLETE = -203,
198 SPLT_DEWRAP_ERR_FILE_NOT_WRAPED_DAMAGED = -204,
200 SPLT_OUTPUT_FORMAT_ERROR = -400,
202 SPLT_ERROR_INEXISTENT_SPLITPOINT = -500,
204 SPLT_PLUGIN_ERROR_UNSUPPORTED_FEATURE = -600,
206 SPLT_INVALID_AUDACITY_FILE = -700,
208 SPLT_INVALID_REGEX = -800,
209 SPLT_REGEX_NO_MATCH = -801,
210 SPLT_REGEX_UNAVAILABLE = -802,
212 SPLT_ERROR_NO_AUTO_ADJUST_FOUND = -900,
214 SPLT_ERROR_INVALID_CODE = -1000,
804 #define SPLT_DEFAULT_PARAM_THRESHOLD -48.0
808 #define SPLT_DEFAULT_PARAM_OFFSET 0.8
812 #define SPLT_DEFAULT_PARAM_MINIMUM_LENGTH 0.0
816 #define SPLT_DEFAULT_PARAM_MINIMUM_TRACK_LENGTH 0.0
820 #define SPLT_DEFAULT_PARAM_MIN_TRACK_JOIN 0.0
824 #define SPLT_DEFAULT_PARAM_GAP 30
828 #define SPLT_DEFAULT_PARAM_TRACKS 0
832 #define SPLT_DEFAULT_PARAM_SHOTS 25
836 #define SPLT_DEFAULT_KEEP_SILENCE_LEFT 0
840 #define SPLT_DEFAULT_KEEP_SILENCE_RIGHT 0
868 #define SPLT_DEFAULT_OUTPUT "@f_@mm_@ss_@h0h__@Mm_@Ss_@H0h"
874 #define SPLT_DEFAULT_CDDB_CUE_OUTPUT "@A - @n - @t"
879 #define SPLT_DEFAULT_SYNCERROR_OUTPUT "@f_error_@n"
884 #define SPLT_DEFAULT_SILENCE_OUTPUT "@f_silence_@n"
889 #define SPLT_DEFAULT_TRIM_SILENCE_OUTPUT "@f_trimmed"
1147 void (*message_cb)(
const char *message,
splt_message_type type,
void *cb_data),
void *cb_data);
1163 void (*file_cb)(
const char *filename,
void *cb_data),
1187 void (*write_cb)(
const void *ptr,
size_t size,
size_t nmemb,
void *cb_data),
1245 void (*progress_cb)(
splt_progress *p_bar,
void *cb_data),
void *cb_data);
1298 void (*get_silence_cb)(
long time,
float level,
void *user_data),
1471 #define SPLT_UNDEFINED_GENRE "Other"
1477 #define SPLT_ID3V1_NUMBER_OF_GENRES 127
1488 SPLT_TAGS_TITLE = 1,
1489 SPLT_TAGS_ARTIST = 2,
1490 SPLT_TAGS_ALBUM = 3,
1492 SPLT_TAGS_COMMENT = 5,
1493 SPLT_TAGS_TRACK = 6,
1494 SPLT_TAGS_GENRE = 7,
1495 SPLT_TAGS_PERFORMER = 8,
1762 int *num_of_files_found,
splt_code *error);
1780 AUDACITY_LABELS_IMPORT,
1781 PLUGIN_INTERNAL_IMPORT
1801 #define SPLT_FREEDB_SEARCH_TYPE_CDDB_CGI 1
1808 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI 3
1815 #define SPLT_FREEDB_GET_FILE_TYPE_CDDB 4
1823 #define SPLT_FREEDB_CDDB_CGI_PORT 80
1832 #define SPLT_FREEDB2_CGI_SITE "tracktype.org/~cddb/cddb.cgi"
1875 const char *base64_authentification);
1914 const char *searched_string,
splt_code *error,
1915 int search_type,
const char *search_server,
int port);
1971 int disc_id,
const char *output_file,
1972 int cddb_get_type,
const char *cddb_get_server,
int port);
2002 const char *file,
int stop_at_total_time);
2101 char *mp3splt_win32_utf16_to_utf8(
const wchar_t *source);
2109 #ifndef SPLT_DIRCHAR
2111 #define SPLT_DIRCHAR '\\'
2112 #define SPLT_DIRSTR "\\"
2117 #define SPLT_DIRCHAR '/'
2121 #define SPLT_DIRSTR "/"
2226 double (*splt_pl_split)(
splt_state *state,
const char *final_fname,
double begin_point,
2227 double end_point,
splt_code *error,
int save_end_point);
2293 int (*splt_pl_offset_split)(
splt_state *state,
const char *output_fname, off_t begin, off_t end);
2320 #define MP3SPLT_MP3SPLT_H
struct _splt_wrap splt_wrap
Structure containg the wrapped filenames found inside the input filename.
splt_code mp3splt_stop_split(splt_state *state)
Stop the main split process.
Structure containing plugin information, like the version, the name and file extension.
Pretend to split the file, without actually creating output files.
int mp3splt_get_int_option(splt_state *state, splt_options option, splt_code *error)
Returns the value of an int option from the state.
const splt_freedb_one_result * mp3splt_freedb_next(splt_freedb_results *freedb_results)
Returns the next freedb result from the freedb_results.
Keep the tags issued from CDDB, CUE, tracktype.org or set by the user with mp3splt_append_tags.
char * mp3splt_get_strerror(splt_state *state, splt_code error)
Returns the error message of the error.
splt_code mp3splt_find_plugins(splt_state *state)
Finds the plugins in the plugins directories.
splt_code mp3splt_write_freedb_file_result(splt_state *state, int disc_id, const char *output_file, int cddb_get_type, const char *cddb_get_server, int port)
Downloads the CDDB file of the disc_id and writes it to a file.
splt_code mp3splt_set_silence_log_filename(splt_state *state, const char *filename)
Log filename for the SPLT_OPTION_SILENCE_MODE split mode that will be created.
float version
Plugin version.
char * mp3splt_encode_in_base64(splt_state *state, const char *input, int *error)
Encode the input in base64.
const splt_one_wrap * mp3splt_wrap_next(splt_wrap *wrap)
Returns the next wrapped file from the wrap.
Keep the input "as is" without further change.
char * upper_extension
File extension handled by the plugin as uppercase.
Number of files to be created when splitting by equal time length with SPLT_OPTION_LENGTH_MODE.
splt_code mp3splt_set_message_function(splt_state *state, void(*message_cb)(const char *message, splt_message_type type, void *cb_data), void *cb_data)
Register callback function used to send text messages to the client.
splt_code mp3splt_use_proxy(splt_state *state, const char *proxy_address, int proxy_port)
Use proxy when accessing the internet.
The default output; depends of the type of the split.
UTF-16 encoding for ID3v2 tags.
float mp3splt_progress_get_silence_db_level(const splt_progress *p_bar)
int mp3splt_progress_get_max_splits(const splt_progress *p_bar)
struct _splt_point splt_point
Structure defining one splitpoint.
Convert all characters of the input to uppercase.
The time to auto-adjust before and after splitpoint when having the SPLT_OPT_AUTO_ADJUST option...
struct splt_progres splt_progress
Structure containing all information needed to display a progress bar.
Minimum number of silence seconds to be considered a valid splitpoint.
splt_output_filenames_options
Values for the SPLT_OPT_OUTPUT_FILENAMES option.
Output or not a message that the CUE file has been created.
Defines the encoding of the input tags - used only for generating ID3V2 tags.
Trim silence detection split mode.
splt_code mp3splt_use_base64_authentification(splt_state *state, const char *base64_authentification)
Use proxy with base64 authentification.
splt_code mp3splt_free_state(splt_state *state)
Free the memory of the state.
Splitpoint used only to end the previous segment.
splt_points * mp3splt_get_splitpoints(splt_state *state, splt_code *error)
Returns all the splitpoints of the state.
int mp3splt_progress_get_silence_found_tracks(const splt_progress *p_bar)
Normal split mode - using splitpoints provided with mp3splt_append_splitpoint.
Replace underscores with space when setting tags from filename regex with SPLT_TAGS_FROM_FILENAME_REG...
Output format of the artist extracted from filename when using SPLT_TAGS_FROM_FILENAME_REGEX.
If SPLT_TRUE, stop with error when no auto-adjust silence is found when using the SPLT_OPT_AUTO_ADJUS...
int mp3splt_freedb_get_id(const splt_freedb_one_result *result)
Returns the ID of the result.
int mp3splt_freedb_get_number_of_revisions(const splt_freedb_one_result *result)
Returns the number of revisions of the result.
Wrap split mode - split the files created with mp3wrap or albumwrap.
Convert the first character of each word to uppercase.
splt_code mp3splt_set_silence_level_function(splt_state *state, void(*get_silence_cb)(long time, float level, void *user_data), void *user_data)
Register callback function that is called when looking for silence detection.
const splt_point * mp3splt_points_next(splt_points *splitpoints)
Returns the next splitpoint from the splitpoints.
splt_code mp3splt_set_split_filename_function(splt_state *state, void(*file_cb)(const char *filename, void *cb_data), void *cb_data)
Register callback function that is called when an output file is created.
int mp3splt_set_silence_points(splt_state *state, splt_code *error)
Scan for silence and set silence splitpoints in the state.
splt_export_type
Type of the export.
Synchronisation error split mode (mp3 only).
splt_code mp3splt_append_plugins_scan_dir(splt_state *state, const char *directory)
Appends an additional directory where plugins are searched.
Defines the encoding of the ID3V2 tags.
UTF-8 encoding for ID3v2 tags.
Minimum number of seconds to be considered a valid track.
If we return debug messages or not.
Output format of the comment extracted from filename when using SPLT_TAGS_FROM_FILENAME_REGEX.
Enables or disables replacing tags in tags.
Defines how the output filenames are created.
For mp3 files, if we write the Xing header.
splt_point * mp3splt_point_new(long splitpoint_value, splt_code *error)
Creates a new splitpoint with the splitpoint_value.
char * mp3splt_get_version()
Returns the version of libmp3splt.
splt_code mp3splt_set_filename_to_split(splt_state *state, const char *filename)
Sets the input filename to split.
splt_code mp3splt_split(splt_state *state)
Executes the main split process.
splt_split_mode_options
Split mode.
char * mp3splt_progress_get_filename_shorted(const splt_progress *p_bar)
struct _splt_points splt_points
Structure containing several splt_point.
The desired number of shots when having a SPLT_OPTION_SILENCE_MODE or SPLT_OPTION_TRIM_SILENCE_MODE s...
Create an indefinite number of smaller files with a fixed time length specified by SPLT_OPT_SPLIT_TIM...
char * mp3splt_point_get_name(const splt_point *point)
Returns the name of the splitpoint point.
char * extension
File extension handled by the plugin.
Searching for synchronisation errors - when using SPLT_OPTION_ERROR_MODE.
splt_message_type
Type of the message sent to the client.
The threshold level (dB) to be considered as silence.
Silence detection split mode.
splt_progress_messages
Type of messages sent to the client using the callback registered with mp3splt_set_progress_function...
float mp3splt_get_float_option(splt_state *state, splt_options option, splt_code *error)
Returns the value of a float option from the state.
Keep the tags of the original input file.
When importing a cue file, use the REM NAME comment for each TRACK to set the splitpoint names instea...
When adding cue or cddb tags, keep the option SPLT_TAGS_ORIGINAL.
void mp3splt_points_init_iterator(splt_points *splitpoints)
Initialisation of the iterator for use with mp3splt_points_next.
const char * mp3splt_freedb_get_name(const splt_freedb_one_result *result)
Returns the name of the result.
splt_code mp3splt_set_oformat(splt_state *state, const char *format)
Set the output format when using SPLT_OUTPUT_FORMAT.
int mp3splt_check_if_directory(const char *filename)
Returns SPLT_TRUE if filename is a directory.
splt_code mp3splt_append_splitpoint(splt_state *state, splt_point *splitpoint)
Append a new splitpoint to the state.
splt_tags_options
Values for the SPLT_OPT_TAGS option.
The desired number of tracks when having a SPLT_OPTION_SILENCE_MODE split.
Offset of cutpoint inside the silence part when having a SPLT_OPTION_SILENCE_MODE or SPLT_OPT_AUTO_AD...
For mp3 files, force to use the frame mode or not.
float mp3splt_progress_get_percent_progress(const splt_progress *p_bar)
splt_code mp3splt_set_float_option(splt_state *state, splt_options option, float value)
Sets the value of a float option in the state.
splt_options
Split options.
If quiet return less messages and don't do mp3 CRC check.
splt_wrap * mp3splt_get_wrap_files(splt_state *state, splt_code *error)
Returns the wrapped files found from the input filename set with mp3splt_set_filename_to_split.
If SPLT_TRUE, decode flac frames before writing them in the output file and compute the md5sum to be ...
splt_code mp3splt_set_silence_full_log_filename(splt_state *state, const char *filename)
Full log filename for the SPLT_OPTION_SILENCE_MODE split mode that will be created.
For mp3 files, tags version to be written in output files.
splt_code mp3splt_import(splt_state *state, splt_import_type type, const char *file)
Import splitpoints from the file having the type into the state.
Output format of the title extracted from filename when using SPLT_TAGS_FROM_FILENAME_REGEX.
char * mp3splt_wrap_get_wrapped_file(const splt_one_wrap *one_wrap)
Returns the wrapped file from one_wrap.
long mp3splt_point_get_value(const splt_point *point)
Returns the time value of the splitpoint point.
splt_import_type
Type of the import.
const char * mp3splt_get_filename_to_split(splt_state *state)
Returns the filename to be split from the state.
struct _splt_freedb_results splt_freedb_results
Structure containing the freedb search results.
struct _splt_original_tags splt_original_tags
Structure containing the original tags of the input file.
If this option is SPLT_TRUE, we create directories from the output filenames without parsing for ille...
splt_freedb_results * mp3splt_get_freedb_search(splt_state *state, const char *searched_string, splt_code *error, int search_type, const char *search_server, int port)
Search on the internet for the searched_string and returns the results.
When using the SPLT_OPT_PARAM_REMOVE_SILENCE, this option allows you to keep some number of seconds o...
splt_state * mp3splt_new_state(splt_code *error)
Creates a new splt_state structure.
If we use silence detection to auto-adjust splitpoints.
The names of the splitpoints provided by mp3splt_append_splitpoint are used to generate the output fi...
splt_type_of_splitpoint mp3splt_point_get_type(const splt_point *point)
Returns the type of the splitpoint point.
splt_code mp3splt_set_path_of_split(splt_state *state, const char *path_of_split)
Sets the output directory where the split files will be created.
splt_code mp3splt_point_set_name(splt_point *splitpoint, const char *name)
Sets the name on the splitpoint.
char ** mp3splt_find_filenames(splt_state *state, const char *filename, int *num_of_files_found, splt_code *error)
Recursive search of all the filenames matching the loaded plugins.
int mp3splt_progress_get_type(const splt_progress *p_bar)
splt_code mp3splt_set_progress_function(splt_state *state, void(*progress_cb)(splt_progress *p_bar, void *cb_data), void *cb_data)
Register callback function called to keep track of the current progress.
Creating the output file.
Used to remove silence between the split tracks when having a SPLT_OPTION_SILENCE_MODE split...
Defines the minimum theoretical time length to be created when using SPLT_OPTION_TIME_MODE.
What tags to put in the output split files.
struct _splt_one_wrap splt_one_wrap
Structure containing one wrapped file All members are private.
struct _splt_freedb_one_result splt_freedb_one_result
Structure containing only one freedb result.
Convert all characters of the input to lowercase.
Convert just the first character to uppercase.
Split in SPLT_OPT_LENGTH_SPLIT_FILE_NUMBER pieces of equal time length.
long mp3splt_get_long_option(splt_state *state, splt_options option, splt_code *error)
Returns the value of a long option from the state.
Preparing to split a song.
splt_code mp3splt_point_set_type(splt_point *splitpoint, splt_type_of_splitpoint type)
Sets the name on the splitpoint.
splt_code mp3splt_set_m3u_filename(splt_state *state, const char *m3u_filename)
Output filename for a M3U file that will be created in the output path.
Latin1 (ISO-8859-1) encoding for ID3v2 tags.
Minimum number of seconds to be considered a valid track.
splt_code mp3splt_erase_all_splitpoints(splt_state *state)
Erase all splitpoints from the state.
Time to be added to each end splitpoint in order to overlap the resulting files (in hundreths of seco...
Time of the output files for the SPLT_OPTION_TIME_MODE split (in hundreths of seconds).
int mp3splt_progress_get_current_split(const splt_progress *p_bar)
If SPLT_TRUE, raise a warning when no auto-adjust silence is found when using the SPLT_OPT_AUTO_ADJUS...
void mp3splt_freedb_init_iterator(splt_freedb_results *freedb_results)
Initialisation of the iterator for use with mp3splt_freedb_next.
When importing CUE files, sets the filename to split as the FILE CUE tag value if specified...
struct _splt_state splt_state
Main structure used in libmp3splt.
If SPLT_TRUE, handles bit-reservoir for gapless playback when splitting.
void mp3splt_clear_proxy(splt_state *state)
Clears the proxy data from the state.
splt_code mp3splt_set_int_option(splt_state *state, splt_options option, int value)
Sets the value of an int option in the state.
splt_code mp3splt_set_long_option(splt_state *state, splt_options option, long value)
Sets the value of a long option in the state.
When using the SPLT_OPT_PARAM_REMOVE_SILENCE, this option allows you to keep some number of seconds o...
void mp3splt_wrap_init_iterator(splt_wrap *wrap)
Initialisation of the iterator for use with mp3splt_wrap_next.
Sets tags from filename using regular expression provided by mp3splt_set_input_filename_regex.
splt_id3v2_encoding
Values for the SPLT_OPT_ID3V2_ENCODING.
splt_code
Confirmation and error codes.
splt_code mp3splt_set_pretend_to_split_write_function(splt_state *state, void(*write_cb)(const void *ptr, size_t size, size_t nmemb, void *cb_data), void *cb_data)
Register callback function that is called when SPLT_OPT_PRETEND_TO_SPLIT is SPLT_TRUE.
splt_type_of_splitpoint
Type of the splitpoint.
splt_code mp3splt_export(splt_state *state, splt_export_type type, const char *file, int stop_at_total_time)
Export splitpoints from the state into the file saved as type.
If the input is not seekable.
Enables or disables writing the log file containing splitpoints found with silence detection...
splt_code mp3splt_set_trim_silence_points(splt_state *state)
Scan for silence and set silence trim splitpoints in the state.
splt_str_format
Values for SPLT_OPT_ARTIST_TAG_FORMAT, SPLT_OPT_ALBUM_TAG_FORMAT, SPLT_OPT_TITLE_TAG_FORMAT and SPLT_...
Output filename format specified by mp3splt_set_oformat.
Scanning for silence - when using SPLT_OPTION_SILENCE_MODE, SPLT_OPT_AUTO_ADJUST, mp3splt_set_silence...
Output format of the album extracted from filename when using SPLT_TAGS_FROM_FILENAME_REGEX.