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