Statistics
| Branch: | Revision:

ffmpeg / libavcodec / avcodec.h @ 80a07f6e

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