#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) |
Libmp3splt plugin API.
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.
void(* splt_plugin_func::splt_pl_init)(splt_state *state, splt_code *error) |
void(* splt_plugin_func::splt_pl_end)(splt_state *state, splt_code *error) |
int(* splt_plugin_func::splt_pl_check_plugin_is_for_file)(splt_state *state, splt_code *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. @param[in] state Main state. @param[out] error Fill in possible error. @return #SPLT_TRUE if the plugin matches the input file.
void(* splt_plugin_func::splt_pl_set_plugin_info)(splt_plugin_info *information, splt_code *error) |
Set plugin information into the information
structure.
Mandatory.
Information like the plugin version, plugin name and file extension must be filled.\n @param[in] splt_plugin_info Plugin information to be filled. Parameter is already allocated. @param[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.
@param[in] state Main state. @param[in] final_fname Output filename to be written for this split. @param[in] begin_point Begin point where the split starts as seconds.hundreths. @param[in] end_point End point where the split ends as seconds.hundreths. @param[out] error Fill in possible error. @param[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. @return The real end point split; in most cases, it is equal to the \p end_point.
void(* splt_plugin_func::splt_pl_set_original_tags)(splt_state *state, splt_code *error) |
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.
[in] | state | Main state. |
[out] | error | Fill in possible error. |
void(* splt_plugin_func::splt_pl_clear_original_tags)(splt_original_tags *original_tags) |
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
.
[in] | original_tags | Original tags structure containing the original tags data to be freed. |
int(* splt_plugin_func::splt_pl_scan_silence)(splt_state *state, splt_code *error) |
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.
[in] | state | Main state. |
[out] | error | Fill in possible error. |
int(* splt_plugin_func::splt_pl_scan_trim_silence)(splt_state *state, splt_code *error) |
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.
[in] | state | Main state. |
[out] | error | Fill in possible error. |
void(* splt_plugin_func::splt_pl_search_syncerrors)(splt_state *state, splt_code *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.
[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. |
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.
[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. |