compression.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GAVL_COMPRESSION_H_INCLUDED
00023 #define GAVL_COMPRESSION_H_INCLUDED
00024
00025 #include <gavl/gavldefs.h>
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00045 #define GAVL_COMPRESSION_HAS_P_FRAMES (1<<0)
00046 #define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1)
00047 #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2)
00048 #define GAVL_COMPRESSION_SBR (1<<3)
00049
00050 typedef enum
00051 {
00052 GAVL_CODEC_ID_NONE = 0,
00053
00054 GAVL_CODEC_ID_ALAW = 1,
00055 GAVL_CODEC_ID_ULAW,
00056 GAVL_CODEC_ID_MP2,
00057 GAVL_CODEC_ID_MP3,
00058 GAVL_CODEC_ID_AC3,
00059 GAVL_CODEC_ID_AAC,
00060 GAVL_CODEC_ID_VORBIS,
00061
00062
00063 GAVL_CODEC_ID_JPEG = 0x10000,
00064 GAVL_CODEC_ID_PNG,
00065 GAVL_CODEC_ID_TIFF,
00066 GAVL_CODEC_ID_TGA,
00067 GAVL_CODEC_ID_MPEG1,
00068 GAVL_CODEC_ID_MPEG2,
00069 GAVL_CODEC_ID_MPEG4_ASP,
00070 GAVL_CODEC_ID_H264,
00071 GAVL_CODEC_ID_THEORA,
00072 GAVL_CODEC_ID_DIRAC,
00073 GAVL_CODEC_ID_DV,
00074 } gavl_codec_id_t;
00075
00086 typedef struct
00087 {
00088 int flags;
00089 gavl_codec_id_t id;
00090
00091 uint8_t * global_header;
00092 int global_header_len;
00093
00094 int bitrate;
00095 int palette_size;
00096 } gavl_compression_info_t;
00097
00102 GAVL_PUBLIC
00103 void gavl_compression_info_free(gavl_compression_info_t* info);
00104
00111 GAVL_PUBLIC
00112 void gavl_compression_info_dump(const gavl_compression_info_t * info);
00113
00129 GAVL_PUBLIC
00130 const char * gavl_compression_get_extension(gavl_codec_id_t id, int * separate);
00131
00141 GAVL_PUBLIC
00142 int gavl_compression_need_pixelformat(gavl_codec_id_t id);
00143
00144
00145 #define GAVL_PACKET_TYPE_I 'I'
00146 #define GAVL_PACKET_TYPE_P 'P'
00147 #define GAVL_PACKET_TYPE_B 'B'
00148 #define GAVL_PACKET_TYPE_MASK 0xff
00149
00150 #define GAVL_PACKET_KEYFRAME (1<<8)
00151 #define GAVL_PACKET_LAST (1<<9)
00152
00153
00166 typedef struct
00167 {
00168 uint8_t * data;
00169 int data_len;
00170 int data_alloc;
00171
00172 int flags;
00173
00174 int64_t pts;
00175 int64_t duration;
00176
00177 int field2_offset;
00178 int header_size;
00179 int sequence_end_pos;
00180
00181 } gavl_packet_t;
00182
00191 GAVL_PUBLIC
00192 void gavl_packet_alloc(gavl_packet_t * p, int len);
00193
00198 GAVL_PUBLIC
00199 void gavl_packet_free(gavl_packet_t * p);
00200
00207 GAVL_PUBLIC
00208 void gavl_packet_dump(const gavl_packet_t * p);
00209
00210
00211 #ifdef __cplusplus
00212 }
00213 #endif
00214
00215
00216 #endif // GAVL_COMPRESSION_H_INCLUDED