27#ifndef GAVL_CONNECTORS_H_INCLUDED
28#define GAVL_CONNECTORS_H_INCLUDED
31#include <gavl/compression.h>
54typedef void (*gavl_connector_lock_func_t)(
void * priv);
129#define GAVL_SOURCE_SRC_ALLOC (1<<0)
136#define GAVL_SOURCE_SRC_FRAMESIZE_MAX (1<<2)
142#define GAVL_SOURCE_SRC_DISCONTINUOUS (1<<3)
158 void * priv,
int src_flags,
175 void * priv,
int src_flags,
187 gavl_connector_lock_func_t lock_func,
188 gavl_connector_lock_func_t unlock_func,
287 void * priv,
int src_flags,
304 void * priv,
int src_flags,
317 gavl_connector_lock_func_t lock_func,
318 gavl_connector_lock_func_t unlock_func,
446 void * priv,
int src_flags,
461 void * priv,
int src_flags,
475 void * priv,
int src_flags,
int timescale);
487 void * priv,
int src_flags,
500 gavl_connector_lock_func_t lock_func,
501 gavl_connector_lock_func_t unlock_func,
589(*gavl_audio_sink_get_func)(
void * priv);
623 gavl_connector_lock_func_t lock_func,
624 gavl_connector_lock_func_t unlock_func,
678(*gavl_video_sink_get_func)(
void * priv);
712 gavl_connector_lock_func_t lock_func,
713 gavl_connector_lock_func_t unlock_func,
766(*gavl_packet_sink_get_func)(
void * priv);
798 gavl_connector_lock_func_t lock_func,
799 gavl_connector_lock_func_t unlock_func,
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition gavl.h:945
GAVL_PUBLIC gavl_video_connector_t * gavl_video_connector_create(gavl_video_source_t *src)
Create a video connector.
struct gavl_audio_connector_s gavl_audio_connector_t
Opaque structure for the audio connector.
Definition connectors.h:854
void(* gavl_packet_connector_process_func)(void *priv, gavl_packet_t *p)
Callback for processing a packet.
Definition connectors.h:909
GAVL_PUBLIC gavl_packet_connector_t * gavl_packet_connector_create(gavl_packet_source_t *src)
Create a packet connector.
GAVL_PUBLIC gavl_source_status_t gavl_packet_connector_get_source_status(gavl_packet_connector_t *c)
Get the status of the last read call.
struct gavl_packet_connector_s gavl_packet_connector_t
Opaque structure for the packet connector.
Definition connectors.h:868
GAVL_PUBLIC gavl_video_options_t * gavl_video_connector_get_options(gavl_video_connector_t *c)
Get conversion options.
void(* gavl_audio_connector_process_func)(void *priv, gavl_audio_frame_t *frame)
Callback for processing an audio frame.
Definition connectors.h:882
GAVL_PUBLIC const gavl_video_format_t * gavl_video_connector_get_process_format(gavl_video_connector_t *c)
Get process format.
GAVL_PUBLIC void gavl_audio_connector_reset(gavl_audio_connector_t *c)
Reset an audio connector.
GAVL_PUBLIC int gavl_video_connector_process(gavl_video_connector_t *c)
Process one frame.
GAVL_PUBLIC const gavl_audio_format_t * gavl_audio_connector_get_process_format(gavl_audio_connector_t *c)
Get process format.
GAVL_PUBLIC void gavl_audio_connector_start(gavl_audio_connector_t *c)
Start an audio connector.
GAVL_PUBLIC void gavl_video_connector_connect(gavl_video_connector_t *c, gavl_video_sink_t *sink)
Connect a sink.
GAVL_PUBLIC gavl_audio_connector_t * gavl_audio_connector_create(gavl_audio_source_t *src)
Create an audio connector.
GAVL_PUBLIC void gavl_audio_connector_set_process_func(gavl_audio_connector_t *c, gavl_audio_connector_process_func func, void *priv)
Set process callback.
GAVL_PUBLIC void gavl_packet_connector_connect(gavl_packet_connector_t *c, gavl_packet_sink_t *sink)
Connect a sink.
struct gavl_video_connector_s gavl_video_connector_t
Opaque structure for the audio connector.
Definition connectors.h:861
GAVL_PUBLIC void gavl_video_connector_start(gavl_video_connector_t *c)
Start a video connector.
void(* gavl_video_connector_process_func)(void *priv, gavl_video_frame_t *frame)
Callback for processing a video frame.
Definition connectors.h:897
GAVL_PUBLIC int gavl_audio_connector_process(gavl_audio_connector_t *c)
Process one frame.
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_connector_get_options(gavl_audio_connector_t *c)
Get conversion options.
GAVL_PUBLIC void gavl_packet_connector_set_process_func(gavl_packet_connector_t *c, gavl_packet_connector_process_func func, void *priv)
Set process callback.
GAVL_PUBLIC void gavl_video_connector_destroy(gavl_video_connector_t *c)
Destroy a video connector.
GAVL_PUBLIC void gavl_audio_connector_connect(gavl_audio_connector_t *c, gavl_audio_sink_t *sink)
Connect a sink.
GAVL_PUBLIC gavl_source_status_t gavl_video_connector_get_source_status(gavl_video_connector_t *c)
Get the status of the last read call.
GAVL_PUBLIC gavl_source_status_t gavl_audio_connector_get_source_status(gavl_audio_connector_t *c)
Get the status of the last read call.
GAVL_PUBLIC void gavl_packet_connector_destroy(gavl_packet_connector_t *c)
Destroy a packet connector.
GAVL_PUBLIC void gavl_video_connector_reset(gavl_video_connector_t *c)
Reset a video connector.
GAVL_PUBLIC void gavl_audio_connector_destroy(gavl_audio_connector_t *c)
Destroy an audio connector.
GAVL_PUBLIC int gavl_packet_connector_process(gavl_packet_connector_t *c)
Process one packet.
GAVL_PUBLIC void gavl_video_connector_set_process_func(gavl_video_connector_t *c, gavl_video_connector_process_func func, void *priv)
Set process callback.
struct gavl_video_sink_s gavl_video_sink_t
Video sink.
Definition gavl.h:81
GAVL_PUBLIC gavl_audio_sink_t * gavl_audio_sink_create(gavl_audio_sink_get_func get_func, gavl_audio_sink_put_func put_func, void *priv, const gavl_audio_format_t *format)
Create an audio sink.
GAVL_PUBLIC void gavl_video_sink_set_lock_funcs(gavl_video_sink_t *sink, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv)
Set lock functions.
gavl_sink_status_t(* gavl_packet_sink_put_func)(void *priv, gavl_packet_t *p)
Prototype for putting a frame.
Definition connectors.h:775
GAVL_PUBLIC void gavl_video_sink_destroy(gavl_video_sink_t *s)
Destroy a video sink.
gavl_sink_status_t
Return status of the sink functions.
Definition connectors.h:574
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:72
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition gavl.h:90
GAVL_PUBLIC gavl_video_sink_t * gavl_video_sink_create(gavl_video_sink_get_func get_func, gavl_video_sink_put_func put_func, void *priv, const gavl_video_format_t *format)
Create a video sink.
gavl_sink_status_t(* gavl_audio_sink_put_func)(void *priv, gavl_audio_frame_t *f)
Prototype for putting a frame.
Definition connectors.h:598
gavl_audio_frame_t *(* gavl_audio_sink_get_func)(void *priv)
Prototype for getting a frame buffer.
Definition connectors.h:589
GAVL_PUBLIC gavl_packet_t * gavl_packet_sink_get_packet(gavl_packet_sink_t *s)
Get a buffer for a packet.
GAVL_PUBLIC void gavl_audio_sink_destroy(gavl_audio_sink_t *s)
Destroy an audio sink.
GAVL_PUBLIC gavl_sink_status_t gavl_video_sink_put_frame(gavl_video_sink_t *s, gavl_video_frame_t *f)
Output a frame.
gavl_video_frame_t *(* gavl_video_sink_get_func)(void *priv)
Prototype for getting a frame buffer.
Definition connectors.h:678
GAVL_PUBLIC gavl_sink_status_t gavl_packet_sink_put_packet(gavl_packet_sink_t *s, gavl_packet_t *p)
Output a frame.
GAVL_PUBLIC gavl_video_frame_t * gavl_video_sink_get_frame(gavl_video_sink_t *s)
Get a buffer for a frame.
GAVL_PUBLIC gavl_packet_sink_t * gavl_packet_sink_create(gavl_packet_sink_get_func get_func, gavl_packet_sink_put_func put_func, void *priv)
Create a packet sink.
gavl_packet_t *(* gavl_packet_sink_get_func)(void *priv)
Prototype for getting a packet buffer.
Definition connectors.h:766
gavl_sink_status_t(* gavl_video_sink_put_func)(void *priv, gavl_video_frame_t *f)
Prototype for putting a frame.
Definition connectors.h:687
GAVL_PUBLIC void gavl_audio_sink_set_lock_funcs(gavl_audio_sink_t *sink, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv)
Set lock functions.
GAVL_PUBLIC void gavl_packet_sink_set_lock_funcs(gavl_packet_sink_t *sink, gavl_connector_lock_func_t lock_func, gavl_connector_lock_func_t unlock_func, void *priv)
Set lock functions.
GAVL_PUBLIC gavl_sink_status_t gavl_audio_sink_put_frame(gavl_audio_sink_t *s, gavl_audio_frame_t *f)
Output a frame.
GAVL_PUBLIC gavl_audio_frame_t * gavl_audio_sink_get_frame(gavl_audio_sink_t *s)
Get a buffer for a frame.
GAVL_PUBLIC const gavl_audio_format_t * gavl_audio_sink_get_format(gavl_audio_sink_t *s)
Get the format.
GAVL_PUBLIC void gavl_packet_sink_destroy(gavl_packet_sink_t *s)
Destroy a packet sink.
GAVL_PUBLIC const gavl_video_format_t * gavl_video_sink_get_format(gavl_video_sink_t *s)
Get the format.
@ GAVL_SINK_OK
Frame was successfully processed.
Definition connectors.h:576
@ GAVL_SINK_ERROR
Something went wrong.
Definition connectors.h:575
GAVL_PUBLIC gavl_source_status_t gavl_packet_source_read_packet(void *s, gavl_packet_t **p)
Read one packet.
gavl_source_status_t(* gavl_packet_source_func_t)(void *priv, gavl_packet_t **p)
Prototype for obtaining one packet.
Definition connectors.h:123
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 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_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_source_status_t gavl_audio_source_read_frame(void *s, gavl_audio_frame_t **frame)
Read an audio frame.
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 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_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.
struct gavl_video_source_s gavl_video_source_t
Forward declaration of the video source.
Definition gavl.h:48
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_source_status_t
Return value of the source function.
Definition connectors.h:86
GAVL_PUBLIC const gavl_video_format_t * gavl_video_source_get_src_format(gavl_video_source_t *s)
Get the native format.
GAVL_PUBLIC void gavl_audio_source_reset(gavl_audio_source_t *s)
Reset an audio source.
GAVL_PUBLIC gavl_source_status_t gavl_video_source_read_frame(void *s, gavl_video_frame_t **frame)
Read a video frame.
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 int gavl_audio_source_read_samples(void *s, gavl_audio_frame_t *frame, int num_samples)
Read audio samples.
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 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.
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition gavl.h:56
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_compression_info_t * gavl_packet_source_get_ci(gavl_packet_source_t *s)
Get the compression info.
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_source_get_options(gavl_audio_source_t *s)
Get coversion options of an audio source.
gavl_source_status_t(* gavl_video_source_func_t)(void *priv, gavl_video_frame_t **frame)
Prototype for obtaining one video frame.
Definition connectors.h:112
gavl_source_status_t(* gavl_audio_source_func_t)(void *priv, gavl_audio_frame_t **frame)
Prototype for obtaining one audio frame.
Definition connectors.h:101
GAVL_PUBLIC void gavl_packet_source_destroy(gavl_packet_source_t *s)
Destroy a 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.
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition gavl.h:64
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 const gavl_video_format_t * gavl_video_source_get_dst_format(gavl_video_source_t *s)
Get the output format.
GAVL_PUBLIC int gavl_packet_source_get_timescale(gavl_packet_source_t *s)
Get the time scale.
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_video_format_t * gavl_packet_source_get_video_format(gavl_packet_source_t *s)
Get the video format.
GAVL_PUBLIC void gavl_audio_source_destroy(gavl_audio_source_t *s)
Destroy an audio 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 void gavl_audio_source_skip_src(gavl_audio_source_t *s, int num_samples)
Skip audio samples at the input.
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_audio_format_t * gavl_audio_source_get_src_format(gavl_audio_source_t *s)
Get the native format.
@ GAVL_SOURCE_OK
Frame available.
Definition connectors.h:88
@ GAVL_SOURCE_EOF
End of file, no more frames available.
Definition connectors.h:87
@ GAVL_SOURCE_AGAIN
No frame available right now, might try later.
Definition connectors.h:89
struct gavl_video_options_s gavl_video_options_t
Definition gavl.h:2988
Generic container for audio samples.
Definition gavl.h:595
Compression format.
Definition compression.h:120
Packet structure.
Definition compression.h:340