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