Compressed stream support.
More...
|
enum | gavl_codec_id_t {
GAVL_CODEC_ID_NONE = 0,
GAVL_CODEC_ID_ALAW = 1,
GAVL_CODEC_ID_ULAW,
GAVL_CODEC_ID_MP2,
GAVL_CODEC_ID_MP3,
GAVL_CODEC_ID_AC3,
GAVL_CODEC_ID_AAC,
GAVL_CODEC_ID_VORBIS,
GAVL_CODEC_ID_FLAC,
GAVL_CODEC_ID_JPEG = 0x10000,
GAVL_CODEC_ID_PNG,
GAVL_CODEC_ID_TIFF,
GAVL_CODEC_ID_TGA,
GAVL_CODEC_ID_MPEG1,
GAVL_CODEC_ID_MPEG2,
GAVL_CODEC_ID_MPEG4_ASP,
GAVL_CODEC_ID_H264,
GAVL_CODEC_ID_THEORA,
GAVL_CODEC_ID_DIRAC,
GAVL_CODEC_ID_DV
} |
| Codec ID. More...
|
|
Compressed stream support.
gavl provides some structures and functions for handling compressed data packets. It is a completely independent API layer and has nothing to do with the uncompressed video and audio API. In particular the conversion between compressed and uncompressed data (i.e. codecs) are outside the scope of gavl. These are implemented in gmerlin-avdecoder and gmerlin encoding plugins.
◆ GAVL_COMPRESSION_HAS_P_FRAMES
#define GAVL_COMPRESSION_HAS_P_FRAMES (1<<0) |
Not all frames are keyframes.
◆ GAVL_COMPRESSION_HAS_B_FRAMES
#define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1) |
Frames don't appear in presentation order.
◆ GAVL_COMPRESSION_HAS_FIELD_PICTURES
#define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2) |
Packets can consist of 2 consecutive fields.
◆ GAVL_COMPRESSION_SBR
#define GAVL_COMPRESSION_SBR (1<<3) |
Samplerate got doubled by decoder, format and sample counts are for the upsampled rate.
◆ GAVL_PACKET_TYPE_I
#define GAVL_PACKET_TYPE_I 'I' |
◆ GAVL_PACKET_TYPE_P
#define GAVL_PACKET_TYPE_P 'P' |
◆ GAVL_PACKET_TYPE_B
#define GAVL_PACKET_TYPE_B 'B' |
◆ GAVL_PACKET_TYPE_MASK
#define GAVL_PACKET_TYPE_MASK 0xff |
◆ GAVL_PACKET_KEYFRAME
#define GAVL_PACKET_KEYFRAME (1<<8) |
◆ GAVL_PACKET_LAST
#define GAVL_PACKET_LAST (1<<9) |
Packet is the last in the stream (only Xiph codecs need this flag)
◆ gavl_codec_id_t
Codec ID.
These are used as identifiers for the type of compression
Enumerator |
---|
GAVL_CODEC_ID_NONE | Unknown/unsupported compression format.
|
GAVL_CODEC_ID_ALAW | alaw 2:1
|
GAVL_CODEC_ID_ULAW | mu-law 2:1
|
GAVL_CODEC_ID_MP2 | MPEG-1 audio layer II.
|
GAVL_CODEC_ID_MP3 | MPEG-1/2 audio layer 3 CBR/VBR.
|
GAVL_CODEC_ID_AC3 | AC3.
|
GAVL_CODEC_ID_AAC | AAC as stored in quicktime/mp4.
|
GAVL_CODEC_ID_VORBIS | Vorbis (segmented extradata and packets)
|
GAVL_CODEC_ID_FLAC | Flac (extradata contain a file header without comment and seektable)
|
GAVL_CODEC_ID_JPEG | JPEG image.
|
GAVL_CODEC_ID_PNG | PNG image.
|
GAVL_CODEC_ID_TIFF | TIFF image.
|
GAVL_CODEC_ID_TGA | TGA image.
|
GAVL_CODEC_ID_MPEG1 | MPEG-1 video.
|
GAVL_CODEC_ID_MPEG2 | MPEG-2 video.
|
GAVL_CODEC_ID_MPEG4_ASP | MPEG-4 ASP (a.k.a. Divx4)
|
GAVL_CODEC_ID_H264 | H.264 (Annex B)
|
GAVL_CODEC_ID_THEORA | Theora (segmented extradata)
|
GAVL_CODEC_ID_DIRAC | Complete DIRAC frames, sequence end code appended to last packet.
|
GAVL_CODEC_ID_DV | DV (several variants)
|
◆ gavl_compression_info_free()
Free all dynamically allocated memory of a compression info.
- Parameters
-
◆ gavl_compression_info_dump()
Dump a compression info to stderr.
- Parameters
-
Use this for debugging
◆ gavl_compression_info_copy()
Copy a compression info.
- Parameters
-
◆ gavl_compression_get_extension()
GAVL_PUBLIC const char* gavl_compression_get_extension |
( |
gavl_codec_id_t |
id, |
|
|
int * |
separate |
|
) |
| |
Get the file extension of the corresponding raw format.
- Parameters
-
id | A codec ID |
separate | If non-null returns 1 if each packet should be in a separate file |
- Returns
- The file extension of the raw file or NULL
This function can be used for writing elementary streams to files. It returns a suitable file extension. If separate is 1, each packet should be written to a separate file. This basically means, that the codec corresponds to an image format.
Not all compression formats have a suitable elementary stream format, in this case NULL is returned for the extension. Most prominent examples are Vorbis and Theora, which can hardly exist outside an OGG container.
◆ gavl_compression_need_pixelformat()
Check if the compression supports multiple pixelformats.
- Parameters
-
- Returns
- 1 if the compression ID must be associated with a pixelformat, 0 else
This function can be used by decoding libraries to check if the compresison ID is sufficient or if the pixelformat must be valid in the associated video format.
◆ gavl_compression_constant_frame_samples()
GAVL_PUBLIC int gavl_compression_constant_frame_samples |
( |
gavl_codec_id_t |
id | ) |
|
Check if an audio compression constant frame samples.
- Parameters
-
- Returns
- 1 if the compression has the same number of samples in each frame, 0 else
◆ gavl_packet_alloc()
GAVL_PUBLIC void gavl_packet_alloc |
( |
gavl_packet_t * |
p, |
|
|
int |
len |
|
) |
| |
Allocate memory for a packet.
- Parameters
-
p | A packet |
len | Number of bytes you want to store in the packet |
This function uses realloc(), which means that it preserves the data already contained in the packet.
◆ gavl_packet_free()
Free memory of a packet.
- Parameters
-
◆ gavl_packet_dump()
Dump a packet to stderr.
- Parameters
-
Use this for debugging