gavl
Main Page
Modules
Data Structures
Files
File List
Globals
include
gavl
compression.h
1
/*****************************************************************
2
* gavl - a general purpose audio/video processing library
3
*
4
* Copyright (c) 2001 - 2012 Members of the Gmerlin project
5
* gmerlin-general@lists.sourceforge.net
6
* http://gmerlin.sourceforge.net
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
* *****************************************************************/
21
22
#ifndef GAVL_COMPRESSION_H_INCLUDED
23
#define GAVL_COMPRESSION_H_INCLUDED
24
25
#include <gavl/gavldefs.h>
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
47
#define GAVL_COMPRESSION_HAS_P_FRAMES (1<<0)
48
50
#define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1)
51
52
53
#define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2)
54
56
#define GAVL_COMPRESSION_SBR (1<<3)
57
59
#define GAVL_COMPRESSION_BIG_ENDIAN (1<<4)
60
66
typedef
enum
67
{
68
72
GAVL_CODEC_ID_NONE
= 0,
73
/* Audio */
74
GAVL_CODEC_ID_ALAW
= 1,
75
GAVL_CODEC_ID_ULAW
,
76
GAVL_CODEC_ID_MP2
,
77
GAVL_CODEC_ID_MP3
,
78
GAVL_CODEC_ID_AC3
,
79
GAVL_CODEC_ID_AAC
,
80
GAVL_CODEC_ID_VORBIS
,
81
GAVL_CODEC_ID_FLAC
,
82
GAVL_CODEC_ID_OPUS
,
83
GAVL_CODEC_ID_SPEEX
,
84
GAVL_CODEC_ID_DTS
,
85
86
/* Video */
87
GAVL_CODEC_ID_JPEG
= 0x10000,
88
GAVL_CODEC_ID_PNG
,
89
GAVL_CODEC_ID_TIFF
,
90
GAVL_CODEC_ID_TGA
,
91
GAVL_CODEC_ID_MPEG1
,
92
GAVL_CODEC_ID_MPEG2
,
93
GAVL_CODEC_ID_MPEG4_ASP
,
94
GAVL_CODEC_ID_H264
,
95
GAVL_CODEC_ID_THEORA
,
96
GAVL_CODEC_ID_DIRAC
,
97
GAVL_CODEC_ID_DV
,
98
GAVL_CODEC_ID_VP8
,
99
GAVL_CODEC_ID_DIV3
,
100
101
/* Subtitle (some video codecs can handle subtitles also */
102
GAVL_CODEC_ID_DVDSUB
= 0x20000,
103
104
}
gavl_codec_id_t
;
105
106
#define GAVL_BITRATE_VBR -1
107
#define GAVL_BITRATE_LOSSLESS -2
108
109
119
typedef
struct
120
{
121
uint32_t
flags
;
122
gavl_codec_id_t
id
;
123
124
uint8_t *
global_header
;
125
uint32_t
global_header_len
;
126
127
int32_t
bitrate
;
128
int
palette_size
;
129
uint32_t
pre_skip
;
130
131
uint32_t
video_buffer_size
;
132
133
uint32_t
max_packet_size
;
134
135
uint32_t
max_ref_frames
;
136
137
}
gavl_compression_info_t
;
138
146
void
gavl_compression_info_init
(
gavl_compression_info_t
* info);
147
152
GAVL_PUBLIC
153
void
gavl_compression_info_free
(
gavl_compression_info_t
* info);
154
161
GAVL_PUBLIC
162
void
gavl_compression_info_dump
(
const
gavl_compression_info_t
* info);
163
172
GAVL_PUBLIC
173
void
gavl_compression_info_dumpi
(
const
gavl_compression_info_t
* info,
int
num);
174
181
GAVL_PUBLIC
182
void
gavl_compression_info_copy
(
gavl_compression_info_t
* dst,
183
const
gavl_compression_info_t
* src);
184
192
GAVL_PUBLIC
193
void
gavl_append_xiph_header
(uint8_t ** global_header,
194
int
* global_header_len,
195
uint8_t * header,
196
int
header_len);
197
206
GAVL_PUBLIC
207
uint8_t *
gavl_extract_xiph_header
(uint8_t * global_header,
208
int
global_header_len,
209
int
idx,
210
int
* header_len);
211
212
228
GAVL_PUBLIC
229
const
char
*
gavl_compression_get_extension
(
gavl_codec_id_t
id
,
int
* separate);
230
240
GAVL_PUBLIC
241
int
gavl_compression_need_pixelformat
(
gavl_codec_id_t
id
);
242
248
const
char
*
gavl_compression_get_mimetype
(
const
gavl_compression_info_t
* ci);
249
256
GAVL_PUBLIC
257
int
gavl_compression_constant_frame_samples
(
gavl_codec_id_t
id
);
258
264
GAVL_PUBLIC
265
int
gavl_compression_get_sample_size
(
gavl_codec_id_t
id
);
266
272
GAVL_PUBLIC
const
char
*
273
gavl_compression_get_long_name
(
gavl_codec_id_t
id
);
274
280
GAVL_PUBLIC
const
char
*
281
gavl_compression_get_short_name
(
gavl_codec_id_t
id
);
282
288
GAVL_PUBLIC
gavl_codec_id_t
289
gavl_compression_from_short_name
(
const
char
* name);
290
298
GAVL_PUBLIC
299
int
gavl_num_compressions
();
300
309
GAVL_PUBLIC
310
gavl_codec_id_t
gavl_get_compression
(
int
index);
311
312
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
317
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)
323
324
#define GAVL_PACKET_PADDING 32
325
326
339
typedef
struct
340
{
341
uint8_t *
data
;
342
int
data_len
;
343
int
data_alloc
;
344
345
uint32_t
flags
;
346
347
int64_t
pts
;
348
int64_t
duration
;
349
350
uint32_t
field2_offset
;
351
uint32_t
header_size
;
352
uint32_t
sequence_end_pos
;
353
354
gavl_interlace_mode_t
interlace_mode
;
355
gavl_timecode_t
timecode
;
356
357
gavl_rectangle_i_t
src_rect
;
358
int32_t
dst_x
;
359
int32_t
dst_y
;
360
361
uint32_t
id
;
362
363
}
gavl_packet_t
;
364
370
GAVL_PUBLIC
371
void
gavl_packet_init
(
gavl_packet_t
* p);
372
373
382
GAVL_PUBLIC
383
void
gavl_packet_alloc
(
gavl_packet_t
* p,
int
len);
384
389
GAVL_PUBLIC
390
void
gavl_packet_free
(
gavl_packet_t
* p);
391
397
GAVL_PUBLIC
398
void
gavl_packet_copy
(
gavl_packet_t
* dst,
399
const
gavl_packet_t
* src);
400
411
GAVL_PUBLIC
412
void
gavl_packet_copy_metadata
(
gavl_packet_t
* dst,
413
const
gavl_packet_t
* src);
414
415
422
GAVL_PUBLIC
423
void
gavl_packet_reset
(
gavl_packet_t
* p);
424
425
432
GAVL_PUBLIC
433
void
gavl_packet_dump
(
const
gavl_packet_t
* p);
434
442
GAVL_PUBLIC
443
void
gavl_packet_save
(
const
gavl_packet_t
* p,
444
const
char
* filename);
445
450
#ifdef __cplusplus
451
}
452
#endif
453
454
455
#endif // GAVL_COMPRESSION_H_INCLUDED
Generated by
1.8.2