libmp3splt
The API of libmp3splt

Functions

int mp3splt_append_plugins_scan_dir (splt_state *state, char *dir)
int mp3splt_append_splitpoint (splt_state *state, long split_value, const char *name, int type)
int mp3splt_append_tags (splt_state *state, const char *title, const char *artist, const char *album, const char *performer, const char *year, const char *comment, int track, const char *genre)
int mp3splt_count_silence_points (splt_state *state, int *error)
void mp3splt_erase_all_splitpoints (splt_state *state, int *error)
void mp3splt_erase_all_tags (splt_state *state, int *error)
void mp3splt_export_to_cue (splt_state *state, const char *out_file, short stop_at_total_time, int *error)
char ** mp3splt_find_filenames (splt_state *state, const char *filename, int *num_of_files_found, int *error)
int mp3splt_find_plugins (splt_state *state)
void mp3splt_free_state (splt_state *state, int *error)
char * mp3splt_get_filename_to_split (splt_state *state)
float mp3splt_get_float_option (splt_state *state, int option_name, int *error)
const splt_freedb_resultsmp3splt_get_freedb_search (splt_state *state, const char *search_string, int *error, int search_type, const char search_server[256], int port)
int mp3splt_get_int_option (splt_state *state, int option_name, int *error)
long mp3splt_get_long_option (splt_state *state, int option_name, int *error)
const splt_pointmp3splt_get_splitpoints (splt_state *state, int *splitpoints_number, int *error)
char * mp3splt_get_strerror (splt_state *state, int error_code)
const splt_syncerrorsmp3splt_get_syncerrors (splt_state *state, int *error)
const splt_tagsmp3splt_get_tags (splt_state *state, int *tags_number, int *error)
void mp3splt_get_version (char *version)
const splt_wrapmp3splt_get_wrap_files (splt_state *state, int *error)
splt_statemp3splt_new_state (int *error)
void mp3splt_put_audacity_labels_splitpoints_from_file (splt_state *state, const char *file, int *error)
void mp3splt_put_cddb_splitpoints_from_file (splt_state *state, const char *file, int *error)
void mp3splt_put_cue_splitpoints_from_file (splt_state *state, const char *file, int *error)
int mp3splt_put_tags_from_string (splt_state *state, const char *tags, int *error)
int mp3splt_set_default_comment_tag (splt_state *state, const char *default_comment)
int mp3splt_set_default_genre_tag (splt_state *state, const char *default_genre_tag)
int mp3splt_set_filename_to_split (splt_state *state, const char *filename)
int mp3splt_set_float_option (splt_state *state, int option_name, float value)
int mp3splt_set_input_filename_regex (splt_state *state, const char *regex)
int mp3splt_set_int_option (splt_state *state, int option_name, int value)
int mp3splt_set_long_option (splt_state *state, int option_name, long value)
int mp3splt_set_m3u_filename (splt_state *state, const char *filename)
int mp3splt_set_message_function (splt_state *state, void(*message_cb)(const char *, splt_message_type))
void mp3splt_set_oformat (splt_state *state, const char *format_string, int *error)
int mp3splt_set_path_of_split (splt_state *state, const char *path)
int mp3splt_set_progress_function (splt_state *state, void(*progress_cb)(splt_progress *p_bar))
int mp3splt_set_silence_level_function (splt_state *state, void(*get_silence_cb)(long time, float level, void *user_data), void *data)
int mp3splt_set_silence_log_filename (splt_state *state, const char *filename)
int mp3splt_set_silence_points (splt_state *state, int *error)
int mp3splt_set_split_filename_function (splt_state *state, void(*file_cb)(const char *, int b))
int mp3splt_split (splt_state *state)
void mp3splt_stop_split (splt_state *state, int *error)
void mp3splt_write_freedb_file_result (splt_state *state, int disc_id, const char *cddb_file, int *error, int cddb_get_type, const char cddb_get_server[256], int port)

Detailed Description

This group contains all functions of libmp3splt that are meant to be accessed by the user.


Function Documentation

int mp3splt_append_plugins_scan_dir ( splt_state state,
char *  dir 
)

Tell where to scan for plug-ins.

Parameters:
stateThe splt_state The central structure containing all data for our library
Returns:
The error code in case that anything goes wrong, else SPLT_OK

Definition at line 1550 of file mp3splt.c.

int mp3splt_append_splitpoint ( splt_state state,
long  split_value,
const char *  name,
int  type 
)

puts a splitpoint in the state

Sets a new splitpoint.

Parameters:
stateThe central data structure this library keeps all its data in
nameThe file name if we want to set it, else NULL
split_valueThe time of this splitpoint in hundreths of seconds. If this walue is LONG_MAX we put the splitpoint to the end of the song (EOF)

Definition at line 494 of file mp3splt.c.

int mp3splt_append_tags ( splt_state state,
const char *  title,
const char *  artist,
const char *  album,
const char *  performer,
const char *  year,
const char *  comment,
int  track,
const char *  genre 
)

append tags

Definition at line 583 of file mp3splt.c.

int mp3splt_count_silence_points ( splt_state state,
int *  error 
)

count how many silence splitpoints silence detection results in

Definition at line 1516 of file mp3splt.c.

References mp3splt_set_silence_points().

Here is the call graph for this function:

void mp3splt_erase_all_splitpoints ( splt_state state,
int *  error 
)

erase all the splitpoints

erase all splitpoints

Parameters:
stateThe structure this library keeps all its data in
errorIs set to the error code if any error occours

Definition at line 552 of file mp3splt.c.

void mp3splt_erase_all_tags ( splt_state state,
int *  error 
)

erase all the tags

Definition at line 666 of file mp3splt.c.

void mp3splt_export_to_cue ( splt_state state,
const char *  out_file,
short  stop_at_total_time,
int *  error 
)

Export our split points to a cue file.

Parameters:
out_fileThe name of the file to output the split points to
stateThe splt_state structure containing the split points
errorContains the error code if anything goes wrong
stop_at_total_timeIf this parameter is !=0 we don't output splitpoints that lie beyond the end of the audio data. Note that the last splitpoint can be slightly beyond the calculated end of audio data.

Definition at line 1293 of file mp3splt.c.

References splt_cue_export_to_file().

Here is the call graph for this function:

char** mp3splt_find_filenames ( splt_state state,
const char *  filename,
int *  num_of_files_found,
int *  error 
)

TODO: What does this function do.

Parameters:
stateThe splt_state The central structure containing all data for our library
num_of_files_foundThe number of files this library has found
errorThe error code
Attention:
The resulting string is malloc'ed and must be freed by the caller after use.
Todo:
What does this function do?

Definition at line 1581 of file mp3splt.c.

int mp3splt_find_plugins ( splt_state state)

find plugins and initialise them

Returns:
The error code if necessary

Definition at line 130 of file mp3splt.c.

void mp3splt_free_state ( splt_state state,
int *  error 
)

this function frees all variables malloc'ed by the library

call this function ONLY at the end of the program and don't forget to call it.

Parameters:
errorThe code of any error that might have occoured
statethe splt_state structure that keeps all data for our library

Definition at line 144 of file mp3splt.c.

Reads out the name of the file that is about to be split.

Reads out the path to the input file.

Definition at line 266 of file mp3splt.c.

References splt_t_get_filename_to_split().

Here is the call graph for this function:

const splt_freedb_results* mp3splt_get_freedb_search ( splt_state state,
const char *  search_string,
int *  error,
int  search_type,
const char  search_server[256],
int  port 
)

Do a freedb search.

After dong the search continue by calling mp3splt_write_freedb_file_result().

Parameters:
stateThe central structure this library keeps all its data in
search_stringThe string that is to be searched for
errorThe error code this action returns in
search_typethe type of the search. Usually set to SPLT_SEARCH_TYPE_FREEDB2
search_serverThe URL of the search server or NULL to select the default
portThe port on the server. -1 means default (Which should be 80).

Definition at line 1155 of file mp3splt.c.

References splt_state::fdb, and splt_freedb_process_search().

Here is the call graph for this function:

const splt_point* mp3splt_get_splitpoints ( splt_state state,
int *  splitpoints_number,
int *  error 
)

returns a list containing all the splitpoints

returns a pointer to a list of all splitpoints

Parameters:
stateThe structure this library keeps all its data in
splitpoints_numberWill be set to the number of splitpoints by this function
errorIs set to the error code if any error occours

Definition at line 529 of file mp3splt.c.

char* mp3splt_get_strerror ( splt_state state,
int  error_code 
)

Returns the error string that matches an error code.

Parameters:
stateThe splt_state The central structure containing all data for our library
errorThe error code
Attention:
The resulting string is malloc'ed and must be freed by the caller after use.

Definition at line 1539 of file mp3splt.c.

const splt_syncerrors* mp3splt_get_syncerrors ( splt_state state,
int *  error 
)

Determines if syncerrors are found.

Parameters:
stateThe splt_state structure containing the split points
errorThe error code

Definition at line 1358 of file mp3splt.c.

References splt_state::serrors.

const splt_tags* mp3splt_get_tags ( splt_state state,
int *  tags_number,
int *  error 
)

returns a list containing all the tags

Definition at line 616 of file mp3splt.c.

void mp3splt_get_version ( char *  version)

returns libmp3splt version, max 20 chars

Definition at line 1524 of file mp3splt.c.

References SPLT_PACKAGE_VERSION.

const splt_wrap* mp3splt_get_wrap_files ( splt_state state,
int *  error 
)

Split a file that has been generated by mp3wrap.

Parameters:
stateThe splt_state structure containing the split points
errorThe error code

Definition at line 1417 of file mp3splt.c.

References SPLT_OPT_SPLIT_MODE, SPLT_OPTION_WRAP_MODE, SPLT_TRUE, and splt_state::wrap.

splt_state* mp3splt_new_state ( int *  error)

Initialisation.

Initialisation and free.

creates and returns the new central splt_state structure this library keeps all its data in.

The next step after initialization is to do a mp3splt_find_plugins() to find any plugins;

At the end of the program all data we allocate here is freed by calling mp3splt_free_state()

Parameters:
errorContains the error code if an error occours.

Definition at line 98 of file mp3splt.c.

void mp3splt_put_audacity_labels_splitpoints_from_file ( splt_state state,
const char *  file,
int *  error 
)

get the splitpoints from a audacity splitpoint file

Parameters:
stateThe central structure that keeps all data this library uses
fileThe name of the input file
errorIs set to the error code this action results in

Definition at line 1110 of file mp3splt.c.

void mp3splt_put_cddb_splitpoints_from_file ( splt_state state,
const char *  file,
int *  error 
)

get the cddb splitpoints from the file

Parameters:
stateThe central structure that keeps all data this library uses
fileThe name of the input file
errorIs set to the error code this action results in

Definition at line 1075 of file mp3splt.c.

void mp3splt_put_cue_splitpoints_from_file ( splt_state state,
const char *  file,
int *  error 
)

Fetch the splitpoints from a cue file.

Parameters:
stateThe central structure that keeps all data this library uses
fileThe name of the input file
errorIs set to the error code this action results in

Definition at line 1040 of file mp3splt.c.

References splt_cue_put_splitpoints().

Here is the call graph for this function:

int mp3splt_put_tags_from_string ( splt_state state,
const char *  tags,
int *  error 
)

puts tags from a string

Definition at line 635 of file mp3splt.c.

References SPLT_FALSE.

int mp3splt_set_filename_to_split ( splt_state state,
const char *  filename 
)

Sets the name of the file that is about to be split.

Sets path to the input file.

Parameters:
stateThe central data structure this library keeps its data in
filenameThe filename we want to save in state

Definition at line 276 of file mp3splt.c.

References splt_t_set_filename_to_split().

Here is the call graph for this function:

int mp3splt_set_input_filename_regex ( splt_state state,
const char *  regex 
)

Defines the regex that will be used for SPLT_TAGS_FROM_FILENAME_REGEX to get out tags.

Example: (?<artist>.*?) _ (?<album>.*?) will extract 'one artist' and 'one album' from 'one artist _ one album',

Definition at line 303 of file mp3splt.c.

int mp3splt_set_m3u_filename ( splt_state state,
const char *  filename 
)

Set the m3u filename.

Parameters:
statethe splt_state structure that keeps all our data
filenameConstains the file name that is to be set

Definition at line 207 of file mp3splt.c.

int mp3splt_set_message_function ( splt_state state,
void(*)(const char *, splt_message_type message_cb 
)

Register the callback that is called for messages to the client.

Register the function that is to be called if we got a text message.

Parameters:
stateThe central structure this library keeps all its data in
message_cbThe callback function
Returns:
The error code if any error occours

Definition at line 394 of file mp3splt.c.

References splt_struct::put_message, and splt_state::split.

void mp3splt_set_oformat ( splt_state state,
const char *  format_string,
int *  error 
)

Sets the output format.

Definition at line 1322 of file mp3splt.c.

References SPLT_FALSE.

int mp3splt_set_path_of_split ( splt_state state,
const char *  path 
)

Set the output path.

splt_filepaths Set filenames and paths

Definition at line 175 of file mp3splt.c.

int mp3splt_set_progress_function ( splt_state state,
void(*)(splt_progress *p_bar)  progress_cb 
)

Register the callback called with progress messages.

Register the progress bar callback.

Parameters:
stateThe central structure this library keeps all its data in
progress_cbThe callback function
Returns:
The error code if any error occours

Definition at line 440 of file mp3splt.c.

References splt_struct::p_bar, splt_progres::progress, and splt_state::split.

int mp3splt_set_silence_level_function ( splt_state state,
void(*)(long time, float level, void *user_data)  get_silence_cb,
void *  data 
)

Register the callback for the function that calculates silence levels.

Parameters:
stateThe central structure this library keeps all its data in
get_silence_cbThe callback function
Returns:
The error code if any error occours

Definition at line 463 of file mp3splt.c.

int mp3splt_set_silence_log_filename ( splt_state state,
const char *  filename 
)

sets the m3u filename

Definition at line 235 of file mp3splt.c.

int mp3splt_set_silence_points ( splt_state state,
int *  error 
)

set the silence splitpoints without actually splitting

Definition at line 1469 of file mp3splt.c.

References SPLT_FALSE, SPLT_OPT_SPLIT_MODE, SPLT_OPTION_SILENCE_MODE, and splt_s_set_silence_splitpoints().

Referenced by mp3splt_count_silence_points().

Here is the call graph for this function:

Here is the caller graph for this function:

int mp3splt_set_split_filename_function ( splt_state state,
void(*)(const char *, int b)  file_cb 
)

Register the callback called with the split filename after split.

Parameters:
stateThe central structure this library keeps all its data in
file_cbThe callback function
Returns:
The error code if any error occours

Definition at line 417 of file mp3splt.c.

References splt_struct::file_split, and splt_state::split.

void mp3splt_stop_split ( splt_state state,
int *  error 
)

cancels the current split

Returns:
The error code if any error occours

Definition at line 1015 of file mp3splt.c.

References SPLT_TRUE.

void mp3splt_write_freedb_file_result ( splt_state state,
int  disc_id,
const char *  cddb_file,
int *  error,
int  cddb_get_type,
const char  cddb_get_server[256],
int  port 
)

returns the content of a cddb file

must only be called {after} running get_freedb_search otherwise, it will fail (seg fault!?)

you need to write the cddb entry to the disk in a cddb file to use it be able to use it

Parameters:
stateThe central structure that keeps all data this library uses
errorIs set to the error code this action results in
disc_idThe freedb disc ID.
cddb_get_typespecifies the type of the get: it can be SPLT_FREEDB_GET_FILE_TYPE_CDDB_CGI (that works for both freedb and freedb2 at the moment - 18_10_06) or SPLT_FREEDB_GET_FILE_TYPE_CDDB (that only work for freedb at the moment - 18_10_06)
Attention:
result is malloc'ed and must be freed by the caller after use.

Definition at line 1220 of file mp3splt.c.

References splt_freedb_get_file(), and SPLT_OPT_PRETEND_TO_SPLIT.

Here is the call graph for this function: