gmerlin
Typedefs | Functions

Filter chains

Chains of A/V filters. More...

Typedefs

typedef struct
bg_audio_filter_chain_s 
bg_audio_filter_chain_t
 Audio filter chain.
typedef struct
bg_video_filter_chain_s 
bg_video_filter_chain_t
 Video filter chain.

Functions

bg_audio_filter_chain_tbg_audio_filter_chain_create (const bg_gavl_audio_options_t *opt, bg_plugin_registry_t *plugin_reg)
 Create an audio filter chain.
const bg_parameter_info_tbg_audio_filter_chain_get_parameters (bg_audio_filter_chain_t *ch)
 Return parameters.
void bg_audio_filter_chain_set_parameter (void *data, const char *name, const bg_parameter_value_t *val)
 Set a parameter for an audio chain.
int bg_audio_filter_chain_need_restart (bg_audio_filter_chain_t *ch)
 Check if an audio filter chain needs to be restarted.
void bg_audio_filter_chain_connect_input (bg_audio_filter_chain_t *ch, bg_read_audio_func_t func, void *priv, int stream)
 Set input callback of an audio filter chain.
int bg_audio_filter_chain_init (bg_audio_filter_chain_t *ch, const gavl_audio_format_t *in_format, gavl_audio_format_t *out_format)
 Initialize an audio filter chain.
int bg_audio_filter_chain_set_out_format (bg_audio_filter_chain_t *ch, const gavl_audio_format_t *out_format)
 Set output format of an audio filter chain.
int bg_audio_filter_chain_read (void *priv, gavl_audio_frame_t *frame, int stream, int num_samples)
 Read a audio samples from an audio filter chain.
void bg_audio_filter_chain_destroy (bg_audio_filter_chain_t *ch)
 Destroy an audio filter chain.
void bg_audio_filter_chain_lock (void *ch)
 Lock an audio filter chain.
void bg_audio_filter_chain_unlock (void *ch)
 Unlock an audio filter chain.
void bg_audio_filter_chain_reset (bg_audio_filter_chain_t *ch)
 Reset an audio filter chain.
gavl_audio_source_t * bg_audio_filter_chain_connect (bg_audio_filter_chain_t *ch, gavl_audio_source_t *src)
 Connect using audio sources.
bg_video_filter_chain_tbg_video_filter_chain_create (const bg_gavl_video_options_t *opt, bg_plugin_registry_t *plugin_reg)
 Create a video filter chain.
const bg_parameter_info_tbg_video_filter_chain_get_parameters (bg_video_filter_chain_t *ch)
 Return parameters.
void bg_video_filter_chain_set_parameter (void *data, const char *name, const bg_parameter_value_t *val)
 Set a parameter for a video chain.
int bg_video_filter_chain_need_restart (bg_video_filter_chain_t *ch)
 Check if a video filter chain needs to be restarted.
void bg_video_filter_chain_connect_input (bg_video_filter_chain_t *ch, bg_read_video_func_t func, void *priv, int stream)
 Set input callback of a video filter chain.
int bg_video_filter_chain_init (bg_video_filter_chain_t *ch, const gavl_video_format_t *in_format, gavl_video_format_t *out_format)
 Initialize a video filter chain.
int bg_video_filter_chain_set_out_format (bg_video_filter_chain_t *ch, const gavl_video_format_t *out_format)
 Set output format of a video filter chain.
int bg_video_filter_chain_read (void *priv, gavl_video_frame_t *frame, int stream)
 Read a video frame from a video filter chain.
gavl_video_source_t * bg_video_filter_chain_connect (bg_video_filter_chain_t *ch, gavl_video_source_t *src)
 Connect using video sources.
void bg_video_filter_chain_destroy (bg_video_filter_chain_t *ch)
 Destroy a video filter chain.
void bg_video_filter_chain_lock (void *ch)
 Lock a video filter chain.
void bg_video_filter_chain_unlock (void *ch)
 Unlock a video filter chain.
void bg_video_filter_chain_reset (bg_video_filter_chain_t *ch)
 Reset a video filter chain.

Detailed Description

Chains of A/V filters.


Typedef Documentation

typedef struct bg_audio_filter_chain_s bg_audio_filter_chain_t

Audio filter chain.

Opaque handle for an audio filter chain. You don't want to know, what's inside.

typedef struct bg_video_filter_chain_s bg_video_filter_chain_t

Video filter chain.

Opaque handle for a video filter chain. You don't want to know, what's inside.


Function Documentation

bg_audio_filter_chain_t* bg_audio_filter_chain_create ( const bg_gavl_audio_options_t *  opt,
bg_plugin_registry_t plugin_reg 
)

Create an audio filter chain.

Parameters:
optConversion options
plugin_regA plugin registry

The conversion options should be valid for the whole lifetime of the filter chain.

const bg_parameter_info_t* bg_audio_filter_chain_get_parameters ( bg_audio_filter_chain_t ch)

Return parameters.

Parameters:
chAn audio filter chain
Returns:
A NULL terminated array of parameter descriptions

Usually, there will be a parameter of type BG_PARAMETER_MULTI_CHAIN, which includes all installed filters and their respective parameters.

void bg_audio_filter_chain_set_parameter ( void *  data,
const char *  name,
const bg_parameter_value_t val 
)

Set a parameter for an audio chain.

Parameters:
dataAn audio converter as void*
nameName
valValue

In some cases the filter chain must be rebuilt after setting a parameter. The application should therefore call bg_audio_filter_chain_need_restart and call bg_audio_filter_chain_init if necessary.

int bg_audio_filter_chain_need_restart ( bg_audio_filter_chain_t ch)

Check if an audio filter chain needs to be restarted.

Parameters:
chAn audio filter chain
Returns:
1 if the chain must be restarted, 0 else

If this returns true, you should call bg_audio_filter_chain_init. It's usually used after bg_audio_filter_chain_set_parameter.

void bg_audio_filter_chain_connect_input ( bg_audio_filter_chain_t ch,
bg_read_audio_func_t  func,
void *  priv,
int  stream 
)

Set input callback of an audio filter chain.

Parameters:
chAn audio filter chain
funcThe function to call
privThe private handle to pass to func
streamThe stream argument to pass to func

This function must be called *before* bg_audio_filter_chain_init.

int bg_audio_filter_chain_init ( bg_audio_filter_chain_t ch,
const gavl_audio_format_t in_format,
gavl_audio_format_t out_format 
)

Initialize an audio filter chain.

Parameters:
chAn audio filter chain
in_formatInput format
out_formatReturns the output format
int bg_audio_filter_chain_set_out_format ( bg_audio_filter_chain_t ch,
const gavl_audio_format_t out_format 
)

Set output format of an audio filter chain.

Parameters:
chAn audio filter chain
out_formatOutput format
Returns:
The number of conversion steps

This function initializes a final audio converter at the output for delivering the desired format.

int bg_audio_filter_chain_read ( void *  priv,
gavl_audio_frame_t frame,
int  stream,
int  num_samples 
)

Read a audio samples from an audio filter chain.

Parameters:
privAn audio filter chain
frameAn audio frame
streamStream number (must be 0)
num_samplesNumber of samples to read
Returns:
Number of samples read, 0 means EOF.
void bg_audio_filter_chain_destroy ( bg_audio_filter_chain_t ch)

Destroy an audio filter chain.

Parameters:
chAn audio filter chain
void bg_audio_filter_chain_lock ( void *  ch)

Lock an audio filter chain.

Parameters:
chAn audio filter chain

In multithreaded enviroments, you must lock the chain for calls to bg_audio_filter_chain_set_parameter and bg_audio_filter_chain_read.

void bg_audio_filter_chain_unlock ( void *  ch)

Unlock an audio filter chain.

Parameters:
chAn audio filter chain

In multithreaded enviroments, you must lock the chain for calls to bg_audio_filter_chain_set_parameter and bg_audio_filter_chain_read.

void bg_audio_filter_chain_reset ( bg_audio_filter_chain_t ch)

Reset an audio filter chain.

Parameters:
chAn audio filter chain

Set the internal state as if no sample has been processed since last init

gavl_audio_source_t* bg_audio_filter_chain_connect ( bg_audio_filter_chain_t ch,
gavl_audio_source_t *  src 
)

Connect using audio sources.

Parameters:
chA audio filter chain
srcAudio source to get frames from
Returns:
Audio source for reading frames

This is a replacement for bg_audio_filter_chain_connect_input, bg_audio_filter_chain_init and bg_audio_filter_chain_set_out_format

bg_video_filter_chain_t* bg_video_filter_chain_create ( const bg_gavl_video_options_t *  opt,
bg_plugin_registry_t plugin_reg 
)

Create a video filter chain.

Parameters:
optConversion options
plugin_regA plugin registry

The conversion options should be valid for the whole lifetime of the filter chain.

const bg_parameter_info_t* bg_video_filter_chain_get_parameters ( bg_video_filter_chain_t ch)

Return parameters.

Parameters:
chA video filter chain
Returns:
A NULL terminated array of parameter descriptions

Usually, there will be a parameter of type BG_PARAMETER_MULTI_CHAIN, which includes all installed filters and their respective parameters.

void bg_video_filter_chain_set_parameter ( void *  data,
const char *  name,
const bg_parameter_value_t val 
)

Set a parameter for a video chain.

Parameters:
dataA video converter as void*
nameName
valValue

In some cases the filter chain must be rebuilt after setting a parameter. The application should therefore call bg_video_filter_chain_need_restart and call bg_video_filter_chain_init if necessary.

int bg_video_filter_chain_need_restart ( bg_video_filter_chain_t ch)

Check if a video filter chain needs to be restarted.

Parameters:
chA video filter chain
Returns:
1 if the chain must be restarted, 0 else

If this returns true, you should call bg_video_filter_chain_init. It's usually used after bg_video_filter_chain_set_parameter.

void bg_video_filter_chain_connect_input ( bg_video_filter_chain_t ch,
bg_read_video_func_t  func,
void *  priv,
int  stream 
)

Set input callback of a video filter chain.

Parameters:
chA video filter chain
funcThe function to call
privThe private handle to pass to func
streamThe stream argument to pass to func

This function must be called *before* bg_video_filter_chain_init.

int bg_video_filter_chain_init ( bg_video_filter_chain_t ch,
const gavl_video_format_t in_format,
gavl_video_format_t out_format 
)

Initialize a video filter chain.

Parameters:
chA video filter chain
in_formatInput format
out_formatReturns the output format
int bg_video_filter_chain_set_out_format ( bg_video_filter_chain_t ch,
const gavl_video_format_t out_format 
)

Set output format of a video filter chain.

Parameters:
chA video filter chain
out_formatOutput format

This function initializes a final video converter at the output for delivering the desired format.

int bg_video_filter_chain_read ( void *  priv,
gavl_video_frame_t frame,
int  stream 
)

Read a video frame from a video filter chain.

Parameters:
privA video filter chain
frameA video frame
streamStream number (must be 0)
Returns:
1 if a frame was read, 0 means EOF.
gavl_video_source_t* bg_video_filter_chain_connect ( bg_video_filter_chain_t ch,
gavl_video_source_t *  src 
)

Connect using video sources.

Parameters:
chA video filter chain
srcVideo source to get frames from
Returns:
Video source for reading frames

This is a replacement for bg_video_filter_chain_connect_input, bg_video_filter_chain_init and bg_video_filter_chain_set_out_format

void bg_video_filter_chain_destroy ( bg_video_filter_chain_t ch)

Destroy a video filter chain.

Parameters:
chA video filter chain
void bg_video_filter_chain_lock ( void *  ch)

Lock a video filter chain.

Parameters:
chA video filter chain

In multithreaded enviroments, you must lock the chain for calls to bg_video_filter_chain_set_parameter and bg_video_filter_chain_read.

void bg_video_filter_chain_unlock ( void *  ch)

Unlock a video filter chain.

Parameters:
chA video filter chain

In multithreaded enviroments, you must lock the chain for calls to bg_video_filter_chain_set_parameter and bg_video_filter_chain_read.

void bg_video_filter_chain_reset ( bg_video_filter_chain_t ch)

Reset a video filter chain.

Parameters:
chA video filter chain

Set the internal state as if no sample has been processed since last init