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