gavl

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

compression.h
1 /*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2011 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
45 #define GAVL_COMPRESSION_HAS_P_FRAMES (1<<0)
46 #define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1)
47 #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2)
48 #define GAVL_COMPRESSION_SBR (1<<3)
49
50 typedef enum
51 {
52 GAVL_CODEC_ID_NONE = 0,
53 /* Audio */
54 GAVL_CODEC_ID_ALAW = 1,
55 GAVL_CODEC_ID_ULAW,
56 GAVL_CODEC_ID_MP2,
57 GAVL_CODEC_ID_MP3,
58 GAVL_CODEC_ID_AC3,
59 GAVL_CODEC_ID_AAC,
60 GAVL_CODEC_ID_VORBIS,
61
62 /* Video */
63 GAVL_CODEC_ID_JPEG = 0x10000,
64 GAVL_CODEC_ID_PNG,
65 GAVL_CODEC_ID_TIFF,
66 GAVL_CODEC_ID_TGA,
67 GAVL_CODEC_ID_MPEG1,
68 GAVL_CODEC_ID_MPEG2,
69 GAVL_CODEC_ID_MPEG4_ASP,
70 GAVL_CODEC_ID_H264,
71 GAVL_CODEC_ID_THEORA,
72 GAVL_CODEC_ID_DIRAC,
73 GAVL_CODEC_ID_DV,
74 } gavl_codec_id_t;
75
86 typedef struct
87 {
88 int flags;
89 gavl_codec_id_t id;
90
91 uint8_t * global_header;
92 int global_header_len;
93
94 int bitrate;
95 int palette_size;
96 } gavl_compression_info_t;
97
102 GAVL_PUBLIC
103 void gavl_compression_info_free(gavl_compression_info_t* info);
104
111 GAVL_PUBLIC
112 void gavl_compression_info_dump(const gavl_compression_info_t * info);
113
129 GAVL_PUBLIC
130 const char * gavl_compression_get_extension(gavl_codec_id_t id, int * separate);
131
141 GAVL_PUBLIC
142 int gavl_compression_need_pixelformat(gavl_codec_id_t id);
143
144
145 #define GAVL_PACKET_TYPE_I 'I'
146 #define GAVL_PACKET_TYPE_P 'P'
147 #define GAVL_PACKET_TYPE_B 'B'
148 #define GAVL_PACKET_TYPE_MASK 0xff
149
150 #define GAVL_PACKET_KEYFRAME (1<<8)
151 #define GAVL_PACKET_LAST (1<<9)
152
153
166 typedef struct
167 {
168 uint8_t * data;
169 int data_len;
170 int data_alloc;
171
172 int flags;
173
174 int64_t pts;
175 int64_t duration;
176
177 int field2_offset;
178 int header_size;
179 int sequence_end_pos;
180
181 } gavl_packet_t;
182
191 GAVL_PUBLIC
192 void gavl_packet_alloc(gavl_packet_t * p, int len);
193
198 GAVL_PUBLIC
199 void gavl_packet_free(gavl_packet_t * p);
200
207 GAVL_PUBLIC
208 void gavl_packet_dump(const gavl_packet_t * p);
209
210
211 #ifdef __cplusplus
212 }
213 #endif
214
215
216 #endif // GAVL_COMPRESSION_H_INCLUDED