gmerlin-avdecoder
Typedefs | Functions
Configuration of a decoder

Typedefs

typedef struct bgav_options_s bgav_options_t
 Opaque option container.
 
typedef void(* bgav_metadata_change_callback) (void *data, const bgav_metadata_t *metadata)
 Enumeration for log levels.
 
typedef void(* bgav_buffer_callback) (void *data, float percentage)
 Function to be called if the input module is buffering data.
 
typedef int(* bgav_user_pass_callback) (void *data, const char *resource, char **username, char **password)
 Function to be called if the input module needs authentication data.
 
typedef void(* bgav_aspect_callback) (void *data, int stream, int pixel_width, int pixel_height)
 Function to be called if a change of the aspect ratio was detected.
 
typedef void(* bgav_index_callback) (void *data, float percentage)
 Function to be called periodically while an index is built.
 

Functions

BGAV_PUBLIC bgav_options_tbgav_get_options (bgav_t *bgav)
 Get the options of a decoder instance.
 
BGAV_PUBLIC bgav_options_tbgav_options_create ()
 Create an options container.
 
BGAV_PUBLIC void bgav_options_destroy (bgav_options_t *opt)
 Destroy option cotainer.
 
BGAV_PUBLIC void bgav_options_copy (bgav_options_t *dst, const bgav_options_t *src)
 Copy options.
 
BGAV_PUBLIC void bgav_options_set_connect_timeout (bgav_options_t *opt, int timeout)
 Set connect timeout.
 
BGAV_PUBLIC void bgav_options_set_read_timeout (bgav_options_t *opt, int timeout)
 Set read timeout.
 
BGAV_PUBLIC void bgav_options_set_rtp_port_base (bgav_options_t *opt, int p)
 Set RTP port pase.
 
BGAV_PUBLIC void bgav_options_set_rtp_try_tcp (bgav_options_t *opt, int enable)
 Try TCP before UDP.
 
BGAV_PUBLIC void bgav_options_set_network_bandwidth (bgav_options_t *opt, int bandwidth)
 Set network bandwidth.
 
BGAV_PUBLIC void bgav_options_set_http_use_proxy (bgav_options_t *opt, int enable)
 Set proxy usage.
 
BGAV_PUBLIC void bgav_options_set_http_proxy_host (bgav_options_t *opt, const char *host)
 Set proxy host.
 
BGAV_PUBLIC void bgav_options_set_http_proxy_port (bgav_options_t *opt, int port)
 Set proxy port.
 
BGAV_PUBLIC void bgav_options_set_http_proxy_auth (bgav_options_t *opt, int enable)
 Enable or disable proxy authentication.
 
BGAV_PUBLIC void bgav_options_set_http_proxy_user (bgav_options_t *opt, const char *user)
 Set proxy username.
 
BGAV_PUBLIC void bgav_options_set_http_proxy_pass (bgav_options_t *opt, const char *pass)
 Set proxy password.
 
BGAV_PUBLIC void bgav_options_set_http_shoutcast_metadata (bgav_options_t *opt, int enable)
 Enable or disable shoutcast metadata streaming.
 
BGAV_PUBLIC void bgav_options_set_ftp_anonymous (bgav_options_t *opt, int enable)
 Enable or disable anonymous ftp login.
 
BGAV_PUBLIC void bgav_options_set_ftp_anonymous_password (bgav_options_t *opt, const char *pass)
 Set anonymous password.
 
BGAV_PUBLIC void bgav_options_set_default_subtitle_encoding (bgav_options_t *opt, const char *encoding)
 Set default subtitle encoding.
 
BGAV_PUBLIC void bgav_options_set_audio_dynrange (bgav_options_t *opt, int audio_dynrange)
 Enable dynamic range control.
 
BGAV_PUBLIC void bgav_options_set_sample_accurate (bgav_options_t *opt, int enable)
 Try to be sample accurate.
 
BGAV_PUBLIC void bgav_options_set_cache_time (bgav_options_t *opt, int t)
 Set the index creation time for caching.
 
BGAV_PUBLIC void bgav_options_set_cache_size (bgav_options_t *opt, int s)
 Set the maximum total size of the index cache.
 
BGAV_PUBLIC void bgav_options_set_seek_subtitles (bgav_options_t *opt, int seek_subtitles)
 Enable external subtitle files.
 
BGAV_PUBLIC void bgav_options_set_pp_level (bgav_options_t *opt, int pp_level)
 Set postprocessing level.
 
BGAV_PUBLIC void bgav_options_set_postprocessing_level (bgav_options_t *opt, float pp_level)
 Set postprocessing level.
 
BGAV_PUBLIC void bgav_options_set_threads (bgav_options_t *opt, int threads)
 Set number of threads.
 
BGAV_PUBLIC void bgav_options_set_dvb_channels_file (bgav_options_t *opt, const char *file)
 Set DVB channels file.
 
BGAV_PUBLIC void bgav_options_set_prefer_ffmpeg_demuxers (bgav_options_t *opt, int prefer)
 Preference of ffmpeg demultiplexers.
 
BGAV_PUBLIC void bgav_options_set_dv_datetime (bgav_options_t *opt, int datetime)
 Exports the date and time as timecode field of DV streams.
 
BGAV_PUBLIC void bgav_options_set_shrink (bgav_options_t *opt, int factor)
 Shrink factor.
 
BGAV_PUBLIC void bgav_options_set_vdpau (bgav_options_t *opt, int vdpau)
 VDPAU acceleration.
 
BGAV_PUBLIC void bgav_options_set_vaapi (bgav_options_t *opt, int vaapi)
 VAAPI acceleration.
 
BGAV_PUBLIC void bgav_options_set_dump_headers (bgav_options_t *opt, int enable)
 Dump file headers.
 
BGAV_PUBLIC void bgav_options_set_dump_indices (bgav_options_t *opt, int enable)
 Dump file indices.
 
BGAV_PUBLIC void bgav_options_set_dump_packets (bgav_options_t *opt, int enable)
 Dump packets.
 
BGAV_PUBLIC void bgav_options_set_metadata_change_callback (bgav_options_t *opt, bgav_metadata_change_callback callback, void *data)
 Set the callback for metadata change events.
 
BGAV_PUBLIC void bgav_options_set_buffer_callback (bgav_options_t *opt, bgav_buffer_callback callback, void *data)
 Set the callback for buffering notification.
 
BGAV_PUBLIC void bgav_options_set_user_pass_callback (bgav_options_t *opt, bgav_user_pass_callback callback, void *data)
 Set the callback for user authentication.
 
BGAV_PUBLIC void bgav_options_set_aspect_callback (bgav_options_t *opt, bgav_aspect_callback callback, void *data)
 Set aspect ratio change callback.
 
BGAV_PUBLIC void bgav_options_set_index_callback (bgav_options_t *opt, bgav_index_callback callback, void *data)
 Set index build callback.
 

Detailed Description

These functions are used to configure a decoder and to set callback functions. After you created a bgav_t object, get it's options with bgav_get_options. All options are returned in an option container (bgav_options_t), and the bgav_options_set_* functions allow you to change single options. As an alternative, you can create an independent option container with bgav_options_create, change it as you like and use bgav_options_copy to copy them to the container you got with bgav_get_options.

All options become valid with (and should not be changed after) the call to one of the bgav_open* functions.

Typedef Documentation

◆ bgav_options_t

typedef struct bgav_options_s bgav_options_t

Opaque option container.

◆ bgav_metadata_change_callback

typedef void(* bgav_metadata_change_callback) (void *data, const bgav_metadata_t *metadata)

Enumeration for log levels.

These will be called from within log callbacks

Function to be called if the metadata change

Parameters
dataThe data you passed to bgav_options_set_metadata_change_callback.
metadataThe new metadata of the track

This function will be called whenever the metadata of the track changed. Such changes can have different reasons, the most obvious one is a song change in a webradio stream.

◆ bgav_buffer_callback

typedef void(* bgav_buffer_callback) (void *data, float percentage)

Function to be called if the input module is buffering data.

Parameters
dataThe data you passed to bgav_options_set_buffer_callback.
percentageThe percentage done so far (0.0 .. 1.0)

This function will be called when the input module fills a buffer. It is called multiple times with increasing percentage.

◆ bgav_user_pass_callback

typedef int(* bgav_user_pass_callback) (void *data, const char *resource, char **username, char **password)

Function to be called if the input module needs authentication data.

Parameters
dataThe data you passed to bgav_options_set_user_pass_callback.
resourceA string describing the resource (e.g. the hostname of the server)
usernameReturns the username.
passwordReturns the password.
Returns
1 of the username and password are valid, 0 if the user cancelled the authentication.

This is called during one of the bgav_open* calls.

◆ bgav_aspect_callback

typedef void(* bgav_aspect_callback) (void *data, int stream, int pixel_width, int pixel_height)

Function to be called if a change of the aspect ratio was detected.

Parameters
dataThe data you passed to bgav_options_set_aspect_callback.
streamIndex of the video stream (starts with 0)
pixel_widthNew pixel width
pixel_heightNew pixel height

This is called during bgav_read_video.

◆ bgav_index_callback

typedef void(* bgav_index_callback) (void *data, float percentage)

Function to be called periodically while an index is built.

Parameters
dataThe data you passed to bgav_options_set_index_callback.
percPercentage completed to far

Function Documentation

◆ bgav_get_options()

BGAV_PUBLIC bgav_options_t * bgav_get_options ( bgav_t bgav)

Get the options of a decoder instance.

Returns
Options

Use this to get the options container. You can use the bgav_options_set_* functions to change the options. Options will become valid when you call one of the bgav_open*() functions.

◆ bgav_options_create()

BGAV_PUBLIC bgav_options_t * bgav_options_create ( )

Create an options container.

Returns
A newly allocated option container

This function returns a newly allocated option container filled with default values. Use this, if you need to store decoder options independently from decoder instances. To destroy the container again, use bgav_options_destroy.

To pass the options to a decoder structure, use bgav_get_options and bgav_options_copy.

◆ bgav_options_destroy()

BGAV_PUBLIC void bgav_options_destroy ( bgav_options_t opt)

Destroy option cotainer.

Parameters
optoption cotainer

Use the only to destroy options, you created with bgav_options_create. Options returned by bgav_get_options are owned by the bgav_t instance, and must not be freed by you.

◆ bgav_options_copy()

BGAV_PUBLIC void bgav_options_copy ( bgav_options_t dst,
const bgav_options_t src 
)

Copy options.

Parameters
dstDestination
srcSource

◆ bgav_options_set_connect_timeout()

BGAV_PUBLIC void bgav_options_set_connect_timeout ( bgav_options_t opt,
int  timeout 
)

Set connect timeout.

Parameters
optOption container
timeoutTimeout in milliseconds.

This timeout will be used until the connection is ready to receive media data.

◆ bgav_options_set_read_timeout()

BGAV_PUBLIC void bgav_options_set_read_timeout ( bgav_options_t opt,
int  timeout 
)

Set read timeout.

Parameters
optOption container
timeoutTimeout in milliseconds.

This timeout will be used during streaming to detect server/connection failures.

◆ bgav_options_set_rtp_port_base()

BGAV_PUBLIC void bgav_options_set_rtp_port_base ( bgav_options_t opt,
int  p 
)

Set RTP port pase.

Parameters
optOption container
pPort base

Values below and including 1024 enable random ports. Random ports should be used if you have no or an RTSP aware firewall. Values above 1024 enable a fixed base port. For usual videos (one audio- one videostream) you need 4 consecutive open ports starting with the base port. If your firewall blocks all UDP traffic, use bgav_options_set_rtp_try_tcp.

◆ bgav_options_set_rtp_try_tcp()

BGAV_PUBLIC void bgav_options_set_rtp_try_tcp ( bgav_options_t opt,
int  enable 
)

Try TCP before UDP.

Parameters
optOption container
enable1 to try TCP, 0 else

Use this if your firewall blocks all UDP traffic. Not all servers, however, support TCP fallback.

◆ bgav_options_set_network_bandwidth()

BGAV_PUBLIC void bgav_options_set_network_bandwidth ( bgav_options_t opt,
int  bandwidth 
)

Set network bandwidth.

Parameters
optOption container
bandwidthBandwidth of your internet connection (in bits per second)

Some network protocols allow to select among multiple streams according to the speed of the internet connection.

◆ bgav_options_set_http_use_proxy()

BGAV_PUBLIC void bgav_options_set_http_use_proxy ( bgav_options_t opt,
int  enable 
)

Set proxy usage.

Parameters
optOption container
enableSet 1 of you use a http proxy, 0 else.

Set usage of a http proxy. If you enable proxies, you must specify the proxy host with bgav_options_set_http_proxy_host and the proxy port with bgav_options_set_http_proxy_port.

◆ bgav_options_set_http_proxy_host()

BGAV_PUBLIC void bgav_options_set_http_proxy_host ( bgav_options_t opt,
const char *  host 
)

Set proxy host.

Parameters
optOption container
hostHostname of the proxy.

Note that you must enable proxies with bgav_options_set_http_use_proxy before it's actually used.

◆ bgav_options_set_http_proxy_port()

BGAV_PUBLIC void bgav_options_set_http_proxy_port ( bgav_options_t opt,
int  port 
)

Set proxy port.

Parameters
optOption container
portPort of the proxy.

Note that you must enable proxies with bgav_options_set_http_use_proxy before it's actually used.

◆ bgav_options_set_http_proxy_auth()

BGAV_PUBLIC void bgav_options_set_http_proxy_auth ( bgav_options_t opt,
int  enable 
)

Enable or disable proxy authentication.

Parameters
optOption container
enableSet 1 if your http proxy needs authentication, 0 else.

If you enable http proxy authentication, you must specify the username host with bgav_options_set_http_proxy_user and the proxy password with bgav_options_set_http_proxy_pass.

◆ bgav_options_set_http_proxy_user()

BGAV_PUBLIC void bgav_options_set_http_proxy_user ( bgav_options_t opt,
const char *  user 
)

Set proxy username.

Parameters
optOption container
userThe username for the proxy.

Note that you must enable proxy authentication with bgav_options_set_http_proxy_auth.

◆ bgav_options_set_http_proxy_pass()

BGAV_PUBLIC void bgav_options_set_http_proxy_pass ( bgav_options_t opt,
const char *  pass 
)

Set proxy password.

Parameters
optOption container
passThe password for the proxy.

Note that you must enable proxy authentication with bgav_options_set_http_proxy_auth.

◆ bgav_options_set_http_shoutcast_metadata()

BGAV_PUBLIC void bgav_options_set_http_shoutcast_metadata ( bgav_options_t opt,
int  enable 
)

Enable or disable shoutcast metadata streaming.

Parameters
optOption container
enableSet to 1 if the decoder should try to get shoutcast metadata, 0 else

Normally it's ok to enable shoutcast metadata streaming even if we connect to non-shoutcast servers.

◆ bgav_options_set_ftp_anonymous()

BGAV_PUBLIC void bgav_options_set_ftp_anonymous ( bgav_options_t opt,
int  enable 
)

Enable or disable anonymous ftp login.

Parameters
optOption container
enableSet to 1 if the decoder should try log anonymously into ftp servers, 0 else

◆ bgav_options_set_ftp_anonymous_password()

BGAV_PUBLIC void bgav_options_set_ftp_anonymous_password ( bgav_options_t opt,
const char *  pass 
)

Set anonymous password.

Parameters
optOption container
pass

Note that you must enable anonymous ftp login with bgav_options_set_ftp_anonymous.

◆ bgav_options_set_default_subtitle_encoding()

BGAV_PUBLIC void bgav_options_set_default_subtitle_encoding ( bgav_options_t opt,
const char *  encoding 
)

Set default subtitle encoding.

Parameters
optOption container
encodingEncoding

This sets the default encoding for text subtitles, when the right encoding is unknown. It must be a character set name recognized by iconv. Type "iconv -l" at the commandline for a list of supported encodings).

◆ bgav_options_set_audio_dynrange()

BGAV_PUBLIC void bgav_options_set_audio_dynrange ( bgav_options_t opt,
int  audio_dynrange 
)

Enable dynamic range control.

Parameters
optOption container
audio_dynrange1 for enabling dynamic range control.

This enables dynamic range control for codecs, which supports it. By default dynamic range control is enabled. Use this function to switch it off for the case, that you have a better dynamic range control in your processing pipe.

◆ bgav_options_set_sample_accurate()

BGAV_PUBLIC void bgav_options_set_sample_accurate ( bgav_options_t opt,
int  enable 
)

Try to be sample accurate.

Parameters
optOption container
enableSpecifies how sample accurate mode should be enabled (see below)

If enable is 0, sample accuracy will never be enabled. If enable is 1, sample accuracy will always (whenever possible) be enabled. If enable is 2, sample accuracy will only be enabled, if the file would not be seekable otherwise.

When switching to sample accurate mode, other demultiplexing methods are enabled, which might slow things down a bit.

◆ bgav_options_set_cache_time()

BGAV_PUBLIC void bgav_options_set_cache_time ( bgav_options_t opt,
int  t 
)

Set the index creation time for caching.

Parameters
optOption container
tTime (in milliseconds) needed for creating the index

This option controls, which indices are cached, based on the time needed for creating the index. Indices, whose creation takes longer than the specified time will be cached. If you set this to zero, all indices are cached.

◆ bgav_options_set_cache_size()

BGAV_PUBLIC void bgav_options_set_cache_size ( bgav_options_t opt,
int  s 
)

Set the maximum total size of the index cache.

Parameters
optOption container
sMaximum size (in megabytes) of the whole cache directory

If a new index is created and the size becomes larger than the maximum size, older indices will be deleted. Zero means infinite.

◆ bgav_options_set_seek_subtitles()

BGAV_PUBLIC void bgav_options_set_seek_subtitles ( bgav_options_t opt,
int  seek_subtitles 
)

Enable external subtitle files.

Parameters
optOption container
seek_subtitlesIf 1, subtitle files will be seeked for video files. If 2, subtitles will be seeked for all files.

If the input is a regular file, gmerlin_avdecoder can scan the directory for matching subtitle files. For a file movie.mpg, possible subtitle files are e.g. movie_english.srt, movie_german.srt. The rule is, that the first part of the filename of the subtitle file must be equal to the movie filename up to the extension (hiere: .mpg). Furthermore, the subtitle filename must have an extension supported by any of the subtitle readers.

◆ bgav_options_set_pp_level()

BGAV_PUBLIC void bgav_options_set_pp_level ( bgav_options_t opt,
int  pp_level 
)

Set postprocessing level.

Parameters
optOption container
pp_levelValue between 0 (no postprocessing) and 6 (maximum postprocessing)

Warning: This function is depracated, use bgav_options_set_postprocessing_level instead.

◆ bgav_options_set_postprocessing_level()

BGAV_PUBLIC void bgav_options_set_postprocessing_level ( bgav_options_t opt,
float  pp_level 
)

Set postprocessing level.

Parameters
optOption container
pp_levelValue between 0.0 (no postprocessing) and 1.0 (maximum postprocessing)

Since 1.0.2

◆ bgav_options_set_threads()

BGAV_PUBLIC void bgav_options_set_threads ( bgav_options_t opt,
int  threads 
)

Set number of threads.

Parameters
optOption container
threadsNumber of threads to use

Not all codecs support this

◆ bgav_options_set_dvb_channels_file()

BGAV_PUBLIC void bgav_options_set_dvb_channels_file ( bgav_options_t opt,
const char *  file 
)

Set DVB channels file.

Parameters
optOption container
fileName of the channel configurations file

The channels file must have the format of the dvb-utils programs (like szap, tzap). If you don't set this file, several locations like $HOME/.tzap/channels.conf will be searched.

◆ bgav_options_set_prefer_ffmpeg_demuxers()

BGAV_PUBLIC void bgav_options_set_prefer_ffmpeg_demuxers ( bgav_options_t opt,
int  prefer 
)

Preference of ffmpeg demultiplexers.

Parameters
optOption container
prefer1 to prefer ffmpeg demultiplexers, 0 else

Usually, native demultiplexers are prefered over the ffmpeg ones. This function allows you to chnage that. If gmerlin_avdecoder was compiled without libavformat support, this function is meaningless.

◆ bgav_options_set_dv_datetime()

BGAV_PUBLIC void bgav_options_set_dv_datetime ( bgav_options_t opt,
int  datetime 
)

Exports the date and time as timecode field of DV streams.

Parameters
optOption container
datetime1 to export date and time as timecodes, 0 else

◆ bgav_options_set_shrink()

BGAV_PUBLIC void bgav_options_set_shrink ( bgav_options_t opt,
int  factor 
)

Shrink factor.

Parameters
optOption container
factorExponent of the shrink factor

This enables downscaling of images while decoding. Currently only supported for JPEG-2000.

◆ bgav_options_set_vdpau()

BGAV_PUBLIC void bgav_options_set_vdpau ( bgav_options_t opt,
int  vdpau 
)

VDPAU acceleration.

Parameters
optOption container
vdpau1 to enable vdpau, 0 else

Since 1.0.2

This is a noop now since VDPAU support was removed. Might get enabled again in the future.

◆ bgav_options_set_vaapi()

BGAV_PUBLIC void bgav_options_set_vaapi ( bgav_options_t opt,
int  vaapi 
)

VAAPI acceleration.

Parameters
optOption container
vaapi1 to enable vaapi, 0 else

Since 1.0.2

◆ bgav_options_set_dump_headers()

BGAV_PUBLIC void bgav_options_set_dump_headers ( bgav_options_t opt,
int  enable 
)

Dump file headers.

Parameters
optOption container
enable1 to dump file headers, 0 else

Since 1.1.1

◆ bgav_options_set_dump_indices()

BGAV_PUBLIC void bgav_options_set_dump_indices ( bgav_options_t opt,
int  enable 
)

Dump file indices.

Parameters
optOption container
enable1 to dump file indices, 0 else

Since 1.1.1

◆ bgav_options_set_dump_packets()

BGAV_PUBLIC void bgav_options_set_dump_packets ( bgav_options_t opt,
int  enable 
)

Dump packets.

Parameters
optOption container
enable1 to dump packets, 0 else

Since 1.1.1

◆ bgav_options_set_metadata_change_callback()

BGAV_PUBLIC void bgav_options_set_metadata_change_callback ( bgav_options_t opt,
bgav_metadata_change_callback  callback,
void *  data 
)

Set the callback for metadata change events.

Parameters
optOption container
callbackThe callback
dataSome data you want to get passed to the callback

◆ bgav_options_set_buffer_callback()

BGAV_PUBLIC void bgav_options_set_buffer_callback ( bgav_options_t opt,
bgav_buffer_callback  callback,
void *  data 
)

Set the callback for buffering notification.

Parameters
optOption container
callbackThe callback
dataSome data you want to get passed to the callback

◆ bgav_options_set_user_pass_callback()

BGAV_PUBLIC void bgav_options_set_user_pass_callback ( bgav_options_t opt,
bgav_user_pass_callback  callback,
void *  data 
)

Set the callback for user authentication.

Parameters
optOption container
callbackThe callback
dataSome data you want to get passed to the callback

Note that there is no default authentication built into the library. Therefore you MUST set a callback, otherwise urls which require the user to enter authentication data, cannot be openend.

◆ bgav_options_set_aspect_callback()

BGAV_PUBLIC void bgav_options_set_aspect_callback ( bgav_options_t opt,
bgav_aspect_callback  callback,
void *  data 
)

Set aspect ratio change callback.

Parameters
optOption container
callbackThe callback
dataSome data you want to get passed to the callback

◆ bgav_options_set_index_callback()

BGAV_PUBLIC void bgav_options_set_index_callback ( bgav_options_t opt,
bgav_index_callback  callback,
void *  data 
)

Set index build callback.

Parameters
optOption container
callbackThe callback
dataSome data you want to get passed to the callback