gmerlin
Data Fields
bg_input_plugin_s Struct Reference

Input plugin. More...

#include <plugin.h>

Data Fields

bg_plugin_common_t common
 Infos and functions common to all plugin types.
 
const char *(* get_protocols )(void *priv)
 Get supported protocols.
 
const char *(* get_mimetypes )(void *priv)
 Get supported mimetypes.
 
const char *(* get_extensions )(void *priv)
 Get supported extensions.
 
void(* set_callbacks )(void *priv, bg_input_callbacks_t *callbacks)
 Set callbacks.
 
int(* open )(void *priv, const char *arg)
 Open file/url/device.
 
int(* open_fd )(void *priv, int fd, int64_t total_bytes, const char *mimetype)
 Open plugin from filedescriptor (optional)
 
int(* open_io )(void *priv, gavf_io_t *io)
 Open plugin with callbacks (optional)
 
const gavl_edl_t *(* get_edl )(void *priv)
 Get the edl (optional)
 
const char *(* get_disc_name )(void *priv)
 Get the disc name (optional)
 
int(* eject_disc )(const char *device)
 Eject disc (optional)
 
int(* get_num_tracks )(void *priv)
 Get the number of tracks.
 
bg_track_info_t *(* get_track_info )(void *priv, int track)
 Return information about a track.
 
int(* set_track )(void *priv, int track)
 Set the track to be played.
 
int(* get_audio_compression_info )(void *priv, int stream, gavl_compression_info_t *info)
 Get the compression info of an audio stream.
 
int(* get_video_compression_info )(void *priv, int stream, gavl_compression_info_t *info)
 Get the compression info of a video stream.
 
int(* get_overlay_compression_info )(void *priv, int stream, gavl_compression_info_t *info)
 Get the compression info of an overlay stream.
 
int(* set_audio_stream )(void *priv, int stream, bg_stream_action_t action)
 Setup audio stream.
 
int(* set_video_stream )(void *priv, int stream, bg_stream_action_t action)
 Setup video stream.
 
int(* set_text_stream )(void *priv, int stream, bg_stream_action_t action)
 Setup text stream.
 
int(* set_overlay_stream )(void *priv, int stream, bg_stream_action_t action)
 Setup overlay stream.
 
int(* start )(void *priv)
 Start decoding.
 
gavl_frame_table_t *(* get_frame_table )(void *priv, int stream)
 Get frame table.
 
gavl_audio_source_t *(* get_audio_source )(void *priv, int stream)
 Read audio samples.
 
gavl_video_source_t *(* get_video_source )(void *priv, int stream)
 Check is a still image is available.
 
gavl_packet_source_t *(* get_audio_packet_source )(void *priv, int stream)
 Read compressed audio packet.
 
gavl_packet_source_t *(* get_video_packet_source )(void *priv, int stream)
 Get the packet source for a video stream.
 
gavl_packet_source_t *(* get_overlay_packet_source )(void *priv, int stream)
 Get the packet source for an overlay stream.
 
void(* skip_video )(void *priv, int stream, int64_t *time, int scale, int exact)
 Skip frames in a video stream.
 
gavl_video_source_t *(* get_overlay_source )(void *priv, int stream)
 Query if a new subtitle is available.
 
gavl_packet_source_t *(* get_text_source )(void *priv, int stream)
 Read one text subtitle.
 
gavl_packet_source_t *(* get_subtitle_packet_source )(void *priv, int stream)
 Get the packet source for a text subtitle stream.
 
void(* seek )(void *priv, int64_t *time, int scale)
 Seek within a media track.
 
void(* stop )(void *priv)
 Stop playback.
 
void(* close )(void *priv)
 Close plugin.
 

Detailed Description

Input plugin.

This is for all kinds of media inputs (files, disks, urls, etc), except recording from hardware devices (see Recorder).

Field Documentation

◆ common

bg_plugin_common_t bg_input_plugin_s::common

Infos and functions common to all plugin types.

◆ get_protocols

const char *(* bg_input_plugin_s::get_protocols) (void *priv)

Get supported protocols.

Parameters
privThe handle returned by the create() method
Returns
A space separated list of protocols

◆ get_mimetypes

const char *(* bg_input_plugin_s::get_mimetypes) (void *priv)

Get supported mimetypes.

Parameters
privThe handle returned by the create() method
Returns
A space separated list of mimetypes

◆ get_extensions

const char *(* bg_input_plugin_s::get_extensions) (void *priv)

Get supported extensions.

Parameters
privThe handle returned by the create() method
Returns
A space separated list of extensions

◆ set_callbacks

void(* bg_input_plugin_s::set_callbacks) (void *priv, bg_input_callbacks_t *callbacks)

Set callbacks.

Parameters
privThe handle returned by the create() method
callbacksCallback structure initialized by the caller before

Set callback functions, which will be called by the plugin. Defining as well as calling this function is optional. Any of the members of callbacks can be NULL.

◆ open

int(* bg_input_plugin_s::open) (void *priv, const char *arg)

Open file/url/device.

Parameters
privThe handle returned by the create() method
argFilename, URL or device name
Returns
1 on success, 0 on failure

◆ open_fd

int(* bg_input_plugin_s::open_fd) (void *priv, int fd, int64_t total_bytes, const char *mimetype)

Open plugin from filedescriptor (optional)

Parameters
privThe handle returned by the create() method
fdOpen filedescriptor
total_bytesTotally available bytes or 0 if unknown
mimetypeMimetype from http header (or NULL)
Returns
1 on success, 0 on failure

◆ open_io

int(* bg_input_plugin_s::open_io) (void *priv, gavf_io_t *io)

Open plugin with callbacks (optional)

Parameters
privThe handle returned by the create() method
read_callbackCallback for reading data
seek_callbackCallback for seeking
cb_privPrivate argument for the callbacks
filenameThe filename of the input or NULL if this info is not known.
mimetypeThe mimetype of the input or NULL if this info is not known.
total_bytestotal number of bytes or 0 if this info is not known.
Returns
1 on success, 0 on failure

◆ get_edl

const gavl_edl_t *(* bg_input_plugin_s::get_edl) (void *priv)

Get the edl (optional)

Parameters
privThe handle returned by the create() method
Returns
The edl if any

◆ get_disc_name

const char *(* bg_input_plugin_s::get_disc_name) (void *priv)

Get the disc name (optional)

Parameters
privThe handle returned by the create() method
Returns
The name of the disc if any

This is only for plugins, which access removable discs (e.g. CDs).

◆ eject_disc

int(* bg_input_plugin_s::eject_disc) (const char *device)

Eject disc (optional)

Parameters
privThe handle returned by the create() method
Returns
1 if eject was successful

This is only for plugins, which access removable discs (e.g. CDs).

Todo
This function doesn't work reliably now. Either fix or remove this

◆ get_num_tracks

int(* bg_input_plugin_s::get_num_tracks) (void *priv)

Get the number of tracks.

Parameters
privThe handle returned by the create() method
Returns
The number of tracks

This can be NULL for plugins, which support just one track.

◆ get_track_info

bg_track_info_t *(* bg_input_plugin_s::get_track_info) (void *priv, int track)

Return information about a track.

Parameters
privThe handle returned by the create() method
trackTrack index starting with 0
Returns
The track info

The following fields MUST be valid after this call:

  • num_audio_streams
  • num_video_streams
  • num_subtitle_streams
  • duration
  • Name (If NULL, the filename minus the suffix will be used)

Other data, especially audio and video formats, will become valid after the start() call (see below).

◆ set_track

int(* bg_input_plugin_s::set_track) (void *priv, int track)

Set the track to be played.

Parameters
privThe handle returned by the create() method
trackTrack index starting with 0

This has to be defined even if the plugin doesn't support multiple tracks. In addition to selecting the track, the plugin should also reset it's internal state such that streams can newly be selected.

◆ get_audio_compression_info

int(* bg_input_plugin_s::get_audio_compression_info) (void *priv, int stream, gavl_compression_info_t *info)

Get the compression info of an audio stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
infoReturns the compression info
Returns
1 if the compression info was returned, 0 if the stream cannot be output in compressed form

The returned compression info should be freed with gavl_compression_info_free

◆ get_video_compression_info

int(* bg_input_plugin_s::get_video_compression_info) (void *priv, int stream, gavl_compression_info_t *info)

Get the compression info of a video stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
infoReturns the compression info
Returns
1 if the compression info was returned, 0 if the stream cannot be output in compressed form

The returned compression info should be freed with gavl_compression_info_free

◆ get_overlay_compression_info

int(* bg_input_plugin_s::get_overlay_compression_info) (void *priv, int stream, gavl_compression_info_t *info)

Get the compression info of an overlay stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
infoReturns the compression info
Returns
1 if the compression info was returned, 0 if the stream cannot be output in compressed form

The returned compression info should be freed with gavl_compression_info_free

◆ set_audio_stream

int(* bg_input_plugin_s::set_audio_stream) (void *priv, int stream, bg_stream_action_t action)

Setup audio stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
actionWhat to do with the stream
Returns
1 on success, 0 on failure

◆ set_video_stream

int(* bg_input_plugin_s::set_video_stream) (void *priv, int stream, bg_stream_action_t action)

Setup video stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
actionWhat to do with the stream
Returns
1 on success, 0 on failure

◆ set_text_stream

int(* bg_input_plugin_s::set_text_stream) (void *priv, int stream, bg_stream_action_t action)

Setup text stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
actionWhat to do with the stream
Returns
1 on success, 0 on failure

◆ set_overlay_stream

int(* bg_input_plugin_s::set_overlay_stream) (void *priv, int stream, bg_stream_action_t action)

Setup overlay stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
actionWhat to do with the stream
Returns
1 on success, 0 on failure

◆ start

int(* bg_input_plugin_s::start) (void *priv)

Start decoding.

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

After this call, all remaining members of the track info returned earlier (especially audio- and video formats) must be valid.

From the plugins point of view, this is the last chance to return 0 if something fails

◆ get_frame_table

gavl_frame_table_t *(* bg_input_plugin_s::get_frame_table) (void *priv, int stream)

Get frame table.

Parameters
privThe handle returned by the create() method
streamStream index (starting with 0)
Returns
A newly allocated frame table or NULL

The returned frame table must be freed with gavl_frame_table_destroy.

◆ get_audio_source

gavl_audio_source_t *(* bg_input_plugin_s::get_audio_source) (void *priv, int stream)

Read audio samples.

Parameters
privThe handle returned by the create() method
frameThe frame, where the samples will be copied
streamStream index starting with 0
num_samplesNumber of samples
Returns
The number of decoded samples, 0 means EOF.

The num_samples argument can be larger than the samples_per_frame member of the video format. This means, that all audio decoding plugins must have an internal buffering mechanism.

Get the audio source for a stream

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The audio source for this stream

This is an alternative for read_audio.

◆ get_video_source

gavl_video_source_t *(* bg_input_plugin_s::get_video_source) (void *priv, int stream)

Check is a still image is available.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
1 if a still frame can be decoded, 0 else.

If EOF occurs in still streams, this function will return 1, but the subsequent call to read_video returns 0

Read a video frame

Parameters
privThe handle returned by the create() method
frameThe frame, where the image will be copied
streamStream index starting with 0
Returns
1 if a frame was decoded, 0 means EOF.

Get the video source for a stream

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The video source for that stream

This is an alternative for has_still and read_video.

◆ get_audio_packet_source

gavl_packet_source_t *(* bg_input_plugin_s::get_audio_packet_source) (void *priv, int stream)

Read compressed audio packet.

Parameters
privThe handle returned by the create() method
streamStream index (starting with 0)
pReturns the packet
Returns
1 if a packet was read, 0 else

You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.

Read compressed video packet

Parameters
privThe handle returned by the create() method
streamStream index (starting with 0)
pReturns the packet
Returns
1 if a packet was read, 0 else

You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.

Get the packet source for an audio stream

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The packet source for this stream

This is an alternative for read_audio_packet

◆ get_video_packet_source

gavl_packet_source_t *(* bg_input_plugin_s::get_video_packet_source) (void *priv, int stream)

Get the packet source for a video stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The packet source for this stream

This is an alternative for read_video_packet

◆ get_overlay_packet_source

gavl_packet_source_t *(* bg_input_plugin_s::get_overlay_packet_source) (void *priv, int stream)

Get the packet source for an overlay stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The packet source for this stream

This is an alternative for read_video_packet

◆ skip_video

void(* bg_input_plugin_s::skip_video) (void *priv, int stream, int64_t *time, int scale, int exact)

Skip frames in a video stream.

Parameters
streamStream index (starting with 0)
timeThe time to skip to (will be changed to the true time)
scaleScale by which the time is scaled
exact1 if an exact skip should be done, 0 for faster approximate skip

Use this function if it turns out, that the machine is too weak to decode all frames. Set exact to 0 to make the skipping even faster but less accurate.

◆ get_overlay_source

gavl_video_source_t *(* bg_input_plugin_s::get_overlay_source) (void *priv, int stream)

Query if a new subtitle is available.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
1 if a subtitle is available, 0 else.

Read one pixmap subtitle

Parameters
privThe handle returned by the create() method
ovlWhere the overlay will be copied
streamStream index starting with 0
Returns
1 if a subtitle was decoded, 0 else

EOF in a graphical subtitle stream is reached if

  • has_subtitle() returned 1 and
  • read_subtitle_overlay() returned 0

Get the overlay source for a stream

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The overlay source for this stream

This is an alternative for read_subtitle_overlay.

◆ get_text_source

gavl_packet_source_t *(* bg_input_plugin_s::get_text_source) (void *priv, int stream)

Read one text subtitle.

Parameters
privThe handle returned by the create() method
textWhere the text will be copied, the buffer will be realloc()ed.
text_allocAllocated bytes for text. Will be updated by the function.
start_timeReturns the start time of the subtitle
durationReturns the duration of the subtitle
streamStream index starting with 0
Returns
1 if a subtitle was decoded, 0 else

EOF in a text subtitle stream is reached if

  • has_subtitle() returned 1 and
  • read_subtitle_text() returned 0

This function automatically handles the text buffer (and text_alloc). Just set both to zero before the first call and free() the text buffer after the last call (if non-NULL).

Get the text source for a stream

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The text source for this stream

This is an alternative for read_subtitle_text.

◆ get_subtitle_packet_source

gavl_packet_source_t *(* bg_input_plugin_s::get_subtitle_packet_source) (void *priv, int stream)

Get the packet source for a text subtitle stream.

Parameters
privThe handle returned by the create() method
streamStream index starting with 0
Returns
The packet source for this stream

This is an alternative for read_subtitle_text

◆ seek

void(* bg_input_plugin_s::seek) (void *priv, int64_t *time, int scale)

Seek within a media track.

Parameters
privThe handle returned by the create() method
timeTime to seek to
scaleTimescale

Media streams are supposed to be seekable, if this function is non-NULL AND the duration field of the track info is > 0 AND the seekable flag in the track info is nonzero. The time argument might be changed to the correct value

◆ stop

void(* bg_input_plugin_s::stop) (void *priv)

Stop playback.

Parameters
privThe handle returned by the create() method

This is used for plugins in bypass mode to stop playback. The plugin can be started again after

◆ close

void(* bg_input_plugin_s::close) (void *priv)

Close plugin.

Parameters
privThe handle returned by the create() method

Close the file/device/url.


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