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