22 #ifndef GAVL_COMPRESSION_H_INCLUDED
23 #define GAVL_COMPRESSION_H_INCLUDED
25 #include <gavl/gavldefs.h>
47 #define GAVL_COMPRESSION_HAS_P_FRAMES (1<<0)
50 #define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1)
53 #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2)
56 #define GAVL_COMPRESSION_SBR (1<<3)
59 #define GAVL_COMPRESSION_BIG_ENDIAN (1<<4)
106 #define GAVL_BITRATE_VBR -1
107 #define GAVL_BITRATE_LOSSLESS -2
194 int * global_header_len,
208 int global_header_len,
272 GAVL_PUBLIC
const char *
280 GAVL_PUBLIC
const char *
313 #define GAVL_PACKET_TYPE_I 0x01
314 #define GAVL_PACKET_TYPE_P 0x02
315 #define GAVL_PACKET_TYPE_B 0x03
316 #define GAVL_PACKET_TYPE_MASK 0x03
318 #define GAVL_PACKET_KEYFRAME (1<<2)
319 #define GAVL_PACKET_LAST (1<<3)
320 #define GAVL_PACKET_EXT (1<<4)
321 #define GAVL_PACKET_REF (1<<5)
322 #define GAVL_PACKET_NOOUTPUT (1<<6)
324 #define GAVL_PACKET_PADDING 32
444 const char * filename);
455 #endif // GAVL_COMPRESSION_H_INCLUDED
Complete DIRAC frames, sequence end code appended to last packet.
Definition: compression.h:96
const char * gavl_compression_get_mimetype(const gavl_compression_info_t *ci)
Get the mimetype for the corresponding elementary format.
GAVL_PUBLIC gavl_codec_id_t gavl_get_compression(int index)
Get a compression format for a specified index.
DTS.
Definition: compression.h:84
MPEG-1 video.
Definition: compression.h:91
uint32_t max_ref_frames
Maximum reference frames (if > 2)
Definition: compression.h:135
GAVL_PUBLIC void gavl_compression_info_dump(const gavl_compression_info_t *info)
Dump a compression info to stderr.
AAC as stored in quicktime/mp4.
Definition: compression.h:79
MPEG-1 audio layer II.
Definition: compression.h:76
Old style Divx (aka MSMPEG4V3)
Definition: compression.h:99
GAVL_PUBLIC const char * gavl_compression_get_long_name(gavl_codec_id_t id)
Return the long name of the compression.
GAVL_PUBLIC void gavl_packet_free(gavl_packet_t *p)
Free memory of a packet.
int64_t pts
Presentation time.
Definition: compression.h:347
uint32_t max_packet_size
Maximum packet size or 0 if unknown.
Definition: compression.h:133
void gavl_compression_info_init(gavl_compression_info_t *info)
Initialize a compression info.
GAVL_PUBLIC uint8_t * gavl_extract_xiph_header(uint8_t *global_header, int global_header_len, int idx, int *header_len)
Extract a Xiph packet to a global header.
int32_t dst_y
Y-coordinate in the destination frame (for overlays)
Definition: compression.h:359
GAVL_PUBLIC const char * gavl_compression_get_short_name(gavl_codec_id_t id)
Return the short name of the compression.
GAVL_PUBLIC void gavl_compression_info_dumpi(const gavl_compression_info_t *info, int num)
Dump a compression info to stderr.
int32_t dst_x
X-coordinate in the destination frame (for overlays)
Definition: compression.h:358
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition: timecode.h:43
MPEG-4 ASP (a.k.a. Divx4)
Definition: compression.h:93
int64_t duration
Duration of the contained frame.
Definition: compression.h:348
GAVL_PUBLIC void gavl_compression_info_free(gavl_compression_info_t *info)
Free all dynamically allocated memory of a compression info.
Compression format.
Definition: compression.h:119
GAVL_PUBLIC void gavl_compression_info_copy(gavl_compression_info_t *dst, const gavl_compression_info_t *src)
Copy a compression info.
int data_alloc
How many bytes got allocated.
Definition: compression.h:343
Integer rectangle.
Definition: gavl.h:1365
GAVL_PUBLIC void gavl_packet_save(const gavl_packet_t *p, const char *filename)
Save a packet to a file.
gavl_timecode_t timecode
Timecode.
Definition: compression.h:355
H.264 (Annex B)
Definition: compression.h:94
GAVL_PUBLIC void gavl_packet_dump(const gavl_packet_t *p)
Dump a packet to stderr.
GAVL_PUBLIC void gavl_packet_reset(gavl_packet_t *p)
Reset a packet.
GAVL_PUBLIC void gavl_append_xiph_header(uint8_t **global_header, int *global_header_len, uint8_t *header, int header_len)
Append a Xiph packet to a global header.
Flac (extradata contain a file header without comment and seektable)
Definition: compression.h:81
Vorbis (segmented extradata and packets)
Definition: compression.h:80
uint32_t header_size
Size of a repeated global header (or 0)
Definition: compression.h:351
uint32_t video_buffer_size
VBV buffer size for video (in BYTES)
Definition: compression.h:131
TIFF image.
Definition: compression.h:89
alaw 2:1
Definition: compression.h:74
JPEG image.
Definition: compression.h:87
uint32_t flags
ORed combination of GAVL_COMPRESSION_* flags.
Definition: compression.h:121
int palette_size
Size of the embedded palette for image codecs.
Definition: compression.h:128
uint32_t field2_offset
Offset of field 2 for field pictures.
Definition: compression.h:350
gavl_rectangle_i_t src_rect
Rectangle to take from a video frame.
Definition: compression.h:357
uint8_t * data
Data.
Definition: compression.h:341
GAVL_PUBLIC int gavl_compression_get_sample_size(gavl_codec_id_t id)
Check if an audio compression size for each samples.
GAVL_PUBLIC const char * gavl_compression_get_extension(gavl_codec_id_t id, int *separate)
Get the file extension of the corresponding raw format.
Unknown/unsupported compression format. In gavf files this signals that the stream consists of uncomp...
Definition: compression.h:72
gavl_codec_id_t id
Codec ID.
Definition: compression.h:122
uint8_t * global_header
Global header.
Definition: compression.h:124
uint32_t flags
ORed combination of GAVL_PACKET_* flags.
Definition: compression.h:345
MPEG-1/2 audio layer 3 CBR/VBR.
Definition: compression.h:77
MPEG-2 video.
Definition: compression.h:92
VP8 (as used in webm)
Definition: compression.h:98
TGA image.
Definition: compression.h:90
GAVL_PUBLIC void gavl_packet_copy(gavl_packet_t *dst, const gavl_packet_t *src)
Copy a packet.
gavl_codec_id_t
Codec ID.
Definition: compression.h:66
int32_t bitrate
Needed by some codecs, negative values mean VBR.
Definition: compression.h:127
DV (several variants)
Definition: compression.h:97
uint32_t sequence_end_pos
Position of sequence end code if any.
Definition: compression.h:352
int data_len
Length of data.
Definition: compression.h:342
Speex.
Definition: compression.h:83
DVD subtitles, palette is in header.
Definition: compression.h:102
Theora (segmented extradata)
Definition: compression.h:95
GAVL_PUBLIC int gavl_compression_constant_frame_samples(gavl_codec_id_t id)
Check if an audio compression constant frame samples.
PNG image.
Definition: compression.h:88
GAVL_PUBLIC int gavl_compression_need_pixelformat(gavl_codec_id_t id)
Check if the compression supports multiple pixelformats.
mu-law 2:1
Definition: compression.h:75
uint32_t pre_skip
Samples to skip at the start.
Definition: compression.h:129
GAVL_PUBLIC void gavl_packet_alloc(gavl_packet_t *p, int len)
Allocate memory for a packet.
Packet structure.
Definition: compression.h:339
AC3.
Definition: compression.h:78
GAVL_PUBLIC gavl_codec_id_t gavl_compression_from_short_name(const char *name)
Get a compression from the short name.
uint32_t global_header_len
Length of global header.
Definition: compression.h:125
uint32_t id
ID of the gavf stream where this packet belongs.
Definition: compression.h:361
GAVL_PUBLIC void gavl_packet_copy_metadata(gavl_packet_t *dst, const gavl_packet_t *src)
Copy metadata of a packet.
GAVL_PUBLIC void gavl_packet_init(gavl_packet_t *p)
Initialize a packet.
gavl_interlace_mode_t interlace_mode
Interlace mode for mixed interlacing.
Definition: compression.h:354
GAVL_PUBLIC int gavl_num_compressions()
Get the number of compression formats.
Opus.
Definition: compression.h:82