gavl
Typedefs | Enumerations | Functions

Typedefs

typedef struct gavl_audio_sink_s gavl_audio_sink_t
 Audio sink. More...
 
typedef struct gavl_video_sink_s gavl_video_sink_t
 Video sink. More...
 
typedef struct gavl_packet_sink_s gavl_packet_sink_t
 Packet sink. More...
 
typedef gavl_audio_frame_t *(* gavl_audio_sink_get_func) (void *priv)
 Prototype for getting a frame buffer. More...
 
typedef gavl_sink_status_t(* gavl_audio_sink_put_func) (void *priv, gavl_audio_frame_t *f)
 Prototype for putting a frame. More...
 
typedef gavl_video_frame_t *(* gavl_video_sink_get_func) (void *priv)
 Prototype for getting a frame buffer. More...
 
typedef gavl_sink_status_t(* gavl_video_sink_put_func) (void *priv, gavl_video_frame_t *f)
 Prototype for putting a frame. More...
 
typedef gavl_packet_t *(* gavl_packet_sink_get_func) (void *priv)
 Prototype for getting a packet buffer. More...
 
typedef gavl_sink_status_t(* gavl_packet_sink_put_func) (void *priv, gavl_packet_t *p)
 Prototype for putting a frame. More...
 

Enumerations

enum  gavl_sink_status_t {
  GAVL_SINK_ERROR ,
  GAVL_SINK_OK
}
 Return status of the sink functions. More...
 

Functions

GAVL_PUBLIC gavl_audio_sink_tgavl_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. More...
 
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. More...
 
GAVL_PUBLIC void gavl_audio_sink_set_free_func (gavl_audio_sink_t *sink, gavl_connector_free_func_t free_func)
 Set free function. More...
 
GAVL_PUBLIC const gavl_audio_format_tgavl_audio_sink_get_format (gavl_audio_sink_t *s)
 Get the format. More...
 
GAVL_PUBLIC gavl_audio_frame_tgavl_audio_sink_get_frame (gavl_audio_sink_t *s)
 Get a buffer for a frame. More...
 
GAVL_PUBLIC gavl_sink_status_t gavl_audio_sink_put_frame (gavl_audio_sink_t *s, gavl_audio_frame_t *f)
 Output a frame. More...
 
GAVL_PUBLIC void gavl_audio_sink_destroy (gavl_audio_sink_t *s)
 Destroy an audio sink. More...
 
GAVL_PUBLIC gavl_video_sink_tgavl_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. More...
 
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. More...
 
GAVL_PUBLIC void gavl_video_sink_set_free_func (gavl_video_sink_t *sink, gavl_connector_free_func_t free_func)
 Set free function. More...
 
GAVL_PUBLIC const gavl_video_format_tgavl_video_sink_get_format (gavl_video_sink_t *s)
 Get the format. More...
 
GAVL_PUBLIC gavl_video_frame_tgavl_video_sink_get_frame (gavl_video_sink_t *s)
 Get a buffer for a frame. More...
 
GAVL_PUBLIC gavl_sink_status_t gavl_video_sink_put_frame (gavl_video_sink_t *s, gavl_video_frame_t *f)
 Output a frame. More...
 
GAVL_PUBLIC void gavl_video_sink_destroy (gavl_video_sink_t *s)
 Destroy a video sink. More...
 
GAVL_PUBLIC gavl_packet_sink_tgavl_packet_sink_create (gavl_packet_sink_get_func get_func, gavl_packet_sink_put_func put_func, void *priv)
 Create a packet sink. More...
 
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. More...
 
GAVL_PUBLIC void gavl_packet_sink_set_free_func (gavl_packet_sink_t *sink, gavl_connector_free_func_t free_func)
 Set free function. More...
 
GAVL_PUBLIC gavl_packet_tgavl_packet_sink_get_packet (gavl_packet_sink_t *s)
 Get a buffer for a packet. More...
 
GAVL_PUBLIC gavl_sink_status_t gavl_packet_sink_put_packet (gavl_packet_sink_t *s, gavl_packet_t *p)
 Output a frame. More...
 
GAVL_PUBLIC void gavl_packet_sink_destroy (gavl_packet_sink_t *s)
 Destroy a packet sink. More...
 

Detailed Description

This is a thin layer for a unified handling of A/V sinks. A sink can either supply a frame where the data could be copied or you pass a frame allocated by yourself to the sink. Sinks don't do format conversion. Instead you need to obtain the format and pass this to the source where you read data from.

Typedef Documentation

◆ gavl_audio_sink_t

typedef struct gavl_audio_sink_s gavl_audio_sink_t

Audio sink.

You don't want to know what's inside

◆ gavl_video_sink_t

typedef struct gavl_video_sink_s gavl_video_sink_t

Video sink.

You don't want to know what's inside

◆ gavl_packet_sink_t

typedef struct gavl_packet_sink_s gavl_packet_sink_t

Packet sink.

You don't want to know what's inside

◆ gavl_audio_sink_get_func

typedef gavl_audio_frame_t*(* gavl_audio_sink_get_func) (void *priv)

Prototype for getting a frame buffer.

Parameters
privPrivate data
Returns
An audio frame where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmaped memory) to the client

◆ gavl_audio_sink_put_func

typedef gavl_sink_status_t(* gavl_audio_sink_put_func) (void *priv, gavl_audio_frame_t *f)

Prototype for putting a frame.

Parameters
privPrivate data
fAn audio frame
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

◆ gavl_video_sink_get_func

typedef gavl_video_frame_t*(* gavl_video_sink_get_func) (void *priv)

Prototype for getting a frame buffer.

Parameters
privPrivate data
Returns
A video frame where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmaped memory) to the client

◆ gavl_video_sink_put_func

typedef gavl_sink_status_t(* gavl_video_sink_put_func) (void *priv, gavl_video_frame_t *f)

Prototype for putting a frame.

Parameters
privPrivate data
fA video frame
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

◆ gavl_packet_sink_get_func

typedef gavl_packet_t*(* gavl_packet_sink_get_func) (void *priv)

Prototype for getting a packet buffer.

Parameters
privPrivate data
Returns
A packet where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmaped memory) to the client

◆ gavl_packet_sink_put_func

typedef gavl_sink_status_t(* gavl_packet_sink_put_func) (void *priv, gavl_packet_t *p)

Prototype for putting a frame.

Parameters
privPrivate data
pA packet
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

Enumeration Type Documentation

◆ gavl_sink_status_t

Return status of the sink functions.

Enumerator
GAVL_SINK_ERROR 

Something went wrong.

GAVL_SINK_OK 

Frame was successfully processed.

Function Documentation

◆ gavl_audio_sink_create()

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.

Parameters
get_funcFunction for getting a frame buffer or NULL
put_funcFunction for outputting a frame
privClient data to pass to get_func and put_func
formatFormat in which we accept the data
Returns
A newly created audio sink

◆ gavl_audio_sink_set_lock_funcs()

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.

Parameters
sinkAn audio sink
lock_funcFunction called before a packet is read
unlock_funcFunction called after a packet is read
privClient data (e.g. a mutex) to pass to the functions

◆ gavl_audio_sink_set_free_func()

GAVL_PUBLIC void gavl_audio_sink_set_free_func ( gavl_audio_sink_t sink,
gavl_connector_free_func_t  free_func 
)

Set free function.

Parameters
srcA audio sink
free_funcFunction called with the private data when the sink is destroyed

Use this if you don't want to keep a reference to the private data along wit the sink

◆ gavl_audio_sink_get_format()

GAVL_PUBLIC const gavl_audio_format_t* gavl_audio_sink_get_format ( gavl_audio_sink_t s)

Get the format.

Parameters
sAn audio sink
Returns
format in which the sink accepts data

◆ gavl_audio_sink_get_frame()

GAVL_PUBLIC gavl_audio_frame_t* gavl_audio_sink_get_frame ( gavl_audio_sink_t s)

Get a buffer for a frame.

Parameters
sAn audio sink
Returns
A frame buffer

This function must be called before gavl_audio_sink_put_frame. If it returns non-NULL, the same frame must be passed to the next call to gavl_audio_sink_put_frame.

◆ gavl_audio_sink_put_frame()

GAVL_PUBLIC gavl_sink_status_t gavl_audio_sink_put_frame ( gavl_audio_sink_t s,
gavl_audio_frame_t f 
)

Output a frame.

Parameters
sAn audio sink
fFrame
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceeding call to gavl_audio_sink_get_frame if it was not NULL.

◆ gavl_audio_sink_destroy()

GAVL_PUBLIC void gavl_audio_sink_destroy ( gavl_audio_sink_t s)

Destroy an audio sink.

Parameters
sAn audio sink

◆ gavl_video_sink_create()

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.

Parameters
get_funcFunction for getting a frame buffer or NULL
put_funcFunction for outputting a frame
privClient data to pass to get_func and put_func
formatFormat in which we accept the data
Returns
A newly created video sink

◆ gavl_video_sink_set_lock_funcs()

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.

Parameters
sinkA video sink
lock_funcFunction called before a packet is read
unlock_funcFunction called after a packet is read
privClient data (e.g. a mutex) to pass to the functions

◆ gavl_video_sink_set_free_func()

GAVL_PUBLIC void gavl_video_sink_set_free_func ( gavl_video_sink_t sink,
gavl_connector_free_func_t  free_func 
)

Set free function.

Parameters
srcA video sink
free_funcFunction called with the private data when the sink is destroyed

Use this if you don't want to keep a reference to the private data along wit the sink

◆ gavl_video_sink_get_format()

GAVL_PUBLIC const gavl_video_format_t* gavl_video_sink_get_format ( gavl_video_sink_t s)

Get the format.

Parameters
sA video sink
Returns
format in which the sink accepts data

◆ gavl_video_sink_get_frame()

GAVL_PUBLIC gavl_video_frame_t* gavl_video_sink_get_frame ( gavl_video_sink_t s)

Get a buffer for a frame.

Parameters
sA video sink
Returns
A frame buffer

This function must be called before gavl_video_sink_put_frame. If it returns non-NULL, the same frame must be passed to the next call to gavl_video_sink_put_frame.

◆ gavl_video_sink_put_frame()

GAVL_PUBLIC gavl_sink_status_t gavl_video_sink_put_frame ( gavl_video_sink_t s,
gavl_video_frame_t f 
)

Output a frame.

Parameters
sA video sink
fFrame
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceeding call to gavl_video_sink_get_frame if it was not NULL.

◆ gavl_video_sink_destroy()

GAVL_PUBLIC void gavl_video_sink_destroy ( gavl_video_sink_t s)

Destroy a video sink.

Parameters
sA video sink

◆ gavl_packet_sink_create()

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.

Parameters
get_funcFunction for getting a packet buffer or NULL
put_funcFunction for outputting a packet
privClient data to pass to get_func and put_func
Returns
A newly created packet sink

◆ gavl_packet_sink_set_lock_funcs()

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.

Parameters
sinkA packet sink
lock_funcFunction called before a packet is read
unlock_funcFunction called after a packet is read
privClient data (e.g. a mutex) to pass to the functions

◆ gavl_packet_sink_set_free_func()

GAVL_PUBLIC void gavl_packet_sink_set_free_func ( gavl_packet_sink_t sink,
gavl_connector_free_func_t  free_func 
)

Set free function.

Parameters
srcA packet sink
free_funcFunction called with the private data when the sink is destroyed

Use this if you don't want to keep a reference to the private data along wit the sink

◆ gavl_packet_sink_get_packet()

GAVL_PUBLIC gavl_packet_t* gavl_packet_sink_get_packet ( gavl_packet_sink_t s)

Get a buffer for a packet.

Parameters
sA packet sink
Returns
A packet buffer

This function must be called before gavl_packet_sink_put_packet. If it returns non-NULL, the same frame must be passed to the next call to gavl_packet_sink_put_packet.

◆ gavl_packet_sink_put_packet()

GAVL_PUBLIC gavl_sink_status_t gavl_packet_sink_put_packet ( gavl_packet_sink_t s,
gavl_packet_t p 
)

Output a frame.

Parameters
sA packet sink
pPacket
Returns
GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceeding call to gavl_packet_sink_get_packet if it was not NULL.

◆ gavl_packet_sink_destroy()

GAVL_PUBLIC void gavl_packet_sink_destroy ( gavl_packet_sink_t s)

Destroy a packet sink.

Parameters
sA packet sink