gmerlin
|
Input plugin. More...
#include <plugin.h>
Data Fields | |
bg_plugin_common_t | common |
Infos and functions common to all plugin types. More... | |
const char *(* | get_protocols )(void *priv) |
Get supported protocols. More... | |
const char *(* | get_mimetypes )(void *priv) |
Get supported mimetypes. More... | |
const char *(* | get_extensions )(void *priv) |
Get supported extensions. More... | |
void(* | set_callbacks )(void *priv, bg_input_callbacks_t *callbacks) |
Set callbacks. More... | |
int(* | open )(void *priv, const char *arg) |
Open file/url/device. More... | |
int(* | open_fd )(void *priv, int fd, int64_t total_bytes, const char *mimetype) |
Open plugin from filedescriptor (optional) More... | |
int(* | open_callbacks )(void *priv, int(*read_callback)(void *priv, uint8_t *data, int len), int64_t(*seek_callback)(void *priv, uint64_t pos, int whence), void *cb_priv, const char *filename, const char *mimetype, int64_t total_bytes) |
Open plugin with callbacks (optional) More... | |
const bg_edl_t *(* | get_edl )(void *priv) |
Get the edl (optional) More... | |
const char *(* | get_disc_name )(void *priv) |
Get the disc name (optional) More... | |
int(* | eject_disc )(const char *device) |
Eject disc (optional) More... | |
int(* | get_num_tracks )(void *priv) |
Get the number of tracks. More... | |
bg_track_info_t *(* | get_track_info )(void *priv, int track) |
Return information about a track. More... | |
int(* | set_track )(void *priv, int track) |
Set the track to be played. More... | |
int(* | get_audio_compression_info )(void *priv, int stream, gavl_compression_info_t *info) |
Get the compression info of an audio stream. More... | |
int(* | get_video_compression_info )(void *priv, int stream, gavl_compression_info_t *info) |
Get the compression info of a video stream. More... | |
int(* | set_audio_stream )(void *priv, int stream, bg_stream_action_t action) |
Setup audio stream. More... | |
int(* | set_video_stream )(void *priv, int stream, bg_stream_action_t action) |
Setup video stream. More... | |
int(* | set_subtitle_stream )(void *priv, int stream, bg_stream_action_t action) |
Setup subtitle stream. More... | |
int(* | start )(void *priv) |
Start decoding. More... | |
gavl_frame_table_t *(* | get_frame_table )(void *priv, int stream) |
Get frame table. More... | |
bg_read_audio_func_t | read_audio |
Read audio samples. More... | |
int(* | has_still )(void *priv, int stream) |
Check is a still image is available. More... | |
bg_read_video_func_t | read_video |
Read a video frame. More... | |
int(* | read_audio_packet )(void *priv, int stream, gavl_packet_t *p) |
Read compressed audio packet. More... | |
int(* | read_video_packet )(void *priv, int stream, gavl_packet_t *p) |
Read compressed video packet. More... | |
void(* | skip_video )(void *priv, int stream, int64_t *time, int scale, int exact) |
Skip frames in a video stream. More... | |
int(* | has_subtitle )(void *priv, int stream) |
Query if a new subtitle is available. More... | |
int(* | read_subtitle_overlay )(void *priv, gavl_overlay_t *ovl, int stream) |
Read one pixmap subtitle. More... | |
int(* | read_subtitle_text )(void *priv, char **text, int *text_alloc, int64_t *start_time, int64_t *duration, int stream) |
Read one text subtitle. More... | |
void(* | seek )(void *priv, int64_t *time, int scale) |
Seek within a media track. More... | |
void(* | stop )(void *priv) |
Stop playback. More... | |
void(* | close )(void *priv) |
Close plugin. More... | |
Input plugin.
This is for all kinds of media inputs (files, disks, urls, etc), except recording from hardware devices (see Recorder).
bg_plugin_common_t bg_input_plugin_s::common |
Infos and functions common to all plugin types.
const char*(* bg_input_plugin_s::get_protocols)(void *priv) |
Get supported protocols.
priv | The handle returned by the create() method |
const char*(* bg_input_plugin_s::get_mimetypes)(void *priv) |
Get supported mimetypes.
priv | The handle returned by the create() method |
const char*(* bg_input_plugin_s::get_extensions)(void *priv) |
Get supported extensions.
priv | The handle returned by the create() method |
void(* bg_input_plugin_s::set_callbacks)(void *priv, bg_input_callbacks_t *callbacks) |
Set callbacks.
priv | The handle returned by the create() method |
callbacks | Callback 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.
int(* bg_input_plugin_s::open)(void *priv, const char *arg) |
Open file/url/device.
priv | The handle returned by the create() method |
arg | Filename, URL or device name |
int(* bg_input_plugin_s::open_fd)(void *priv, int fd, int64_t total_bytes, const char *mimetype) |
Open plugin from filedescriptor (optional)
priv | The handle returned by the create() method |
fd | Open filedescriptor |
total_bytes | Totally available bytes or 0 if unknown |
mimetype | Mimetype from http header (or NULL) |
int(* bg_input_plugin_s::open_callbacks)(void *priv, int(*read_callback)(void *priv, uint8_t *data, int len), int64_t(*seek_callback)(void *priv, uint64_t pos, int whence), void *cb_priv, const char *filename, const char *mimetype, int64_t total_bytes) |
Open plugin with callbacks (optional)
priv | The handle returned by the create() method |
read_callback | Callback for reading data |
seek_callback | Callback for seeking |
cb_priv | Private argument for the callbacks |
filename | The filename of the input or NULL if this info is not known. |
mimetype | The mimetype of the input or NULL if this info is not known. |
total_bytes | total number of bytes or 0 if this info is not known. |
const bg_edl_t*(* bg_input_plugin_s::get_edl)(void *priv) |
Get the edl (optional)
priv | The handle returned by the create() method |
const char*(* bg_input_plugin_s::get_disc_name)(void *priv) |
Get the disc name (optional)
priv | The handle returned by the create() method |
This is only for plugins, which access removable discs (e.g. CDs).
int(* bg_input_plugin_s::eject_disc)(const char *device) |
Eject disc (optional)
priv | The handle returned by the create() method |
This is only for plugins, which access removable discs (e.g. CDs).
int(* bg_input_plugin_s::get_num_tracks)(void *priv) |
Get the number of tracks.
priv | The handle returned by the create() method |
This can be NULL for plugins, which support just one track.
bg_track_info_t*(* bg_input_plugin_s::get_track_info)(void *priv, int track) |
Return information about a track.
priv | The handle returned by the create() method |
track | Track index starting with 0 |
The following fields MUST be valid after this call:
Other data, especially audio and video formats, will become valid after the start() call (see below).
int(* bg_input_plugin_s::set_track)(void *priv, int track) |
Set the track to be played.
priv | The handle returned by the create() method |
track | Track 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.
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.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
info | Returns the compression info |
The returned compression info should be freed with gavl_compression_info_free
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.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
info | Returns the compression info |
The returned compression info should be freed with gavl_compression_info_free
int(* bg_input_plugin_s::set_audio_stream)(void *priv, int stream, bg_stream_action_t action) |
Setup audio stream.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
action | What to do with the stream |
int(* bg_input_plugin_s::set_video_stream)(void *priv, int stream, bg_stream_action_t action) |
Setup video stream.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
action | What to do with the stream |
int(* bg_input_plugin_s::set_subtitle_stream)(void *priv, int stream, bg_stream_action_t action) |
Setup subtitle stream.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
action | What to do with the stream |
int(* bg_input_plugin_s::start)(void *priv) |
Start decoding.
priv | The handle returned by the create() method |
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
gavl_frame_table_t*(* bg_input_plugin_s::get_frame_table)(void *priv, int stream) |
Get frame table.
priv | The handle returned by the create() method |
stream | Stream index (starting with 0) |
The returned frame table must be freed with gavl_frame_table_destroy.
bg_read_audio_func_t bg_input_plugin_s::read_audio |
Read audio samples.
priv | The handle returned by the create() method |
frame | The frame, where the samples will be copied |
stream | Stream index starting with 0 |
num_samples | Number of samples |
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.
int(* bg_input_plugin_s::has_still)(void *priv, int stream) |
Check is a still image is available.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
If EOF occurs in still streams, this function will return 1, but the subsequent call to read_video returns 0
bg_read_video_func_t bg_input_plugin_s::read_video |
Read a video frame.
priv | The handle returned by the create() method |
frame | The frame, where the image will be copied |
stream | Stream index starting with 0 |
int(* bg_input_plugin_s::read_audio_packet)(void *priv, int stream, gavl_packet_t *p) |
Read compressed audio packet.
priv | The handle returned by the create() method |
stream | Stream index (starting with 0) |
p | Returns the packet |
You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.
int(* bg_input_plugin_s::read_video_packet)(void *priv, int stream, gavl_packet_t *p) |
Read compressed video packet.
priv | The handle returned by the create() method |
stream | Stream index (starting with 0) |
p | Returns the packet |
You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.
void(* bg_input_plugin_s::skip_video)(void *priv, int stream, int64_t *time, int scale, int exact) |
Skip frames in a video stream.
stream | Stream index (starting with 0) |
time | The time to skip to (will be changed to the true time) |
scale | Scale by which the time is scaled |
exact | 1 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.
int(* bg_input_plugin_s::has_subtitle)(void *priv, int stream) |
Query if a new subtitle is available.
priv | The handle returned by the create() method |
stream | Stream index starting with 0 |
int(* bg_input_plugin_s::read_subtitle_overlay)(void *priv, gavl_overlay_t *ovl, int stream) |
Read one pixmap subtitle.
priv | The handle returned by the create() method |
ovl | Where the overlay will be copied |
stream | Stream index starting with 0 |
EOF in a graphical subtitle stream is reached if
int(* bg_input_plugin_s::read_subtitle_text)(void *priv, char **text, int *text_alloc, int64_t *start_time, int64_t *duration, int stream) |
Read one text subtitle.
priv | The handle returned by the create() method |
text | Where the text will be copied, the buffer will be realloc()ed. |
text_alloc | Allocated bytes for text. Will be updated by the function. |
start_time | Returns the start time of the subtitle |
duration | Returns the duration of the subtitle |
stream | Stream index starting with 0 |
EOF in a text subtitle stream is reached if
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).
void(* bg_input_plugin_s::seek)(void *priv, int64_t *time, int scale) |
Seek within a media track.
priv | The handle returned by the create() method |
time | Time to seek to |
scale | Timescale |
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
void(* bg_input_plugin_s::stop)(void *priv) |
Stop playback.
priv | The handle returned by the create() method |
This is used for plugins in bypass mode to stop playback. The plugin can be started again after
void(* bg_input_plugin_s::close)(void *priv) |
Close plugin.
priv | The handle returned by the create() method |
Close the file/device/url.