splt_plugin_func Struct Reference
[Creating libmp3splt plugins]

Libmp3splt plugin API. More...

#include <mp3splt.h>

Data Fields

void(* splt_pl_init )(splt_state *state, splt_code *error)
void(* splt_pl_end )(splt_state *state, splt_code *error)
int(* splt_pl_check_plugin_is_for_file )(splt_state *state, splt_code *error)
void(* splt_pl_set_plugin_info )(splt_plugin_info *information, splt_code *error)
double(* splt_pl_split )(splt_state *state, const char *final_fname, double begin_point, double end_point, splt_code *error, int save_end_point)
void(* splt_pl_set_original_tags )(splt_state *state, splt_code *error)
void(* splt_pl_clear_original_tags )(splt_original_tags *original_tags)
int(* splt_pl_scan_silence )(splt_state *state, splt_code *error)
int(* splt_pl_scan_trim_silence )(splt_state *state, splt_code *error)
void(* splt_pl_search_syncerrors )(splt_state *state, splt_code *error)
int(* splt_pl_offset_split )(splt_state *state, const char *output_fname, off_t begin, off_t end)
void(* splt_pl_dewrap )(splt_state *state, int listonly, const char *dir, splt_code *error)

Detailed Description

Libmp3splt plugin API.

Warning:
Because only mp3 and ogg plugins exist and are integrated with the library, the plugin API might change.

In order to create a plugin for libmp3splt, the following functions can be implemented.
Mandatory functions are splt_pl_init, splt_pl_end, splt_pl_check_plugin_is_for_file, splt_pl_set_plugin_info and splt_pl_split.

Two examples can be found for the mp3 and ogg implementations.

Definition at line 2123 of file mp3splt.h.


Field Documentation

Initialise the plugin.

Mandatory.

Create the plugin data, open the input file and read headers.
Use the state->codec pointer to store the plugin data.

Parameters:
[in] state Main state.
[out] error Fill in possible error.

Unitialise the plugin.

Mandatory.

Close the input file, free the plugin data.

Parameters:
[in] state Main state.
[out] error Fill in possible error.

Checks if the plugin matches the input file.

Mandatory.

If stdin is supported, don't forget to check if the input filename is stdin.

Parameters:
[in] state Main state.
[out] error Fill in possible error.
Returns:
SPLT_TRUE if the plugin matches the input file.

Set plugin information into the information structure.

Mandatory.

Information like the plugin version, plugin name and file extension must be filled.

Parameters:
[in] splt_plugin_info Plugin information to be filled. Parameter is already allocated.
[out] error Fill in possible error.
double(* splt_plugin_func::splt_pl_split)(splt_state *state, const char *final_fname, double begin_point, double end_point, splt_code *error, int save_end_point)

Main split function.

Mandatory.

Parameters:
[in] state Main state.
[in] final_fname Output filename to be written for this split.
[in] begin_point Begin point where the split starts as seconds.hundreths.
[in] end_point End point where the split ends as seconds.hundreths.
[out] error Fill in possible error.
[in] save_end_point Is equal to SPLT_TRUE if optimisation can be done for saving the end point seek for the next call to this function. This avoids looking for the next begin point seek since it will be equal to the previous saved end point seek.
Returns:
The real end point split; in most cases, it is equal to the end_point.

Set the original tags into the state from the input file.

splt_tu_set_original_tags_field has to be used to set the original tags.
You can also save all the original tags in the state using splt_tu_set_original_tags_data, in case you want to write them all in the output file, for the tags that are not supported by the library's structure.

Parameters:
[in] state Main state.
[out] error Fill in possible error.

Frees the memory of the tags previously set in the splt_pl_set_original_tags function.

Free the original_tags->all_original_tags data previously set with splt_tu_set_original_tags_data.

Parameters:
[in] original_tags Original tags structure containing the original tags data to be freed.

Scan the input file for silence.

The input file has to be scanned for silence and for each time/audio level, a generic silence processor will be called.
The processor handles the mp3splt silence detection logic.

Parameters:
[in] state Main state.
[out] error Fill in possible error.
Returns:
The number of silence spots found.

Scan the input file for trimming using silence detection.

The implementation of this function is straight forward after implementing splt_pl_scan_silence, since the silence detection is the same.
Only the generic silence processor changes.

Parameters:
[in] state Main state.
[out] error Fill in possible error.
Returns:
The number of silence spots found.

Search for synchronisation errors.

Currently only mp3 supports synchronisation errors split.

Parameters:
[in] state Main state.
[out] error Fill in possible error.
int(* splt_plugin_func::splt_pl_offset_split)(splt_state *state, const char *output_fname, off_t begin, off_t end)

Split the input filename by offsets.

Currently only used when splitting mp3 files using the synchronisation error mode.

Parameters:
[in] state Main state.
[in] output_fname Output filename.
[in] begin Begin offset of the portion to be split.
[in] end End offset of the portion to be split.
Returns:
Possible error.
void(* splt_plugin_func::splt_pl_dewrap)(splt_state *state, int listonly, const char *dir, splt_code *error)

Unwrap the input file into the directory dir.

Currently only mp3 supports wrapped files.

Parameters:
[in] state Main state.
[in] listonly If equal to SPLT_TRUE, then the wrapped files found are stored in the state without actually splitting.
[in] dir Output directory where the wrapped files have to be stored.
[out] error Fill in possible error.

The documentation for this struct was generated from the following file: