gmerlin
Data Fields
bg_encoder_plugin_s Struct Reference

Encoder plugin. More...

#include <plugin.h>

Data Fields

bg_plugin_common_t common
 Infos and functions common to all plugin types.
int max_audio_streams
 Maximum number of audio streams. -1 means infinite.
int max_video_streams
 Maximum number of video streams. -1 means infinite.
int max_subtitle_text_streams
 Maximum number of text subtitle streams. -1 means infinite.
int max_subtitle_overlay_streams
 Maximum number of overlay subtitle streams. -1 means infinite.
void(* set_callbacks )(void *priv, bg_encoder_callbacks_t *cb)
 Set callbacks.
int(* writes_compressed_audio )(void *priv, const gavl_audio_format_t *format, const gavl_compression_info_t *info)
 Query for writing compressed audio packets.
int(* writes_compressed_video )(void *priv, const gavl_video_format_t *format, const gavl_compression_info_t *info)
 Query for writing compressed video packets.
int(* open )(void *data, const char *filename, const gavl_metadata_t *metadata, const bg_chapter_list_t *chapter_list)
 Open a file.
const bg_parameter_info_t *(* get_audio_parameters )(void *priv)
 Get audio related parameters.
const bg_parameter_info_t *(* get_video_parameters )(void *priv)
 Get video related parameters.
const bg_parameter_info_t *(* get_subtitle_text_parameters )(void *priv)
 Get text subtitle related parameters.
const bg_parameter_info_t *(* get_subtitle_overlay_parameters )(void *priv)
 Get overlay subtitle related parameters.
int(* add_audio_stream )(void *priv, const gavl_metadata_t *m, const gavl_audio_format_t *format)
 Add an audio stream.
int(* add_audio_stream_compressed )(void *priv, const gavl_metadata_t *m, const gavl_audio_format_t *format, const gavl_compression_info_t *info)
 Add an audio stream fpr compressed writing.
int(* add_video_stream )(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format)
 Add a video stream.
int(* add_video_stream_compressed )(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format, const gavl_compression_info_t *info)
 Add a video stream for compressed writing.
int(* add_subtitle_text_stream )(void *priv, const gavl_metadata_t *m, int *timescale)
 Add a text subtitle stream.
int(* add_subtitle_overlay_stream )(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format)
 Add a text subtitle stream.
void(* set_audio_parameter )(void *priv, int stream, const char *name, const bg_parameter_value_t *v)
 Set audio encoding parameter.
void(* set_video_parameter )(void *priv, int stream, const char *name, const bg_parameter_value_t *v)
 Set video encoding parameter.
void(* set_subtitle_text_parameter )(void *priv, int stream, const char *name, const bg_parameter_value_t *v)
 Set text subtitle encoding parameter.
void(* set_subtitle_overlay_parameter )(void *priv, int stream, const char *name, const bg_parameter_value_t *v)
 Set text subtitle encoding parameter.
int(* set_video_pass )(void *priv, int stream, int pass, int total_passes, const char *stats_file)
 Setup multipass video encoding.
int(* start )(void *priv)
 Set up all codecs and prepare for encoding.
void(* get_audio_format )(void *priv, int stream, gavl_audio_format_t *ret)
 Get audio format.
void(* get_video_format )(void *priv, int stream, gavl_video_format_t *ret)
 Get video format.
void(* get_subtitle_overlay_format )(void *priv, int stream, gavl_video_format_t *ret)
 Get video format of an overlay subtitle stream.
int(* write_audio_frame )(void *data, gavl_audio_frame_t *frame, int stream)
 Write audio samples.
int(* write_audio_packet )(void *data, gavl_packet_t *packet, int stream)
 Write audio packet.
int(* write_video_frame )(void *data, gavl_video_frame_t *frame, int stream)
 Write video frame.
int(* write_video_packet )(void *data, gavl_packet_t *packet, int stream)
 Write video packet.
int(* write_subtitle_text )(void *data, const char *text, int64_t start, int64_t duration, int stream)
 Write a text subtitle.
int(* write_subtitle_overlay )(void *data, gavl_overlay_t *ovl, int stream)
 Write an overlay subtitle.
void(* update_metadata )(void *data, const char *name, const gavl_metadata_t *m)
 Update metadata.
int(* close )(void *data, int do_delete)
 Close encoder.

Detailed Description

Encoder plugin.


Field Documentation

bg_plugin_common_t bg_encoder_plugin_s::common

Infos and functions common to all plugin types.

int bg_encoder_plugin_s::max_audio_streams

Maximum number of audio streams. -1 means infinite.

int bg_encoder_plugin_s::max_video_streams

Maximum number of video streams. -1 means infinite.

int bg_encoder_plugin_s::max_subtitle_text_streams

Maximum number of text subtitle streams. -1 means infinite.

int bg_encoder_plugin_s::max_subtitle_overlay_streams

Maximum number of overlay subtitle streams. -1 means infinite.

void(* bg_encoder_plugin_s::set_callbacks)(void *priv, bg_encoder_callbacks_t *cb)

Set callbacks.

Parameters:
privThe handle returned by the create() method
cbCallback structure
int(* bg_encoder_plugin_s::writes_compressed_audio)(void *priv, const gavl_audio_format_t *format, const gavl_compression_info_t *info)

Query for writing compressed audio packets.

Parameters:
privThe handle returned by the create() method
formatFormat of the source
infoCompression info
Returns:
1 if stream compressed format can be written, 0 else

Call this function after all global parameters are set.

int(* bg_encoder_plugin_s::writes_compressed_video)(void *priv, const gavl_video_format_t *format, const gavl_compression_info_t *info)

Query for writing compressed video packets.

Parameters:
privThe handle returned by the create() method
formatFormat of the source
infoCompression info
Returns:
1 if stream compressed format can be written, 0 else

Call this function after all global parameters are set.

int(* bg_encoder_plugin_s::open)(void *data, const char *filename, const gavl_metadata_t *metadata, const bg_chapter_list_t *chapter_list)

Open a file.

Parameters:
privThe handle returned by the create() method
filenameName of the file to be opened (without extension!)
metadataMetadata to be written to the file
chapter_listChapter list (optional, can be NULL)

The extension is added automatically by the plugin. To keep track of the written files, use the bg_encoder_callbacks_t.

const bg_parameter_info_t*(* bg_encoder_plugin_s::get_audio_parameters)(void *priv)

Get audio related parameters.

Parameters:
privThe handle returned by the create() method
Returns:
NULL terminated array of parameter descriptions

The returned parameters are owned by the plugin and must not be freed.

const bg_parameter_info_t*(* bg_encoder_plugin_s::get_video_parameters)(void *priv)

Get video related parameters.

Parameters:
privThe handle returned by the create() method
Returns:
NULL terminated array of parameter descriptions

The returned parameters are owned by the plugin and must not be freed.

const bg_parameter_info_t*(* bg_encoder_plugin_s::get_subtitle_text_parameters)(void *priv)

Get text subtitle related parameters.

Parameters:
privThe handle returned by the create() method
Returns:
NULL terminated array of parameter descriptions

The returned parameters are owned by the plugin and must not be freed.

const bg_parameter_info_t*(* bg_encoder_plugin_s::get_subtitle_overlay_parameters)(void *priv)

Get overlay subtitle related parameters.

Parameters:
privThe handle returned by the create() method
Returns:
NULL terminated array of parameter descriptions

The returned parameters are owned by the plugin and must not be freed.

int(* bg_encoder_plugin_s::add_audio_stream)(void *priv, const gavl_metadata_t *m, const gavl_audio_format_t *format)

Add an audio stream.

Parameters:
privThe handle returned by the create() method
languageas ISO 639-2 code (3 characters+'\0') or NULL
formatFormat of the source
Returns:
Index of this stream (starting with 0)

The format might be changed to the nearest format supported by the plugin. Use get_audio_format to get the actual format needed by the plugin, after start() was called.

int(* bg_encoder_plugin_s::add_audio_stream_compressed)(void *priv, const gavl_metadata_t *m, const gavl_audio_format_t *format, const gavl_compression_info_t *info)

Add an audio stream fpr compressed writing.

Parameters:
privThe handle returned by the create() method
languageas ISO 639-2 code (3 characters+'\0') or NULL
formatFormat of the source
infoCompression info of the source
Returns:
Index of this stream (starting with 0)

The format might be changed to the nearest format supported by the plugin. Use get_audio_format to get the actual format needed by the plugin, after start() was called.

int(* bg_encoder_plugin_s::add_video_stream)(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format)

Add a video stream.

Parameters:
privThe handle returned by the create() method
formatFormat of the source
Returns:
Index of this stream (starting with 0)

The format might be changed to the nearest format supported by the plugin. Use get_video_format to get the actual format needed by the plugin, after start() was called.

int(* bg_encoder_plugin_s::add_video_stream_compressed)(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format, const gavl_compression_info_t *info)

Add a video stream for compressed writing.

Parameters:
privThe handle returned by the create() method
formatFormat of the source
infoCompression info of the source
Returns:
Index of this stream (starting with 0)

The format might be changed to the nearest format supported by the plugin. Use get_video_format to get the actual format needed by the plugin, after start() was called.

int(* bg_encoder_plugin_s::add_subtitle_text_stream)(void *priv, const gavl_metadata_t *m, int *timescale)

Add a text subtitle stream.

Parameters:
privThe handle returned by the create() method
languageas ISO 639-2 code (3 characters+'\0') or NULL
Returns:
Index of this stream (starting with 0)
int(* bg_encoder_plugin_s::add_subtitle_overlay_stream)(void *priv, const gavl_metadata_t *m, const gavl_video_format_t *format)

Add a text subtitle stream.

Parameters:
privThe handle returned by the create() method
languageas ISO 639-2 code (3 characters+'\0') or NULL
formatFormat of the source
Returns:
Index of this stream (starting with 0)

The format might be changed to the nearest format supported by the plugin. Use get_subtitle_overlay_format to get the actual format needed by the plugin, after start was called.

void(* bg_encoder_plugin_s::set_audio_parameter)(void *priv, int stream, const char *name, const bg_parameter_value_t *v)

Set audio encoding parameter.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
nameName of the parameter
vValue

Use this function with parameters obtained by get_audio_parameters.

void(* bg_encoder_plugin_s::set_video_parameter)(void *priv, int stream, const char *name, const bg_parameter_value_t *v)

Set video encoding parameter.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
nameName of the parameter
vValue

Use this function with parameters obtained by get_video_parameters.

void(* bg_encoder_plugin_s::set_subtitle_text_parameter)(void *priv, int stream, const char *name, const bg_parameter_value_t *v)

Set text subtitle encoding parameter.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
nameName of the parameter
vValue

Use this function with parameters obtained by get_subtitle_text_parameters.

void(* bg_encoder_plugin_s::set_subtitle_overlay_parameter)(void *priv, int stream, const char *name, const bg_parameter_value_t *v)

Set text subtitle encoding parameter.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
nameName of the parameter
vValue

Use this function with parameters obtained by get_subtitle_overlay_parameters.

int(* bg_encoder_plugin_s::set_video_pass)(void *priv, int stream, int pass, int total_passes, const char *stats_file)

Setup multipass video encoding.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
passNumber of this pass (starting with 1)
total_passesNumber of total passes
stats_fileName of a file, which can be used for multipass statistics
Returns:
0 if multipass transcoding is not supported and can be ommitted, 1 else
int(* bg_encoder_plugin_s::start)(void *priv)

Set up all codecs and prepare for encoding.

Parameters:
privThe handle returned by the create() method
Returns:
0 on error, 1 on success

Optional function for preparing the actual encoding. Applications must check for this function and call it when available.

void(* bg_encoder_plugin_s::get_audio_format)(void *priv, int stream, gavl_audio_format_t *ret)

Get audio format.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
retReturns format

Call this after calling start() if it's defined.

void(* bg_encoder_plugin_s::get_video_format)(void *priv, int stream, gavl_video_format_t *ret)

Get video format.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
retReturns format

Call this after calling start() if it's defined.

void(* bg_encoder_plugin_s::get_subtitle_overlay_format)(void *priv, int stream, gavl_video_format_t *ret)

Get video format of an overlay subtitle stream.

Parameters:
privThe handle returned by the create() method
streamStream index (starting with 0)
retReturns format

Call this after calling start() if it's defined.

int(* bg_encoder_plugin_s::write_audio_frame)(void *data, gavl_audio_frame_t *frame, int stream)

Write audio samples.

Parameters:
privThe handle returned by the create() method
frameFrame with samples
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else

The actual number of samples must be stored in the valid_samples member of the frame.

int(* bg_encoder_plugin_s::write_audio_packet)(void *data, gavl_packet_t *packet, int stream)

Write audio packet.

Parameters:
privThe handle returned by the create() method
packetPacket with compressed data
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else

The actual number of samples must be stored in the duration member of the packet.

int(* bg_encoder_plugin_s::write_video_frame)(void *data, gavl_video_frame_t *frame, int stream)

Write video frame.

Parameters:
privThe handle returned by the create() method
frameFrame
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else
int(* bg_encoder_plugin_s::write_video_packet)(void *data, gavl_packet_t *packet, int stream)

Write video packet.

Parameters:
privThe handle returned by the create() method
packetPacket with compressed data
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else
int(* bg_encoder_plugin_s::write_subtitle_text)(void *data, const char *text, int64_t start, int64_t duration, int stream)

Write a text subtitle.

Parameters:
privThe handle returned by the create() method
frameThe text
startStart of the subtitle
durationDuration of the subtitle
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else
int(* bg_encoder_plugin_s::write_subtitle_overlay)(void *data, gavl_overlay_t *ovl, int stream)

Write an overlay subtitle.

Parameters:
privThe handle returned by the create() method
ovlAn overlay
streamStream index (starting with 0)
Returns:
1 is the data was successfully written, 0 else
void(* bg_encoder_plugin_s::update_metadata)(void *data, const char *name, const gavl_metadata_t *m)

Update metadata.

Parameters:
dataThe data member of this bg_input_callbacks_s struct
nameName
mMetadata

Update metadata for broadcasting plugins. Either name or m can be NULL.

int(* bg_encoder_plugin_s::close)(void *data, int do_delete)

Close encoder.

Parameters:
privThe handle returned by the create() method
do_deleteSet this to 1 to delete all created files
Returns:
1 is the file was sucessfully closed, 0 else

After calling this function, the plugin should be destroyed.


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