gavl

Typedefs | Enumerations | Functions
A/V sinks
A/V pipeline building elements

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

## 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_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_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_audio_sink_set_free_func (gavl_audio_sink_t *sink, gavl_connector_free_func_t free_func)
| Set free function.
GAVL_PUBLIC const gavl_audio_format_t * | gavl_audio_sink_get_format (gavl_audio_sink_t *s)
| Get the format.
GAVL_PUBLIC gavl_audio_frame_t * | gavl_audio_sink_get_frame (gavl_audio_sink_t *s)
| Get a buffer for a 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.
GAVL_PUBLIC void | gavl_audio_sink_destroy (gavl_audio_sink_t *s)
| Destroy an audio sink.
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_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_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 const gavl_video_format_t * | gavl_video_sink_get_format (gavl_video_sink_t *s)
| Get the format.
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_sink_status_t | gavl_video_sink_put_frame (gavl_video_sink_t *s, gavl_video_frame_t *f)
| Output a frame.
GAVL_PUBLIC void | gavl_video_sink_destroy (gavl_video_sink_t *s)
| Destroy a video sink.
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_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 void | gavl_packet_sink_set_free_func (gavl_packet_sink_t *sink, gavl_connector_free_func_t free_func)
| Set free function.
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_reset (gavl_packet_sink_t *s)
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 void | gavl_packet_sink_destroy (gavl_packet_sink_t *s)
| Destroy a packet sink.

## 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

  priv | Private data

Returns
  An audio frame where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmapped 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

  priv | Private data
  f | An 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

  priv | Private data

Returns
  A video frame where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmapped 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

  priv | Private data
  f | A 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

  priv | Private data

Returns
  A packet where to copy the data

Sinks can use this to pass specially allocated buffers (e.g. shared or mmapped 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

  priv | Private data
  p | A packet

Returns
  GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

## Enumeration Type Documentation

## ◆ gavl_sink_status_t

enum 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_func | Function for getting a frame buffer or NULL
  put_func | Function for outputting a frame
  priv | Client data to pass to get_func and put_func
  format | Format 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

  sink | An audio sink
  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_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

  src | A audio sink
  free_func | Function 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 with 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

  s | An 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

  s | An 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

  s | An audio sink
  f | Frame

Returns
  GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceding 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

  s | An 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_func | Function for getting a frame buffer or NULL
  put_func | Function for outputting a frame
  priv | Client data to pass to get_func and put_func
  format | Format 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

  sink | A video sink
  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_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

  src | A video sink
  free_func | Function 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 with 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

  s | A 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

  s | A 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

  s | A video sink
  f | Frame

Returns
  GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceding 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

  s | A 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_func | Function for getting a packet buffer or NULL
  put_func | Function for outputting a packet
  priv | Client 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

  sink | A packet sink
  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_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

  src | A packet sink
  free_func | Function 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 with 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

  s | A 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

  s | A packet sink
  p | Packet

Returns
  GAVL_SINK_ERROR if an error happened, GAVL_SINK_OK else.

The frame must be the same as returned by the preceding 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

  s | A packet sink