A minimal usage example.
A minimal usage example.
#include <stdio.h>
#include <stdlib.h>
static void print_message_from_library(
const char *message,
splt_message_type type,
void *data);
static void print_split_filename(const char *filename, void *data);
int main(int argc, char *argv[])
{
if (argc != 2)
{
fprintf(stderr, "Please provide the input file to be split as the first argument.\n");
fflush(stderr);
return EXIT_FAILURE;
}
print_confirmation_and_exit_if_error(state, error);
print_confirmation_and_exit_if_error(state, error);
return EXIT_SUCCESS;
}
{
if (!message)
{
return;
}
if (error < 0)
{
fprintf(stderr, "%s\n", message);
fflush(stderr);
exit(1);
}
else
{
fprintf(stdout, "%s\n", message);
fflush(stdout);
}
free(message);
}
static void print_message_from_library(
const char *message,
splt_message_type type,
void *data)
{
{
fprintf(stdout, message);
fflush(stdout);
return;
}
fprintf(stderr, message);
fflush(stderr);
}
static void print_split_filename(const char *filename, void *data)
{
fprintf(stdout, " %s created.\n", filename);
fflush(stdout);
}
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.
splt_message_type
Type of the message sent to the client.
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_MESSAGE_INFO
Info message.
char * mp3splt_get_strerror(splt_state *state, splt_code error)
Returns the error message of the error.
splt_code
Confirmation and error codes.
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.
struct _splt_point splt_point
Structure defining one splitpoint.
splt_point * mp3splt_point_new(long splitpoint_value, splt_code *error)
Creates a new splitpoint with the splitpoint_value.
splt_code mp3splt_append_splitpoint(splt_state *state, splt_point *splitpoint)
Append a new splitpoint to the state.
struct _splt_state splt_state
Main structure used in libmp3splt.
splt_code mp3splt_find_plugins(splt_state *state)
Finds the plugins in the plugins directories.
splt_state * mp3splt_new_state(splt_code *error)
Creates a new splt_state structure.
splt_code mp3splt_free_state(splt_state *state)
Free the memory of the state.