gavl
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 
55 typedef enum
56  {
58  /* Audio */
67 
68  /* Video */
69  GAVL_CODEC_ID_JPEG = 0x10000,
81 
92 typedef struct
93  {
94  int flags;
96 
97  uint8_t * global_header;
99 
100  int bitrate;
103 
108 GAVL_PUBLIC
110 
117 GAVL_PUBLIC
119 
126 GAVL_PUBLIC
128  const gavl_compression_info_t * src);
129 
130 
146 GAVL_PUBLIC
147 const char * gavl_compression_get_extension(gavl_codec_id_t id, int * separate);
148 
158 GAVL_PUBLIC
160 
167 GAVL_PUBLIC
169 
170 
171 
172 #define GAVL_PACKET_TYPE_I 'I'
173 #define GAVL_PACKET_TYPE_P 'P'
174 #define GAVL_PACKET_TYPE_B 'B'
175 #define GAVL_PACKET_TYPE_MASK 0xff
176 
177 #define GAVL_PACKET_KEYFRAME (1<<8)
178 #define GAVL_PACKET_LAST (1<<9)
179 
180 
193 typedef struct
194  {
195  uint8_t * data;
196  int data_len;
198 
199  int flags;
200 
201  int64_t pts;
202  int64_t duration;
203 
207 
208  } gavl_packet_t;
209 
218 GAVL_PUBLIC
219 void gavl_packet_alloc(gavl_packet_t * p, int len);
220 
225 GAVL_PUBLIC
227 
234 GAVL_PUBLIC
235 void gavl_packet_dump(const gavl_packet_t * p);
236 
241 #ifdef __cplusplus
242 }
243 #endif
244 
245 
246 #endif // GAVL_COMPRESSION_H_INCLUDED