Read compressed media packets
Decoding of multimedia streams

## Functions

BGAV_PUBLIC int | bgav_get_audio_compression_info (bgav_t *bgav, int stream, gavl_compression_info_t *info)
| Get audio compression info. More...
BGAV_PUBLIC int | bgav_get_video_compression_info (bgav_t *bgav, int stream, gavl_compression_info_t *info)
| Get video compression info. More...
BGAV_PUBLIC int | bgav_read_audio_packet (bgav_t *bgav, int stream, gavl_packet_t *p)
| Read compressed audio packet. More...
BGAV_PUBLIC int | bgav_read_video_packet (bgav_t *bgav, int stream, gavl_packet_t *p)
| Read compressed video packet. More...

## Detailed Description

This API layer allows you to read compressed media packets from the stream bypassing the codecs. You can read some streams of a file as compressed packets while decoding others. You can however not mix read calls for compressed packets and decompressed frames in a single stream. Reading compressed packets is supported only for a subset of codecs, which are defined by the gavl_codec_id_t. If your application supports compressed packets, you can first get the compression info with bgav_get_audio_compression_info or bgav_get_video_compression_info. If you support this compression, set the stream mode to BGAV_STREAM_READRAW. Before reading you must call bgav_start. Packets are then read with bgav_read_audio_packet and bgav_read_video_packet.

## Function Documentation

BGAV_PUBLIC int bgav_get_audio_compression_info | ( | bgav_t * | bgav,
|  | int | stream,
|  | gavl_compression_info_t * | info
| ) |  |

Get audio compression info.

Parameters

  bgav | A decoder instance
  stream | Stream index (starting with 0)
  info | Returns the compression info

Returns
  1 if a compression info was returned, 0 else

This function must be called after bgav_select_track. Before selecting the track the compression info might not be complete. Free the returned compression info with gavl_compression_info_free.

BGAV_PUBLIC int bgav_get_video_compression_info | ( | bgav_t * | bgav,
|  | int | stream,
|  | gavl_compression_info_t * | info
| ) |  |

Get video compression info.

Parameters

  bgav | A decoder instance
  stream | Stream index (starting with 0)
  info | Returns the compression info

Returns
  1 if a compression info was returned, 0 else

This function must be called after bgav_select_track. Before selecting the track the compression info might not be complete. Free the returned compression info with gavl_compression_info_free.

BGAV_PUBLIC int bgav_read_audio_packet | ( | bgav_t * | bgav,
|  | int | stream,
|  | gavl_packet_t * | p
| ) |  |

Read compressed audio packet.

Parameters

  bgav | A decoder instance
  stream | Stream index (starting with 0)
  p | Returns the packet

Returns
  1 if a packet was read, 0 else

You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.

BGAV_PUBLIC int bgav_read_video_packet | ( | bgav_t * | bgav,
|  | int | stream,
|  | gavl_packet_t * | p
| ) |  |

Read compressed video packet.

Parameters

  bgav | A decoder instance
  stream | Stream index (starting with 0)
  p | Returns the packet

Returns
  1 if a packet was read, 0 else

You can pass the same packet multiple times to a read fuction. Use gavl_packet_free when it's no longer used.