Defines | |
#define | GAVL_SOURCE_SRC_ALLOC (1<<0) |
Source provides a pointer to an internal structure. | |
#define | GAVL_SOURCE_SRC_FRAMESIZE_MAX (1<<2) |
Samples per frame is just an upper bound. Frames can have smaller sizes also. The last frame is always allowed to have fewer samples, even if this flag is not set. | |
#define | GAVL_SOURCE_SRC_DISCONTINUOUS (1<<3) |
Stream is discontinuous. Set this for video sources delivering graphical subtitles. | |
Typedefs | |
typedef struct gavl_video_source_s | gavl_video_source_t |
Forward declaration of the video source. | |
typedef struct gavl_audio_source_s | gavl_audio_source_t |
Forward declaration of the audio source. | |
typedef struct gavl_packet_source_s | gavl_packet_source_t |
Forward declaration of the packet source. | |
typedef gavl_source_status_t(* | gavl_audio_source_func_t )(void *priv, gavl_audio_frame_t **frame) |
Prototype for obtaining one audio frame. | |
typedef gavl_source_status_t(* | gavl_video_source_func_t )(void *priv, gavl_video_frame_t **frame) |
Prototype for obtaining one video frame. | |
typedef gavl_source_status_t(* | gavl_packet_source_func_t )(void *priv, gavl_packet_t **p) |
Prototype for obtaining one packet. | |
Enumerations | |
enum | gavl_source_status_t { GAVL_SOURCE_EOF = 0, GAVL_SOURCE_OK = 1, GAVL_SOURCE_AGAIN = 2 } |
Return value of the source function. More... | |
Functions | |
GAVL_PUBLIC gavl_video_source_t * | gavl_video_source_create (gavl_video_source_func_t func, void *priv, int src_flags, const gavl_video_format_t *src_format) |
Create a video source. | |
GAVL_PUBLIC gavl_video_source_t * | gavl_video_source_create_source (gavl_video_source_func_t func, void *priv, int src_flags, gavl_video_source_t *src) |
Create a video source from another source. | |
GAVL_PUBLIC void | gavl_video_source_set_lock_funcs (gavl_video_source_t *src, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv) |
Set lock functions. | |
GAVL_PUBLIC gavl_video_options_t * | gavl_video_source_get_options (gavl_video_source_t *s) |
Get coversion options of a video source. | |
GAVL_PUBLIC void | gavl_video_source_reset (gavl_video_source_t *s) |
Reset a video source. | |
GAVL_PUBLIC void | gavl_video_source_destroy (gavl_video_source_t *s) |
Destroy a video source. | |
GAVL_PUBLIC const gavl_video_format_t * | gavl_video_source_get_src_format (gavl_video_source_t *s) |
Get the native format. | |
GAVL_PUBLIC const gavl_video_format_t * | gavl_video_source_get_dst_format (gavl_video_source_t *s) |
Get the output format. | |
GAVL_PUBLIC void | gavl_video_source_set_dst (gavl_video_source_t *s, int dst_flags, const gavl_video_format_t *dst_format) |
Set the destination mode. | |
GAVL_PUBLIC gavl_source_status_t | gavl_video_source_read_frame (void *s, gavl_video_frame_t **frame) |
Read a video frame. | |
GAVL_PUBLIC gavl_audio_source_t * | gavl_audio_source_create (gavl_audio_source_func_t func, void *priv, int src_flags, const gavl_audio_format_t *src_format) |
Create an audio source. | |
GAVL_PUBLIC gavl_audio_source_t * | gavl_audio_source_create_source (gavl_audio_source_func_t func, void *priv, int src_flags, gavl_audio_source_t *src) |
Create an audio source from another source. | |
GAVL_PUBLIC void | gavl_audio_source_set_lock_funcs (gavl_audio_source_t *src, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv) |
Set lock functions. | |
GAVL_PUBLIC const gavl_audio_format_t * | gavl_audio_source_get_src_format (gavl_audio_source_t *s) |
Get the native format. | |
GAVL_PUBLIC const gavl_audio_format_t * | gavl_audio_source_get_dst_format (gavl_audio_source_t *s) |
Get the output format. | |
GAVL_PUBLIC void | gavl_audio_source_set_dst (gavl_audio_source_t *s, int dst_flags, const gavl_audio_format_t *dst_format) |
Set the destination mode. | |
GAVL_PUBLIC gavl_source_status_t | gavl_audio_source_read_frame (void *s, gavl_audio_frame_t **frame) |
Read an audio frame. | |
GAVL_PUBLIC void | gavl_audio_source_skip_src (gavl_audio_source_t *s, int num_samples) |
Skip audio samples at the input. | |
GAVL_PUBLIC int | gavl_audio_source_read_samples (void *s, gavl_audio_frame_t *frame, int num_samples) |
Read audio samples. | |
GAVL_PUBLIC gavl_audio_options_t * | gavl_audio_source_get_options (gavl_audio_source_t *s) |
Get coversion options of an audio source. | |
GAVL_PUBLIC void | gavl_audio_source_reset (gavl_audio_source_t *s) |
Reset an audio source. | |
GAVL_PUBLIC void | gavl_audio_source_destroy (gavl_audio_source_t *s) |
Destroy an audio source. | |
GAVL_PUBLIC gavl_packet_source_t * | gavl_packet_source_create_audio (gavl_packet_source_func_t func, void *priv, int src_flags, const gavl_compression_info_t *ci, const gavl_audio_format_t *afmt) |
Create an audio packet source. | |
GAVL_PUBLIC gavl_packet_source_t * | gavl_packet_source_create_video (gavl_packet_source_func_t func, void *priv, int src_flags, const gavl_compression_info_t *ci, const gavl_video_format_t *vfmt) |
Create a video packet source. | |
GAVL_PUBLIC gavl_packet_source_t * | gavl_packet_source_create_text (gavl_packet_source_func_t func, void *priv, int src_flags, int timescale) |
Create a text packet source. | |
GAVL_PUBLIC gavl_packet_source_t * | gavl_packet_source_create_source (gavl_packet_source_func_t func, void *priv, int src_flags, gavl_packet_source_t *src) |
Create a packet source from another packet source. | |
GAVL_PUBLIC void | gavl_packet_source_set_lock_funcs (gavl_packet_source_t *src, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv) |
Set lock functions. | |
GAVL_PUBLIC const gavl_compression_info_t * | gavl_packet_source_get_ci (gavl_packet_source_t *s) |
Get the compression info. | |
GAVL_PUBLIC const gavl_audio_format_t * | gavl_packet_source_get_audio_format (gavl_packet_source_t *s) |
Get the audio format. | |
GAVL_PUBLIC const gavl_video_format_t * | gavl_packet_source_get_video_format (gavl_packet_source_t *s) |
Get the video format. | |
GAVL_PUBLIC int | gavl_packet_source_get_timescale (gavl_packet_source_t *s) |
Get the time scale. | |
GAVL_PUBLIC gavl_source_status_t | gavl_packet_source_read_packet (void *s, gavl_packet_t **p) |
Read one packet. | |
GAVL_PUBLIC void | gavl_packet_source_destroy (gavl_packet_source_t *s) |
Destroy a packet source. |
A module, which provides A/V frames, creates a source module and tells the native format in which it provides the frames. If you want to obtain the frames from the source, you tell the desired output format and if you intend to overwrite the frames.
To obtain the frames, you pass the address of the pointer of the frame. If the pointer is NULL, it will be set to an internal buffer.
The return value is of the type gavl_source_status_t, which can have 3 states depending on whether the stream ended (EOF) or a frame is available or if no frame is available right now. The latter can be used to implement parts of the pipeline in pull mode (the default) and others in push mode.
#define GAVL_SOURCE_SRC_ALLOC (1<<0) |
Source provides a pointer to an internal structure.
#define GAVL_SOURCE_SRC_FRAMESIZE_MAX (1<<2) |
Samples per frame is just an upper bound. Frames can have smaller sizes also. The last frame is always allowed to have fewer samples, even if this flag is not set.
#define GAVL_SOURCE_SRC_DISCONTINUOUS (1<<3) |
Stream is discontinuous. Set this for video sources delivering graphical subtitles.
typedef struct gavl_video_source_s gavl_video_source_t |
Forward declaration of the video source.
You don't want to know what's inside
typedef struct gavl_audio_source_s gavl_audio_source_t |
Forward declaration of the audio source.
You don't want to know what's inside
typedef struct gavl_packet_source_s gavl_packet_source_t |
Forward declaration of the packet source.
You don't want to know what's inside
typedef gavl_source_status_t(* gavl_audio_source_func_t)(void *priv, gavl_audio_frame_t **frame) |
Prototype for obtaining one audio frame.
priv | Client data | |
frame | Where to store the frame |
typedef gavl_source_status_t(* gavl_video_source_func_t)(void *priv, gavl_video_frame_t **frame) |
Prototype for obtaining one video frame.
priv | Client data | |
frame | Where to store the frame |
typedef gavl_source_status_t(* gavl_packet_source_func_t)(void *priv, gavl_packet_t **p) |
Prototype for obtaining one packet.
priv | Client data | |
frame | Where to store the packet |
enum gavl_source_status_t |
GAVL_PUBLIC gavl_video_source_t* gavl_video_source_create | ( | gavl_video_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
const gavl_video_format_t * | src_format | |||
) |
Create a video source.
func | Function to get the frames from | |
priv | Client data to pass to func | |
src_flags | Flags describing the source | |
src_format | Native source format |
GAVL_PUBLIC gavl_video_source_t* gavl_video_source_create_source | ( | gavl_video_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
gavl_video_source_t * | src | |||
) |
Create a video source from another source.
func | Function to get the frames from | |
priv | Client data to pass to func | |
src_flags | Flags describing the source | |
src | preceeding source in the pipeline |
GAVL_PUBLIC void gavl_video_source_set_lock_funcs | ( | gavl_video_source_t * | src, | |
gavl_connector_lock_func_t | lock_func, | |||
gavl_connector_lock_func_t | unlock_func, | |||
void * | priv | |||
) |
Set lock functions.
src | A video source | |
lock_func | Function called before a frame is read | |
unlock_func | Function called after a frame is read | |
priv | Client data (e.g. a mutex) to pass to the functions |
GAVL_PUBLIC gavl_video_options_t* gavl_video_source_get_options | ( | gavl_video_source_t * | s | ) |
Get coversion options of a video source.
s | A video source |
GAVL_PUBLIC void gavl_video_source_reset | ( | gavl_video_source_t * | s | ) |
Reset a video source.
s | A video source |
GAVL_PUBLIC void gavl_video_source_destroy | ( | gavl_video_source_t * | s | ) |
Destroy a video source.
s | A video source |
GAVL_PUBLIC const gavl_video_format_t* gavl_video_source_get_src_format | ( | gavl_video_source_t * | s | ) |
Get the native format.
s | A video source |
GAVL_PUBLIC const gavl_video_format_t* gavl_video_source_get_dst_format | ( | gavl_video_source_t * | s | ) |
Get the output format.
s | A video source |
GAVL_PUBLIC void gavl_video_source_set_dst | ( | gavl_video_source_t * | s, | |
int | dst_flags, | |||
const gavl_video_format_t * | dst_format | |||
) |
Set the destination mode.
s | A video source | |
dst_flags | Flags | |
dst_format | Format in which the frames will be read |
If the destination format differs from the source format, the frames will converted. For this, we have a gavl_video_converter_t and also do simple framerate conversion which repeats/drops frames.
GAVL_PUBLIC gavl_source_status_t gavl_video_source_read_frame | ( | void * | s, | |
gavl_video_frame_t ** | frame | |||
) |
Read a video frame.
s | A video source | |
frame | Address of a frame. |
GAVL_PUBLIC gavl_audio_source_t* gavl_audio_source_create | ( | gavl_audio_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
const gavl_audio_format_t * | src_format | |||
) |
Create an audio source.
func | Function to get the frames from | |
priv | Client data to pass to func | |
src_flags | Flags describing the source | |
src_format | Native source format |
GAVL_PUBLIC gavl_audio_source_t* gavl_audio_source_create_source | ( | gavl_audio_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
gavl_audio_source_t * | src | |||
) |
Create an audio source from another source.
func | Function to get the frames from | |
priv | Client data to pass to func | |
src_flags | Flags describing the source | |
src | preceeding source in the pipeline |
GAVL_PUBLIC void gavl_audio_source_set_lock_funcs | ( | gavl_audio_source_t * | src, | |
gavl_connector_lock_func_t | lock_func, | |||
gavl_connector_lock_func_t | unlock_func, | |||
void * | priv | |||
) |
Set lock functions.
src | An audio source | |
lock_func | Function called before a frame is read | |
unlock_func | Function called after a frame is read | |
priv | Client data (e.g. a mutex) to pass to the functions |
GAVL_PUBLIC const gavl_audio_format_t* gavl_audio_source_get_src_format | ( | gavl_audio_source_t * | s | ) |
Get the native format.
s | An audio source |
GAVL_PUBLIC const gavl_audio_format_t* gavl_audio_source_get_dst_format | ( | gavl_audio_source_t * | s | ) |
Get the output format.
s | An audio source |
GAVL_PUBLIC void gavl_audio_source_set_dst | ( | gavl_audio_source_t * | s, | |
int | dst_flags, | |||
const gavl_audio_format_t * | dst_format | |||
) |
Set the destination mode.
s | An audio source | |
dst_flags | Flags | |
dst_format | Format in which the frames will be read |
If the destination format differs from the source format, the frames will converted. For this, we have a gavl_audio_converter_t. In addition, if the samples_per_frame members are different, the frames will be repackaged.
GAVL_PUBLIC gavl_source_status_t gavl_audio_source_read_frame | ( | void * | s, | |
gavl_audio_frame_t ** | frame | |||
) |
Read an audio frame.
s | An audio source | |
frame | Address of a frame. |
If the return value is GAVL_SOURCE_AGAIN, you might have an imcomplete frame. In this case you must call this function again with exactly the same frame argument.
GAVL_PUBLIC void gavl_audio_source_skip_src | ( | gavl_audio_source_t * | s, | |
int | num_samples | |||
) |
Skip audio samples at the input.
s | An audio source | |
num_samples | Number of samples to skip |
GAVL_PUBLIC int gavl_audio_source_read_samples | ( | void * | s, | |
gavl_audio_frame_t * | frame, | |||
int | num_samples | |||
) |
Read audio samples.
s | An audio source | |
frame | An audio frame | |
num_samples | Number of samples to read |
GAVL_PUBLIC gavl_audio_options_t* gavl_audio_source_get_options | ( | gavl_audio_source_t * | s | ) |
Get coversion options of an audio source.
s | An audio source |
GAVL_PUBLIC void gavl_audio_source_reset | ( | gavl_audio_source_t * | s | ) |
Reset an audio source.
s | An audio source |
GAVL_PUBLIC void gavl_audio_source_destroy | ( | gavl_audio_source_t * | s | ) |
Destroy an audio source.
s | An audio source |
GAVL_PUBLIC gavl_packet_source_t* gavl_packet_source_create_audio | ( | gavl_packet_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
const gavl_compression_info_t * | ci, | |||
const gavl_audio_format_t * | afmt | |||
) |
Create an audio packet source.
func | Callback for reading one frame | |
priv | Client data to be passed to func | |
src_flags | Flags | |
ci | Compression info | |
afmt | Format of the audio stream |
GAVL_PUBLIC gavl_packet_source_t* gavl_packet_source_create_video | ( | gavl_packet_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
const gavl_compression_info_t * | ci, | |||
const gavl_video_format_t * | vfmt | |||
) |
Create a video packet source.
func | Callback for reading one frame | |
priv | Client data to be passed to func | |
src_flags | Flags | |
ci | Compression info | |
vfmt | Format of the video stream |
GAVL_PUBLIC gavl_packet_source_t* gavl_packet_source_create_text | ( | gavl_packet_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
int | timescale | |||
) |
Create a text packet source.
func | Callback for reading one frame | |
priv | Client data to be passed to func | |
src_flags | Flags | |
scale | Timescale of the text packets |
GAVL_PUBLIC gavl_packet_source_t* gavl_packet_source_create_source | ( | gavl_packet_source_func_t | func, | |
void * | priv, | |||
int | src_flags, | |||
gavl_packet_source_t * | src | |||
) |
Create a packet source from another packet source.
func | Callback for reading one frame | |
priv | Client data to be passed to func | |
src_flags | Flags | |
src | Source to copy the stream specific data from |
GAVL_PUBLIC void gavl_packet_source_set_lock_funcs | ( | gavl_packet_source_t * | src, | |
gavl_connector_lock_func_t | lock_func, | |||
gavl_connector_lock_func_t | unlock_func, | |||
void * | priv | |||
) |
Set lock functions.
src | A packet source | |
lock_func | Function called before a packet is read | |
unlock_func | Function called after a packet is read | |
priv | Client data (e.g. a mutex) to pass to the functions |
GAVL_PUBLIC const gavl_compression_info_t* gavl_packet_source_get_ci | ( | gavl_packet_source_t * | s | ) |
Get the compression info.
s | A packet source |
GAVL_PUBLIC const gavl_audio_format_t* gavl_packet_source_get_audio_format | ( | gavl_packet_source_t * | s | ) |
Get the audio format.
s | A packet source |
GAVL_PUBLIC const gavl_video_format_t* gavl_packet_source_get_video_format | ( | gavl_packet_source_t * | s | ) |
Get the video format.
s | A packet source |
GAVL_PUBLIC int gavl_packet_source_get_timescale | ( | gavl_packet_source_t * | s | ) |
Get the time scale.
s | A packet source |
GAVL_PUBLIC gavl_source_status_t gavl_packet_source_read_packet | ( | void * | s, | |
gavl_packet_t ** | p | |||
) |
Read one packet.
s | A packet source |
GAVL_PUBLIC void gavl_packet_source_destroy | ( | gavl_packet_source_t * | s | ) |
Destroy a packet source.
s | A packet source |