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