28#ifndef GAVL_CONNECTORS_H_INCLUDED
29#define GAVL_CONNECTORS_H_INCLUDED
32#include <gavl/trackinfo.h>
33#include <gavl/compression.h>
56typedef void (*gavl_connector_lock_func_t)(
void * priv);
62typedef void (*gavl_connector_free_func_t)(
void * priv);
137#define GAVL_SOURCE_SRC_ALLOC (1<<0)
144#define GAVL_SOURCE_SRC_FRAMESIZE_MAX (1<<2)
150#define GAVL_SOURCE_SRC_DISCONTINUOUS (1<<3)
166 void * priv,
int src_flags,
191 void * priv,
int src_flags,
203 gavl_connector_lock_func_t lock_func,
204 gavl_connector_lock_func_t unlock_func,
216 gavl_connector_free_func_t free_func);
335 void * priv,
int src_flags,
360 void * priv,
int src_flags,
373 gavl_connector_lock_func_t lock_func,
374 gavl_connector_lock_func_t unlock_func,
386 gavl_connector_free_func_t free_func);
472 int64_t t,
int scale);
530 void * priv,
int src_flags,
const gavl_dictionary_t * s);
543GAVL_PUBLIC
const gavl_dictionary_t *
546GAVL_PUBLIC gavl_dictionary_t *
560 void * priv,
int src_flags,
573 gavl_connector_lock_func_t lock_func,
574 gavl_connector_lock_func_t unlock_func,
586 gavl_connector_free_func_t free_func);
632gavl_packet_source_peek_packet(
void*sp, gavl_packet_t ** p);
679(*gavl_audio_sink_get_func)(
void * priv);
713 gavl_connector_lock_func_t lock_func,
714 gavl_connector_lock_func_t unlock_func,
726 gavl_connector_free_func_t free_func);
779typedef gavl_video_frame_t *
780(*gavl_video_sink_get_func)(
void * priv);
814 gavl_connector_lock_func_t lock_func,
815 gavl_connector_lock_func_t unlock_func,
827 gavl_connector_free_func_t free_func);
847GAVL_PUBLIC gavl_video_frame_t *
879typedef gavl_packet_t *
880(*gavl_packet_sink_get_func)(
void * priv);
912 gavl_connector_lock_func_t lock_func,
913 gavl_connector_lock_func_t unlock_func,
925 gavl_connector_free_func_t free_func);
937GAVL_PUBLIC gavl_packet_t *
970typedef struct gavl_packet_buffer_s
974gavl_packet_buffer_t * gavl_packet_buffer_create(
const gavl_dictionary_t * stream_info);
977void gavl_packet_buffer_destroy(gavl_packet_buffer_t *);
980void gavl_packet_buffer_flush(gavl_packet_buffer_t *);
983void gavl_packet_buffer_clear(gavl_packet_buffer_t *);
994void gavl_packet_buffer_set_out_pts(gavl_packet_buffer_t * buf, int64_t pts);
1002void gavl_packet_buffer_set_mark_last(gavl_packet_buffer_t * buf,
int mark);
1005void gavl_packet_buffer_set_calc_frame_durations(gavl_packet_buffer_t * buf,
int calc);
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition gavl.h:1004
struct gavl_video_sink_s gavl_video_sink_t
Video sink.
Definition gavl.h:83
GAVL_PUBLIC void gavl_video_sink_set_free_func(gavl_video_sink_t *sink, gavl_connector_free_func_t free_func)
Set free function.
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:889
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:664
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:74
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition gavl.h:92
GAVL_PUBLIC void gavl_audio_sink_set_free_func(gavl_audio_sink_t *sink, gavl_connector_free_func_t free_func)
Set free function.
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:688
gavl_audio_frame_t *(* gavl_audio_sink_get_func)(void *priv)
Prototype for getting a frame buffer.
Definition connectors.h:679
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_packet_sink_set_free_func(gavl_packet_sink_t *sink, gavl_connector_free_func_t free_func)
Set free function.
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:780
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:880
gavl_sink_status_t(* gavl_video_sink_put_func)(void *priv, gavl_video_frame_t *f)
Prototype for putting a frame.
Definition connectors.h:789
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:666
@ GAVL_SINK_ERROR
Something went wrong.
Definition connectors.h:665
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:131
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(gavl_packet_source_func_t func, void *priv, int src_flags, const gavl_dictionary_t *s)
Create a 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:50
GAVL_PUBLIC void gavl_audio_source_set_free_func(gavl_audio_source_t *src, gavl_connector_free_func_t free_func)
Set free function.
GAVL_PUBLIC void gavl_audio_source_skip(gavl_audio_source_t *s, int num_samples)
Skip audio samples at the input.
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:94
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 int gavl_video_source_get_src_flags(gavl_video_source_t *s)
Get the source flags.
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 void gavl_video_source_set_free_func(gavl_video_source_t *src, gavl_connector_free_func_t free_func)
Set free function.
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 conversion 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.
GAVL_PUBLIC void gavl_video_source_support_hw(gavl_video_source_t *s)
Enable hardware surfaces.
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition gavl.h:58
GAVL_PUBLIC const gavl_audio_format_t * gavl_packet_source_get_audio_format(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 conversion 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:120
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:109
GAVL_PUBLIC void gavl_packet_source_destroy(gavl_packet_source_t *s)
Destroy a packet source.
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition gavl.h:66
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_packet_source_set_free_func(gavl_packet_source_t *src, gavl_connector_free_func_t free_func)
Set free function.
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_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 int gavl_audio_source_get_dst_flags(gavl_audio_source_t *s)
Get the output flags.
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:96
@ GAVL_SOURCE_EOF
End of file, no more frames available.
Definition connectors.h:95
@ GAVL_SOURCE_AGAIN
No frame available right now, might try later.
Definition connectors.h:97
struct gavl_video_options_s gavl_video_options_t
Definition gavl.h:3230
Generic container for audio samples.
Definition gavl.h:624