Statistics
| Branch: | Revision:

ffmpeg / libavcodec / avcodec.h @ 725d86bf

History | View | Annotate | Download (90.3 KB)

1 04d7f601 Diego Biurrun
/*
2
 * copyright (c) 2001 Fabrice Bellard
3
 *
4 b78e7197 Diego Biurrun
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7 04d7f601 Diego Biurrun
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9 b78e7197 Diego Biurrun
 * version 2.1 of the License, or (at your option) any later version.
10 04d7f601 Diego Biurrun
 *
11 b78e7197 Diego Biurrun
 * FFmpeg is distributed in the hope that it will be useful,
12 04d7f601 Diego Biurrun
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17 b78e7197 Diego Biurrun
 * License along with FFmpeg; if not, write to the Free Software
18 e5a389a1 Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 04d7f601 Diego Biurrun
 */
20
21 5b21bdab Diego Biurrun
#ifndef FFMPEG_AVCODEC_H
22
#define FFMPEG_AVCODEC_H
23 a96b68b7 Fabrice Bellard
24 36df8805 Michael Niedermayer
/**
25
 * @file avcodec.h
26 f5bccd85 Diego Biurrun
 * external API header
27 36df8805 Michael Niedermayer
 */
28
29
30 c11c2bc2 Alexander Strasser
#include "avutil.h"
31 4b813d5c Zdenek Kabelac
#include <sys/types.h> /* size_t */
32 de6d9b64 Fabrice Bellard
33 bb270c08 Diego Biurrun
#define AV_STRINGIFY(s)         AV_TOSTRING(s)
34 7b7d86f1 Fabrice Bellard
#define AV_TOSTRING(s) #s
35 5aa083ee Michael Niedermayer
36 12877faf Kostya Shishkov
#define LIBAVCODEC_VERSION_INT  ((51<<16)+(48<<8)+0)
37
#define LIBAVCODEC_VERSION      51.48.0
38 bb270c08 Diego Biurrun
#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
39 5aa083ee Michael Niedermayer
40 bb270c08 Diego Biurrun
#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
41 ce2749d2 Alex Beregszaszi
42 8da9266c Måns Rullgård
#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
43 bb270c08 Diego Biurrun
#define AV_TIME_BASE            1000000
44
#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
45 9740beff Michael Niedermayer
46 7ebf5927 Michael Niedermayer
/**
47 6b0cdb6e Nicolas George
 * Identifies the syntax and semantics of the bitstream.
48
 * The principle is roughly:
49
 * Two decoders with the same ID can decode the same streams.
50
 * Two encoders with the same ID can encode compatible streams.
51
 * There may be slight deviations from the principle due to implementation
52
 * details.
53 7ebf5927 Michael Niedermayer
 *
54 f5bccd85 Diego Biurrun
 * If you add a codec ID to this list, add it so that
55
 * 1. no value of a existing codec ID changes (that would break ABI),
56
 * 2. it is as close as possible to similar codecs.
57 7ebf5927 Michael Niedermayer
 */
58 de6d9b64 Fabrice Bellard
enum CodecID {
59 115329f1 Diego Biurrun
    CODEC_ID_NONE,
60 de6d9b64 Fabrice Bellard
    CODEC_ID_MPEG1VIDEO,
61 f5bccd85 Diego Biurrun
    CODEC_ID_MPEG2VIDEO, /* preferred ID for MPEG-1/2 video decoding */
62 fb364ada Ivan Kalvachev
    CODEC_ID_MPEG2VIDEO_XVMC,
63 c6148de2 Michael Niedermayer
    CODEC_ID_H261,
64 de6d9b64 Fabrice Bellard
    CODEC_ID_H263,
65
    CODEC_ID_RV10,
66 68b94c35 Michael Niedermayer
    CODEC_ID_RV20,
67 de6d9b64 Fabrice Bellard
    CODEC_ID_MJPEG,
68 b135d9fb Alex Beregszaszi
    CODEC_ID_MJPEGB,
69 b1e6b355 Michael Niedermayer
    CODEC_ID_LJPEG,
70 5e83dec4 Alex Beregszaszi
    CODEC_ID_SP5X,
71 5639729b Michael Niedermayer
    CODEC_ID_JPEGLS,
72 bf89e6b1 Fabrice Bellard
    CODEC_ID_MPEG4,
73 de6d9b64 Fabrice Bellard
    CODEC_ID_RAWVIDEO,
74 84afee34 Michael Niedermayer
    CODEC_ID_MSMPEG4V1,
75
    CODEC_ID_MSMPEG4V2,
76
    CODEC_ID_MSMPEG4V3,
77 e1a9dbff Michael Niedermayer
    CODEC_ID_WMV1,
78 b50eef3a Michael Niedermayer
    CODEC_ID_WMV2,
79 de6d9b64 Fabrice Bellard
    CODEC_ID_H263P,
80
    CODEC_ID_H263I,
81 d4f5d74a Garrick Meeker
    CODEC_ID_FLV1,
82 be8ffec9 Nick Kurshev
    CODEC_ID_SVQ1,
83 8b82a956 Michael Niedermayer
    CODEC_ID_SVQ3,
84 020fcc94 Fabrice Bellard
    CODEC_ID_DVVIDEO,
85 11f18faf Michael Niedermayer
    CODEC_ID_HUFFYUV,
86 f70f7c6d Michael Niedermayer
    CODEC_ID_CYUV,
87 0da71265 Michael Niedermayer
    CODEC_ID_H264,
88 deabd4fd Mike Melanson
    CODEC_ID_INDEO3,
89 d86053a4 Mike Melanson
    CODEC_ID_VP3,
90 f44ee2c3 Alex Beregszaszi
    CODEC_ID_THEORA,
91 3d2e8cce Michael Niedermayer
    CODEC_ID_ASV1,
92 9b56edf5 Michael Niedermayer
    CODEC_ID_ASV2,
93 5e20f836 Michael Niedermayer
    CODEC_ID_FFV1,
94 e2a7bb28 Mike Melanson
    CODEC_ID_4XM,
95 be3564ed Michael Niedermayer
    CODEC_ID_VCR1,
96 3aff069b Alex Beregszaszi
    CODEC_ID_CLJR,
97 c3bf0288 Michael Niedermayer
    CODEC_ID_MDEC,
98 3ef8be2b Mike Melanson
    CODEC_ID_ROQ,
99
    CODEC_ID_INTERPLAY_VIDEO,
100 9937e686 Mike Melanson
    CODEC_ID_XAN_WC3,
101
    CODEC_ID_XAN_WC4,
102 2fdf638b Mike Melanson
    CODEC_ID_RPZA,
103
    CODEC_ID_CINEPAK,
104
    CODEC_ID_WS_VQA,
105
    CODEC_ID_MSRLE,
106
    CODEC_ID_MSVIDEO1,
107 4120a53a Mike Melanson
    CODEC_ID_IDCIN,
108 1dc1ed99 Roberto Togni
    CODEC_ID_8BPS,
109 11e29a41 Mike Melanson
    CODEC_ID_SMC,
110 42cad81a Mike Melanson
    CODEC_ID_FLIC,
111 9a4117d5 Mike Melanson
    CODEC_ID_TRUEMOTION1,
112 fafa0b75 Mike Melanson
    CODEC_ID_VMDVIDEO,
113 a273bbfb Roberto Togni
    CODEC_ID_MSZH,
114
    CODEC_ID_ZLIB,
115 070ed1bc Mike Melanson
    CODEC_ID_QTRLE,
116 791e7b83 Michael Niedermayer
    CODEC_ID_SNOW,
117 9d53d58e Mike Melanson
    CODEC_ID_TSCC,
118 d0a0bbd2 Mike Melanson
    CODEC_ID_ULTI,
119 d08d7142 Mike Melanson
    CODEC_ID_QDRAW,
120 ab711b3c Mike Melanson
    CODEC_ID_VIXL,
121 acfd8f0f Mike Melanson
    CODEC_ID_QPEG,
122 17179d2d Michael Niedermayer
    CODEC_ID_XVID,
123
    CODEC_ID_PNG,
124
    CODEC_ID_PPM,
125
    CODEC_ID_PBM,
126
    CODEC_ID_PGM,
127
    CODEC_ID_PGMYUV,
128
    CODEC_ID_PAM,
129 f37b9768 Loren Merritt
    CODEC_ID_FFVHUFF,
130 3f05305d Michael Niedermayer
    CODEC_ID_RV30,
131
    CODEC_ID_RV40,
132 10b9c374 Kostya Shishkov
    CODEC_ID_VC1,
133 21aa398f Alex Beregszaszi
    CODEC_ID_WMV3,
134 9c7fb608 Mike Melanson
    CODEC_ID_LOCO,
135 a8a15e9d Mike Melanson
    CODEC_ID_WNV1,
136 589f8220 Mike Melanson
    CODEC_ID_AASC,
137 856dbbff Michael Niedermayer
    CODEC_ID_INDEO2,
138 b81f8949 Mike Melanson
    CODEC_ID_FRAPS,
139 64af6168 Mike Melanson
    CODEC_ID_TRUEMOTION2,
140 9fa62f2a Måns Rullgård
    CODEC_ID_BMP,
141 e0f80bd7 Reimar Döffinger
    CODEC_ID_CSCD,
142 4e114829 Mike Melanson
    CODEC_ID_MMVIDEO,
143 9c8d8e84 Mike Melanson
    CODEC_ID_ZMBV,
144 26376701 Mike Melanson
    CODEC_ID_AVS,
145 348efc18 Kostya Shishkov
    CODEC_ID_SMACKVIDEO,
146 dfca23e3 Reimar Döffinger
    CODEC_ID_NUV,
147 fd7b1991 Kostya Shishkov
    CODEC_ID_KMVC,
148 0919e788 Benjamin Larsson
    CODEC_ID_FLASHSV,
149 20ffddb9 Stefan Gehrer
    CODEC_ID_CAVS,
150 f31065f6 Baptiste Coudurier
    CODEC_ID_JPEG2000,
151 eb57c889 Kostya Shishkov
    CODEC_ID_VMNC,
152 5ce117c3 Aurelien Jacobs
    CODEC_ID_VP5,
153
    CODEC_ID_VP6,
154
    CODEC_ID_VP6F,
155 3689cf16 Kostya Shishkov
    CODEC_ID_TARGA,
156 72450e50 Baptiste Coudurier
    CODEC_ID_DSICINVIDEO,
157 29f86228 Baptiste Coudurier
    CODEC_ID_TIERTEXSEQVIDEO,
158 a991b1fe Kostya Shishkov
    CODEC_ID_TIFF,
159 06d392a7 Baptiste Coudurier
    CODEC_ID_GIF,
160 3edeab82 Panagiotis Issaris
    CODEC_ID_FFH264,
161 33a0dd37 Kostya Shishkov
    CODEC_ID_DXA,
162 52b6bad2 Baptiste Coudurier
    CODEC_ID_DNXHD,
163 efb0c399 Diego Biurrun
    CODEC_ID_THP,
164 2d99eed1 Xiaohui Sun
    CODEC_ID_SGI,
165 9a0ddd09 Anssi Hannula
    CODEC_ID_C93,
166 1e6c6759 Nicholas Tung
    CODEC_ID_BETHSOFTVID,
167 b46d68c6 Ivo van Poorten
    CODEC_ID_PTX,
168 1ca779e7 Ivo van Poorten
    CODEC_ID_TXD,
169 91fc2cf1 Aurelien Jacobs
    CODEC_ID_VP6A,
170 8787d837 Vladimir Voroshilov
    CODEC_ID_AMV,
171 66f7679c Kostya Shishkov
    CODEC_ID_VB,
172 a96b68b7 Fabrice Bellard
173 f5bccd85 Diego Biurrun
    /* various PCM "codecs" */
174 17179d2d Michael Niedermayer
    CODEC_ID_PCM_S16LE= 0x10000,
175 a96b68b7 Fabrice Bellard
    CODEC_ID_PCM_S16BE,
176
    CODEC_ID_PCM_U16LE,
177
    CODEC_ID_PCM_U16BE,
178
    CODEC_ID_PCM_S8,
179
    CODEC_ID_PCM_U8,
180
    CODEC_ID_PCM_MULAW,
181
    CODEC_ID_PCM_ALAW,
182 b461b3bc Reimar Döffinger
    CODEC_ID_PCM_S32LE,
183
    CODEC_ID_PCM_S32BE,
184
    CODEC_ID_PCM_U32LE,
185
    CODEC_ID_PCM_U32BE,
186
    CODEC_ID_PCM_S24LE,
187
    CODEC_ID_PCM_S24BE,
188
    CODEC_ID_PCM_U24LE,
189
    CODEC_ID_PCM_U24BE,
190
    CODEC_ID_PCM_S24DAUD,
191 a11c2a2c Michael Niedermayer
    CODEC_ID_PCM_ZORK,
192 725d86bf Aurelien Jacobs
    CODEC_ID_PCM_S16LE_PLANAR,
193 0147f198 François Revol
194 f5bccd85 Diego Biurrun
    /* various ADPCM codecs */
195 17179d2d Michael Niedermayer
    CODEC_ID_ADPCM_IMA_QT= 0x11000,
196 0147f198 François Revol
    CODEC_ID_ADPCM_IMA_WAV,
197 9937e686 Mike Melanson
    CODEC_ID_ADPCM_IMA_DK3,
198
    CODEC_ID_ADPCM_IMA_DK4,
199 2fdf638b Mike Melanson
    CODEC_ID_ADPCM_IMA_WS,
200 7d8379f2 Mike Melanson
    CODEC_ID_ADPCM_IMA_SMJPEG,
201 0147f198 François Revol
    CODEC_ID_ADPCM_MS,
202 e2a7bb28 Mike Melanson
    CODEC_ID_ADPCM_4XM,
203 fc384777 Mike Melanson
    CODEC_ID_ADPCM_XA,
204
    CODEC_ID_ADPCM_ADX,
205 7d8379f2 Mike Melanson
    CODEC_ID_ADPCM_EA,
206 e5966052 Roman Shaposhnik
    CODEC_ID_ADPCM_G726,
207 b3bfb299 Mike Melanson
    CODEC_ID_ADPCM_CT,
208 659c3692 Alex Beregszaszi
    CODEC_ID_ADPCM_SWF,
209 2ff4524e Vidar Madsen
    CODEC_ID_ADPCM_YAMAHA,
210 2433f24f Aurelien Jacobs
    CODEC_ID_ADPCM_SBPRO_4,
211
    CODEC_ID_ADPCM_SBPRO_3,
212
    CODEC_ID_ADPCM_SBPRO_2,
213 d1e0d21f Marco Gerards
    CODEC_ID_ADPCM_THP,
214 3a7f5d07 Vitor Sessak
    CODEC_ID_ADPCM_IMA_AMV,
215 e7583962 Peter Ross
    CODEC_ID_ADPCM_EA_R1,
216
    CODEC_ID_ADPCM_EA_R3,
217
    CODEC_ID_ADPCM_EA_R2,
218 7bb65d89 Peter Ross
    CODEC_ID_ADPCM_IMA_EA_SEAD,
219 fac84d3c Peter Ross
    CODEC_ID_ADPCM_IMA_EA_EACS,
220 271b4095 Aurelien Jacobs
    CODEC_ID_ADPCM_EA_XAS,
221 891f64b3 joca@rixmail.se
222 17179d2d Michael Niedermayer
    /* AMR */
223
    CODEC_ID_AMR_NB= 0x12000,
224 d663a1fd Michael Niedermayer
    CODEC_ID_AMR_WB,
225
226 b8414bbd Nick Kurshev
    /* RealAudio codecs*/
227 17179d2d Michael Niedermayer
    CODEC_ID_RA_144= 0x13000,
228 b8414bbd Nick Kurshev
    CODEC_ID_RA_288,
229 3ef8be2b Mike Melanson
230
    /* various DPCM codecs */
231 17179d2d Michael Niedermayer
    CODEC_ID_ROQ_DPCM= 0x14000,
232 3ef8be2b Mike Melanson
    CODEC_ID_INTERPLAY_DPCM,
233 9937e686 Mike Melanson
    CODEC_ID_XAN_DPCM,
234 d08d7142 Mike Melanson
    CODEC_ID_SOL_DPCM,
235 115329f1 Diego Biurrun
236 17179d2d Michael Niedermayer
    CODEC_ID_MP2= 0x15000,
237 f5bccd85 Diego Biurrun
    CODEC_ID_MP3, /* preferred ID for decoding MPEG audio layer 1, 2 or 3 */
238 17179d2d Michael Niedermayer
    CODEC_ID_AAC,
239 cbee7a69 Baptiste Coudurier
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
240 17179d2d Michael Niedermayer
    CODEC_ID_MPEG4AAC,
241 cbee7a69 Baptiste Coudurier
#endif
242 17179d2d Michael Niedermayer
    CODEC_ID_AC3,
243
    CODEC_ID_DTS,
244
    CODEC_ID_VORBIS,
245
    CODEC_ID_DVAUDIO,
246
    CODEC_ID_WMAV1,
247
    CODEC_ID_WMAV2,
248
    CODEC_ID_MACE3,
249
    CODEC_ID_MACE6,
250
    CODEC_ID_VMDAUDIO,
251
    CODEC_ID_SONIC,
252
    CODEC_ID_SONIC_LS,
253 ac2570a8 Michael Niedermayer
    CODEC_ID_FLAC,
254 1ede228a Roberto Togni
    CODEC_ID_MP3ADU,
255 d2a7718d Roberto Togni
    CODEC_ID_MP3ON4,
256 85ad5695 Michael Niedermayer
    CODEC_ID_SHORTEN,
257 5df8a0c6 Michael Niedermayer
    CODEC_ID_ALAC,
258 034eeaa1 Mike Melanson
    CODEC_ID_WESTWOOD_SND1,
259 f5bccd85 Diego Biurrun
    CODEC_ID_GSM, /* as in Berlin toast format */
260 d9b1c197 Roberto Togni
    CODEC_ID_QDM2,
261 e0f7e329 Benjamin Larsson
    CODEC_ID_COOK,
262 bf3027c8 Diego Biurrun
    CODEC_ID_TRUESPEECH,
263 a24c4a2a Alex Beregszaszi
    CODEC_ID_TTA,
264 348efc18 Kostya Shishkov
    CODEC_ID_SMACKAUDIO,
265 6c496518 Benjamin Larsson
    CODEC_ID_QCELP,
266 730581f3 Kostya Shishkov
    CODEC_ID_WAVPACK,
267 72450e50 Baptiste Coudurier
    CODEC_ID_DSICINAUDIO,
268 84ed36da Kostya Shishkov
    CODEC_ID_IMC,
269 185c7b6b Kostya Shishkov
    CODEC_ID_MUSEPACK7,
270 aad512b4 Michael Niedermayer
    CODEC_ID_MLP,
271 f5bccd85 Diego Biurrun
    CODEC_ID_GSM_MS, /* as found in WAV */
272 10e26bc7 Benjamin Larsson
    CODEC_ID_ATRAC3,
273 8950f828 Michael Niedermayer
    CODEC_ID_VOXWARE,
274 bf4a1f17 Kostya Shishkov
    CODEC_ID_APE,
275 636b13c5 Benjamin Larsson
    CODEC_ID_NELLYMOSER,
276 12877faf Kostya Shishkov
    CODEC_ID_MUSEPACK8,
277 115329f1 Diego Biurrun
278 240c1657 Fabrice Bellard
    /* subtitle codecs */
279 115329f1 Diego Biurrun
    CODEC_ID_DVD_SUBTITLE= 0x17000,
280
    CODEC_ID_DVB_SUBTITLE,
281 66fc495a Aurelien Jacobs
    CODEC_ID_TEXT,  /* raw UTF-8 text */
282 7e2643ae Reimar Döffinger
    CODEC_ID_XSUB,
283 115329f1 Diego Biurrun
284 f5bccd85 Diego Biurrun
    CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG-2 TS
285
                                * stream (only used by libavformat) */
286 de6d9b64 Fabrice Bellard
};
287 dcedf586 Fabrice Bellard
288 abd6a4fc Baptiste Coudurier
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
289 f5bccd85 Diego Biurrun
/* CODEC_ID_MP3LAME is obsolete */
290 dcedf586 Fabrice Bellard
#define CODEC_ID_MP3LAME CODEC_ID_MP3
291 abd6a4fc Baptiste Coudurier
#define CODEC_ID_MPEG4AAC CODEC_ID_AAC
292
#endif
293 de6d9b64 Fabrice Bellard
294
enum CodecType {
295 4a663d80 Philip Gladstone
    CODEC_TYPE_UNKNOWN = -1,
296 de6d9b64 Fabrice Bellard
    CODEC_TYPE_VIDEO,
297
    CODEC_TYPE_AUDIO,
298 985180a1 Fabrice Bellard
    CODEC_TYPE_DATA,
299 240c1657 Fabrice Bellard
    CODEC_TYPE_SUBTITLE,
300 9ff77d17 Benoit Fouet
    CODEC_TYPE_NB
301 de6d9b64 Fabrice Bellard
};
302
303 f5bccd85 Diego Biurrun
/* Currently unused, may be used if 24/32 bits samples are ever supported. */
304
/* all in native-endian format */
305 a96b68b7 Fabrice Bellard
enum SampleFormat {
306 9076fee4 Måns Rullgård
    SAMPLE_FMT_NONE = -1,
307 1319a77b Alex Beregszaszi
    SAMPLE_FMT_U8,              ///< unsigned 8 bits
308
    SAMPLE_FMT_S16,             ///< signed 16 bits
309
    SAMPLE_FMT_S24,             ///< signed 24 bits
310 115329f1 Diego Biurrun
    SAMPLE_FMT_S32,             ///< signed 32 bits
311 a3a5f4d6 Michael Niedermayer
    SAMPLE_FMT_FLT,             ///< float
312 a96b68b7 Fabrice Bellard
};
313
314 de6d9b64 Fabrice Bellard
/* in bytes */
315 8170e5fb Alex Beregszaszi
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
316 de6d9b64 Fabrice Bellard
317 d7425f59 Michael Niedermayer
/**
318 cf713bb8 Michael Niedermayer
 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
319 f5bccd85 Diego Biurrun
 * This is mainly needed because some optimized bitstream readers read
320
 * 32 or 64 bit at once and could read over the end.<br>
321
 * Note: If the first 23 bits of the additional bytes are not 0, then damaged
322
 * MPEG bitstreams could cause overread and segfault.
323 d7425f59 Michael Niedermayer
 */
324
#define FF_INPUT_BUFFER_PADDING_SIZE 8
325
326 0ecca7a4 Michael Niedermayer
/**
327 f5bccd85 Diego Biurrun
 * minimum encoding buffer size
328
 * Used to avoid some checks during header writing.
329 0ecca7a4 Michael Niedermayer
 */
330
#define FF_MIN_BUFFER_SIZE 16384
331
332 e4986da9 Juanjo
/* motion estimation type, EPZS by default */
333
enum Motion_Est_ID {
334 101bea5f Juanjo
    ME_ZERO = 1,
335 e4986da9 Juanjo
    ME_FULL,
336
    ME_LOG,
337
    ME_PHODS,
338
    ME_EPZS,
339 51d6a3cf Michael Niedermayer
    ME_X1,
340
    ME_HEX,
341
    ME_UMH,
342
    ME_ITER,
343 e4986da9 Juanjo
};
344
345 8c3eba7c Michael Niedermayer
enum AVDiscard{
346 f5bccd85 Diego Biurrun
    /* We leave some space between them for extensions (drop some
347
     * keyframes for intra-only or drop just some bidir frames). */
348 8c3eba7c Michael Niedermayer
    AVDISCARD_NONE   =-16, ///< discard nothing
349
    AVDISCARD_DEFAULT=  0, ///< discard useless packets like 0 size packets in avi
350
    AVDISCARD_NONREF =  8, ///< discard all non reference
351
    AVDISCARD_BIDIR  = 16, ///< discard all bidirectional frames
352
    AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
353
    AVDISCARD_ALL    = 48, ///< discard all
354
};
355
356 ce980a95 Michael Niedermayer
typedef struct RcOverride{
357
    int start_frame;
358
    int end_frame;
359 f5bccd85 Diego Biurrun
    int qscale; // If this is 0 then quality_factor will be used instead.
360 ce980a95 Michael Niedermayer
    float quality_factor;
361
} RcOverride;
362
363 b0ec9efd Erik Slagter
#define FF_MAX_B_FRAMES 16
364 9dbcbd92 Michael Niedermayer
365 a949d72e Michael Niedermayer
/* encoding support
366 f5bccd85 Diego Biurrun
   These flags can be passed in AVCodecContext.flags before initialization.
367
   Note: Not everything is supported yet.
368 a949d72e Michael Niedermayer
*/
369 de6d9b64 Fabrice Bellard
370 f5bccd85 Diego Biurrun
#define CODEC_FLAG_QSCALE 0x0002  ///< Use fixed qscale.
371
#define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed / advanced prediction for H.263.
372
#define CODEC_FLAG_QPEL   0x0010  ///< Use qpel MC.
373
#define CODEC_FLAG_GMC    0x0020  ///< Use GMC.
374
#define CODEC_FLAG_MV0    0x0040  ///< Always try a MB with MV=<0,0>.
375
#define CODEC_FLAG_PART   0x0080  ///< Use data partitioning.
376
/* The parent program guarantees that the input for B-frames containing
377
 * streams is not written to for at least s->max_b_frames+1 frames, if
378
 * this is not set the input will be copied. */
379 8b4c7dbc Michael Niedermayer
#define CODEC_FLAG_INPUT_PRESERVED 0x0100
380 273b0cd3 Diego Biurrun
#define CODEC_FLAG_PASS1           0x0200   ///< Use internal 2pass ratecontrol in first pass mode.
381
#define CODEC_FLAG_PASS2           0x0400   ///< Use internal 2pass ratecontrol in second pass mode.
382
#define CODEC_FLAG_EXTERN_HUFF     0x1000   ///< Use external Huffman table (for MJPEG).
383
#define CODEC_FLAG_GRAY            0x2000   ///< Only decode/encode grayscale.
384
#define CODEC_FLAG_EMU_EDGE        0x4000   ///< Don't draw edges.
385
#define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding.
386
#define CODEC_FLAG_TRUNCATED       0x00010000 /** Input bitstream might be truncated at a random
387
                                                  location instead of only at frame boundaries. */
388 f5bccd85 Diego Biurrun
#define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< Normalize adaptive quantization.
389
#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
390
#define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay.
391
#define CODEC_FLAG_ALT_SCAN       0x00100000 ///< Use alternate scan.
392
#define CODEC_FLAG_TRELLIS_QUANT  0x00200000 ///< Use trellis quantization.
393
#define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe.
394
#define CODEC_FLAG_BITEXACT       0x00800000 ///< Use only bitexact stuff (except (I)DCT).
395 21e59552 Michael Niedermayer
/* Fx : Flag for h263+ extra options */
396 6b936ec6 Baptiste Coudurier
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
397 f5bccd85 Diego Biurrun
#define CODEC_FLAG_H263P_AIC      0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction (remove this)
398 6b936ec6 Baptiste Coudurier
#endif
399 f5bccd85 Diego Biurrun
#define CODEC_FLAG_AC_PRED        0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
400
#define CODEC_FLAG_H263P_UMV      0x02000000 ///< unlimited motion vector
401
#define CODEC_FLAG_CBP_RD         0x04000000 ///< Use rate distortion optimization for cbp.
402
#define CODEC_FLAG_QP_RD          0x08000000 ///< Use rate distortion optimization for qp selectioon.
403
#define CODEC_FLAG_H263P_AIV      0x00000008 ///< H.263 alternative inter VLC
404 332f9ac4 Michael Niedermayer
#define CODEC_FLAG_OBMC           0x00000001 ///< OBMC
405
#define CODEC_FLAG_LOOP_FILTER    0x00000800 ///< loop filter
406 bb198e19 Michael Niedermayer
#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
407
#define CODEC_FLAG_INTERLACED_ME  0x20000000 ///< interlaced motion estimation
408 f5bccd85 Diego Biurrun
#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
409 f2cf4a6b Baptiste Coudurier
#define CODEC_FLAG_CLOSED_GOP     ((int)0x80000000)
410 f5bccd85 Diego Biurrun
#define CODEC_FLAG2_FAST          0x00000001 ///< Allow non spec compliant speedup tricks.
411
#define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
412
#define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
413
#define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
414
#define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
415
#define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
416 d3075ed5 Panagiotis Issaris
#define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
417 58f7833e Robert Swain
#define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
418
#define CODEC_FLAG2_FASTPSKIP     0x00000100 ///< H.264 fast pskip
419
#define CODEC_FLAG2_AUD           0x00000200 ///< H.264 access unit delimiters
420 f5bccd85 Diego Biurrun
#define CODEC_FLAG2_BRDO          0x00000400 ///< B-frame rate-distortion optimization
421
#define CODEC_FLAG2_INTRA_VLC     0x00000800 ///< Use MPEG-2 intra VLC table.
422
#define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
423
#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
424
#define CODEC_FLAG2_SKIP_RD       0x00004000 ///< RD optimal MB level residual skipping
425
#define CODEC_FLAG2_CHUNKS        0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
426
#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
427 6fc5b059 Michael Niedermayer
428 21e59552 Michael Niedermayer
/* Unsupported options :
429 bb270c08 Diego Biurrun
 *              Syntax Arithmetic coding (SAC)
430
 *              Reference Picture Selection
431 eafcac6a Diego Biurrun
 *              Independent Segment Decoding */
432 21e59552 Michael Niedermayer
/* /Fx */
433 bf89e6b1 Fabrice Bellard
/* codec capabilities */
434
435 f5bccd85 Diego Biurrun
#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
436 6814a25c Michael Niedermayer
/**
437
 * Codec uses get_buffer() for allocating buffers.
438
 * direct rendering method 1
439
 */
440
#define CODEC_CAP_DR1             0x0002
441 f5bccd85 Diego Biurrun
/* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
442 917e06c8 Fabrice Bellard
#define CODEC_CAP_PARSE_ONLY      0x0004
443 d7425f59 Michael Niedermayer
#define CODEC_CAP_TRUNCATED       0x0008
444 f5bccd85 Diego Biurrun
/* Codec can export data for HW decoding (XvMC). */
445 5e5c247a Ivan Kalvachev
#define CODEC_CAP_HWACCEL         0x0010
446 115329f1 Diego Biurrun
/**
447 f5bccd85 Diego Biurrun
 * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data.
448
 * If this is not set, the codec is guaranteed to never be fed with NULL data.
449 934982c4 Michael Niedermayer
 */
450 6f824977 Michael Niedermayer
#define CODEC_CAP_DELAY           0x0020
451 cef7cc72 Justin Ruggles
/**
452
 * Codec can be fed a final frame with a smaller size.
453
 * This can be used to prevent truncation of the last audio samples.
454
 */
455
#define CODEC_CAP_SMALL_LAST_FRAME 0x0040
456 bf89e6b1 Fabrice Bellard
457 f5bccd85 Diego Biurrun
//The following defines may change, don't expect compatibility if you use them.
458 8d7ec294 Wolfgang Hesseler
#define MB_TYPE_INTRA4x4   0x0001
459 f5bccd85 Diego Biurrun
#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
460
#define MB_TYPE_INTRA_PCM  0x0004 //FIXME H.264-specific
461 8d7ec294 Wolfgang Hesseler
#define MB_TYPE_16x16      0x0008
462
#define MB_TYPE_16x8       0x0010
463
#define MB_TYPE_8x16       0x0020
464
#define MB_TYPE_8x8        0x0040
465
#define MB_TYPE_INTERLACED 0x0080
466 273b0cd3 Diego Biurrun
#define MB_TYPE_DIRECT2    0x0100 //FIXME
467 8d7ec294 Wolfgang Hesseler
#define MB_TYPE_ACPRED     0x0200
468
#define MB_TYPE_GMC        0x0400
469
#define MB_TYPE_SKIP       0x0800
470
#define MB_TYPE_P0L0       0x1000
471
#define MB_TYPE_P1L0       0x2000
472
#define MB_TYPE_P0L1       0x4000
473
#define MB_TYPE_P1L1       0x8000
474
#define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
475
#define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
476
#define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
477
#define MB_TYPE_QUANT      0x00010000
478
#define MB_TYPE_CBP        0x00020000
479
//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
480
481 fa384dcc Michael Niedermayer
/**
482
 * Pan Scan area.
483 f5bccd85 Diego Biurrun
 * This specifies the area which should be displayed.
484
 * Note there may be multiple such areas for one frame.
485 fa384dcc Michael Niedermayer
 */
486
typedef struct AVPanScan{
487
    /**
488 f5bccd85 Diego Biurrun
     * id
489
     * - encoding: Set by user.
490
     * - decoding: Set by libavcodec.
491 fa384dcc Michael Niedermayer
     */
492
    int id;
493
494
    /**
495
     * width and height in 1/16 pel
496 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
497
     * - decoding: Set by libavcodec.
498 fa384dcc Michael Niedermayer
     */
499
    int width;
500
    int height;
501
502
    /**
503 f5bccd85 Diego Biurrun
     * position of the top left corner in 1/16 pel for up to 3 fields/frames
504
     * - encoding: Set by user.
505
     * - decoding: Set by libavcodec.
506 fa384dcc Michael Niedermayer
     */
507
    int16_t position[3][2];
508
}AVPanScan;
509
510 492cd3a9 Michael Niedermayer
#define FF_COMMON_FRAME \
511 b536d0aa Michael Niedermayer
    /**\
512
     * pointer to the picture planes.\
513 f5bccd85 Diego Biurrun
     * This might be different from the first allocated byte\
514 b536d0aa Michael Niedermayer
     * - encoding: \
515
     * - decoding: \
516
     */\
517 1e491e29 Michael Niedermayer
    uint8_t *data[4];\
518
    int linesize[4];\
519
    /**\
520 f5bccd85 Diego Biurrun
     * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.\
521
     * This isn't used by libavcodec unless the default get/release_buffer() is used.\
522 64863965 Michael Niedermayer
     * - encoding: \
523
     * - decoding: \
524 1e491e29 Michael Niedermayer
     */\
525
    uint8_t *base[4];\
526
    /**\
527
     * 1 -> keyframe, 0-> not\
528 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec.\
529
     * - decoding: Set by libavcodec.\
530 1e491e29 Michael Niedermayer
     */\
531
    int key_frame;\
532
\
533
    /**\
534 f5bccd85 Diego Biurrun
     * Picture type of the frame, see ?_TYPE below.\
535
     * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
536
     * - decoding: Set by libavcodec.\
537 1e491e29 Michael Niedermayer
     */\
538
    int pict_type;\
539
\
540
    /**\
541 c0df9d75 Michael Niedermayer
     * presentation timestamp in time_base units (time when frame should be shown to user)\
542 f5bccd85 Diego Biurrun
     * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
543
     * - encoding: MUST be set by user.\
544
     * - decoding: Set by libavcodec.\
545 1e491e29 Michael Niedermayer
     */\
546 be6784dc Richard Hodges
    int64_t pts;\
547 1e491e29 Michael Niedermayer
\
548
    /**\
549 f5bccd85 Diego Biurrun
     * picture number in bitstream order\
550 64863965 Michael Niedermayer
     * - encoding: set by\
551 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
552 1e491e29 Michael Niedermayer
     */\
553
    int coded_picture_number;\
554
    /**\
555 f5bccd85 Diego Biurrun
     * picture number in display order\
556 64863965 Michael Niedermayer
     * - encoding: set by\
557 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
558 1e491e29 Michael Niedermayer
     */\
559
    int display_picture_number;\
560
\
561
    /**\
562 158c7f05 Michael Niedermayer
     * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
563 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
564
     * - decoding: Set by libavcodec.\
565 1e491e29 Michael Niedermayer
     */\
566 158c7f05 Michael Niedermayer
    int quality; \
567 1e491e29 Michael Niedermayer
\
568
    /**\
569
     * buffer age (1->was last buffer and dint change, 2->..., ...).\
570 f5bccd85 Diego Biurrun
     * Set to INT_MAX if the buffer has not been used yet.\
571 64863965 Michael Niedermayer
     * - encoding: unused\
572 f5bccd85 Diego Biurrun
     * - decoding: MUST be set by get_buffer().\
573 1e491e29 Michael Niedermayer
     */\
574
    int age;\
575
\
576
    /**\
577
     * is this picture used as reference\
578 64863965 Michael Niedermayer
     * - encoding: unused\
579 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec. (before get_buffer() call)).\
580 1e491e29 Michael Niedermayer
     */\
581
    int reference;\
582
\
583
    /**\
584
     * QP table\
585 64863965 Michael Niedermayer
     * - encoding: unused\
586 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
587 1e491e29 Michael Niedermayer
     */\
588
    int8_t *qscale_table;\
589
    /**\
590
     * QP store stride\
591 64863965 Michael Niedermayer
     * - encoding: unused\
592 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
593 1e491e29 Michael Niedermayer
     */\
594
    int qstride;\
595
\
596
    /**\
597 f5bccd85 Diego Biurrun
     * mbskip_table[mb]>=1 if MB didn't change\
598 1e491e29 Michael Niedermayer
     * stride= mb_width = (width+15)>>4\
599 64863965 Michael Niedermayer
     * - encoding: unused\
600 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
601 1e491e29 Michael Niedermayer
     */\
602
    uint8_t *mbskip_table;\
603
\
604
    /**\
605 f5bccd85 Diego Biurrun
     * motion vector table\
606 61436073 Michael Niedermayer
     * @code\
607
     * example:\
608
     * int mv_sample_log2= 4 - motion_subsample_log2;\
609
     * int mb_width= (width+15)>>4;\
610
     * int mv_stride= (mb_width << mv_sample_log2) + 1;\
611
     * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\
612
     * @endcode\
613 f5bccd85 Diego Biurrun
     * - encoding: Set by user.\
614
     * - decoding: Set by libavcodec.\
615 8d7ec294 Wolfgang Hesseler
     */\
616
    int16_t (*motion_val[2])[2];\
617
\
618
    /**\
619 f5bccd85 Diego Biurrun
     * macroblock type table\
620 8d7ec294 Wolfgang Hesseler
     * mb_type_base + mb_width + 2\
621 f5bccd85 Diego Biurrun
     * - encoding: Set by user.\
622
     * - decoding: Set by libavcodec.\
623 8d7ec294 Wolfgang Hesseler
     */\
624
    uint32_t *mb_type;\
625
\
626
    /**\
627 f0b77c69 Michael Niedermayer
     * log2 of the size of the block which a single vector in motion_val represents: \
628
     * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\
629 8d7ec294 Wolfgang Hesseler
     * - encoding: unused\
630 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
631 8d7ec294 Wolfgang Hesseler
     */\
632
    uint8_t motion_subsample_log2;\
633
\
634
    /**\
635 1e491e29 Michael Niedermayer
     * for some private data of the user\
636 64863965 Michael Niedermayer
     * - encoding: unused\
637 f5bccd85 Diego Biurrun
     * - decoding: Set by user.\
638 1e491e29 Michael Niedermayer
     */\
639
    void *opaque;\
640 140cb663 Michael Niedermayer
\
641
    /**\
642
     * error\
643 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.\
644 64863965 Michael Niedermayer
     * - decoding: unused\
645 140cb663 Michael Niedermayer
     */\
646
    uint64_t error[4];\
647 4e00e76b Michael Niedermayer
\
648
    /**\
649 f5bccd85 Diego Biurrun
     * type of the buffer (to keep track of who has to deallocate data[*])\
650
     * - encoding: Set by the one who allocates it.\
651
     * - decoding: Set by the one who allocates it.\
652
     * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.\
653 4e00e76b Michael Niedermayer
     */\
654
    int type;\
655 2ec23b6d Michael Niedermayer
    \
656
    /**\
657 f5bccd85 Diego Biurrun
     * When decoding, this signals how much the picture must be delayed.\
658 2ec23b6d Michael Niedermayer
     * extra_delay = repeat_pict / (2*fps)\
659 64863965 Michael Niedermayer
     * - encoding: unused\
660 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
661 2ec23b6d Michael Niedermayer
     */\
662 0426af31 Michael Niedermayer
    int repeat_pict;\
663
    \
664
    /**\
665
     * \
666
     */\
667
    int qscale_type;\
668 2744ca9a Roman Shaposhnik
    \
669
    /**\
670
     * The content of the picture is interlaced.\
671 f5bccd85 Diego Biurrun
     * - encoding: Set by user.\
672
     * - decoding: Set by libavcodec. (default 0)\
673 2744ca9a Roman Shaposhnik
     */\
674
    int interlaced_frame;\
675
    \
676
    /**\
677 f5bccd85 Diego Biurrun
     * If the content is interlaced, is top field displayed first.\
678
     * - encoding: Set by user.\
679
     * - decoding: Set by libavcodec.\
680 2744ca9a Roman Shaposhnik
     */\
681 9dad924e Michael Niedermayer
    int top_field_first;\
682 fa384dcc Michael Niedermayer
    \
683
    /**\
684
     * Pan scan.\
685 f5bccd85 Diego Biurrun
     * - encoding: Set by user.\
686
     * - decoding: Set by libavcodec.\
687 fa384dcc Michael Niedermayer
     */\
688
    AVPanScan *pan_scan;\
689 2a2bbcb0 Mike Melanson
    \
690
    /**\
691 f5bccd85 Diego Biurrun
     * Tell user application that palette has changed from previous frame.\
692 2a2bbcb0 Mike Melanson
     * - encoding: ??? (no palette-enabled encoder yet)\
693 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec. (default 0).\
694 2a2bbcb0 Mike Melanson
     */\
695
    int palette_has_changed;\
696 074c4ca7 Roberto Togni
    \
697
    /**\
698 f5bccd85 Diego Biurrun
     * codec suggestion on buffer type if != 0\
699 074c4ca7 Roberto Togni
     * - encoding: unused\
700 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec. (before get_buffer() call)).\
701 074c4ca7 Roberto Togni
     */\
702
    int buffer_hints;\
703 8289c6fa Wolfgang Hesseler
\
704
    /**\
705 f5bccd85 Diego Biurrun
     * DCT coefficients\
706 8289c6fa Wolfgang Hesseler
     * - encoding: unused\
707 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.\
708 8289c6fa Wolfgang Hesseler
     */\
709
    short *dct_coeff;\
710 a4d36c11 Michael Niedermayer
\
711
    /**\
712 f5bccd85 Diego Biurrun
     * motion referece frame index\
713
     * - encoding: Set by user.\
714
     * - decoding: Set by libavcodec.\
715 a4d36c11 Michael Niedermayer
     */\
716
    int8_t *ref_index[2];
717 2ec23b6d Michael Niedermayer
718 bb270c08 Diego Biurrun
#define FF_QSCALE_TYPE_MPEG1 0
719
#define FF_QSCALE_TYPE_MPEG2 1
720
#define FF_QSCALE_TYPE_H264  2
721 4e00e76b Michael Niedermayer
722
#define FF_BUFFER_TYPE_INTERNAL 1
723 f5bccd85 Diego Biurrun
#define FF_BUFFER_TYPE_USER     2 ///< direct rendering buffers (image is (de)allocated by user)
724
#define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
725
#define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
726 4e00e76b Michael Niedermayer
727 1e491e29 Michael Niedermayer
728 273b0cd3 Diego Biurrun
#define FF_I_TYPE  1 // Intra
729
#define FF_P_TYPE  2 // Predicted
730
#define FF_B_TYPE  3 // Bi-dir predicted
731
#define FF_S_TYPE  4 // S(GMC)-VOP MPEG4
732 0da71265 Michael Niedermayer
#define FF_SI_TYPE 5
733
#define FF_SP_TYPE 6
734 1e491e29 Michael Niedermayer
735 f5bccd85 Diego Biurrun
#define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
736
#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
737
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
738
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
739 074c4ca7 Roberto Togni
740 0da71265 Michael Niedermayer
/**
741
 * Audio Video Frame.
742
 */
743 492cd3a9 Michael Niedermayer
typedef struct AVFrame {
744
    FF_COMMON_FRAME
745
} AVFrame;
746 1e491e29 Michael Niedermayer
747 14bea432 Michael Niedermayer
#define DEFAULT_FRAME_RATE_BASE 1001000
748 d33c949c Michael Niedermayer
749
/**
750 f5bccd85 Diego Biurrun
 * main external API structure
751 d33c949c Michael Niedermayer
 */
752 de6d9b64 Fabrice Bellard
typedef struct AVCodecContext {
753 b71901e6 Michael Niedermayer
    /**
754 f5bccd85 Diego Biurrun
     * information on struct for av_log
755 bc874dae Michel Bardiaux
     * - set by avcodec_alloc_context
756
     */
757 43465395 Michael Niedermayer
    AVClass *av_class;
758 bc874dae Michel Bardiaux
    /**
759 f5bccd85 Diego Biurrun
     * the average bitrate
760
     * - encoding: Set by user; unused for constant quantizer encoding.
761
     * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
762 b71901e6 Michael Niedermayer
     */
763 de6d9b64 Fabrice Bellard
    int bit_rate;
764 b71901e6 Michael Niedermayer
765
    /**
766 64863965 Michael Niedermayer
     * number of bits the bitstream is allowed to diverge from the reference.
767 b71901e6 Michael Niedermayer
     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
768 f5bccd85 Diego Biurrun
     * - encoding: Set by user; unused for constant quantizer encoding.
769 64863965 Michael Niedermayer
     * - decoding: unused
770 b71901e6 Michael Niedermayer
     */
771 115329f1 Diego Biurrun
    int bit_rate_tolerance;
772 b71901e6 Michael Niedermayer
773
    /**
774 64863965 Michael Niedermayer
     * CODEC_FLAG_*.
775 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
776
     * - decoding: Set by user.
777 b71901e6 Michael Niedermayer
     */
778 de6d9b64 Fabrice Bellard
    int flags;
779 b71901e6 Michael Niedermayer
780
    /**
781 f5bccd85 Diego Biurrun
     * Some codecs need additional format info. It is stored here.
782
     * If any muxer uses this then ALL demuxers/parsers AND encoders for the
783
     * specific codec MUST set it correctly otherwise stream copy breaks.
784
     * In general use of this field by muxers is not recommanded.
785
     * - encoding: Set by libavcodec.
786
     * - decoding: Set by libavcodec. (FIXME: Is this OK?)
787 b71901e6 Michael Niedermayer
     */
788
    int sub_id;
789
790
    /**
791 f5bccd85 Diego Biurrun
     * Motion estimation algorithm used for video coding.
792 58f7833e Robert Swain
     * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
793
     * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific]
794 64863965 Michael Niedermayer
     * - encoding: MUST be set by user.
795
     * - decoding: unused
796 b71901e6 Michael Niedermayer
     */
797
    int me_method;
798
799
    /**
800 f5bccd85 Diego Biurrun
     * some codecs need / can use extradata like Huffman tables.
801
     * mjpeg: Huffman tables
802 b71901e6 Michael Niedermayer
     * rv10: additional flags
803 b704e742 Michael Niedermayer
     * mpeg4: global headers (they can be in the bitstream or here)
804 f5bccd85 Diego Biurrun
     * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
805
     * than extradata_size to avoid prolems if it is read with the bitstream reader.
806
     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
807
     * - encoding: Set/allocated/freed by libavcodec.
808
     * - decoding: Set/allocated/freed by user.
809 b71901e6 Michael Niedermayer
     */
810 58f2a4b0 Baptiste Coudurier
    uint8_t *extradata;
811 e84c31dc Arpi
    int extradata_size;
812 115329f1 Diego Biurrun
813 b71901e6 Michael Niedermayer
    /**
814 f5bccd85 Diego Biurrun
     * This is the fundamental unit of time (in seconds) in terms
815
     * of which frame timestamps are represented. For fixed-fps content,
816 5b28c8c3 Michael Niedermayer
     * timebase should be 1/framerate and timestamp increments should be
817
     * identically 1.
818 f5bccd85 Diego Biurrun
     * - encoding: MUST be set by user.
819
     * - decoding: Set by libavcodec.
820 b71901e6 Michael Niedermayer
     */
821 c0df9d75 Michael Niedermayer
    AVRational time_base;
822 115329f1 Diego Biurrun
823 5b28c8c3 Michael Niedermayer
    /* video only */
824 14bea432 Michael Niedermayer
    /**
825 21adafec Michael Niedermayer
     * picture width / height.
826 115329f1 Diego Biurrun
     * - encoding: MUST be set by user.
827 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec.
828
     * Note: For compatibility it is possible to set this instead of
829
     * coded_width/height before decoding.
830 b71901e6 Michael Niedermayer
     */
831 de6d9b64 Fabrice Bellard
    int width, height;
832 115329f1 Diego Biurrun
833 e769f053 Alex Beregszaszi
#define FF_ASPECT_EXTENDED 15
834 b71901e6 Michael Niedermayer
835
    /**
836 f5bccd85 Diego Biurrun
     * the number of pictures in a group of pictures, or 0 for intra_only
837
     * - encoding: Set by user.
838 64863965 Michael Niedermayer
     * - decoding: unused
839 b71901e6 Michael Niedermayer
     */
840
    int gop_size;
841
842
    /**
843 f5bccd85 Diego Biurrun
     * Pixel format, see PIX_FMT_xxx.
844
     * - encoding: Set by user.
845
     * - decoding: Set by libavcodec.
846 b71901e6 Michael Niedermayer
     */
847 e4eadb4b Michael Niedermayer
    enum PixelFormat pix_fmt;
848 115329f1 Diego Biurrun
849 bdfcbbed Max Krasnyansky
    /**
850 f5bccd85 Diego Biurrun
     * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
851 bdfcbbed Max Krasnyansky
     * has to read frames at native frame rate.
852 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
853
     * - decoding: unused
854 bdfcbbed Max Krasnyansky
     */
855
    int rate_emu;
856 115329f1 Diego Biurrun
857 b71901e6 Michael Niedermayer
    /**
858 f5bccd85 Diego Biurrun
     * If non NULL, 'draw_horiz_band' is called by the libavcodec
859
     * decoder to draw a horizontal band. It improves cache usage. Not
860 b71901e6 Michael Niedermayer
     * all codecs can do that. You must check the codec capabilities
861 f5bccd85 Diego Biurrun
     * beforehand.
862 64863965 Michael Niedermayer
     * - encoding: unused
863 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
864 3bb07d61 Michael Niedermayer
     * @param height the height of the slice
865
     * @param y the y position of the slice
866
     * @param type 1->top field, 2->bottom field, 3->frame
867
     * @param offset offset into the AVFrame.data from which the slice should be read
868 b71901e6 Michael Niedermayer
     */
869 bf89e6b1 Fabrice Bellard
    void (*draw_horiz_band)(struct AVCodecContext *s,
870 da64ecc3 Drew Hess
                            const AVFrame *src, int offset[4],
871 3bb07d61 Michael Niedermayer
                            int y, int type, int height);
872 bf89e6b1 Fabrice Bellard
873 de6d9b64 Fabrice Bellard
    /* audio only */
874 f5bccd85 Diego Biurrun
    int sample_rate; ///< samples per second
875 de6d9b64 Fabrice Bellard
    int channels;
876 a3a5f4d6 Michael Niedermayer
877
    /**
878 f5bccd85 Diego Biurrun
     * audio sample format
879
     * - encoding: Set by user.
880
     * - decoding: Set by libavcodec.
881 a3a5f4d6 Michael Niedermayer
     */
882 f5bccd85 Diego Biurrun
    enum SampleFormat sample_fmt;  ///< sample format, currently unused
883 de6d9b64 Fabrice Bellard
884 f5bccd85 Diego Biurrun
    /* The following data should not be initialized. */
885 718b27a7 Michael Niedermayer
    /**
886 f5bccd85 Diego Biurrun
     * Samples per packet, initialized when calling 'init'.
887 718b27a7 Michael Niedermayer
     */
888
    int frame_size;
889 115329f1 Diego Biurrun
    int frame_number;   ///< audio or video frame number
890 f5bccd85 Diego Biurrun
    int real_pict_num;  ///< Returns the real picture number of previous encoded frame.
891 115329f1 Diego Biurrun
892 b71901e6 Michael Niedermayer
    /**
893 f5bccd85 Diego Biurrun
     * Number of frames the decoded output will be delayed relative to
894 64863965 Michael Niedermayer
     * the encoded input.
895 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec.
896 64863965 Michael Niedermayer
     * - decoding: unused
897 b71901e6 Michael Niedermayer
     */
898
    int delay;
899 115329f1 Diego Biurrun
900 64863965 Michael Niedermayer
    /* - encoding parameters */
901
    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
902 115329f1 Diego Biurrun
    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
903
904 b71901e6 Michael Niedermayer
    /**
905 f5bccd85 Diego Biurrun
     * minimum quantizer
906
     * - encoding: Set by user.
907 64863965 Michael Niedermayer
     * - decoding: unused
908 b71901e6 Michael Niedermayer
     */
909
    int qmin;
910
911
    /**
912 f5bccd85 Diego Biurrun
     * maximum quantizer
913
     * - encoding: Set by user.
914 64863965 Michael Niedermayer
     * - decoding: unused
915 b71901e6 Michael Niedermayer
     */
916
    int qmax;
917
918
    /**
919 f5bccd85 Diego Biurrun
     * maximum quantizer difference between frames
920
     * - encoding: Set by user.
921 64863965 Michael Niedermayer
     * - decoding: unused
922 b71901e6 Michael Niedermayer
     */
923
    int max_qdiff;
924
925
    /**
926 f5bccd85 Diego Biurrun
     * maximum number of B-frames between non-B-frames
927
     * Note: The output will be delayed by max_b_frames+1 relative to the input.
928
     * - encoding: Set by user.
929 64863965 Michael Niedermayer
     * - decoding: unused
930 b71901e6 Michael Niedermayer
     */
931
    int max_b_frames;
932
933
    /**
934 f5bccd85 Diego Biurrun
     * qscale factor between IP and B-frames
935
     * - encoding: Set by user.
936 64863965 Michael Niedermayer
     * - decoding: unused
937 b71901e6 Michael Niedermayer
     */
938
    float b_quant_factor;
939 115329f1 Diego Biurrun
940 b71901e6 Michael Niedermayer
    /** obsolete FIXME remove */
941
    int rc_strategy;
942 64b7c5b6 Michael Niedermayer
#define FF_RC_STRATEGY_XVID 1
943
944 8b4c7dbc Michael Niedermayer
    int b_frame_strategy;
945 9dbcbd92 Michael Niedermayer
946 b71901e6 Michael Niedermayer
    /**
947 f5bccd85 Diego Biurrun
     * hurry up amount
948 64863965 Michael Niedermayer
     * - encoding: unused
949 f5bccd85 Diego Biurrun
     * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
950 f9ec0aa1 Panagiotis Issaris
     * @deprecated Deprecated in favor of skip_idct and skip_frame.
951 b71901e6 Michael Niedermayer
     */
952
    int hurry_up;
953 115329f1 Diego Biurrun
954 de6d9b64 Fabrice Bellard
    struct AVCodec *codec;
955 115329f1 Diego Biurrun
956 de6d9b64 Fabrice Bellard
    void *priv_data;
957
958 ccec0f4f Baptiste Coudurier
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
959 ba58dabc Michael Niedermayer
    /* unused, FIXME remove*/
960
    int rtp_mode;
961 ccec0f4f Baptiste Coudurier
#endif
962 115329f1 Diego Biurrun
963 bb628dae Diego Biurrun
    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
964 f5bccd85 Diego Biurrun
                            /* do its best to deliver a chunk with size     */
965 644d98a4 Juanjo
                            /* below rtp_payload_size, the chunk will start */
966 f5bccd85 Diego Biurrun
                            /* with a start code on some codecs like H.263. */
967 644d98a4 Juanjo
                            /* This doesn't take account of any particular  */
968 f5bccd85 Diego Biurrun
                            /* headers inside the transmitted RTP payload.  */
969 81401c1f Juanjo
970 115329f1 Diego Biurrun
971 f5bccd85 Diego Biurrun
    /* The RTP callback: This function is called    */
972
    /* every time the encoder has a packet to send. */
973
    /* It depends on the encoder if the data starts */
974
    /* with a Start Code (it should). H.263 does.   */
975
    /* mb_nb contains the number of macroblocks     */
976
    /* encoded in the RTP payload.                  */
977 115329f1 Diego Biurrun
    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
978 81401c1f Juanjo
979 098eefe1 Michael Niedermayer
    /* statistics, used for 2-pass encoding */
980
    int mv_bits;
981
    int header_bits;
982
    int i_tex_bits;
983
    int p_tex_bits;
984
    int i_count;
985
    int p_count;
986
    int skip_count;
987 b71901e6 Michael Niedermayer
    int misc_bits;
988 115329f1 Diego Biurrun
989 b71901e6 Michael Niedermayer
    /**
990 f5bccd85 Diego Biurrun
     * number of bits used for the previously encoded frame
991
     * - encoding: Set by libavcodec.
992 7004ffb3 Michael Niedermayer
     * - decoding: unused
993 b71901e6 Michael Niedermayer
     */
994 098eefe1 Michael Niedermayer
    int frame_bits;
995 7004ffb3 Michael Niedermayer
996 b71901e6 Michael Niedermayer
    /**
997 f5bccd85 Diego Biurrun
     * Private data of the user, can be used to carry app specific stuff.
998
     * - encoding: Set by user.
999
     * - decoding: Set by user.
1000 b71901e6 Michael Niedermayer
     */
1001
    void *opaque;
1002
1003 de6d9b64 Fabrice Bellard
    char codec_name[32];
1004 4a663d80 Philip Gladstone
    enum CodecType codec_type; /* see CODEC_TYPE_xxx */
1005
    enum CodecID codec_id; /* see CODEC_ID_xxx */
1006 115329f1 Diego Biurrun
1007 7004ffb3 Michael Niedermayer
    /**
1008
     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1009 f5bccd85 Diego Biurrun
     * This is used to work around some encoder bugs.
1010
     * A demuxer should set this to what is stored in the field used to identify the codec.
1011
     * If there are multiple such fields in a container then the demuxer should choose the one
1012
     * which maximizes the information about the used codec.
1013
     * If the codec tag field in a container is larger then 32 bits then the demuxer should
1014
     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1015 47bbf8a7 Michael Niedermayer
     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1016 f5bccd85 Diego Biurrun
     * first.
1017
     * - encoding: Set by user, if not then the default based on codec_id will be used.
1018
     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1019 7004ffb3 Michael Niedermayer
     */
1020
    unsigned int codec_tag;
1021 115329f1 Diego Biurrun
1022 b71901e6 Michael Niedermayer
    /**
1023 f5bccd85 Diego Biurrun
     * Work around bugs in encoders which sometimes cannot be detected automatically.
1024
     * - encoding: Set by user
1025
     * - decoding: Set by user
1026 b71901e6 Michael Niedermayer
     */
1027
    int workaround_bugs;
1028 64863965 Michael Niedermayer
#define FF_BUG_AUTODETECT       1  ///< autodetection
1029 4d2858de Michael Niedermayer
#define FF_BUG_OLD_MSMPEG4      2
1030
#define FF_BUG_XVID_ILACE       4
1031
#define FF_BUG_UMP4             8
1032
#define FF_BUG_NO_PADDING       16
1033 3116cb14 Michael Niedermayer
#define FF_BUG_AMV              32
1034 f5bccd85 Diego Biurrun
#define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
1035 03e93d35 Michael Niedermayer
#define FF_BUG_QPEL_CHROMA      64
1036 db794953 Michael Niedermayer
#define FF_BUG_STD_QPEL         128
1037 36df8805 Michael Niedermayer
#define FF_BUG_QPEL_CHROMA2     256
1038 c40c3482 Michael Niedermayer
#define FF_BUG_DIRECT_BLOCKSIZE 512
1039 1c6dcb0f Michael Niedermayer
#define FF_BUG_EDGE             1024
1040 b44bdf7e Michael Niedermayer
#define FF_BUG_HPEL_CHROMA      2048
1041 4ccde216 Michael Niedermayer
#define FF_BUG_DC_CLIP          4096
1042 f5bccd85 Diego Biurrun
#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
1043
//#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
1044 115329f1 Diego Biurrun
1045 b71901e6 Michael Niedermayer
    /**
1046 f5bccd85 Diego Biurrun
     * luma single coefficient elimination threshold
1047
     * - encoding: Set by user.
1048 64863965 Michael Niedermayer
     * - decoding: unused
1049 b71901e6 Michael Niedermayer
     */
1050 1f6b6e50 Michael Niedermayer
    int luma_elim_threshold;
1051 115329f1 Diego Biurrun
1052 b71901e6 Michael Niedermayer
    /**
1053 f5bccd85 Diego Biurrun
     * chroma single coeff elimination threshold
1054
     * - encoding: Set by user.
1055 64863965 Michael Niedermayer
     * - decoding: unused
1056 b71901e6 Michael Niedermayer
     */
1057 1f6b6e50 Michael Niedermayer
    int chroma_elim_threshold;
1058 115329f1 Diego Biurrun
1059 b71901e6 Michael Niedermayer
    /**
1060 f5bccd85 Diego Biurrun
     * strictly follow the standard (MPEG4, ...).
1061
     * - encoding: Set by user.
1062 64863965 Michael Niedermayer
     * - decoding: unused
1063 b71901e6 Michael Niedermayer
     */
1064
    int strict_std_compliance;
1065 f5bccd85 Diego Biurrun
#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to a older more strict version of the spec or reference software.
1066
#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
1067 9cd81798 Michael Niedermayer
#define FF_COMPLIANCE_NORMAL        0
1068 f5bccd85 Diego Biurrun
#define FF_COMPLIANCE_INOFFICIAL   -1 ///< Allow inofficial extensions.
1069
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
1070 9cd81798 Michael Niedermayer
1071 b71901e6 Michael Niedermayer
    /**
1072 f5bccd85 Diego Biurrun
     * qscale offset between IP and B-frames
1073
     * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
1074
     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1075
     * - encoding: Set by user.
1076 64863965 Michael Niedermayer
     * - decoding: unused
1077 b71901e6 Michael Niedermayer
     */
1078
    float b_quant_offset;
1079 115329f1 Diego Biurrun
1080 b71901e6 Michael Niedermayer
    /**
1081 f5bccd85 Diego Biurrun
     * Error resilience; higher values will detect more errors but may
1082
     * misdetect some more or less valid parts as errors.
1083 64863965 Michael Niedermayer
     * - encoding: unused
1084 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1085 b71901e6 Michael Niedermayer
     */
1086 1f6b6e50 Michael Niedermayer
    int error_resilience;
1087 1471c6c2 Diego Biurrun
#define FF_ER_CAREFUL         1
1088 ce3bcaed Michael Niedermayer
#define FF_ER_COMPLIANT       2
1089
#define FF_ER_AGGRESSIVE      3
1090
#define FF_ER_VERY_AGGRESSIVE 4
1091 115329f1 Diego Biurrun
1092 6b72ac63 Michael Niedermayer
    /**
1093 f5bccd85 Diego Biurrun
     * Called at the beginning of each frame to get a buffer for it.
1094
     * If pic.reference is set then the frame will be read later by libavcodec.
1095 2b5296d2 Michael Niedermayer
     * avcodec_align_dimensions() should be used to find the required width and
1096 f5bccd85 Diego Biurrun
     * height, as they normally need to be rounded up to the next multiple of 16.
1097 64863965 Michael Niedermayer
     * - encoding: unused
1098 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec., user can override.
1099 b71901e6 Michael Niedermayer
     */
1100 492cd3a9 Michael Niedermayer
    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
1101 115329f1 Diego Biurrun
1102 b71901e6 Michael Niedermayer
    /**
1103 f5bccd85 Diego Biurrun
     * Called to release buffers which where allocated with get_buffer.
1104
     * A released buffer can be reused in get_buffer().
1105
     * pic.data[*] must be set to NULL.
1106 64863965 Michael Niedermayer
     * - encoding: unused
1107 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec., user can override.
1108 b71901e6 Michael Niedermayer
     */
1109 492cd3a9 Michael Niedermayer
    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1110 0fd90455 Michael Niedermayer
1111 b71901e6 Michael Niedermayer
    /**
1112 f5bccd85 Diego Biurrun
     * If 1 the stream has a 1 frame delay during decoding.
1113
     * - encoding: Set by libavcodec.
1114
     * - decoding: Set by libavcodec.
1115 b71901e6 Michael Niedermayer
     */
1116
    int has_b_frames;
1117 718b27a7 Michael Niedermayer
1118
    /**
1119
     * number of bytes per packet if constant and known or 0
1120 f5bccd85 Diego Biurrun
     * Used by some WAV based audio codecs.
1121 718b27a7 Michael Niedermayer
     */
1122
    int block_align;
1123 115329f1 Diego Biurrun
1124 f5bccd85 Diego Biurrun
    int parse_only; /* - decoding only: If true, only parsing is done
1125 917e06c8 Fabrice Bellard
                       (function avcodec_parse_frame()). The frame
1126
                       data is returned. Only MPEG codecs support this now. */
1127 115329f1 Diego Biurrun
1128 b71901e6 Michael Niedermayer
    /**
1129 f5bccd85 Diego Biurrun
     * 0-> h263 quant 1-> mpeg quant
1130
     * - encoding: Set by user.
1131 64863965 Michael Niedermayer
     * - decoding: unused
1132 b71901e6 Michael Niedermayer
     */
1133
    int mpeg_quant;
1134 115329f1 Diego Biurrun
1135 b71901e6 Michael Niedermayer
    /**
1136 f5bccd85 Diego Biurrun
     * pass1 encoding statistics output buffer
1137
     * - encoding: Set by libavcodec.
1138 64863965 Michael Niedermayer
     * - decoding: unused
1139 b71901e6 Michael Niedermayer
     */
1140 64863965 Michael Niedermayer
    char *stats_out;
1141 115329f1 Diego Biurrun
1142 b71901e6 Michael Niedermayer
    /**
1143 f5bccd85 Diego Biurrun
     * pass2 encoding statistics input buffer
1144
     * Concatenated stuff from stats_out of pass1 should be placed here.
1145
     * - encoding: Allocated/set/freed by user.
1146 64863965 Michael Niedermayer
     * - decoding: unused
1147 b71901e6 Michael Niedermayer
     */
1148
    char *stats_in;
1149 115329f1 Diego Biurrun
1150 b71901e6 Michael Niedermayer
    /**
1151 f5bccd85 Diego Biurrun
     * ratecontrol qmin qmax limiting method
1152
     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
1153
     * - encoding: Set by user.
1154 64863965 Michael Niedermayer
     * - decoding: unused
1155 b71901e6 Michael Niedermayer
     */
1156 ce980a95 Michael Niedermayer
    float rc_qsquish;
1157 b71901e6 Michael Niedermayer
1158 ce980a95 Michael Niedermayer
    float rc_qmod_amp;
1159
    int rc_qmod_freq;
1160 115329f1 Diego Biurrun
1161 b71901e6 Michael Niedermayer
    /**
1162 f5bccd85 Diego Biurrun
     * ratecontrol override, see RcOverride
1163
     * - encoding: Allocated/set/freed by user.
1164 64863965 Michael Niedermayer
     * - decoding: unused
1165 b71901e6 Michael Niedermayer
     */
1166 ce980a95 Michael Niedermayer
    RcOverride *rc_override;
1167
    int rc_override_count;
1168 115329f1 Diego Biurrun
1169 b71901e6 Michael Niedermayer
    /**
1170 f5bccd85 Diego Biurrun
     * rate control equation
1171
     * - encoding: Set by user
1172 64863965 Michael Niedermayer
     * - decoding: unused
1173 b71901e6 Michael Niedermayer
     */
1174 ce980a95 Michael Niedermayer
    char *rc_eq;
1175 115329f1 Diego Biurrun
1176 b71901e6 Michael Niedermayer
    /**
1177 f5bccd85 Diego Biurrun
     * maximum bitrate
1178
     * - encoding: Set by user.
1179 64863965 Michael Niedermayer
     * - decoding: unused
1180 b71901e6 Michael Niedermayer
     */
1181 ce980a95 Michael Niedermayer
    int rc_max_rate;
1182 115329f1 Diego Biurrun
1183 b71901e6 Michael Niedermayer
    /**
1184 f5bccd85 Diego Biurrun
     * minimum bitrate
1185
     * - encoding: Set by user.
1186 64863965 Michael Niedermayer
     * - decoding: unused
1187 b71901e6 Michael Niedermayer
     */
1188 ce980a95 Michael Niedermayer
    int rc_min_rate;
1189 115329f1 Diego Biurrun
1190 b71901e6 Michael Niedermayer
    /**
1191 f5bccd85 Diego Biurrun
     * decoder bitstream buffer size
1192
     * - encoding: Set by user.
1193 64863965 Michael Niedermayer
     * - decoding: unused
1194 b71901e6 Michael Niedermayer
     */
1195 ce980a95 Michael Niedermayer
    int rc_buffer_size;
1196
    float rc_buffer_aggressivity;
1197 b71901e6 Michael Niedermayer
1198
    /**
1199 f5bccd85 Diego Biurrun
     * qscale factor between P and I-frames
1200
     * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1201
     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1202
     * - encoding: Set by user.
1203 64863965 Michael Niedermayer
     * - decoding: unused
1204 b71901e6 Michael Niedermayer
     */
1205
    float i_quant_factor;
1206 115329f1 Diego Biurrun
1207 b71901e6 Michael Niedermayer
    /**
1208 f5bccd85 Diego Biurrun
     * qscale offset between P and I-frames
1209
     * - encoding: Set by user.
1210 64863965 Michael Niedermayer
     * - decoding: unused
1211 b71901e6 Michael Niedermayer
     */
1212
    float i_quant_offset;
1213 115329f1 Diego Biurrun
1214 b71901e6 Michael Niedermayer
    /**
1215 f5bccd85 Diego Biurrun
     * initial complexity for pass1 ratecontrol
1216
     * - encoding: Set by user.
1217 64863965 Michael Niedermayer
     * - decoding: unused
1218 b71901e6 Michael Niedermayer
     */
1219 ce980a95 Michael Niedermayer
    float rc_initial_cplx;
1220 917e06c8 Fabrice Bellard
1221 b71901e6 Michael Niedermayer
    /**
1222 f5bccd85 Diego Biurrun
     * DCT algorithm, see FF_DCT_* below
1223
     * - encoding: Set by user.
1224 64863965 Michael Niedermayer
     * - decoding: unused
1225 b71901e6 Michael Niedermayer
     */
1226 28db7fce Michael Niedermayer
    int dct_algo;
1227 c7e07931 Martin Olschewski
#define FF_DCT_AUTO    0
1228 28db7fce Michael Niedermayer
#define FF_DCT_FASTINT 1
1229 c7e07931 Martin Olschewski
#define FF_DCT_INT     2
1230
#define FF_DCT_MMX     3
1231
#define FF_DCT_MLIB    4
1232 05c4072b Michael Niedermayer
#define FF_DCT_ALTIVEC 5
1233 65e4c8c9 Michael Niedermayer
#define FF_DCT_FAAN    6
1234 115329f1 Diego Biurrun
1235 c5d309f2 Michael Niedermayer
    /**
1236 f5bccd85 Diego Biurrun
     * luminance masking (0-> disabled)
1237
     * - encoding: Set by user.
1238 64863965 Michael Niedermayer
     * - decoding: unused
1239 c5d309f2 Michael Niedermayer
     */
1240
    float lumi_masking;
1241 115329f1 Diego Biurrun
1242 c5d309f2 Michael Niedermayer
    /**
1243 f5bccd85 Diego Biurrun
     * temporary complexity masking (0-> disabled)
1244
     * - encoding: Set by user.
1245 64863965 Michael Niedermayer
     * - decoding: unused
1246 c5d309f2 Michael Niedermayer
     */
1247
    float temporal_cplx_masking;
1248 115329f1 Diego Biurrun
1249 c5d309f2 Michael Niedermayer
    /**
1250 f5bccd85 Diego Biurrun
     * spatial complexity masking (0-> disabled)
1251
     * - encoding: Set by user.
1252 64863965 Michael Niedermayer
     * - decoding: unused
1253 c5d309f2 Michael Niedermayer
     */
1254
    float spatial_cplx_masking;
1255 115329f1 Diego Biurrun
1256 c5d309f2 Michael Niedermayer
    /**
1257 f5bccd85 Diego Biurrun
     * p block masking (0-> disabled)
1258
     * - encoding: Set by user.
1259 64863965 Michael Niedermayer
     * - decoding: unused
1260 c5d309f2 Michael Niedermayer
     */
1261
    float p_masking;
1262 15415af4 Michael Niedermayer
1263 5e746b99 Michael Niedermayer
    /**
1264 f5bccd85 Diego Biurrun
     * darkness masking (0-> disabled)
1265
     * - encoding: Set by user.
1266 64863965 Michael Niedermayer
     * - decoding: unused
1267 5e746b99 Michael Niedermayer
     */
1268
    float dark_masking;
1269 115329f1 Diego Biurrun
1270
1271 3a694b04 Nick Kurshev
    /* for binary compatibility */
1272
    int unused;
1273 115329f1 Diego Biurrun
1274 0c2dd16e Michael Niedermayer
    /**
1275 f5bccd85 Diego Biurrun
     * IDCT algorithm, see FF_IDCT_* below.
1276
     * - encoding: Set by user.
1277
     * - decoding: Set by user.
1278 2ad1516a Michael Niedermayer
     */
1279
    int idct_algo;
1280 273b0cd3 Diego Biurrun
#define FF_IDCT_AUTO          0
1281
#define FF_IDCT_INT           1
1282
#define FF_IDCT_SIMPLE        2
1283
#define FF_IDCT_SIMPLEMMX     3
1284
#define FF_IDCT_LIBMPEG2MMX   4
1285
#define FF_IDCT_PS2           5
1286
#define FF_IDCT_MLIB          6
1287
#define FF_IDCT_ARM           7
1288
#define FF_IDCT_ALTIVEC       8
1289
#define FF_IDCT_SH4           9
1290
#define FF_IDCT_SIMPLEARM     10
1291
#define FF_IDCT_H264          11
1292
#define FF_IDCT_VP3           12
1293
#define FF_IDCT_IPP           13
1294
#define FF_IDCT_XVIDMMX       14
1295
#define FF_IDCT_CAVS          15
1296 a0403006 Måns Rullgård
#define FF_IDCT_SIMPLEARMV5TE 16
1297 273b0cd3 Diego Biurrun
#define FF_IDCT_SIMPLEARMV6   17
1298 d9420d4d Denes Balatoni
#define FF_IDCT_SIMPLEVIS     18
1299 9abc7e0f Michael Niedermayer
#define FF_IDCT_WMV2          19
1300 2ad1516a Michael Niedermayer
1301 144f0625 Michael Niedermayer
    /**
1302 f5bccd85 Diego Biurrun
     * slice count
1303
     * - encoding: Set by libavcodec.
1304
     * - decoding: Set by user (or 0).
1305 144f0625 Michael Niedermayer
     */
1306
    int slice_count;
1307
    /**
1308 f5bccd85 Diego Biurrun
     * slice offsets in the frame in bytes
1309
     * - encoding: Set/allocated by libavcodec.
1310
     * - decoding: Set/allocated by user (or NULL).
1311 144f0625 Michael Niedermayer
     */
1312
    int *slice_offset;
1313
1314 4d2858de Michael Niedermayer
    /**
1315 f5bccd85 Diego Biurrun
     * error concealment flags
1316 64863965 Michael Niedermayer
     * - encoding: unused
1317 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1318 4d2858de Michael Niedermayer
     */
1319
    int error_concealment;
1320
#define FF_EC_GUESS_MVS   1
1321
#define FF_EC_DEBLOCK     2
1322
1323 6b72ac63 Michael Niedermayer
    /**
1324 bec89a84 Zdenek Kabelac
     * dsp_mask could be add used to disable unwanted CPU features
1325 8350df97 Zdenek Kabelac
     * CPU features (i.e. MMX, SSE. ...)
1326 bec89a84 Zdenek Kabelac
     *
1327 f5bccd85 Diego Biurrun
     * With the FORCE flag you may instead enable given CPU features.
1328
     * (Dangerous: Usable in case of misdetection, improper usage however will
1329
     * result into program crash.)
1330 bec89a84 Zdenek Kabelac
     */
1331
    unsigned dsp_mask;
1332 f5bccd85 Diego Biurrun
#define FF_MM_FORCE    0x80000000 /* Force usage of selected flags (OR) */
1333 bec89a84 Zdenek Kabelac
    /* lower 16 bits - CPU features */
1334 bb270c08 Diego Biurrun
#define FF_MM_MMX      0x0001 /* standard MMX */
1335
#define FF_MM_3DNOW    0x0004 /* AMD 3DNOW */
1336
#define FF_MM_MMXEXT   0x0002 /* SSE integer functions or AMD MMX ext */
1337
#define FF_MM_SSE      0x0008 /* SSE functions */
1338
#define FF_MM_SSE2     0x0010 /* PIV SSE2 functions */
1339
#define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */
1340 ac237a2f Ronald S. Bultje
#define FF_MM_SSE3     0x0040 /* Prescott SSE3 functions */
1341
#define FF_MM_SSSE3    0x0080 /* Conroe SSSE3 functions */
1342 bb270c08 Diego Biurrun
#define FF_MM_IWMMXT   0x0100 /* XScale IWMMXT */
1343 11f18faf Michael Niedermayer
1344
    /**
1345 64863965 Michael Niedermayer
     * bits per sample/pixel from the demuxer (needed for huffyuv).
1346 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec.
1347
     * - decoding: Set by user.
1348 11f18faf Michael Niedermayer
     */
1349
     int bits_per_sample;
1350 115329f1 Diego Biurrun
1351 11f18faf Michael Niedermayer
    /**
1352 f5bccd85 Diego Biurrun
     * prediction method (needed for huffyuv)
1353
     * - encoding: Set by user.
1354 64863965 Michael Niedermayer
     * - decoding: unused
1355 11f18faf Michael Niedermayer
     */
1356
     int prediction_method;
1357
#define FF_PRED_LEFT   0
1358
#define FF_PRED_PLANE  1
1359
#define FF_PRED_MEDIAN 2
1360 115329f1 Diego Biurrun
1361 5d3cea3a Michael Niedermayer
    /**
1362 f5bccd85 Diego Biurrun
     * sample aspect ratio (0 if unknown)
1363
     * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1364
     * - encoding: Set by user.
1365
     * - decoding: Set by libavcodec.
1366 5d3cea3a Michael Niedermayer
     */
1367 5ff85f1d Michael Niedermayer
    AVRational sample_aspect_ratio;
1368 1e491e29 Michael Niedermayer
1369
    /**
1370 f5bccd85 Diego Biurrun
     * the picture in the bitstream
1371
     * - encoding: Set by libavcodec.
1372
     * - decoding: Set by libavcodec.
1373 1e491e29 Michael Niedermayer
     */
1374 492cd3a9 Michael Niedermayer
    AVFrame *coded_frame;
1375 c8c437bc Michael Niedermayer
1376
    /**
1377 f5bccd85 Diego Biurrun
     * debug
1378
     * - encoding: Set by user.
1379
     * - decoding: Set by user.
1380 c8c437bc Michael Niedermayer
     */
1381
    int debug;
1382 273b0cd3 Diego Biurrun
#define FF_DEBUG_PICT_INFO   1
1383
#define FF_DEBUG_RC          2
1384
#define FF_DEBUG_BITSTREAM   4
1385
#define FF_DEBUG_MB_TYPE     8
1386
#define FF_DEBUG_QP          16
1387
#define FF_DEBUG_MV          32
1388
#define FF_DEBUG_DCT_COEFF   0x00000040
1389
#define FF_DEBUG_SKIP        0x00000080
1390
#define FF_DEBUG_STARTCODE   0x00000100
1391
#define FF_DEBUG_PTS         0x00000200
1392
#define FF_DEBUG_ER          0x00000400
1393
#define FF_DEBUG_MMCO        0x00000800
1394
#define FF_DEBUG_BUGS        0x00001000
1395
#define FF_DEBUG_VIS_QP      0x00002000
1396 864119b6 Michael Niedermayer
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
1397 115329f1 Diego Biurrun
1398 140cb663 Michael Niedermayer
    /**
1399 f5bccd85 Diego Biurrun
     * debug
1400
     * - encoding: Set by user.
1401
     * - decoding: Set by user.
1402 0c9bbaec Wolfgang Hesseler
     */
1403
    int debug_mv;
1404
#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
1405
#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
1406
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
1407
1408
    /**
1409 f5bccd85 Diego Biurrun
     * error
1410
     * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
1411 64863965 Michael Niedermayer
     * - decoding: unused
1412 140cb663 Michael Niedermayer
     */
1413
    uint64_t error[4];
1414 115329f1 Diego Biurrun
1415 17a70fde Michael Niedermayer
    /**
1416 f5bccd85 Diego Biurrun
     * minimum MB quantizer
1417 6e0d8c06 Michael Niedermayer
     * - encoding: unused
1418 64863965 Michael Niedermayer
     * - decoding: unused
1419 17a70fde Michael Niedermayer
     */
1420
    int mb_qmin;
1421
1422
    /**
1423 f5bccd85 Diego Biurrun
     * maximum MB quantizer
1424 6e0d8c06 Michael Niedermayer
     * - encoding: unused
1425 64863965 Michael Niedermayer
     * - decoding: unused
1426 17a70fde Michael Niedermayer
     */
1427
    int mb_qmax;
1428 115329f1 Diego Biurrun
1429 1457ab52 Michael Niedermayer
    /**
1430 f5bccd85 Diego Biurrun
     * motion estimation comparison function
1431
     * - encoding: Set by user.
1432 64863965 Michael Niedermayer
     * - decoding: unused
1433 1457ab52 Michael Niedermayer
     */
1434
    int me_cmp;
1435
    /**
1436 f5bccd85 Diego Biurrun
     * subpixel motion estimation comparison function
1437
     * - encoding: Set by user.
1438 64863965 Michael Niedermayer
     * - decoding: unused
1439 1457ab52 Michael Niedermayer
     */
1440
    int me_sub_cmp;
1441
    /**
1442 f5bccd85 Diego Biurrun
     * macroblock comparison function (not supported yet)
1443
     * - encoding: Set by user.
1444 64863965 Michael Niedermayer
     * - decoding: unused
1445 1457ab52 Michael Niedermayer
     */
1446
    int mb_cmp;
1447 622348f9 Michael Niedermayer
    /**
1448 f5bccd85 Diego Biurrun
     * interlaced DCT comparison function
1449
     * - encoding: Set by user.
1450 622348f9 Michael Niedermayer
     * - decoding: unused
1451
     */
1452
    int ildct_cmp;
1453 273b0cd3 Diego Biurrun
#define FF_CMP_SAD    0
1454
#define FF_CMP_SSE    1
1455
#define FF_CMP_SATD   2
1456
#define FF_CMP_DCT    3
1457
#define FF_CMP_PSNR   4
1458
#define FF_CMP_BIT    5
1459
#define FF_CMP_RD     6
1460
#define FF_CMP_ZERO   7
1461
#define FF_CMP_VSAD   8
1462
#define FF_CMP_VSSE   9
1463
#define FF_CMP_NSSE   10
1464
#define FF_CMP_W53    11
1465
#define FF_CMP_W97    12
1466 0fd6aea1 Michael Niedermayer
#define FF_CMP_DCTMAX 13
1467 27c61ac5 Michael Niedermayer
#define FF_CMP_DCT264 14
1468 1457ab52 Michael Niedermayer
#define FF_CMP_CHROMA 256
1469 115329f1 Diego Biurrun
1470 1457ab52 Michael Niedermayer
    /**
1471 f5bccd85 Diego Biurrun
     * ME diamond size & shape
1472
     * - encoding: Set by user.
1473 64863965 Michael Niedermayer
     * - decoding: unused
1474 1457ab52 Michael Niedermayer
     */
1475
    int dia_size;
1476 b07a5980 Michael Niedermayer
1477
    /**
1478 f5bccd85 Diego Biurrun
     * amount of previous MV predictors (2a+1 x 2a+1 square)
1479
     * - encoding: Set by user.
1480 64863965 Michael Niedermayer
     * - decoding: unused
1481 b07a5980 Michael Niedermayer
     */
1482
    int last_predictor_count;
1483 70ac76c0 Michael Niedermayer
1484 f5fb6b34 Michael Niedermayer
    /**
1485 f5bccd85 Diego Biurrun
     * prepass for motion estimation
1486
     * - encoding: Set by user.
1487 64863965 Michael Niedermayer
     * - decoding: unused
1488 f5fb6b34 Michael Niedermayer
     */
1489
    int pre_me;
1490 b07a5980 Michael Niedermayer
1491 70ac76c0 Michael Niedermayer
    /**
1492 f5bccd85 Diego Biurrun
     * motion estimation prepass comparison function
1493
     * - encoding: Set by user.
1494 64863965 Michael Niedermayer
     * - decoding: unused
1495 70ac76c0 Michael Niedermayer
     */
1496
    int me_pre_cmp;
1497 826f429a Michael Niedermayer
1498 70ac76c0 Michael Niedermayer
    /**
1499 f5bccd85 Diego Biurrun
     * ME prepass diamond size & shape
1500
     * - encoding: Set by user.
1501 64863965 Michael Niedermayer
     * - decoding: unused
1502 70ac76c0 Michael Niedermayer
     */
1503
    int pre_dia_size;
1504
1505 826f429a Michael Niedermayer
    /**
1506 f5bccd85 Diego Biurrun
     * subpel ME quality
1507
     * - encoding: Set by user.
1508 64863965 Michael Niedermayer
     * - decoding: unused
1509 826f429a Michael Niedermayer
     */
1510
    int me_subpel_quality;
1511
1512 a33c7159 Michael Niedermayer
    /**
1513 f5bccd85 Diego Biurrun
     * callback to negotiate the pixelFormat
1514 a33c7159 Michael Niedermayer
     * @param fmt is the list of formats which are supported by the codec,
1515 f5bccd85 Diego Biurrun
     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1516
     * The first is always the native one.
1517
     * @return the chosen format
1518 64863965 Michael Niedermayer
     * - encoding: unused
1519 f5bccd85 Diego Biurrun
     * - decoding: Set by user, if not set the native format will be chosen.
1520 a33c7159 Michael Niedermayer
     */
1521 494c56d3 Ivan Kalvachev
    enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
1522 e2f9490e Fabrice Bellard
1523
    /**
1524 f5bccd85 Diego Biurrun
     * DTG active format information (additional aspect ratio
1525
     * information only used in DVB MPEG-2 transport streams)
1526
     * 0 if not set.
1527 115329f1 Diego Biurrun
     *
1528 f5bccd85 Diego Biurrun
     * - encoding: unused
1529
     * - decoding: Set by decoder.
1530 e2f9490e Fabrice Bellard
     */
1531
    int dtg_active_format;
1532
#define FF_DTG_AFD_SAME         8
1533
#define FF_DTG_AFD_4_3          9
1534
#define FF_DTG_AFD_16_9         10
1535
#define FF_DTG_AFD_14_9         11
1536
#define FF_DTG_AFD_4_3_SP_14_9  13
1537
#define FF_DTG_AFD_16_9_SP_14_9 14
1538
#define FF_DTG_AFD_SP_4_3       15
1539
1540 ebbcdc9a Michael Niedermayer
    /**
1541 f5bccd85 Diego Biurrun
     * maximum motion estimation search range in subpel units
1542
     * If 0 then no limit.
1543 115329f1 Diego Biurrun
     *
1544 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1545
     * - decoding: unused
1546 ebbcdc9a Michael Niedermayer
     */
1547 59e0ac8e Zdenek Kabelac
    int me_range;
1548 ebbcdc9a Michael Niedermayer
1549 65f7062d Michael Niedermayer
    /**
1550 f5bccd85 Diego Biurrun
     * intra quantizer bias
1551
     * - encoding: Set by user.
1552 1984f635 Michael Niedermayer
     * - decoding: unused
1553
     */
1554
    int intra_quant_bias;
1555
#define FF_DEFAULT_QUANT_BIAS 999999
1556 115329f1 Diego Biurrun
1557 1984f635 Michael Niedermayer
    /**
1558 f5bccd85 Diego Biurrun
     * inter quantizer bias
1559
     * - encoding: Set by user.
1560 1984f635 Michael Niedermayer
     * - decoding: unused
1561
     */
1562
    int inter_quant_bias;
1563 5cd62665 Zdenek Kabelac
1564
    /**
1565 f5bccd85 Diego Biurrun
     * color table ID
1566
     * - encoding: unused
1567
     * - decoding: Which clrtable should be used for 8bit RGB images.
1568
     *             Tables have to be stored somewhere. FIXME
1569 5cd62665 Zdenek Kabelac
     */
1570
    int color_table_id;
1571 115329f1 Diego Biurrun
1572 d90cf87b Michael Niedermayer
    /**
1573 f5bccd85 Diego Biurrun
     * internal_buffer count
1574
     * Don't touch, used by libavcodec default_get_buffer().
1575 d90cf87b Michael Niedermayer
     */
1576
    int internal_buffer_count;
1577 115329f1 Diego Biurrun
1578 d90cf87b Michael Niedermayer
    /**
1579 f5bccd85 Diego Biurrun
     * internal_buffers
1580
     * Don't touch, used by libavcodec default_get_buffer().
1581 d90cf87b Michael Niedermayer
     */
1582
    void *internal_buffer;
1583 158c7f05 Michael Niedermayer
1584
#define FF_LAMBDA_SHIFT 7
1585
#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
1586
#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
1587
#define FF_LAMBDA_MAX (256*128-1)
1588
1589
#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
1590 3d2e8cce Michael Niedermayer
    /**
1591 f5bccd85 Diego Biurrun
     * Global quality for codecs which cannot change it per frame.
1592
     * This should be proportional to MPEG-1/2/4 qscale.
1593
     * - encoding: Set by user.
1594 3d2e8cce Michael Niedermayer
     * - decoding: unused
1595
     */
1596
    int global_quality;
1597 115329f1 Diego Biurrun
1598 bd446bb1 Michael Niedermayer
#define FF_CODER_TYPE_VLC       0
1599
#define FF_CODER_TYPE_AC        1
1600 f87459e4 Kamil Nowosad
#define FF_CODER_TYPE_RAW       2
1601
#define FF_CODER_TYPE_RLE       3
1602
#define FF_CODER_TYPE_DEFLATE   4
1603 11e659c2 Michael Niedermayer
    /**
1604
     * coder type
1605 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1606 11e659c2 Michael Niedermayer
     * - decoding: unused
1607
     */
1608
    int coder_type;
1609
1610
    /**
1611
     * context model
1612 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1613 11e659c2 Michael Niedermayer
     * - decoding: unused
1614
     */
1615
    int context_model;
1616 5639729b Michael Niedermayer
#if 0
1617
    /**
1618
     *
1619
     * - encoding: unused
1620 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1621 5639729b Michael Niedermayer
     */
1622
    uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
1623
#endif
1624 115329f1 Diego Biurrun
1625 3bb07d61 Michael Niedermayer
    /**
1626
     * slice flags
1627
     * - encoding: unused
1628 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1629 3bb07d61 Michael Niedermayer
     */
1630
    int slice_flags;
1631
#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
1632
#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
1633
#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
1634
1635 fb364ada Ivan Kalvachev
    /**
1636
     * XVideo Motion Acceleration
1637
     * - encoding: forbidden
1638
     * - decoding: set by decoder
1639
     */
1640
    int xvmc_acceleration;
1641 115329f1 Diego Biurrun
1642 7d1c3fc1 Michael Niedermayer
    /**
1643
     * macroblock decision mode
1644 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1645 7d1c3fc1 Michael Niedermayer
     * - decoding: unused
1646
     */
1647
    int mb_decision;
1648
#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
1649
#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
1650
#define FF_MB_DECISION_RD     2        ///< rate distoration
1651 d6eb3c50 Michael Niedermayer
1652
    /**
1653
     * custom intra quantization matrix
1654 f5bccd85 Diego Biurrun
     * - encoding: Set by user, can be NULL.
1655
     * - decoding: Set by libavcodec.
1656 d6eb3c50 Michael Niedermayer
     */
1657
    uint16_t *intra_matrix;
1658
1659
    /**
1660
     * custom inter quantization matrix
1661 f5bccd85 Diego Biurrun
     * - encoding: Set by user, can be NULL.
1662
     * - decoding: Set by libavcodec.
1663 d6eb3c50 Michael Niedermayer
     */
1664
    uint16_t *inter_matrix;
1665 115329f1 Diego Biurrun
1666 541ae140 Michael Niedermayer
    /**
1667
     * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1668 f5bccd85 Diego Biurrun
     * This is used to work around some encoder bugs.
1669 541ae140 Michael Niedermayer
     * - encoding: unused
1670 f5bccd85 Diego Biurrun
     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1671 541ae140 Michael Niedermayer
     */
1672
    unsigned int stream_codec_tag;
1673 05fbd0a2 Michael Niedermayer
1674
    /**
1675 f5bccd85 Diego Biurrun
     * scene change detection threshold
1676
     * 0 is default, larger means fewer detected scene changes.
1677
     * - encoding: Set by user.
1678 05fbd0a2 Michael Niedermayer
     * - decoding: unused
1679
     */
1680
    int scenechange_threshold;
1681 158c7f05 Michael Niedermayer
1682
    /**
1683 f5bccd85 Diego Biurrun
     * minimum Lagrange multipler
1684
     * - encoding: Set by user.
1685 158c7f05 Michael Niedermayer
     * - decoding: unused
1686
     */
1687
    int lmin;
1688
1689
    /**
1690 f5bccd85 Diego Biurrun
     * maximum Lagrange multipler
1691
     * - encoding: Set by user.
1692 158c7f05 Michael Niedermayer
     * - decoding: unused
1693
     */
1694
    int lmax;
1695 2a2bbcb0 Mike Melanson
1696
    /**
1697 f5bccd85 Diego Biurrun
     * palette control structure
1698 2a2bbcb0 Mike Melanson
     * - encoding: ??? (no palette-enabled encoder yet)
1699 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1700 2a2bbcb0 Mike Melanson
     */
1701
    struct AVPaletteControl *palctrl;
1702 821cb11f Michael Niedermayer
1703
    /**
1704
     * noise reduction strength
1705 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1706 821cb11f Michael Niedermayer
     * - decoding: unused
1707
     */
1708
    int noise_reduction;
1709 115329f1 Diego Biurrun
1710 074c4ca7 Roberto Togni
    /**
1711 f5bccd85 Diego Biurrun
     * Called at the beginning of a frame to get cr buffer for it.
1712
     * Buffer type (size, hints) must be the same. libavcodec won't check it.
1713
     * libavcodec will pass previous buffer in pic, function should return
1714 e1c2a5a0 Roberto Togni
     * same buffer or new buffer with old frame "painted" into it.
1715 f5bccd85 Diego Biurrun
     * If pic.data[0] == NULL must behave like get_buffer().
1716 074c4ca7 Roberto Togni
     * - encoding: unused
1717 f5bccd85 Diego Biurrun
     * - decoding: Set by libavcodec., user can override
1718 074c4ca7 Roberto Togni
     */
1719 e1c2a5a0 Roberto Togni
    int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
1720 ba58dabc Michael Niedermayer
1721
    /**
1722 f5bccd85 Diego Biurrun
     * Number of bits which should be loaded into the rc buffer before decoding starts.
1723
     * - encoding: Set by user.
1724 ba58dabc Michael Niedermayer
     * - decoding: unused
1725
     */
1726
    int rc_initial_buffer_occupancy;
1727
1728
    /**
1729
     *
1730 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1731 ba58dabc Michael Niedermayer
     * - decoding: unused
1732
     */
1733
    int inter_threshold;
1734
1735
    /**
1736 f5bccd85 Diego Biurrun
     * CODEC_FLAG2_*
1737
     * - encoding: Set by user.
1738
     * - decoding: Set by user.
1739 ba58dabc Michael Niedermayer
     */
1740
    int flags2;
1741 7ebfc0ea Michael Niedermayer
1742
    /**
1743 f5bccd85 Diego Biurrun
     * Simulates errors in the bitstream to test error concealment.
1744
     * - encoding: Set by user.
1745
     * - decoding: unused
1746 7ebfc0ea Michael Niedermayer
     */
1747
    int error_rate;
1748 115329f1 Diego Biurrun
1749 a1e257b2 Michael Niedermayer
    /**
1750
     * MP3 antialias algorithm, see FF_AA_* below.
1751
     * - encoding: unused
1752 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1753 a1e257b2 Michael Niedermayer
     */
1754
    int antialias_algo;
1755
#define FF_AA_AUTO    0
1756
#define FF_AA_FASTINT 1 //not implemented yet
1757
#define FF_AA_INT     2
1758
#define FF_AA_FLOAT   3
1759 77ea0d4b Michael Niedermayer
    /**
1760 f5bccd85 Diego Biurrun
     * quantizer noise shaping
1761
     * - encoding: Set by user.
1762 77ea0d4b Michael Niedermayer
     * - decoding: unused
1763
     */
1764
    int quantizer_noise_shaping;
1765 9c3d33d6 Michael Niedermayer
1766
    /**
1767 f5bccd85 Diego Biurrun
     * thread count
1768 eafcac6a Diego Biurrun
     * is used to decide how many independent tasks should be passed to execute()
1769 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1770
     * - decoding: Set by user.
1771 9c3d33d6 Michael Niedermayer
     */
1772
    int thread_count;
1773 115329f1 Diego Biurrun
1774 9c3d33d6 Michael Niedermayer
    /**
1775 f5bccd85 Diego Biurrun
     * The codec may call this to execute several independent things.
1776
     * It will return only after finishing all tasks.
1777
     * The user may replace this with some multithreaded implementation,
1778
     * the default implementation will execute the parts serially.
1779 399cec2f Michael Niedermayer
     * @param count the number of things to execute
1780 f5bccd85 Diego Biurrun
     * - encoding: Set by libavcodec, user can override.
1781
     * - decoding: Set by libavcodec, user can override.
1782 9c3d33d6 Michael Niedermayer
     */
1783
    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count);
1784 115329f1 Diego Biurrun
1785 9c3d33d6 Michael Niedermayer
    /**
1786 f5bccd85 Diego Biurrun
     * thread opaque
1787
     * Can be used by execute() to store some per AVCodecContext stuff.
1788 9c3d33d6 Michael Niedermayer
     * - encoding: set by execute()
1789
     * - decoding: set by execute()
1790
     */
1791
    void *thread_opaque;
1792 a4d36c11 Michael Niedermayer
1793
    /**
1794 f5bccd85 Diego Biurrun
     * Motion estimation threshold below which no motion estimation is
1795
     * performed, but instead the user specified motion vectors are used.
1796 115329f1 Diego Biurrun
     *
1797 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1798 f20f8a8b Michael Niedermayer
     * - decoding: unused
1799 a4d36c11 Michael Niedermayer
     */
1800 2750b827 Michael Niedermayer
     int me_threshold;
1801 f20f8a8b Michael Niedermayer
1802
    /**
1803 f5bccd85 Diego Biurrun
     * Macroblock threshold below which the user specified macroblock types will be used.
1804
     * - encoding: Set by user.
1805 f20f8a8b Michael Niedermayer
     * - decoding: unused
1806
     */
1807
     int mb_threshold;
1808 bf266e19 Michael Niedermayer
1809
    /**
1810 f5bccd85 Diego Biurrun
     * precision of the intra DC coefficient - 8
1811
     * - encoding: Set by user.
1812 bf266e19 Michael Niedermayer
     * - decoding: unused
1813
     */
1814
     int intra_dc_precision;
1815 d4c5d2ad Michael Niedermayer
1816
    /**
1817 f5bccd85 Diego Biurrun
     * noise vs. sse weight for the nsse comparsion function
1818
     * - encoding: Set by user.
1819 d4c5d2ad Michael Niedermayer
     * - decoding: unused
1820
     */
1821
     int nsse_weight;
1822 0dfd33c3 Michael Niedermayer
1823
    /**
1824 f5bccd85 Diego Biurrun
     * Number of macroblock rows at the top which are skipped.
1825 0dfd33c3 Michael Niedermayer
     * - encoding: unused
1826 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1827 0dfd33c3 Michael Niedermayer
     */
1828
     int skip_top;
1829
1830
    /**
1831 f5bccd85 Diego Biurrun
     * Number of macroblock rows at the bottom which are skipped.
1832 0dfd33c3 Michael Niedermayer
     * - encoding: unused
1833 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1834 0dfd33c3 Michael Niedermayer
     */
1835
     int skip_bottom;
1836 baced9f5 Michael Niedermayer
1837
    /**
1838
     * profile
1839 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1840
     * - decoding: Set by libavcodec.
1841 baced9f5 Michael Niedermayer
     */
1842
     int profile;
1843
#define FF_PROFILE_UNKNOWN -99
1844 4f2c36ac Nicolas George
#define FF_PROFILE_AAC_MAIN 0
1845 273b0cd3 Diego Biurrun
#define FF_PROFILE_AAC_LOW  1
1846
#define FF_PROFILE_AAC_SSR  2
1847
#define FF_PROFILE_AAC_LTP  3
1848 baced9f5 Michael Niedermayer
1849
    /**
1850
     * level
1851 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1852
     * - decoding: Set by libavcodec.
1853 baced9f5 Michael Niedermayer
     */
1854
     int level;
1855
#define FF_LEVEL_UNKNOWN -99
1856 178fcca8 Michael Niedermayer
1857
    /**
1858 f5bccd85 Diego Biurrun
     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
1859 178fcca8 Michael Niedermayer
     * - encoding: unused
1860 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1861 178fcca8 Michael Niedermayer
     */
1862
     int lowres;
1863 21adafec Michael Niedermayer
1864
    /**
1865 f5bccd85 Diego Biurrun
     * Bitstream width / height, may be different from width/height if lowres
1866
     * or other things are used.
1867 21adafec Michael Niedermayer
     * - encoding: unused
1868 f5bccd85 Diego Biurrun
     * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
1869 21adafec Michael Niedermayer
     */
1870
    int coded_width, coded_height;
1871 bbf18b21 Michael Niedermayer
1872
    /**
1873
     * frame skip threshold
1874 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1875 bbf18b21 Michael Niedermayer
     * - decoding: unused
1876
     */
1877
    int frame_skip_threshold;
1878
1879
    /**
1880
     * frame skip factor
1881 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1882 bbf18b21 Michael Niedermayer
     * - decoding: unused
1883
     */
1884
    int frame_skip_factor;
1885 0fd6aea1 Michael Niedermayer
1886
    /**
1887
     * frame skip exponent
1888 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1889 0fd6aea1 Michael Niedermayer
     * - decoding: unused
1890
     */
1891
    int frame_skip_exp;
1892
1893
    /**
1894 f5bccd85 Diego Biurrun
     * frame skip comparison function
1895
     * - encoding: Set by user.
1896 0fd6aea1 Michael Niedermayer
     * - decoding: unused
1897
     */
1898
    int frame_skip_cmp;
1899 957c743a Christophe Massiot
1900
    /**
1901 f5bccd85 Diego Biurrun
     * Border processing masking, raises the quantizer for mbs on the borders
1902 957c743a Christophe Massiot
     * of the picture.
1903 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1904 957c743a Christophe Massiot
     * - decoding: unused
1905
     */
1906
    float border_masking;
1907 6e0d8c06 Michael Niedermayer
1908
    /**
1909 f5bccd85 Diego Biurrun
     * minimum MB lagrange multipler
1910
     * - encoding: Set by user.
1911 6e0d8c06 Michael Niedermayer
     * - decoding: unused
1912
     */
1913
    int mb_lmin;
1914
1915
    /**
1916 f5bccd85 Diego Biurrun
     * maximum MB lagrange multipler
1917
     * - encoding: Set by user.
1918 6e0d8c06 Michael Niedermayer
     * - decoding: unused
1919
     */
1920
    int mb_lmax;
1921 09c3e44e Michael Niedermayer
1922
    /**
1923 115329f1 Diego Biurrun
     *
1924 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1925 09c3e44e Michael Niedermayer
     * - decoding: unused
1926
     */
1927
    int me_penalty_compensation;
1928 8c3eba7c Michael Niedermayer
1929
    /**
1930 115329f1 Diego Biurrun
     *
1931 8c3eba7c Michael Niedermayer
     * - encoding: unused
1932 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1933 8c3eba7c Michael Niedermayer
     */
1934
    enum AVDiscard skip_loop_filter;
1935
1936
    /**
1937 115329f1 Diego Biurrun
     *
1938 8c3eba7c Michael Niedermayer
     * - encoding: unused
1939 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1940 8c3eba7c Michael Niedermayer
     */
1941
    enum AVDiscard skip_idct;
1942
1943
    /**
1944 115329f1 Diego Biurrun
     *
1945 8c3eba7c Michael Niedermayer
     * - encoding: unused
1946 f5bccd85 Diego Biurrun
     * - decoding: Set by user.
1947 8c3eba7c Michael Niedermayer
     */
1948
    enum AVDiscard skip_frame;
1949 316a2ec8 Michael Niedermayer
1950
    /**
1951
     *
1952 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1953 316a2ec8 Michael Niedermayer
     * - decoding: unused
1954
     */
1955
    int bidir_refine;
1956 e8501c93 Michael Niedermayer
1957
    /**
1958
     *
1959 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1960 e8501c93 Michael Niedermayer
     * - decoding: unused
1961
     */
1962
    int brd_scale;
1963 58f7833e Robert Swain
1964
    /**
1965
     * constant rate factor - quality-based VBR - values ~correspond to qps
1966 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1967 58f7833e Robert Swain
     * - decoding: unused
1968
     */
1969 9f1c1c99 Luca Barbato
    float crf;
1970 58f7833e Robert Swain
1971
    /**
1972
     * constant quantization parameter rate control method
1973 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1974 58f7833e Robert Swain
     * - decoding: unused
1975
     */
1976
    int cqp;
1977
1978
    /**
1979 f5bccd85 Diego Biurrun
     * minimum GOP size
1980
     * - encoding: Set by user.
1981 58f7833e Robert Swain
     * - decoding: unused
1982
     */
1983
    int keyint_min;
1984
1985
    /**
1986
     * number of reference frames
1987 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1988 58f7833e Robert Swain
     * - decoding: unused
1989
     */
1990
    int refs;
1991
1992
    /**
1993
     * chroma qp offset from luma
1994 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
1995 58f7833e Robert Swain
     * - decoding: unused
1996
     */
1997
    int chromaoffset;
1998
1999
    /**
2000 f5bccd85 Diego Biurrun
     * Influences how often B-frames are used.
2001
     * - encoding: Set by user.
2002 58f7833e Robert Swain
     * - decoding: unused
2003
     */
2004
    int bframebias;
2005
2006
    /**
2007
     * trellis RD quantization
2008 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2009 58f7833e Robert Swain
     * - decoding: unused
2010
     */
2011
    int trellis;
2012
2013
    /**
2014 f5bccd85 Diego Biurrun
     * Reduce fluctuations in qp (before curve compression).
2015
     * - encoding: Set by user.
2016 58f7833e Robert Swain
     * - decoding: unused
2017
     */
2018
    float complexityblur;
2019
2020
    /**
2021
     * in-loop deblocking filter alphac0 parameter
2022
     * alpha is in the range -6...6
2023 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2024 58f7833e Robert Swain
     * - decoding: unused
2025
     */
2026
    int deblockalpha;
2027
2028
    /**
2029
     * in-loop deblocking filter beta parameter
2030
     * beta is in the range -6...6
2031 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2032 58f7833e Robert Swain
     * - decoding: unused
2033
     */
2034
    int deblockbeta;
2035
2036
    /**
2037
     * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
2038 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2039 58f7833e Robert Swain
     * - decoding: unused
2040
     */
2041
    int partitions;
2042
#define X264_PART_I4X4 0x001  /* Analyse i4x4 */
2043
#define X264_PART_I8X8 0x002  /* Analyse i8x8 (requires 8x8 transform) */
2044
#define X264_PART_P8X8 0x010  /* Analyse p16x8, p8x16 and p8x8 */
2045
#define X264_PART_P4X4 0x020  /* Analyse p8x4, p4x8, p4x4 */
2046
#define X264_PART_B8X8 0x100  /* Analyse b16x8, b8x16 and b8x8 */
2047
2048
    /**
2049 f5bccd85 Diego Biurrun
     * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal)
2050
     * - encoding: Set by user.
2051 58f7833e Robert Swain
     * - decoding: unused
2052
     */
2053
    int directpred;
2054 4f59b684 Diego Biurrun
2055 14f0c8e2 Luca Abeni
    /**
2056 f5bccd85 Diego Biurrun
     * Audio cutoff bandwidth (0 means "automatic"), currently used only by FAAC.
2057
     * - encoding: Set by user.
2058 14f0c8e2 Luca Abeni
     * - decoding: unused
2059
     */
2060
    int cutoff;
2061 39a64e30 Corey Hickey
2062
    /**
2063 f5bccd85 Diego Biurrun
     * Multiplied by qscale for each frame and added to scene_change_score.
2064
     * - encoding: Set by user.
2065 39a64e30 Corey Hickey
     * - decoding: unused
2066
     */
2067
    int scenechange_factor;
2068 1dd509b1 Michael Niedermayer
2069
    /**
2070
     *
2071 f5bccd85 Diego Biurrun
     * Note: Value depends upon the compare function used for fullpel ME.
2072
     * - encoding: Set by user.
2073 1dd509b1 Michael Niedermayer
     * - decoding: unused
2074
     */
2075
    int mv0_threshold;
2076 f9243d34 Corey Hickey
2077
    /**
2078 f5bccd85 Diego Biurrun
     * Adjusts sensitivity of b_frame_strategy 1.
2079
     * - encoding: Set by user.
2080 f9243d34 Corey Hickey
     * - decoding: unused
2081
     */
2082
    int b_sensitivity;
2083 a403fc03 Justin Ruggles
2084
    /**
2085 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2086 a403fc03 Justin Ruggles
     * - decoding: unused
2087
     */
2088
    int compression_level;
2089
#define FF_COMPRESSION_DEFAULT -1
2090
2091
    /**
2092 f5bccd85 Diego Biurrun
     * Sets whether to use LPC mode - used by FLAC encoder.
2093
     * - encoding: Set by user.
2094
     * - decoding: unused
2095 a403fc03 Justin Ruggles
     */
2096
    int use_lpc;
2097
2098
    /**
2099
     * LPC coefficient precision - used by FLAC encoder
2100 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2101
     * - decoding: unused
2102 a403fc03 Justin Ruggles
     */
2103
    int lpc_coeff_precision;
2104
2105
    /**
2106 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2107
     * - decoding: unused
2108 a403fc03 Justin Ruggles
     */
2109
    int min_prediction_order;
2110
2111
    /**
2112 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2113
     * - decoding: unused
2114 a403fc03 Justin Ruggles
     */
2115
    int max_prediction_order;
2116
2117
    /**
2118
     * search method for selecting prediction order
2119 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2120
     * - decoding: unused
2121 a403fc03 Justin Ruggles
     */
2122
    int prediction_order_method;
2123
2124
    /**
2125 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2126
     * - decoding: unused
2127 a403fc03 Justin Ruggles
     */
2128
    int min_partition_order;
2129
2130
    /**
2131 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2132
     * - decoding: unused
2133 a403fc03 Justin Ruggles
     */
2134
    int max_partition_order;
2135 80d617f5 Baptiste Coudurier
2136
    /**
2137
     * GOP timecode frame start number, in non drop frame format
2138 f5bccd85 Diego Biurrun
     * - encoding: Set by user.
2139
     * - decoding: unused
2140 80d617f5 Baptiste Coudurier
     */
2141
    int64_t timecode_frame_start;
2142 b1ec601f Reimar Döffinger
2143
    /**
2144
     * Decoder should decode to this many channels if it can (0 for default)
2145
     * - encoding: unused
2146
     * - decoding: Set by user.
2147
     */
2148
    int request_channels;
2149 de6d9b64 Fabrice Bellard
} AVCodecContext;
2150
2151 64863965 Michael Niedermayer
/**
2152
 * AVCodec.
2153
 */
2154 de6d9b64 Fabrice Bellard
typedef struct AVCodec {
2155 6b0cdb6e Nicolas George
    /**
2156
     * Name of the codec implementation.
2157
     * The name is globally unique among encoders and among decoders (but an
2158
     * encoder and a decoder can share the same name).
2159
     * This is the primary way to find a codec from the user perspective.
2160
     */
2161 18f77016 Zdenek Kabelac
    const char *name;
2162 5d234974 Zdenek Kabelac
    enum CodecType type;
2163 9297ddd3 Michael Niedermayer
    enum CodecID id;
2164 de6d9b64 Fabrice Bellard
    int priv_data_size;
2165
    int (*init)(AVCodecContext *);
2166 0c1a9eda Zdenek Kabelac
    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
2167 de6d9b64 Fabrice Bellard
    int (*close)(AVCodecContext *);
2168 0fd90455 Michael Niedermayer
    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
2169 0c1a9eda Zdenek Kabelac
                  uint8_t *buf, int buf_size);
2170 bf89e6b1 Fabrice Bellard
    int capabilities;
2171 de6d9b64 Fabrice Bellard
    struct AVCodec *next;
2172 7a06ff14 Michael Niedermayer
    void (*flush)(AVCodecContext *);
2173 b0df362b Zdenek Kabelac
    const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0}
2174 fcee0164 Michael Niedermayer
    const enum PixelFormat *pix_fmts;       ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1
2175 de6d9b64 Fabrice Bellard
} AVCodec;
2176
2177 97d96aaa Zdenek Kabelac
/**
2178 d7425f59 Michael Niedermayer
 * four components are given, that's all.
2179
 * the last component is alpha
2180
 */
2181 de6d9b64 Fabrice Bellard
typedef struct AVPicture {
2182 0c1a9eda Zdenek Kabelac
    uint8_t *data[4];
2183 cd394651 Michael Niedermayer
    int linesize[4];       ///< number of bytes per line
2184 de6d9b64 Fabrice Bellard
} AVPicture;
2185
2186 ba118447 Mike Melanson
/**
2187
 * AVPaletteControl
2188
 * This structure defines a method for communicating palette changes
2189
 * between and demuxer and a decoder.
2190 671adb17 Mark Cox
 *
2191
 * @deprecated Use AVPacket to send palette changes instead.
2192
 * This is totally broken.
2193 ba118447 Mike Melanson
 */
2194 2e99641b Roberto Togni
#define AVPALETTE_SIZE 1024
2195 432d84c3 Michael Niedermayer
#define AVPALETTE_COUNT 256
2196 ba118447 Mike Melanson
typedef struct AVPaletteControl {
2197
2198 f5bccd85 Diego Biurrun
    /* Demuxer sets this to 1 to indicate the palette has changed;
2199
     * decoder resets to 0. */
2200 ba118447 Mike Melanson
    int palette_changed;
2201
2202 2a2bbcb0 Mike Melanson
    /* 4-byte ARGB palette entries, stored in native byte order; note that
2203
     * the individual palette components should be on a 8-bit scale; if
2204 f5bccd85 Diego Biurrun
     * the palette data comes from an IBM VGA native format, the component
2205
     * data is probably 6 bits in size and needs to be scaled. */
2206 2e99641b Roberto Togni
    unsigned int palette[AVPALETTE_COUNT];
2207 ba118447 Mike Melanson
2208 18239edf Michael Niedermayer
} AVPaletteControl attribute_deprecated;
2209 ba118447 Mike Melanson
2210 c6ec28b1 Michael Niedermayer
typedef struct AVSubtitleRect {
2211 240c1657 Fabrice Bellard
    uint16_t x;
2212
    uint16_t y;
2213
    uint16_t w;
2214
    uint16_t h;
2215
    uint16_t nb_colors;
2216
    int linesize;
2217
    uint32_t *rgba_palette;
2218
    uint8_t *bitmap;
2219 c6ec28b1 Michael Niedermayer
} AVSubtitleRect;
2220
2221
typedef struct AVSubtitle {
2222
    uint16_t format; /* 0 = graphics */
2223
    uint32_t start_display_time; /* relative to packet pts, in ms */
2224
    uint32_t end_display_time; /* relative to packet pts, in ms */
2225
    uint32_t num_rects;
2226
    AVSubtitleRect *rects;
2227 240c1657 Fabrice Bellard
} AVSubtitle;
2228
2229
2230 de6d9b64 Fabrice Bellard
/* resample.c */
2231
2232
struct ReSampleContext;
2233 aaaf1635 Michael Niedermayer
struct AVResampleContext;
2234 de6d9b64 Fabrice Bellard
2235
typedef struct ReSampleContext ReSampleContext;
2236
2237 115329f1 Diego Biurrun
ReSampleContext *audio_resample_init(int output_channels, int input_channels,
2238 de6d9b64 Fabrice Bellard
                                     int output_rate, int input_rate);
2239
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
2240
void audio_resample_close(ReSampleContext *s);
2241
2242 6e225de2 Michael Niedermayer
struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
2243 aaaf1635 Michael Niedermayer
int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
2244 2d48eddd Michael Niedermayer
void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
2245 d88443ae William Juwono
void av_resample_close(struct AVResampleContext *c);
2246 aaaf1635 Michael Niedermayer
2247 bc2ce35b Michael Niedermayer
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
2248 de6d9b64 Fabrice Bellard
/* YUV420 format is assumed ! */
2249
2250 671adb17 Mark Cox
/**
2251
 * @deprecated Use the software scaler (swscale) instead.
2252
 */
2253 bc2ce35b Michael Niedermayer
typedef struct ImgReSampleContext ImgReSampleContext attribute_deprecated;
2254 de6d9b64 Fabrice Bellard
2255 671adb17 Mark Cox
/**
2256
 * @deprecated Use the software scaler (swscale) instead.
2257
 */
2258 bc2ce35b Michael Niedermayer
attribute_deprecated ImgReSampleContext *img_resample_init(int output_width, int output_height,
2259 de6d9b64 Fabrice Bellard
                                      int input_width, int input_height);
2260 ab6d194a Michael Niedermayer
2261 671adb17 Mark Cox
/**
2262
 * @deprecated Use the software scaler (swscale) instead.
2263
 */
2264 bc2ce35b Michael Niedermayer
attribute_deprecated ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
2265 ab6d194a Michael Niedermayer
                                      int iwidth, int iheight,
2266
                                      int topBand, int bottomBand,
2267 1ff93ffc Todd Kirby
                                      int leftBand, int rightBand,
2268
                                      int padtop, int padbottom,
2269
                                      int padleft, int padright);
2270
2271 671adb17 Mark Cox
/**
2272
 * @deprecated Use the software scaler (swscale) instead.
2273
 */
2274 4f13e733 Måns Rullgård
attribute_deprecated void img_resample(struct ImgReSampleContext *s,
2275 da64ecc3 Drew Hess
                  AVPicture *output, const AVPicture *input);
2276 de6d9b64 Fabrice Bellard
2277 671adb17 Mark Cox
/**
2278
 * @deprecated Use the software scaler (swscale) instead.
2279
 */
2280 4f13e733 Måns Rullgård
attribute_deprecated void img_resample_close(struct ImgReSampleContext *s);
2281 bc2ce35b Michael Niedermayer
2282
#endif
2283 de6d9b64 Fabrice Bellard
2284 75917b88 Drew Hess
/**
2285
 * Allocate memory for a picture.  Call avpicture_free to free it.
2286
 *
2287 f5bccd85 Diego Biurrun
 * @param picture the picture to be filled in
2288
 * @param pix_fmt the format of the picture
2289
 * @param width the width of the picture
2290
 * @param height the height of the picture
2291
 * @return zero if successful, a negative value if not
2292 75917b88 Drew Hess
 */
2293
int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
2294
2295 8fc3d25c Panagiotis Issaris
/**
2296
 * Free a picture previously allocated by avpicture_alloc().
2297
 *
2298 f5bccd85 Diego Biurrun
 * @param picture the AVPicture to be freed
2299 8fc3d25c Panagiotis Issaris
 */
2300 75917b88 Drew Hess
void avpicture_free(AVPicture *picture);
2301
2302 392cf77a Panagiotis Issaris
/**
2303 f5bccd85 Diego Biurrun
 * Fill in the AVPicture fields.
2304 392cf77a Panagiotis Issaris
 * The fields of the given AVPicture are filled in by using the 'ptr' address
2305
 * which points to the image data buffer. Depending on the specified picture
2306
 * format, one or multiple image data pointers and line sizes will be set.
2307
 * If a planar format is specified, several pointers will be set pointing to
2308
 * the different picture planes and the line sizes of the different planes
2309
 * will be stored in the lines_sizes array.
2310
 *
2311 f5bccd85 Diego Biurrun
 * @param picture AVPicture whose fields are to be filled in
2312 392cf77a Panagiotis Issaris
 * @param ptr Buffer which will contain or contains the actual image data
2313 f5bccd85 Diego Biurrun
 * @param pix_fmt The format in which the picture data is stored.
2314
 * @param width the width of the image in pixels
2315
 * @param height the height of the image in pixels
2316
 * @return size of the image data in bytes
2317 392cf77a Panagiotis Issaris
 */
2318 0c1a9eda Zdenek Kabelac
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
2319 2d1a4094 Fabrice Bellard
                   int pix_fmt, int width, int height);
2320 da64ecc3 Drew Hess
int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
2321 63167088 Roman Shaposhnik
                     unsigned char *dest, int dest_size);
2322 392cf77a Panagiotis Issaris
2323
/**
2324
 * Calculate the size in bytes that a picture of the given width and height
2325
 * would occupy if stored in the given picture format.
2326
 *
2327 f5bccd85 Diego Biurrun
 * @param pix_fmt the given picture format
2328
 * @param width the width of the image
2329
 * @param height the height of the image
2330 392cf77a Panagiotis Issaris
 * @return Image data size in bytes
2331
 */
2332 219b06c6 Fabrice Bellard
int avpicture_get_size(int pix_fmt, int width, int height);
2333 dab64ebc Fabrice Bellard
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
2334
const char *avcodec_get_pix_fmt_name(int pix_fmt);
2335 21adafec Michael Niedermayer
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
2336 63167088 Roman Shaposhnik
enum PixelFormat avcodec_get_pix_fmt(const char* name);
2337 d07730dd Michael Niedermayer
unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
2338 219b06c6 Fabrice Bellard
2339 81299d42 Panagiotis Issaris
#define FF_LOSS_RESOLUTION  0x0001 /**< loss due to resolution change */
2340
#define FF_LOSS_DEPTH       0x0002 /**< loss due to color depth change */
2341
#define FF_LOSS_COLORSPACE  0x0004 /**< loss due to color space conversion */
2342
#define FF_LOSS_ALPHA       0x0008 /**< loss of alpha bits */
2343
#define FF_LOSS_COLORQUANT  0x0010 /**< loss due to color quantization */
2344
#define FF_LOSS_CHROMA      0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
2345 fab21997 Fabrice Bellard
2346 392cf77a Panagiotis Issaris
/**
2347 81299d42 Panagiotis Issaris
 * Computes what kind of losses will occur when converting from one specific
2348
 * pixel format to another.
2349
 * When converting from one pixel format to another, information loss may occur.
2350
 * For example, when converting from RGB24 to GRAY, the color information will
2351
 * be lost. Similarly, other losses occur when converting from some formats to
2352
 * other formats. These losses can involve loss of chroma, but also loss of
2353
 * resolution, loss of color depth, loss due to the color space conversion, loss
2354
 * of the alpha bits or loss due to color quantization.
2355 f5bccd85 Diego Biurrun
 * avcodec_get_fix_fmt_loss() informs you about the various types of losses
2356
 * which will occur when converting from one pixel format to another.
2357 81299d42 Panagiotis Issaris
 *
2358 f5bccd85 Diego Biurrun
 * @param[in] dst_pix_fmt destination pixel format
2359
 * @param[in] src_pix_fmt source pixel format
2360 81299d42 Panagiotis Issaris
 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2361
 * @return Combination of flags informing you what kind of losses will occur.
2362 392cf77a Panagiotis Issaris
 */
2363 fab21997 Fabrice Bellard
int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
2364
                             int has_alpha);
2365 392cf77a Panagiotis Issaris
2366
/**
2367 81299d42 Panagiotis Issaris
 * Finds the best pixel format to convert to given a certain source pixel
2368
 * format.  When converting from one pixel format to another, information loss
2369
 * may occur.  For example, when converting from RGB24 to GRAY, the color
2370
 * information will be lost. Similarly, other losses occur when converting from
2371
 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
2372 f5bccd85 Diego Biurrun
 * the given pixel formats should be used to suffer the least amount of loss.
2373
 * The pixel formats from which it chooses one, are determined by the
2374 81299d42 Panagiotis Issaris
 * \p pix_fmt_mask parameter.
2375
 *
2376
 * @code
2377
 * src_pix_fmt = PIX_FMT_YUV420P;
2378
 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
2379
 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
2380
 * @endcode
2381
 *
2382 f5bccd85 Diego Biurrun
 * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
2383
 * @param[in] src_pix_fmt source pixel format
2384 81299d42 Panagiotis Issaris
 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2385
 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
2386
 * @return The best pixel format to convert to or -1 if none was found.
2387 392cf77a Panagiotis Issaris
 */
2388 fab21997 Fabrice Bellard
int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
2389
                              int has_alpha, int *loss_ptr);
2390
2391 c3b95b1d Stefano Sabatini
2392
/**
2393
 * Print in buf the string corresponding to the pixel format with
2394
 * number pix_fmt, or an header if pix_fmt is negative.
2395
 *
2396 9bd51b9a Panagiotis Issaris
 * @param[in] buf the buffer where to write the string
2397
 * @param[in] buf_size the size of buf
2398
 * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or
2399 c3b95b1d Stefano Sabatini
 * a negative value to print the corresponding header.
2400
 * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
2401
 */
2402
void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt);
2403
2404 0469baf1 Fabrice Bellard
#define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
2405
#define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
2406 392cf77a Panagiotis Issaris
2407
/**
2408
 * Tell if an image really has transparent alpha values.
2409
 * @return ored mask of FF_ALPHA_xxx constants
2410
 */
2411 da64ecc3 Drew Hess
int img_get_alpha_info(const AVPicture *src,
2412 bb270c08 Diego Biurrun
                       int pix_fmt, int width, int height);
2413 0469baf1 Fabrice Bellard
2414 bc2ce35b Michael Niedermayer
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
2415 671adb17 Mark Cox
/**
2416
 * convert among pixel formats
2417
 * @deprecated Use the software scaler (swscale) instead.
2418
 */
2419 bc2ce35b Michael Niedermayer
attribute_deprecated int img_convert(AVPicture *dst, int dst_pix_fmt,
2420 115329f1 Diego Biurrun
                const AVPicture *src, int pix_fmt,
2421 219b06c6 Fabrice Bellard
                int width, int height);
2422 bc2ce35b Michael Niedermayer
#endif
2423 219b06c6 Fabrice Bellard
2424
/* deinterlace a picture */
2425 392cf77a Panagiotis Issaris
/* deinterlace - if not supported return -1 */
2426 da64ecc3 Drew Hess
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
2427 de6d9b64 Fabrice Bellard
                          int pix_fmt, int width, int height);
2428
2429
/* external high level API */
2430
2431
extern AVCodec *first_avcodec;
2432
2433 156e5023 Nick Kurshev
/* returns LIBAVCODEC_VERSION_INT constant */
2434 51a49663 Fabrice Bellard
unsigned avcodec_version(void);
2435 8bceb6af Nick Kurshev
/* returns LIBAVCODEC_BUILD constant */
2436 51a49663 Fabrice Bellard
unsigned avcodec_build(void);
2437 f9ec0aa1 Panagiotis Issaris
2438
/**
2439
 * Initializes libavcodec.
2440
 *
2441
 * @warning This function \e must be called before any other libavcodec
2442
 * function.
2443
 */
2444 de6d9b64 Fabrice Bellard
void avcodec_init(void);
2445
2446
void register_avcodec(AVCodec *format);
2447 f9ec0aa1 Panagiotis Issaris
2448
/**
2449 645f7879 Ville Skyttä
 * Finds a registered encoder with a matching codec ID.
2450 f9ec0aa1 Panagiotis Issaris
 *
2451 f5bccd85 Diego Biurrun
 * @param id CodecID of the requested encoder
2452 f9ec0aa1 Panagiotis Issaris
 * @return An encoder if one was found, NULL otherwise.
2453
 */
2454 de6d9b64 Fabrice Bellard
AVCodec *avcodec_find_encoder(enum CodecID id);
2455 f9ec0aa1 Panagiotis Issaris
2456
/**
2457 645f7879 Ville Skyttä
 * Finds a registered encoder with the specified name.
2458 f9ec0aa1 Panagiotis Issaris
 *
2459 f5bccd85 Diego Biurrun
 * @param name name of the requested encoder
2460 f9ec0aa1 Panagiotis Issaris
 * @return An encoder if one was found, NULL otherwise.
2461
 */
2462 98f3b098 Arpi
AVCodec *avcodec_find_encoder_by_name(const char *name);
2463 f9ec0aa1 Panagiotis Issaris
2464
/**
2465 645f7879 Ville Skyttä
 * Finds a registered decoder with a matching codec ID.
2466 f9ec0aa1 Panagiotis Issaris
 *
2467 f5bccd85 Diego Biurrun
 * @param id CodecID of the requested decoder
2468 f9ec0aa1 Panagiotis Issaris
 * @return A decoder if one was found, NULL otherwise.
2469
 */
2470 de6d9b64 Fabrice Bellard
AVCodec *avcodec_find_decoder(enum CodecID id);
2471 f9ec0aa1 Panagiotis Issaris
2472
/**
2473 645f7879 Ville Skyttä
 * Finds a registered decoder with the specified name.
2474 f9ec0aa1 Panagiotis Issaris
 *
2475 f5bccd85 Diego Biurrun
 * @param name name of the requested decoder
2476 f9ec0aa1 Panagiotis Issaris
 * @return A decoder if one was found, NULL otherwise.
2477
 */
2478 de6d9b64 Fabrice Bellard
AVCodec *avcodec_find_decoder_by_name(const char *name);
2479
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
2480
2481 f9ec0aa1 Panagiotis Issaris
/**
2482
 * Sets the fields of the given AVCodecContext to default values.
2483
 *
2484
 * @param s The AVCodecContext of which the fields should be set to default values.
2485
 */
2486 1e491e29 Michael Niedermayer
void avcodec_get_context_defaults(AVCodecContext *s);
2487 f9ec0aa1 Panagiotis Issaris
2488 29301573 Michael Niedermayer
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
2489
 *  we WILL change its arguments and name a few times! */
2490
void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType);
2491
2492 f9ec0aa1 Panagiotis Issaris
/**
2493
 * Allocates an AVCodecContext and sets its fields to default values.  The
2494
 * resulting struct can be deallocated by simply calling av_free().
2495
 *
2496
 * @return An AVCodecContext filled with default values or NULL on failure.
2497
 * @see avcodec_get_context_defaults
2498
 */
2499 7ffbb60e Falk Hüffner
AVCodecContext *avcodec_alloc_context(void);
2500 f9ec0aa1 Panagiotis Issaris
2501 29301573 Michael Niedermayer
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
2502
 *  we WILL change its arguments and name a few times! */
2503
AVCodecContext *avcodec_alloc_context2(enum CodecType);
2504
2505 f9ec0aa1 Panagiotis Issaris
/**
2506
 * Sets the fields of the given AVFrame to default values.
2507
 *
2508
 * @param pic The AVFrame of which the fields should be set to default values.
2509
 */
2510 7906085f Falk Hüffner
void avcodec_get_frame_defaults(AVFrame *pic);
2511 f9ec0aa1 Panagiotis Issaris
2512
/**
2513
 * Allocates an AVFrame and sets its fields to default values.  The resulting
2514
 * struct can be deallocated by simply calling av_free().
2515
 *
2516
 * @return An AVFrame filled with default values or NULL on failure.
2517
 * @see avcodec_get_frame_defaults
2518
 */
2519 492cd3a9 Michael Niedermayer
AVFrame *avcodec_alloc_frame(void);
2520 1e491e29 Michael Niedermayer
2521 492cd3a9 Michael Niedermayer
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
2522
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
2523 3a569751 Michael Niedermayer
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
2524
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
2525 f9ec0aa1 Panagiotis Issaris
2526
/**
2527
 * Checks if the given dimension of a picture is valid, meaning that all
2528
 * bytes of the picture can be addressed with a signed int.
2529
 *
2530
 * @param[in] w Width of the picture.
2531
 * @param[in] h Height of the picture.
2532
 * @return Zero if valid, a negative value if invalid.
2533
 */
2534 0ecca7a4 Michael Niedermayer
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
2535 3a569751 Michael Niedermayer
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
2536 1e491e29 Michael Niedermayer
2537 5a815088 Michael Niedermayer
int avcodec_thread_init(AVCodecContext *s, int thread_count);
2538
void avcodec_thread_free(AVCodecContext *s);
2539
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
2540 3a569751 Michael Niedermayer
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
2541 9c3d33d6 Michael Niedermayer
//FIXME func typedef
2542
2543 7a06ff14 Michael Niedermayer
/**
2544 f9ec0aa1 Panagiotis Issaris
 * Initializes the AVCodecContext to use the given AVCodec. Prior to using this
2545
 * function the context has to be allocated.
2546
 *
2547
 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
2548
 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
2549
 * retrieving a codec.
2550
 *
2551 f5bccd85 Diego Biurrun
 * @warning This function is not thread safe!
2552 f9ec0aa1 Panagiotis Issaris
 *
2553
 * @code
2554 c9823f05 Carl Eugen Hoyos
 * avcodec_register_all();
2555 f9ec0aa1 Panagiotis Issaris
 * codec = avcodec_find_decoder(CODEC_ID_H264);
2556
 * if (!codec)
2557
 *     exit(1);
2558
 *
2559
 * context = avcodec_alloc_context();
2560
 *
2561
 * if (avcodec_open(context, codec) < 0)
2562
 *     exit(1);
2563
 * @endcode
2564
 *
2565 f5bccd85 Diego Biurrun
 * @param avctx The context which will be set up to use the given codec.
2566 f9ec0aa1 Panagiotis Issaris
 * @param codec The codec to use within the context.
2567 f5bccd85 Diego Biurrun
 * @return zero on success, a negative value on error
2568 f9ec0aa1 Panagiotis Issaris
 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder
2569 7a06ff14 Michael Niedermayer
 */
2570 de6d9b64 Fabrice Bellard
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
2571 7a06ff14 Michael Niedermayer
2572 f9ec0aa1 Panagiotis Issaris
/**
2573
 * @deprecated Use avcodec_decode_audio2() instead.
2574
 */
2575 ac66834c Michael Niedermayer
attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
2576
                         int *frame_size_ptr,
2577
                         uint8_t *buf, int buf_size);
2578 f9ec0aa1 Panagiotis Issaris
2579 98145875 Luca Barbato
/**
2580 f9ec0aa1 Panagiotis Issaris
 * Decodes an audio frame from \p buf into \p samples.
2581 f5bccd85 Diego Biurrun
 * The avcodec_decode_audio2() function decodes an audio frame from the input
2582 f9ec0aa1 Panagiotis Issaris
 * buffer \p buf of size \p buf_size. To decode it, it makes use of the
2583 f5bccd85 Diego Biurrun