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 typedef enum
51  {
53  /* Audio */
61 
62  /* Video */
63  GAVL_CODEC_ID_JPEG = 0x10000,
75 
86 typedef struct
87  {
88  int flags;
90 
91  uint8_t * global_header;
93 
94  int bitrate;
97 
102 GAVL_PUBLIC
104 
111 GAVL_PUBLIC
113 
129 GAVL_PUBLIC
130 const char * gavl_compression_get_extension(gavl_codec_id_t id, int * separate);
131 
141 GAVL_PUBLIC
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;
171 
172  int flags;
173 
174  int64_t pts;
175  int64_t duration;
176 
180 
181  } gavl_packet_t;
182 
191 GAVL_PUBLIC
192 void gavl_packet_alloc(gavl_packet_t * p, int len);
193 
198 GAVL_PUBLIC
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