lavc: fix mixing CODEC_ID/AV_CODEC_ID in C++ code.
[libav.git] / libavcodec / avcodec.h
CommitLineData
04d7f601
DB
1/*
2 * copyright (c) 2001 Fabrice Bellard
3 *
2912e87a 4 * This file is part of Libav.
b78e7197 5 *
2912e87a 6 * Libav is free software; you can redistribute it and/or
04d7f601
DB
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
b78e7197 9 * version 2.1 of the License, or (at your option) any later version.
04d7f601 10 *
2912e87a 11 * Libav is distributed in the hope that it will be useful,
04d7f601
DB
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
2912e87a 17 * License along with Libav; if not, write to the Free Software
e5a389a1 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
04d7f601
DB
19 */
20
98790382
SS
21#ifndef AVCODEC_AVCODEC_H
22#define AVCODEC_AVCODEC_H
a96b68b7 23
36df8805 24/**
ba87f080 25 * @file
f5bccd85 26 * external API header
36df8805
MN
27 */
28
c60208e7 29#include <errno.h>
737eb597 30#include "libavutil/samplefmt.h"
76a448ed 31#include "libavutil/avutil.h"
7160bb71 32#include "libavutil/cpu.h"
0b950fe2 33#include "libavutil/dict.h"
abc78a5a 34#include "libavutil/log.h"
d49ea4af 35#include "libavutil/pixfmt.h"
e91709ca 36#include "libavutil/rational.h"
de6d9b64 37
3dd851c4 38#include "libavcodec/version.h"
e97e5a2e
LB
39/**
40 * @defgroup libavc Encoding/Decoding Library
41 * @{
42 *
43 * @defgroup lavc_decoding Decoding
44 * @{
45 * @}
46 *
47 * @defgroup lavc_encoding Encoding
48 * @{
49 * @}
50 *
51 * @defgroup lavc_codec Codecs
52 * @{
53 * @defgroup lavc_codec_native Native Codecs
54 * @{
55 * @}
56 * @defgroup lavc_codec_wrappers External library wrappers
57 * @{
58 * @}
59 * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
60 * @{
61 * @}
62 * @}
63 * @defgroup lavc_internal Internal
64 * @{
65 * @}
66 * @}
67 *
68 */
69
294b3a50
AK
70/**
71 * @defgroup lavc_core Core functions/structures.
72 * @ingroup libavc
73 *
74 * Basic definitions, functions for querying libavcodec capabilities,
75 * allocating core structures, etc.
76 * @{
77 */
eda7c983 78
104e10fb 79
7ebf5927 80/**
48966b02 81 * Identify the syntax and semantics of the bitstream.
6b0cdb6e
NG
82 * The principle is roughly:
83 * Two decoders with the same ID can decode the same streams.
84 * Two encoders with the same ID can encode compatible streams.
85 * There may be slight deviations from the principle due to implementation
86 * details.
7ebf5927 87 *
f5bccd85
DB
88 * If you add a codec ID to this list, add it so that
89 * 1. no value of a existing codec ID changes (that would break ABI),
90 * 2. it is as close as possible to similar codecs.
7ebf5927 91 */
104e10fb
AK
92enum AVCodecID {
93 AV_CODEC_ID_NONE,
ba0dabbf
DB
94
95 /* video codecs */
104e10fb
AK
96 AV_CODEC_ID_MPEG1VIDEO,
97 AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
98 AV_CODEC_ID_MPEG2VIDEO_XVMC,
99 AV_CODEC_ID_H261,
100 AV_CODEC_ID_H263,
101 AV_CODEC_ID_RV10,
102 AV_CODEC_ID_RV20,
103 AV_CODEC_ID_MJPEG,
104 AV_CODEC_ID_MJPEGB,
105 AV_CODEC_ID_LJPEG,
106 AV_CODEC_ID_SP5X,
107 AV_CODEC_ID_JPEGLS,
108 AV_CODEC_ID_MPEG4,
109 AV_CODEC_ID_RAWVIDEO,
110 AV_CODEC_ID_MSMPEG4V1,
111 AV_CODEC_ID_MSMPEG4V2,
112 AV_CODEC_ID_MSMPEG4V3,
113 AV_CODEC_ID_WMV1,
114 AV_CODEC_ID_WMV2,
115 AV_CODEC_ID_H263P,
116 AV_CODEC_ID_H263I,
117 AV_CODEC_ID_FLV1,
118 AV_CODEC_ID_SVQ1,
119 AV_CODEC_ID_SVQ3,
120 AV_CODEC_ID_DVVIDEO,
121 AV_CODEC_ID_HUFFYUV,
122 AV_CODEC_ID_CYUV,
123 AV_CODEC_ID_H264,
124 AV_CODEC_ID_INDEO3,
125 AV_CODEC_ID_VP3,
126 AV_CODEC_ID_THEORA,
127 AV_CODEC_ID_ASV1,
128 AV_CODEC_ID_ASV2,
129 AV_CODEC_ID_FFV1,
130 AV_CODEC_ID_4XM,
131 AV_CODEC_ID_VCR1,
132 AV_CODEC_ID_CLJR,
133 AV_CODEC_ID_MDEC,
134 AV_CODEC_ID_ROQ,
135 AV_CODEC_ID_INTERPLAY_VIDEO,
136 AV_CODEC_ID_XAN_WC3,
137 AV_CODEC_ID_XAN_WC4,
138 AV_CODEC_ID_RPZA,
139 AV_CODEC_ID_CINEPAK,
140 AV_CODEC_ID_WS_VQA,
141 AV_CODEC_ID_MSRLE,
142 AV_CODEC_ID_MSVIDEO1,
143 AV_CODEC_ID_IDCIN,
144 AV_CODEC_ID_8BPS,
145 AV_CODEC_ID_SMC,
146 AV_CODEC_ID_FLIC,
147 AV_CODEC_ID_TRUEMOTION1,
148 AV_CODEC_ID_VMDVIDEO,
149 AV_CODEC_ID_MSZH,
150 AV_CODEC_ID_ZLIB,
151 AV_CODEC_ID_QTRLE,
152 AV_CODEC_ID_SNOW,
153 AV_CODEC_ID_TSCC,
154 AV_CODEC_ID_ULTI,
155 AV_CODEC_ID_QDRAW,
156 AV_CODEC_ID_VIXL,
157 AV_CODEC_ID_QPEG,
158 AV_CODEC_ID_PNG,
159 AV_CODEC_ID_PPM,
160 AV_CODEC_ID_PBM,
161 AV_CODEC_ID_PGM,
162 AV_CODEC_ID_PGMYUV,
163 AV_CODEC_ID_PAM,
164 AV_CODEC_ID_FFVHUFF,
165 AV_CODEC_ID_RV30,
166 AV_CODEC_ID_RV40,
167 AV_CODEC_ID_VC1,
168 AV_CODEC_ID_WMV3,
169 AV_CODEC_ID_LOCO,
170 AV_CODEC_ID_WNV1,
171 AV_CODEC_ID_AASC,
172 AV_CODEC_ID_INDEO2,
173 AV_CODEC_ID_FRAPS,
174 AV_CODEC_ID_TRUEMOTION2,
175 AV_CODEC_ID_BMP,
176 AV_CODEC_ID_CSCD,
177 AV_CODEC_ID_MMVIDEO,
178 AV_CODEC_ID_ZMBV,
179 AV_CODEC_ID_AVS,
180 AV_CODEC_ID_SMACKVIDEO,
181 AV_CODEC_ID_NUV,
182 AV_CODEC_ID_KMVC,
183 AV_CODEC_ID_FLASHSV,
184 AV_CODEC_ID_CAVS,
185 AV_CODEC_ID_JPEG2000,
186 AV_CODEC_ID_VMNC,
187 AV_CODEC_ID_VP5,
188 AV_CODEC_ID_VP6,
189 AV_CODEC_ID_VP6F,
190 AV_CODEC_ID_TARGA,
191 AV_CODEC_ID_DSICINVIDEO,
192 AV_CODEC_ID_TIERTEXSEQVIDEO,
193 AV_CODEC_ID_TIFF,
194 AV_CODEC_ID_GIF,
195 AV_CODEC_ID_DXA,
196 AV_CODEC_ID_DNXHD,
197 AV_CODEC_ID_THP,
198 AV_CODEC_ID_SGI,
199 AV_CODEC_ID_C93,
200 AV_CODEC_ID_BETHSOFTVID,
201 AV_CODEC_ID_PTX,
202 AV_CODEC_ID_TXD,
203 AV_CODEC_ID_VP6A,
204 AV_CODEC_ID_AMV,
205 AV_CODEC_ID_VB,
206 AV_CODEC_ID_PCX,
207 AV_CODEC_ID_SUNRAST,
208 AV_CODEC_ID_INDEO4,
209 AV_CODEC_ID_INDEO5,
210 AV_CODEC_ID_MIMIC,
211 AV_CODEC_ID_RL2,
212 AV_CODEC_ID_ESCAPE124,
213 AV_CODEC_ID_DIRAC,
214 AV_CODEC_ID_BFI,
215 AV_CODEC_ID_CMV,
216 AV_CODEC_ID_MOTIONPIXELS,
217 AV_CODEC_ID_TGV,
218 AV_CODEC_ID_TGQ,
219 AV_CODEC_ID_TQI,
220 AV_CODEC_ID_AURA,
221 AV_CODEC_ID_AURA2,
222 AV_CODEC_ID_V210X,
223 AV_CODEC_ID_TMV,
224 AV_CODEC_ID_V210,
225 AV_CODEC_ID_DPX,
226 AV_CODEC_ID_MAD,
227 AV_CODEC_ID_FRWU,
228 AV_CODEC_ID_FLASHSV2,
229 AV_CODEC_ID_CDGRAPHICS,
230 AV_CODEC_ID_R210,
231 AV_CODEC_ID_ANM,
232 AV_CODEC_ID_BINKVIDEO,
233 AV_CODEC_ID_IFF_ILBM,
234 AV_CODEC_ID_IFF_BYTERUN1,
235 AV_CODEC_ID_KGV1,
236 AV_CODEC_ID_YOP,
237 AV_CODEC_ID_VP8,
238 AV_CODEC_ID_PICTOR,
239 AV_CODEC_ID_ANSI,
240 AV_CODEC_ID_A64_MULTI,
241 AV_CODEC_ID_A64_MULTI5,
242 AV_CODEC_ID_R10K,
243 AV_CODEC_ID_MXPEG,
244 AV_CODEC_ID_LAGARITH,
245 AV_CODEC_ID_PRORES,
246 AV_CODEC_ID_JV,
247 AV_CODEC_ID_DFA,
248 AV_CODEC_ID_WMV3IMAGE,
249 AV_CODEC_ID_VC1IMAGE,
250 AV_CODEC_ID_UTVIDEO,
251 AV_CODEC_ID_BMV_VIDEO,
252 AV_CODEC_ID_VBLE,
253 AV_CODEC_ID_DXTORY,
254 AV_CODEC_ID_V410,
255 AV_CODEC_ID_XWD,
256 AV_CODEC_ID_CDXL,
257 AV_CODEC_ID_XBM,
258 AV_CODEC_ID_ZEROCODEC,
259 AV_CODEC_ID_MSS1,
260 AV_CODEC_ID_MSA1,
261 AV_CODEC_ID_TSCC2,
262 AV_CODEC_ID_MTS2,
263 AV_CODEC_ID_CLLC,
40c5ee99 264
f5bccd85 265 /* various PCM "codecs" */
104e10fb
AK
266 AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
267 AV_CODEC_ID_PCM_S16LE = 0x10000,
268 AV_CODEC_ID_PCM_S16BE,
269 AV_CODEC_ID_PCM_U16LE,
270 AV_CODEC_ID_PCM_U16BE,
271 AV_CODEC_ID_PCM_S8,
272 AV_CODEC_ID_PCM_U8,
273 AV_CODEC_ID_PCM_MULAW,
274 AV_CODEC_ID_PCM_ALAW,
275 AV_CODEC_ID_PCM_S32LE,
276 AV_CODEC_ID_PCM_S32BE,
277 AV_CODEC_ID_PCM_U32LE,
278 AV_CODEC_ID_PCM_U32BE,
279 AV_CODEC_ID_PCM_S24LE,
280 AV_CODEC_ID_PCM_S24BE,
281 AV_CODEC_ID_PCM_U24LE,
282 AV_CODEC_ID_PCM_U24BE,
283 AV_CODEC_ID_PCM_S24DAUD,
284 AV_CODEC_ID_PCM_ZORK,
285 AV_CODEC_ID_PCM_S16LE_PLANAR,
286 AV_CODEC_ID_PCM_DVD,
287 AV_CODEC_ID_PCM_F32BE,
288 AV_CODEC_ID_PCM_F32LE,
289 AV_CODEC_ID_PCM_F64BE,
290 AV_CODEC_ID_PCM_F64LE,
291 AV_CODEC_ID_PCM_BLURAY,
292 AV_CODEC_ID_PCM_LXF,
293 AV_CODEC_ID_S302M,
294 AV_CODEC_ID_PCM_S8_PLANAR,
0147f198 295
f5bccd85 296 /* various ADPCM codecs */
104e10fb
AK
297 AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
298 AV_CODEC_ID_ADPCM_IMA_WAV,
299 AV_CODEC_ID_ADPCM_IMA_DK3,
300 AV_CODEC_ID_ADPCM_IMA_DK4,
301 AV_CODEC_ID_ADPCM_IMA_WS,
302 AV_CODEC_ID_ADPCM_IMA_SMJPEG,
303 AV_CODEC_ID_ADPCM_MS,
304 AV_CODEC_ID_ADPCM_4XM,
305 AV_CODEC_ID_ADPCM_XA,
306 AV_CODEC_ID_ADPCM_ADX,
307 AV_CODEC_ID_ADPCM_EA,
308 AV_CODEC_ID_ADPCM_G726,
309 AV_CODEC_ID_ADPCM_CT,
310 AV_CODEC_ID_ADPCM_SWF,
311 AV_CODEC_ID_ADPCM_YAMAHA,
312 AV_CODEC_ID_ADPCM_SBPRO_4,
313 AV_CODEC_ID_ADPCM_SBPRO_3,
314 AV_CODEC_ID_ADPCM_SBPRO_2,
315 AV_CODEC_ID_ADPCM_THP,
316 AV_CODEC_ID_ADPCM_IMA_AMV,
317 AV_CODEC_ID_ADPCM_EA_R1,
318 AV_CODEC_ID_ADPCM_EA_R3,
319 AV_CODEC_ID_ADPCM_EA_R2,
320 AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
321 AV_CODEC_ID_ADPCM_IMA_EA_EACS,
322 AV_CODEC_ID_ADPCM_EA_XAS,
323 AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
324 AV_CODEC_ID_ADPCM_IMA_ISS,
325 AV_CODEC_ID_ADPCM_G722,
326 AV_CODEC_ID_ADPCM_IMA_APC,
891f64b3 327
17179d2d 328 /* AMR */
104e10fb
AK
329 AV_CODEC_ID_AMR_NB = 0x12000,
330 AV_CODEC_ID_AMR_WB,
d663a1fd 331
b8414bbd 332 /* RealAudio codecs*/
104e10fb
AK
333 AV_CODEC_ID_RA_144 = 0x13000,
334 AV_CODEC_ID_RA_288,
3ef8be2b
MM
335
336 /* various DPCM codecs */
104e10fb
AK
337 AV_CODEC_ID_ROQ_DPCM = 0x14000,
338 AV_CODEC_ID_INTERPLAY_DPCM,
339 AV_CODEC_ID_XAN_DPCM,
340 AV_CODEC_ID_SOL_DPCM,
115329f1 341
ba0dabbf 342 /* audio codecs */
104e10fb
AK
343 AV_CODEC_ID_MP2 = 0x15000,
344 AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
345 AV_CODEC_ID_AAC,
346 AV_CODEC_ID_AC3,
347 AV_CODEC_ID_DTS,
348 AV_CODEC_ID_VORBIS,
349 AV_CODEC_ID_DVAUDIO,
350 AV_CODEC_ID_WMAV1,
351 AV_CODEC_ID_WMAV2,
352 AV_CODEC_ID_MACE3,
353 AV_CODEC_ID_MACE6,
354 AV_CODEC_ID_VMDAUDIO,
355 AV_CODEC_ID_FLAC,
356 AV_CODEC_ID_MP3ADU,
357 AV_CODEC_ID_MP3ON4,
358 AV_CODEC_ID_SHORTEN,
359 AV_CODEC_ID_ALAC,
360 AV_CODEC_ID_WESTWOOD_SND1,
361 AV_CODEC_ID_GSM, ///< as in Berlin toast format
362 AV_CODEC_ID_QDM2,
363 AV_CODEC_ID_COOK,
364 AV_CODEC_ID_TRUESPEECH,
365 AV_CODEC_ID_TTA,
366 AV_CODEC_ID_SMACKAUDIO,
367 AV_CODEC_ID_QCELP,
368 AV_CODEC_ID_WAVPACK,
369 AV_CODEC_ID_DSICINAUDIO,
370 AV_CODEC_ID_IMC,
371 AV_CODEC_ID_MUSEPACK7,
372 AV_CODEC_ID_MLP,
373 AV_CODEC_ID_GSM_MS, /* as found in WAV */
374 AV_CODEC_ID_ATRAC3,
375 AV_CODEC_ID_VOXWARE,
376 AV_CODEC_ID_APE,
377 AV_CODEC_ID_NELLYMOSER,
378 AV_CODEC_ID_MUSEPACK8,
379 AV_CODEC_ID_SPEEX,
380 AV_CODEC_ID_WMAVOICE,
381 AV_CODEC_ID_WMAPRO,
382 AV_CODEC_ID_WMALOSSLESS,
383 AV_CODEC_ID_ATRAC3P,
384 AV_CODEC_ID_EAC3,
385 AV_CODEC_ID_SIPR,
386 AV_CODEC_ID_MP1,
387 AV_CODEC_ID_TWINVQ,
388 AV_CODEC_ID_TRUEHD,
389 AV_CODEC_ID_MP4ALS,
390 AV_CODEC_ID_ATRAC1,
391 AV_CODEC_ID_BINKAUDIO_RDFT,
392 AV_CODEC_ID_BINKAUDIO_DCT,
393 AV_CODEC_ID_AAC_LATM,
394 AV_CODEC_ID_QDMC,
395 AV_CODEC_ID_CELT,
396 AV_CODEC_ID_G723_1,
397 AV_CODEC_ID_G729,
398 AV_CODEC_ID_8SVX_EXP,
399 AV_CODEC_ID_8SVX_FIB,
400 AV_CODEC_ID_BMV_AUDIO,
401 AV_CODEC_ID_RALF,
402 AV_CODEC_ID_IAC,
403 AV_CODEC_ID_ILBC,
115329f1 404
240c1657 405 /* subtitle codecs */
104e10fb
AK
406 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
407 AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
408 AV_CODEC_ID_DVB_SUBTITLE,
409 AV_CODEC_ID_TEXT, ///< raw UTF-8 text
410 AV_CODEC_ID_XSUB,
411 AV_CODEC_ID_SSA,
412 AV_CODEC_ID_MOV_TEXT,
413 AV_CODEC_ID_HDMV_PGS_SUBTITLE,
414 AV_CODEC_ID_DVB_TELETEXT,
415 AV_CODEC_ID_SRT,
115329f1 416
7ce68923 417 /* other specific kind of codecs (generally used for attachments) */
104e10fb
AK
418 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
419 AV_CODEC_ID_TTF = 0x18000,
f8d7c9d3 420
104e10fb 421 AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
0bef08e5 422
104e10fb 423 AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
f5bccd85 424 * stream (only used by libavformat) */
104e10fb 425 AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
77b5c82b 426 * stream (only used by libavformat) */
104e10fb 427 AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
2ff67c90
AK
428
429#if FF_API_CODEC_ID
430#include "old_codec_ids.h"
431#endif
de6d9b64 432};
dcedf586 433
2ff67c90
AK
434#if FF_API_CODEC_ID
435#define CodecID AVCodecID
436#endif
437
0eea2129 438#if FF_API_OLD_DECODE_AUDIO
de6d9b64 439/* in bytes */
8170e5fb 440#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
0eea2129 441#endif
de6d9b64 442
d7425f59 443/**
c8ef8464 444 * @ingroup lavc_decoding
cf713bb8 445 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
171b7b91
AC
446 * This is mainly needed because some optimized bitstream readers read
447 * 32 or 64 bit at once and could read over the end.<br>
f5bccd85
DB
448 * Note: If the first 23 bits of the additional bytes are not 0, then damaged
449 * MPEG bitstreams could cause overread and segfault.
d7425f59 450 */
171b7b91 451#define FF_INPUT_BUFFER_PADDING_SIZE 8
d7425f59 452
0ecca7a4 453/**
f038515f 454 * @ingroup lavc_encoding
f5bccd85
DB
455 * minimum encoding buffer size
456 * Used to avoid some checks during header writing.
0ecca7a4
MN
457 */
458#define FF_MIN_BUFFER_SIZE 16384
459
47146dfb 460
0e373b95 461/**
f038515f 462 * @ingroup lavc_encoding
bafc102b 463 * motion estimation type.
0e373b95 464 */
e4986da9 465enum Motion_Est_ID {
9b4dd1b8 466 ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
e4986da9
J
467 ME_FULL,
468 ME_LOG,
469 ME_PHODS,
9b4dd1b8
MN
470 ME_EPZS, ///< enhanced predictive zonal search
471 ME_X1, ///< reserved for experiments
472 ME_HEX, ///< hexagon based search
473 ME_UMH, ///< uneven multi-hexagon search
474 ME_ITER, ///< iterative search
359bbdab 475 ME_TESA, ///< transformed exhaustive search algorithm
e4986da9
J
476};
477
c8ef8464
AK
478/**
479 * @ingroup lavc_decoding
480 */
8c3eba7c 481enum AVDiscard{
f5bccd85
DB
482 /* We leave some space between them for extensions (drop some
483 * keyframes for intra-only or drop just some bidir frames). */
ccc2dfbc
LB
484 AVDISCARD_NONE =-16, ///< discard nothing
485 AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
486 AVDISCARD_NONREF = 8, ///< discard all non reference
487 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
488 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
489 AVDISCARD_ALL = 48, ///< discard all
8c3eba7c
MN
490};
491
4ee6a5c1 492enum AVColorPrimaries{
ccc2dfbc
LB
493 AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
494 AVCOL_PRI_UNSPECIFIED = 2,
495 AVCOL_PRI_BT470M = 4,
496 AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
497 AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
498 AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
499 AVCOL_PRI_FILM = 8,
500 AVCOL_PRI_NB , ///< Not part of ABI
4ee6a5c1
MN
501};
502
503enum AVColorTransferCharacteristic{
ccc2dfbc
LB
504 AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
505 AVCOL_TRC_UNSPECIFIED = 2,
506 AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
507 AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
ca93f0fa 508 AVCOL_TRC_SMPTE240M = 7,
ccc2dfbc 509 AVCOL_TRC_NB , ///< Not part of ABI
4ee6a5c1
MN
510};
511
512enum AVColorSpace{
ccc2dfbc
LB
513 AVCOL_SPC_RGB = 0,
514 AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
515 AVCOL_SPC_UNSPECIFIED = 2,
516 AVCOL_SPC_FCC = 4,
517 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
518 AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
519 AVCOL_SPC_SMPTE240M = 7,
85395ba7 520 AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
ccc2dfbc 521 AVCOL_SPC_NB , ///< Not part of ABI
4ee6a5c1
MN
522};
523
524enum AVColorRange{
ccc2dfbc
LB
525 AVCOL_RANGE_UNSPECIFIED = 0,
526 AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
527 AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
528 AVCOL_RANGE_NB , ///< Not part of ABI
4ee6a5c1
MN
529};
530
580a7465
DC
531/**
532 * X X 3 4 X X are luma samples,
533 * 1 2 1-6 are possible chroma positions
534 * X X 5 6 X 0 is undefined/unknown position
535 */
536enum AVChromaLocation{
ccc2dfbc
LB
537 AVCHROMA_LOC_UNSPECIFIED = 0,
538 AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default
539 AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263
540 AVCHROMA_LOC_TOPLEFT = 3, ///< DV
541 AVCHROMA_LOC_TOP = 4,
542 AVCHROMA_LOC_BOTTOMLEFT = 5,
543 AVCHROMA_LOC_BOTTOM = 6,
544 AVCHROMA_LOC_NB , ///< Not part of ABI
580a7465
DC
545};
546
34b47d7c
JR
547enum AVAudioServiceType {
548 AV_AUDIO_SERVICE_TYPE_MAIN = 0,
549 AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
550 AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
551 AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
552 AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
553 AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
554 AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
555 AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
556 AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
557 AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
558};
559
f038515f
AK
560/**
561 * @ingroup lavc_encoding
562 */
ce980a95
MN
563typedef struct RcOverride{
564 int start_frame;
565 int end_frame;
f5bccd85 566 int qscale; // If this is 0 then quality_factor will be used instead.
ce980a95
MN
567 float quality_factor;
568} RcOverride;
569
b0ec9efd 570#define FF_MAX_B_FRAMES 16
9dbcbd92 571
a949d72e 572/* encoding support
f5bccd85
DB
573 These flags can be passed in AVCodecContext.flags before initialization.
574 Note: Not everything is supported yet.
a949d72e 575*/
de6d9b64 576
f5bccd85
DB
577#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
578#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
579#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
580#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
581#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
1ba8f5eb
MN
582/**
583 * The parent program guarantees that the input for B-frames containing
f5bccd85 584 * streams is not written to for at least s->max_b_frames+1 frames, if
1ba8f5eb
MN
585 * this is not set the input will be copied.
586 */
8b4c7dbc 587#define CODEC_FLAG_INPUT_PRESERVED 0x0100
273b0cd3
DB
588#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
589#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
273b0cd3
DB
590#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
591#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
592#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
593#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
594 location instead of only at frame boundaries. */
f5bccd85
DB
595#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
596#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
597#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
f5bccd85
DB
598#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
599#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
21e59552 600/* Fx : Flag for h263+ extra options */
f5bccd85 601#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
332f9ac4 602#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
bb198e19 603#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
f3eec1cf 604#define CODEC_FLAG_CLOSED_GOP 0x80000000
f5bccd85 605#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
f5bccd85
DB
606#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
607#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
ed019b8e 608#if FF_API_MPV_GLOBAL_OPTS
af3d804f 609#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
ff71a383 610#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
a249f0cc 611#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
f013cb81 612#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
ed019b8e 613#endif
f013cb81 614#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
6fc5b059 615
21e59552 616/* Unsupported options :
bb270c08
DB
617 * Syntax Arithmetic coding (SAC)
618 * Reference Picture Selection
eafcac6a 619 * Independent Segment Decoding */
21e59552 620/* /Fx */
bf89e6b1
FB
621/* codec capabilities */
622
f5bccd85 623#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
6814a25c 624/**
9b489e02
RD
625 * Codec uses get_buffer() for allocating buffers and supports custom allocators.
626 * If not set, it might not use get_buffer() at all or use operations that
627 * assume the buffer was allocated by avcodec_default_get_buffer.
6814a25c
MN
628 */
629#define CODEC_CAP_DR1 0x0002
d7425f59 630#define CODEC_CAP_TRUNCATED 0x0008
f5bccd85 631/* Codec can export data for HW decoding (XvMC). */
5e5c247a 632#define CODEC_CAP_HWACCEL 0x0010
115329f1 633/**
3f6aa85e
JR
634 * Encoder or decoder requires flushing with NULL input at the end in order to
635 * give the complete and correct output.
636 *
637 * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
638 * with NULL data. The user can still send NULL data to the public encode
639 * or decode function, but libavcodec will not pass it along to the codec
640 * unless this flag is set.
641 *
642 * Decoders:
643 * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
ffeeae92 644 * avpkt->size=0 at the end to get the delayed data until the decoder no longer
3f6aa85e
JR
645 * returns frames.
646 *
647 * Encoders:
648 * The encoder needs to be fed with NULL data at the end of encoding until the
649 * encoder no longer returns data.
b2c75b6e
JR
650 *
651 * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
652 * flag also means that the encoder must set the pts and duration for
653 * each output packet. If this flag is not set, the pts and duration will
654 * be determined by libavcodec from the input frame.
934982c4 655 */
6f824977 656#define CODEC_CAP_DELAY 0x0020
cef7cc72
JR
657/**
658 * Codec can be fed a final frame with a smaller size.
659 * This can be used to prevent truncation of the last audio samples.
660 */
661#define CODEC_CAP_SMALL_LAST_FRAME 0x0040
369122dd
NC
662/**
663 * Codec can export data for HW decoding (VDPAU).
664 */
665#define CODEC_CAP_HWACCEL_VDPAU 0x0080
d859bb1d
SS
666/**
667 * Codec can output multiple frames per AVPacket
e9e949cf
MN
668 * Normally demuxers return one frame at a time, demuxers which do not do
669 * are connected to a parser to split what they return into proper frames.
670 * This flag is reserved to the very rare category of codecs which have a
671 * bitstream that cannot be split into frames without timeconsuming
672 * operations like full decoding. Demuxers carring such bitstreams thus
673 * may return multiple frames in a packet. This has many disadvantages like
674 * prohibiting stream copy in many cases thus it should only be considered
675 * as a last resort.
d859bb1d
SS
676 */
677#define CODEC_CAP_SUBFRAMES 0x0100
93ebfeea
JG
678/**
679 * Codec is experimental and is thus avoided in favor of non experimental
680 * encoders
681 */
682#define CODEC_CAP_EXPERIMENTAL 0x0200
62784e37
BL
683/**
684 * Codec should fill in channel configuration and samplerate instead of container
685 */
686#define CODEC_CAP_CHANNEL_CONF 0x0400
16cfc961
SS
687/**
688 * Codec is able to deal with negative linesizes
689 */
690#define CODEC_CAP_NEG_LINESIZES 0x0800
37b00b47
AS
691/**
692 * Codec supports frame-level multithreading.
693 */
694#define CODEC_CAP_FRAME_THREADS 0x1000
94f7451a
RB
695/**
696 * Codec supports slice-based (or partition-based) multithreading.
697 */
698#define CODEC_CAP_SLICE_THREADS 0x2000
fe75dc85
MS
699/**
700 * Codec supports changed parameters at any point.
701 */
702#define CODEC_CAP_PARAM_CHANGE 0x4000
b4d44a45
JG
703/**
704 * Codec supports avctx->thread_count == 0 (auto).
705 */
706#define CODEC_CAP_AUTO_THREADS 0x8000
b2c75b6e
JR
707/**
708 * Audio encoder supports receiving a different number of samples in each call.
709 */
710#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
bf89e6b1 711
f5bccd85 712//The following defines may change, don't expect compatibility if you use them.
8d7ec294 713#define MB_TYPE_INTRA4x4 0x0001
f5bccd85
DB
714#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
715#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
8d7ec294
WH
716#define MB_TYPE_16x16 0x0008
717#define MB_TYPE_16x8 0x0010
718#define MB_TYPE_8x16 0x0020
719#define MB_TYPE_8x8 0x0040
720#define MB_TYPE_INTERLACED 0x0080
273b0cd3 721#define MB_TYPE_DIRECT2 0x0100 //FIXME
8d7ec294
WH
722#define MB_TYPE_ACPRED 0x0200
723#define MB_TYPE_GMC 0x0400
724#define MB_TYPE_SKIP 0x0800
725#define MB_TYPE_P0L0 0x1000
726#define MB_TYPE_P1L0 0x2000
727#define MB_TYPE_P0L1 0x4000
728#define MB_TYPE_P1L1 0x8000
729#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
730#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
731#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
732#define MB_TYPE_QUANT 0x00010000
733#define MB_TYPE_CBP 0x00020000
734//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
735
fa384dcc
MN
736/**
737 * Pan Scan area.
f5bccd85
DB
738 * This specifies the area which should be displayed.
739 * Note there may be multiple such areas for one frame.
fa384dcc
MN
740 */
741typedef struct AVPanScan{
742 /**
f5bccd85
DB
743 * id
744 * - encoding: Set by user.
745 * - decoding: Set by libavcodec.
fa384dcc
MN
746 */
747 int id;
748
749 /**
750 * width and height in 1/16 pel
f5bccd85
DB
751 * - encoding: Set by user.
752 * - decoding: Set by libavcodec.
fa384dcc
MN
753 */
754 int width;
755 int height;
756
757 /**
f5bccd85
DB
758 * position of the top left corner in 1/16 pel for up to 3 fields/frames
759 * - encoding: Set by user.
760 * - decoding: Set by libavcodec.
fa384dcc
MN
761 */
762 int16_t position[3][2];
763}AVPanScan;
764
bb270c08
DB
765#define FF_QSCALE_TYPE_MPEG1 0
766#define FF_QSCALE_TYPE_MPEG2 1
767#define FF_QSCALE_TYPE_H264 2
800274f8 768#define FF_QSCALE_TYPE_VP56 3
4e00e76b
MN
769
770#define FF_BUFFER_TYPE_INTERNAL 1
f5bccd85
DB
771#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
772#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
773#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
4e00e76b 774
f5bccd85
DB
775#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
776#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
777#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
778#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
074c4ca7 779
30f3f625
AK
780/**
781 * @defgroup lavc_packet AVPacket
782 *
783 * Types and functions for working with AVPacket.
784 * @{
785 */
4de339e2
KS
786enum AVPacketSideDataType {
787 AV_PKT_DATA_PALETTE,
195c123c 788 AV_PKT_DATA_NEW_EXTRADATA,
30f3f625
AK
789
790 /**
791 * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
199ada49 792 * @code
30f3f625
AK
793 * u32le param_flags
794 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
795 * s32le channel_count
796 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
797 * u64le channel_layout
798 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
799 * s32le sample_rate
800 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
801 * s32le width
802 * s32le height
199ada49 803 * @endcode
30f3f625 804 */
fe75dc85 805 AV_PKT_DATA_PARAM_CHANGE,
30f3f625
AK
806
807 /**
808 * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
809 * structures with info about macroblocks relevant to splitting the
810 * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
811 * That is, it does not necessarily contain info about all macroblocks,
812 * as long as the distance between macroblocks in the info is smaller
813 * than the target payload size.
814 * Each MB info structure is 12 bytes, and is laid out as follows:
199ada49 815 * @code
30f3f625
AK
816 * u32le bit offset from the start of the packet
817 * u8 current quantizer at the start of the macroblock
818 * u8 GOB number
819 * u16le macroblock address within the GOB
820 * u8 horizontal MV predictor
821 * u8 vertical MV predictor
822 * u8 horizontal MV predictor for block number 3
823 * u8 vertical MV predictor for block number 3
199ada49 824 * @endcode
30f3f625 825 */
bdc1220e 826 AV_PKT_DATA_H263_MB_INFO,
4de339e2
KS
827};
828
18c915ee
TB
829typedef struct AVPacket {
830 /**
7b356d39
RS
831 * Presentation timestamp in AVStream->time_base units; the time at which
832 * the decompressed packet will be presented to the user.
18c915ee
TB
833 * Can be AV_NOPTS_VALUE if it is not stored in the file.
834 * pts MUST be larger or equal to dts as presentation cannot happen before
835 * decompression, unless one wants to view hex dumps. Some formats misuse
836 * the terms dts and pts/cts to mean something different. Such timestamps
837 * must be converted to true pts/dts before they are stored in AVPacket.
838 */
839 int64_t pts;
840 /**
7b356d39
RS
841 * Decompression timestamp in AVStream->time_base units; the time at which
842 * the packet is decompressed.
18c915ee
TB
843 * Can be AV_NOPTS_VALUE if it is not stored in the file.
844 */
845 int64_t dts;
846 uint8_t *data;
847 int size;
848 int stream_index;
9d39cbf6
LB
849 /**
850 * A combination of AV_PKT_FLAG values
851 */
18c915ee
TB
852 int flags;
853 /**
4de339e2
KS
854 * Additional packet data that can be provided by the container.
855 * Packet can contain several types of side information.
856 */
857 struct {
858 uint8_t *data;
859 int size;
860 enum AVPacketSideDataType type;
861 } *side_data;
862 int side_data_elems;
863
864 /**
7b356d39 865 * Duration of this packet in AVStream->time_base units, 0 if unknown.
18c915ee
TB
866 * Equals next_pts - this_pts in presentation order.
867 */
868 int duration;
869 void (*destruct)(struct AVPacket *);
870 void *priv;
871 int64_t pos; ///< byte position in stream, -1 if unknown
872
873 /**
7b356d39 874 * Time difference in AVStream->time_base units from the pts of this
18c915ee
TB
875 * packet to the point at which the output from the decoder has converged
876 * independent from the availability of previous frames. That is, the
877 * frames are virtually identical no matter if decoding started from
878 * the very first frame or from this keyframe.
879 * Is AV_NOPTS_VALUE if unknown.
880 * This field is not the display duration of the current packet.
8ee82f40
AJ
881 * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
882 * set.
18c915ee
TB
883 *
884 * The purpose of this field is to allow seeking in streams that have no
885 * keyframes in the conventional sense. It corresponds to the
886 * recovery point SEI in H.264 and match_time_delta in NUT. It is also
887 * essential for some types of subtitle streams to ensure that all
888 * subtitles are correctly displayed after seeking.
889 */
890 int64_t convergence_duration;
891} AVPacket;
9d39cbf6
LB
892#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
893#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
18c915ee 894
fe75dc85
MS
895enum AVSideDataParamChangeFlags {
896 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
897 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
898 AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
899 AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
900};
30f3f625
AK
901/**
902 * @}
903 */
fe75dc85
MS
904
905/**
0da71265 906 * Audio Video Frame.
657ccb5a
DB
907 * New fields can be added to the end of AVFRAME with minor version
908 * bumps. Removal, reordering and changes to existing fields require
909 * a major version bump.
8bfb108b 910 * sizeof(AVFrame) must not be used outside libav*.
0da71265 911 */
492cd3a9 912typedef struct AVFrame {
560f773c 913#define AV_NUM_DATA_POINTERS 8
657ccb5a 914 /**
0eea2129 915 * pointer to the picture/channel planes.
657ccb5a 916 * This might be different from the first allocated byte
0eea2129
JR
917 * - encoding: Set by user
918 * - decoding: set by AVCodecContext.get_buffer()
657ccb5a 919 */
560f773c 920 uint8_t *data[AV_NUM_DATA_POINTERS];
0eea2129
JR
921
922 /**
923 * Size, in bytes, of the data for each picture/channel plane.
924 *
925 * For audio, only linesize[0] may be set. For planar audio, each channel
926 * plane must be the same size.
927 *
9814974d 928 * - encoding: Set by user
0eea2129
JR
929 * - decoding: set by AVCodecContext.get_buffer()
930 */
560f773c 931 int linesize[AV_NUM_DATA_POINTERS];
0eea2129 932
657ccb5a 933 /**
1d428004
AK
934 * pointers to the data planes/channels.
935 *
936 * For video, this should simply point to data[].
937 *
938 * For planar audio, each channel has a separate data pointer, and
939 * linesize[0] contains the size of each channel buffer.
940 * For packed audio, there is just one data pointer, and linesize[0]
941 * contains the total size of the buffer for all channels.
942 *
943 * Note: Both data and extended_data will always be set by get_buffer(),
944 * but for planar audio with more channels that can fit in data,
945 * extended_data must be used by the decoder in order to access all
946 * channels.
947 *
948 * encoding: unused
949 * decoding: set by AVCodecContext.get_buffer()
657ccb5a 950 */
1d428004
AK
951 uint8_t **extended_data;
952
953 /**
954 * width and height of the video frame
955 * - encoding: unused
956 * - decoding: Read by user.
957 */
958 int width, height;
959
960 /**
961 * number of audio samples (per channel) described by this frame
962 * - encoding: Set by user
963 * - decoding: Set by libavcodec
964 */
965 int nb_samples;
966
967 /**
968 * format of the frame, -1 if unknown or unset
969 * Values correspond to enum PixelFormat for video frames,
970 * enum AVSampleFormat for audio)
971 * - encoding: unused
972 * - decoding: Read by user.
973 */
974 int format;
975
657ccb5a
DB
976 /**
977 * 1 -> keyframe, 0-> not
978 * - encoding: Set by libavcodec.
979 * - decoding: Set by libavcodec.
980 */
981 int key_frame;
982
983 /**
984 * Picture type of the frame, see ?_TYPE below.
985 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
986 * - decoding: Set by libavcodec.
987 */
988 enum AVPictureType pict_type;
989
990 /**
1d428004
AK
991 * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
992 * This isn't used by libavcodec unless the default get/release_buffer() is used.
993 * - encoding:
994 * - decoding:
995 */
996 uint8_t *base[AV_NUM_DATA_POINTERS];
997
998 /**
40ca0e6a 999 * sample aspect ratio for the video frame, 0/1 if unknown/unspecified
1d428004
AK
1000 * - encoding: unused
1001 * - decoding: Read by user.
1002 */
1003 AVRational sample_aspect_ratio;
1004
1005 /**
657ccb5a
DB
1006 * presentation timestamp in time_base units (time when frame should be shown to user)
1007 * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
1008 * - encoding: MUST be set by user.
1009 * - decoding: Set by libavcodec.
1010 */
1011 int64_t pts;
1012
1013 /**
1d428004
AK
1014 * reordered pts from the last AVPacket that has been input into the decoder
1015 * - encoding: unused
1016 * - decoding: Read by user.
1017 */
1018 int64_t pkt_pts;
1019
1020 /**
1021 * dts from the last AVPacket that has been input into the decoder
1022 * - encoding: unused
1023 * - decoding: Read by user.
1024 */
1025 int64_t pkt_dts;
1026
1027 /**
657ccb5a
DB
1028 * picture number in bitstream order
1029 * - encoding: set by
1030 * - decoding: Set by libavcodec.
1031 */
1032 int coded_picture_number;
1033 /**
1034 * picture number in display order
1035 * - encoding: set by
1036 * - decoding: Set by libavcodec.
1037 */
1038 int display_picture_number;
1039
1040 /**
1041 * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
1042 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
1043 * - decoding: Set by libavcodec.
1044 */
1045 int quality;
1046
657ccb5a
DB
1047 /**
1048 * is this picture used as reference
1049 * The values for this are the same as the MpegEncContext.picture_structure
1050 * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
1051 * Set to 4 for delayed, non-reference frames.
1052 * - encoding: unused
1053 * - decoding: Set by libavcodec. (before get_buffer() call)).
1054 */
1055 int reference;
1056
1057 /**
1058 * QP table
1059 * - encoding: unused
1060 * - decoding: Set by libavcodec.
1061 */
1062 int8_t *qscale_table;
1063 /**
1064 * QP store stride
1065 * - encoding: unused
1066 * - decoding: Set by libavcodec.
1067 */
1068 int qstride;
1069
1070 /**
1d428004
AK
1071 *
1072 */
1073 int qscale_type;
1074
1075 /**
657ccb5a
DB
1076 * mbskip_table[mb]>=1 if MB didn't change
1077 * stride= mb_width = (width+15)>>4
1078 * - encoding: unused
1079 * - decoding: Set by libavcodec.
1080 */
1081 uint8_t *mbskip_table;
1082
1083 /**
1084 * motion vector table
1085 * @code
1086 * example:
1087 * int mv_sample_log2= 4 - motion_subsample_log2;
1088 * int mb_width= (width+15)>>4;
1089 * int mv_stride= (mb_width << mv_sample_log2) + 1;
1090 * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];
1091 * @endcode
1092 * - encoding: Set by user.
1093 * - decoding: Set by libavcodec.
1094 */
1095 int16_t (*motion_val[2])[2];
1096
1097 /**
1098 * macroblock type table
1099 * mb_type_base + mb_width + 2
1100 * - encoding: Set by user.
1101 * - decoding: Set by libavcodec.
1102 */
1103 uint32_t *mb_type;
1104
1105 /**
1d428004 1106 * DCT coefficients
657ccb5a
DB
1107 * - encoding: unused
1108 * - decoding: Set by libavcodec.
1109 */
1d428004
AK
1110 short *dct_coeff;
1111
1112 /**
1113 * motion reference frame index
1114 * the order in which these are stored can depend on the codec.
1115 * - encoding: Set by user.
1116 * - decoding: Set by libavcodec.
1117 */
1118 int8_t *ref_index[2];
657ccb5a
DB
1119
1120 /**
1121 * for some private data of the user
1122 * - encoding: unused
1123 * - decoding: Set by user.
1124 */
1125 void *opaque;
1126
1127 /**
1128 * error
1129 * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.
1130 * - decoding: unused
1131 */
560f773c 1132 uint64_t error[AV_NUM_DATA_POINTERS];
657ccb5a
DB
1133
1134 /**
1135 * type of the buffer (to keep track of who has to deallocate data[*])
1136 * - encoding: Set by the one who allocates it.
1137 * - decoding: Set by the one who allocates it.
1138 * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.
1139 */
1140 int type;
1141
1142 /**
1143 * When decoding, this signals how much the picture must be delayed.
1144 * extra_delay = repeat_pict / (2*fps)
1145 * - encoding: unused
1146 * - decoding: Set by libavcodec.
1147 */
1148 int repeat_pict;
1149
1150 /**
657ccb5a
DB
1151 * The content of the picture is interlaced.
1152 * - encoding: Set by user.
1153 * - decoding: Set by libavcodec. (default 0)
1154 */
1155 int interlaced_frame;
1156
1157 /**
1158 * If the content is interlaced, is top field displayed first.
1159 * - encoding: Set by user.
1160 * - decoding: Set by libavcodec.
1161 */
1162 int top_field_first;
1163
1164 /**
657ccb5a
DB
1165 * Tell user application that palette has changed from previous frame.
1166 * - encoding: ??? (no palette-enabled encoder yet)
1167 * - decoding: Set by libavcodec. (default 0).
1168 */
1169 int palette_has_changed;
1170
1171 /**
1172 * codec suggestion on buffer type if != 0
1173 * - encoding: unused
1174 * - decoding: Set by libavcodec. (before get_buffer() call)).
1175 */
1176 int buffer_hints;
1177
1178 /**
1d428004 1179 * Pan scan.
657ccb5a
DB
1180 * - encoding: Set by user.
1181 * - decoding: Set by libavcodec.
1182 */
1d428004 1183 AVPanScan *pan_scan;
657ccb5a
DB
1184
1185 /**
1186 * reordered opaque 64bit (generally an integer or a double precision float
1187 * PTS but can be anything).
1188 * The user sets AVCodecContext.reordered_opaque to represent the input at
1189 * that time,
1190 * the decoder reorders values as needed and sets AVFrame.reordered_opaque
1191 * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
1192 * @deprecated in favor of pkt_pts
1193 * - encoding: unused
1194 * - decoding: Read by user.
1195 */
1196 int64_t reordered_opaque;
1197
1198 /**
1199 * hardware accelerator private data (Libav-allocated)
1200 * - encoding: unused
1201 * - decoding: Set by libavcodec
1202 */
1203 void *hwaccel_picture_private;
1204
1205 /**
657ccb5a
DB
1206 * the AVCodecContext which ff_thread_get_buffer() was last called on
1207 * - encoding: Set by libavcodec.
1208 * - decoding: Set by libavcodec.
1209 */
1210 struct AVCodecContext *owner;
1211
1212 /**
1213 * used by multithreading to store frame-specific info
1214 * - encoding: Set by libavcodec.
1215 * - decoding: Set by libavcodec.
1216 */
1217 void *thread_opaque;
0eea2129
JR
1218
1219 /**
1d428004
AK
1220 * log2 of the size of the block which a single vector in motion_val represents:
1221 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
8a4a5f6f 1222 * - encoding: unused
1d428004 1223 * - decoding: Set by libavcodec.
8a4a5f6f 1224 */
1d428004 1225 uint8_t motion_subsample_log2;
828bd088
AK
1226
1227 /**
1228 * Sample rate of the audio data.
1229 *
1230 * - encoding: unused
1231 * - decoding: set by get_buffer()
1232 */
1233 int sample_rate;
1234
1235 /**
1236 * Channel layout of the audio data.
1237 *
1238 * - encoding: unused
1239 * - decoding: set by get_buffer()
1240 */
1241 uint64_t channel_layout;
492cd3a9 1242} AVFrame;
1e491e29 1243
f3a29b75
JR
1244struct AVCodecInternal;
1245
4bf3c8f2
AC
1246enum AVFieldOrder {
1247 AV_FIELD_UNKNOWN,
1248 AV_FIELD_PROGRESSIVE,
1249 AV_FIELD_TT, //< Top coded_first, top displayed first
1250 AV_FIELD_BB, //< Bottom coded first, bottom displayed first
1251 AV_FIELD_TB, //< Top coded first, bottom displayed first
1252 AV_FIELD_BT, //< Bottom coded first, top displayed first
1253};
1254
d33c949c 1255/**
252f17e2
MN
1256 * main external API structure.
1257 * New fields can be added to the end with minor version bumps.
8bfb108b 1258 * Removal, reordering and changes to existing fields require a major
252f17e2 1259 * version bump.
8bfb108b 1260 * sizeof(AVCodecContext) must not be used outside libav*.
d33c949c 1261 */
de6d9b64 1262typedef struct AVCodecContext {
b71901e6 1263 /**
f5bccd85 1264 * information on struct for av_log
488eec10 1265 * - set by avcodec_alloc_context3
bc874dae 1266 */
d42a814e 1267 const AVClass *av_class;
b1edfce0
AK
1268 int log_level_offset;
1269
1270 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1271 struct AVCodec *codec;
1272 char codec_name[32];
36ef5369 1273 enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
b1edfce0
AK
1274
1275 /**
1276 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1277 * This is used to work around some encoder bugs.
1278 * A demuxer should set this to what is stored in the field used to identify the codec.
1279 * If there are multiple such fields in a container then the demuxer should choose the one
1280 * which maximizes the information about the used codec.
1281 * If the codec tag field in a container is larger than 32 bits then the demuxer should
1282 * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1283 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1284 * first.
1285 * - encoding: Set by user, if not then the default based on codec_id will be used.
1286 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1287 */
1288 unsigned int codec_tag;
1289
1290 /**
1291 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1292 * This is used to work around some encoder bugs.
1293 * - encoding: unused
1294 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1295 */
1296 unsigned int stream_codec_tag;
1297
02beb982 1298#if FF_API_SUB_ID
b1edfce0 1299 /**
02beb982 1300 * @deprecated this field is unused
b1edfce0 1301 */
02beb982
AK
1302 attribute_deprecated int sub_id;
1303#endif
b1edfce0
AK
1304
1305 void *priv_data;
1306
1307 /**
1308 * Private context used for internal data.
1309 *
1310 * Unlike priv_data, this is not codec-specific. It is used in general
1311 * libavcodec functions.
1312 */
1313 struct AVCodecInternal *internal;
1314
1315 /**
1316 * Private data of the user, can be used to carry app specific stuff.
1317 * - encoding: Set by user.
1318 * - decoding: Set by user.
1319 */
1320 void *opaque;
1321
bc874dae 1322 /**
f5bccd85
DB
1323 * the average bitrate
1324 * - encoding: Set by user; unused for constant quantizer encoding.
1325 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
b71901e6 1326 */
de6d9b64 1327 int bit_rate;
b71901e6
MN
1328
1329 /**
64863965 1330 * number of bits the bitstream is allowed to diverge from the reference.
b71901e6 1331 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
f5bccd85 1332 * - encoding: Set by user; unused for constant quantizer encoding.
64863965 1333 * - decoding: unused
b71901e6 1334 */
115329f1 1335 int bit_rate_tolerance;
b71901e6
MN
1336
1337 /**
b1edfce0
AK
1338 * Global quality for codecs which cannot change it per frame.
1339 * This should be proportional to MPEG-1/2/4 qscale.
f5bccd85 1340 * - encoding: Set by user.
b1edfce0 1341 * - decoding: unused
b71901e6 1342 */
b1edfce0 1343 int global_quality;
b71901e6
MN
1344
1345 /**
b1edfce0
AK
1346 * - encoding: Set by user.
1347 * - decoding: unused
b71901e6 1348 */
b1edfce0
AK
1349 int compression_level;
1350#define FF_COMPRESSION_DEFAULT -1
b71901e6
MN
1351
1352 /**
b1edfce0
AK
1353 * CODEC_FLAG_*.
1354 * - encoding: Set by user.
1355 * - decoding: Set by user.
b71901e6 1356 */
b1edfce0
AK
1357 int flags;
1358
1359 /**
1360 * CODEC_FLAG2_*
1361 * - encoding: Set by user.
1362 * - decoding: Set by user.
1363 */
1364 int flags2;
b71901e6
MN
1365
1366 /**
f5bccd85
DB
1367 * some codecs need / can use extradata like Huffman tables.
1368 * mjpeg: Huffman tables
b71901e6 1369 * rv10: additional flags
b704e742 1370 * mpeg4: global headers (they can be in the bitstream or here)
f5bccd85
DB
1371 * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
1372 * than extradata_size to avoid prolems if it is read with the bitstream reader.
1373 * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1374 * - encoding: Set/allocated/freed by libavcodec.
1375 * - decoding: Set/allocated/freed by user.
b71901e6 1376 */
58f2a4b0 1377 uint8_t *extradata;
e84c31dc 1378 int extradata_size;
115329f1 1379
b71901e6 1380 /**
f5bccd85
DB
1381 * This is the fundamental unit of time (in seconds) in terms
1382 * of which frame timestamps are represented. For fixed-fps content,
5b28c8c3
MN
1383 * timebase should be 1/framerate and timestamp increments should be
1384 * identically 1.
f5bccd85
DB
1385 * - encoding: MUST be set by user.
1386 * - decoding: Set by libavcodec.
b71901e6 1387 */
c0df9d75 1388 AVRational time_base;
115329f1 1389
b1edfce0
AK
1390 /**
1391 * For some codecs, the time base is closer to the field rate than the frame rate.
1392 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
1393 * if no telecine is used ...
1394 *
1395 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
1396 */
1397 int ticks_per_frame;
1398
1399 /**
1400 * Encoder delay.
1401 *
1402 * Video:
1403 * Number of frames the decoded output will be delayed relative to the
1404 * encoded input.
1405 *
1406 * Audio:
1407 * Number of "priming" samples added to the beginning of the stream
1408 * during encoding. The decoded output will be delayed by this many
1409 * samples relative to the input to the encoder. Note that this field is
1410 * purely informational and does not directly affect the pts output by
1411 * the encoder, which should always be based on the actual presentation
1412 * time, including any delay.
1413 *
1414 * - encoding: Set by libavcodec.
1415 * - decoding: unused
1416 */
1417 int delay;
1418
1419
5b28c8c3 1420 /* video only */
14bea432 1421 /**
21adafec 1422 * picture width / height.
115329f1 1423 * - encoding: MUST be set by user.
f5bccd85
DB
1424 * - decoding: Set by libavcodec.
1425 * Note: For compatibility it is possible to set this instead of
1426 * coded_width/height before decoding.
b71901e6 1427 */
de6d9b64 1428 int width, height;
115329f1 1429
b1edfce0 1430 /**
2bcbd984 1431 * Bitstream width / height, may be different from width/height.
b1edfce0
AK
1432 * - encoding: unused
1433 * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
1434 */
1435 int coded_width, coded_height;
1436
e769f053 1437#define FF_ASPECT_EXTENDED 15
b71901e6
MN
1438
1439 /**
f5bccd85
DB
1440 * the number of pictures in a group of pictures, or 0 for intra_only
1441 * - encoding: Set by user.
64863965 1442 * - decoding: unused
b71901e6
MN
1443 */
1444 int gop_size;
1445
1446 /**
f5bccd85 1447 * Pixel format, see PIX_FMT_xxx.
c1bdc930
TH
1448 * May be set by the demuxer if known from headers.
1449 * May be overriden by the decoder if it knows better.
f5bccd85 1450 * - encoding: Set by user.
c1bdc930 1451 * - decoding: Set by user if known, overridden by libavcodec if known
b71901e6 1452 */
e4eadb4b 1453 enum PixelFormat pix_fmt;
115329f1 1454
b71901e6 1455 /**
b1edfce0
AK
1456 * Motion estimation algorithm used for video coding.
1457 * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
1458 * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
1459 * - encoding: MUST be set by user.
1460 * - decoding: unused
1461 */
1462 int me_method;
1463
1464 /**
f5bccd85
DB
1465 * If non NULL, 'draw_horiz_band' is called by the libavcodec
1466 * decoder to draw a horizontal band. It improves cache usage. Not
b71901e6 1467 * all codecs can do that. You must check the codec capabilities
f5bccd85 1468 * beforehand.
37b00b47
AS
1469 * When multithreading is used, it may be called from multiple threads
1470 * at the same time; threads might draw different parts of the same AVFrame,
1471 * or multiple AVFrames, and there is no guarantee that slices will be drawn
1472 * in order.
24b1583a
IK
1473 * The function is also used by hardware acceleration APIs.
1474 * It is called at least once during frame decoding to pass
1475 * the data needed for hardware render.
1476 * In that mode instead of pixel data, AVFrame points to
1477 * a structure specific to the acceleration API. The application
1478 * reads the structure and can change some fields to indicate progress
1479 * or mark state.
64863965 1480 * - encoding: unused
f5bccd85 1481 * - decoding: Set by user.
3bb07d61
MN
1482 * @param height the height of the slice
1483 * @param y the y position of the slice
1484 * @param type 1->top field, 2->bottom field, 3->frame
1485 * @param offset offset into the AVFrame.data from which the slice should be read
b71901e6 1486 */
bf89e6b1 1487 void (*draw_horiz_band)(struct AVCodecContext *s,
560f773c 1488 const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
3bb07d61 1489 int y, int type, int height);
bf89e6b1 1490
a3a5f4d6 1491 /**
b1edfce0
AK
1492 * callback to negotiate the pixelFormat
1493 * @param fmt is the list of formats which are supported by the codec,
1494 * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1495 * The first is always the native one.
1496 * @return the chosen format
1497 * - encoding: unused
1498 * - decoding: Set by user, if not set the native format will be chosen.
a3a5f4d6 1499 */
b1edfce0 1500 enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
de6d9b64 1501
718b27a7 1502 /**
b1edfce0
AK
1503 * maximum number of B-frames between non-B-frames
1504 * Note: The output will be delayed by max_b_frames+1 relative to the input.
1505 * - encoding: Set by user.
1506 * - decoding: unused
718b27a7 1507 */
b1edfce0 1508 int max_b_frames;
115329f1 1509
b71901e6 1510 /**
b1edfce0
AK
1511 * qscale factor between IP and B-frames
1512 * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
1513 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1514 * - encoding: Set by user.
64863965 1515 * - decoding: unused
b71901e6 1516 */
b1edfce0 1517 float b_quant_factor;
115329f1 1518
b1edfce0
AK
1519 /** obsolete FIXME remove */
1520 int rc_strategy;
1521#define FF_RC_STRATEGY_XVID 1
1522
1523 int b_frame_strategy;
115329f1 1524
63efd83a 1525#if FF_API_MPV_GLOBAL_OPTS
b71901e6 1526 /**
b1edfce0 1527 * luma single coefficient elimination threshold
f5bccd85 1528 * - encoding: Set by user.
64863965 1529 * - decoding: unused
b71901e6 1530 */
63efd83a 1531 attribute_deprecated int luma_elim_threshold;
b71901e6
MN
1532
1533 /**
b1edfce0 1534 * chroma single coeff elimination threshold
f5bccd85 1535 * - encoding: Set by user.
64863965 1536 * - decoding: unused
b71901e6 1537 */
63efd83a
AK
1538 attribute_deprecated int chroma_elim_threshold;
1539#endif
b71901e6
MN
1540
1541 /**
b1edfce0 1542 * qscale offset between IP and B-frames
f5bccd85 1543 * - encoding: Set by user.
64863965 1544 * - decoding: unused
b71901e6 1545 */
b1edfce0 1546 float b_quant_offset;
b71901e6
MN
1547
1548 /**
b1edfce0
AK
1549 * Size of the frame reordering buffer in the decoder.
1550 * For MPEG-2 it is 1 IPB or 0 low delay IP.
1551 * - encoding: Set by libavcodec.
1552 * - decoding: Set by libavcodec.
1553 */
1554 int has_b_frames;
1555
1556 /**
1557 * 0-> h263 quant 1-> mpeg quant
f5bccd85 1558 * - encoding: Set by user.
64863965 1559 * - decoding: unused
b71901e6 1560 */
b1edfce0 1561 int mpeg_quant;
b71901e6
MN
1562
1563 /**
b1edfce0
AK
1564 * qscale factor between P and I-frames
1565 * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
662e5411 1566 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
f5bccd85 1567 * - encoding: Set by user.
64863965 1568 * - decoding: unused
b71901e6 1569 */
b1edfce0 1570 float i_quant_factor;
64b7c5b6 1571
b1edfce0
AK
1572 /**
1573 * qscale offset between P and I-frames
1574 * - encoding: Set by user.
1575 * - decoding: unused
1576 */
1577 float i_quant_offset;
9dbcbd92 1578
b1edfce0
AK
1579 /**
1580 * luminance masking (0-> disabled)
1581 * - encoding: Set by user.
1582 * - decoding: unused
1583 */
1584 float lumi_masking;
115329f1 1585
b1edfce0
AK
1586 /**
1587 * temporary complexity masking (0-> disabled)
1588 * - encoding: Set by user.
1589 * - decoding: unused
1590 */
1591 float temporal_cplx_masking;
de6d9b64 1592
b1edfce0
AK
1593 /**
1594 * spatial complexity masking (0-> disabled)
1595 * - encoding: Set by user.
1596 * - decoding: unused
1597 */
1598 float spatial_cplx_masking;
115329f1 1599
b71901e6 1600 /**
b1edfce0 1601 * p block masking (0-> disabled)
f5bccd85 1602 * - encoding: Set by user.
64863965 1603 * - decoding: unused
b71901e6 1604 */
b1edfce0 1605 float p_masking;
115329f1 1606
b71901e6 1607 /**
b1edfce0 1608 * darkness masking (0-> disabled)
f5bccd85 1609 * - encoding: Set by user.
64863965 1610 * - decoding: unused
b71901e6 1611 */
b1edfce0 1612 float dark_masking;
115329f1 1613
b71901e6 1614 /**
b1edfce0
AK
1615 * slice count
1616 * - encoding: Set by libavcodec.
1617 * - decoding: Set by user (or 0).
b71901e6 1618 */
b1edfce0 1619 int slice_count;
b71901e6 1620 /**
b1edfce0 1621 * prediction method (needed for huffyuv)
f5bccd85 1622 * - encoding: Set by user.
64863965 1623 * - decoding: unused
b71901e6 1624 */
b1edfce0
AK
1625 int prediction_method;
1626#define FF_PRED_LEFT 0
1627#define FF_PRED_PLANE 1
1628#define FF_PRED_MEDIAN 2
115329f1 1629
b71901e6 1630 /**
b1edfce0
AK
1631 * slice offsets in the frame in bytes
1632 * - encoding: Set/allocated by libavcodec.
1633 * - decoding: Set/allocated by user (or NULL).
b71901e6 1634 */
b1edfce0 1635 int *slice_offset;
0fd90455 1636
b71901e6 1637 /**
b1edfce0
AK
1638 * sample aspect ratio (0 if unknown)
1639 * That is the width of a pixel divided by the height of the pixel.
1640 * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1641 * - encoding: Set by user.
f5bccd85 1642 * - decoding: Set by libavcodec.
b71901e6 1643 */
b1edfce0 1644 AVRational sample_aspect_ratio;
115329f1 1645
b71901e6 1646 /**
b1edfce0 1647 * motion estimation comparison function
f5bccd85 1648 * - encoding: Set by user.
64863965 1649 * - decoding: unused
b71901e6 1650 */
b1edfce0 1651 int me_cmp;
b71901e6 1652 /**
b1edfce0 1653 * subpixel motion estimation comparison function
f5bccd85 1654 * - encoding: Set by user.
64863965 1655 * - decoding: unused
b71901e6 1656 */
b1edfce0 1657 int me_sub_cmp;
b71901e6 1658 /**
b1edfce0 1659 * macroblock comparison function (not supported yet)
f5bccd85 1660 * - encoding: Set by user.
64863965 1661 * - decoding: unused
b71901e6 1662 */
b1edfce0 1663 int mb_cmp;
b71901e6 1664 /**
b1edfce0 1665 * interlaced DCT comparison function
f5bccd85 1666 * - encoding: Set by user.
64863965 1667 * - decoding: unused
b71901e6 1668 */
b1edfce0
AK
1669 int ildct_cmp;
1670#define FF_CMP_SAD 0
1671#define FF_CMP_SSE 1
1672#define FF_CMP_SATD 2
1673#define FF_CMP_DCT 3
1674#define FF_CMP_PSNR 4
1675#define FF_CMP_BIT 5
1676#define FF_CMP_RD 6
1677#define FF_CMP_ZERO 7
1678#define FF_CMP_VSAD 8
1679#define FF_CMP_VSSE 9
1680#define FF_CMP_NSSE 10
1681#define FF_CMP_W53 11
1682#define FF_CMP_W97 12
1683#define FF_CMP_DCTMAX 13
1684#define FF_CMP_DCT264 14
1685#define FF_CMP_CHROMA 256
115329f1 1686
b71901e6 1687 /**
b1edfce0 1688 * ME diamond size & shape
f5bccd85 1689 * - encoding: Set by user.
64863965 1690 * - decoding: unused
b71901e6 1691 */
b1edfce0 1692 int dia_size;
b71901e6
MN
1693
1694 /**
b1edfce0 1695 * amount of previous MV predictors (2a+1 x 2a+1 square)
f5bccd85 1696 * - encoding: Set by user.
64863965 1697 * - decoding: unused
b71901e6 1698 */
b1edfce0 1699 int last_predictor_count;
115329f1 1700
b71901e6 1701 /**
b1edfce0 1702 * prepass for motion estimation
f5bccd85 1703 * - encoding: Set by user.
64863965 1704 * - decoding: unused
b71901e6 1705 */
b1edfce0 1706 int pre_me;
115329f1 1707
b71901e6 1708 /**
b1edfce0 1709 * motion estimation prepass comparison function
f5bccd85 1710 * - encoding: Set by user.
64863965 1711 * - decoding: unused
b71901e6 1712 */
b1edfce0 1713 int me_pre_cmp;
917e06c8 1714
b71901e6 1715 /**
b1edfce0 1716 * ME prepass diamond size & shape
f5bccd85 1717 * - encoding: Set by user.
64863965 1718 * - decoding: unused
b71901e6 1719 */
b1edfce0 1720 int pre_dia_size;
115329f1 1721
c5d309f2 1722 /**
b1edfce0 1723 * subpel ME quality
f5bccd85 1724 * - encoding: Set by user.
64863965 1725 * - decoding: unused
c5d309f2 1726 */
b1edfce0 1727 int me_subpel_quality;
115329f1 1728
c5d309f2 1729 /**
b1edfce0
AK
1730 * DTG active format information (additional aspect ratio
1731 * information only used in DVB MPEG-2 transport streams)
1732 * 0 if not set.
1733 *
1734 * - encoding: unused
1735 * - decoding: Set by decoder.
c5d309f2 1736 */
b1edfce0
AK
1737 int dtg_active_format;
1738#define FF_DTG_AFD_SAME 8
1739#define FF_DTG_AFD_4_3 9
1740#define FF_DTG_AFD_16_9 10
1741#define FF_DTG_AFD_14_9 11
1742#define FF_DTG_AFD_4_3_SP_14_9 13
1743#define FF_DTG_AFD_16_9_SP_14_9 14
1744#define FF_DTG_AFD_SP_4_3 15
115329f1 1745
c5d309f2 1746 /**
b1edfce0
AK
1747 * maximum motion estimation search range in subpel units
1748 * If 0 then no limit.
1749 *
f5bccd85 1750 * - encoding: Set by user.
64863965 1751 * - decoding: unused
c5d309f2 1752 */
b1edfce0 1753 int me_range;
115329f1 1754
c5d309f2 1755 /**
b1edfce0 1756 * intra quantizer bias
f5bccd85 1757 * - encoding: Set by user.
64863965 1758 * - decoding: unused
c5d309f2 1759 */
b1edfce0
AK
1760 int intra_quant_bias;
1761#define FF_DEFAULT_QUANT_BIAS 999999
15415af4 1762
5e746b99 1763 /**
b1edfce0 1764 * inter quantizer bias
f5bccd85 1765 * - encoding: Set by user.
64863965 1766 * - decoding: unused
5e746b99 1767 */
b1edfce0 1768 int inter_quant_bias;
115329f1 1769
4f07f819 1770#if FF_API_COLOR_TABLE_ID
0c2dd16e 1771 /**
b1edfce0
AK
1772 * color table ID
1773 * - encoding: unused
1774 * - decoding: Which clrtable should be used for 8bit RGB images.
1775 * Tables have to be stored somewhere. FIXME
2ad1516a 1776 */
4f07f819
AK
1777 attribute_deprecated int color_table_id;
1778#endif
2ad1516a 1779
144f0625 1780 /**
b1edfce0
AK
1781 * slice flags
1782 * - encoding: unused
1783 * - decoding: Set by user.
144f0625 1784 */
b1edfce0
AK
1785 int slice_flags;
1786#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
1787#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
1788#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
1789
144f0625 1790 /**
b1edfce0
AK
1791 * XVideo Motion Acceleration
1792 * - encoding: forbidden
1793 * - decoding: set by decoder
144f0625 1794 */
b1edfce0 1795 int xvmc_acceleration;
144f0625 1796
4d2858de 1797 /**
b1edfce0
AK
1798 * macroblock decision mode
1799 * - encoding: Set by user.
1800 * - decoding: unused
4d2858de 1801 */
b1edfce0
AK
1802 int mb_decision;
1803#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
1804#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
1805#define FF_MB_DECISION_RD 2 ///< rate distortion
4d2858de 1806
6b72ac63 1807 /**
b1edfce0
AK
1808 * custom intra quantization matrix
1809 * - encoding: Set by user, can be NULL.
1810 * - decoding: Set by libavcodec.
bec89a84 1811 */
b1edfce0 1812 uint16_t *intra_matrix;
7160bb71 1813
11f18faf 1814 /**
b1edfce0
AK
1815 * custom inter quantization matrix
1816 * - encoding: Set by user, can be NULL.
1817 * - decoding: Set by libavcodec.
11f18faf 1818 */
b1edfce0 1819 uint16_t *inter_matrix;
115329f1 1820
11f18faf 1821 /**
b1edfce0
AK
1822 * scene change detection threshold
1823 * 0 is default, larger means fewer detected scene changes.
f5bccd85 1824 * - encoding: Set by user.
64863965 1825 * - decoding: unused
11f18faf 1826 */
b1edfce0 1827 int scenechange_threshold;
115329f1 1828
5d3cea3a 1829 /**
b1edfce0 1830 * noise reduction strength
f5bccd85 1831 * - encoding: Set by user.
b1edfce0 1832 * - decoding: unused
5d3cea3a 1833 */
b1edfce0 1834 int noise_reduction;
1e491e29 1835
16b7557b 1836#if FF_API_INTER_THRESHOLD
1e491e29 1837 /**
16b7557b 1838 * @deprecated this field is unused
1e491e29 1839 */
16b7557b
AK
1840 attribute_deprecated int inter_threshold;
1841#endif
c8c437bc 1842
23bfcc06 1843#if FF_API_MPV_GLOBAL_OPTS
c8c437bc 1844 /**
23bfcc06 1845 * @deprecated use mpegvideo private options instead
c8c437bc 1846 */
23bfcc06
AK
1847 attribute_deprecated int quantizer_noise_shaping;
1848#endif
115329f1 1849
140cb663 1850 /**
b1edfce0
AK
1851 * Motion estimation threshold below which no motion estimation is
1852 * performed, but instead the user specified motion vectors are used.
1853 *
f5bccd85 1854 * - encoding: Set by user.
b1edfce0 1855 * - decoding: unused
0c9bbaec 1856 */
b1edfce0 1857 int me_threshold;
0c9bbaec
WH
1858
1859 /**
b1edfce0
AK
1860 * Macroblock threshold below which the user specified macroblock types will be used.
1861 * - encoding: Set by user.
64863965 1862 * - decoding: unused
140cb663 1863 */
b1edfce0 1864 int mb_threshold;
115329f1 1865
1457ab52 1866 /**
b1edfce0 1867 * precision of the intra DC coefficient - 8
f5bccd85 1868 * - encoding: Set by user.
64863965 1869 * - decoding: unused
1457ab52 1870 */
b1edfce0
AK
1871 int intra_dc_precision;
1872
1457ab52 1873 /**
b1edfce0
AK
1874 * Number of macroblock rows at the top which are skipped.
1875 * - encoding: unused
1876 * - decoding: Set by user.
1457ab52 1877 */
b1edfce0
AK
1878 int skip_top;
1879
1457ab52 1880 /**
b1edfce0
AK
1881 * Number of macroblock rows at the bottom which are skipped.
1882 * - encoding: unused
1883 * - decoding: Set by user.
1457ab52 1884 */
b1edfce0
AK
1885 int skip_bottom;
1886
622348f9 1887 /**
b1edfce0
AK
1888 * Border processing masking, raises the quantizer for mbs on the borders
1889 * of the picture.
f5bccd85 1890 * - encoding: Set by user.
622348f9
MN
1891 * - decoding: unused
1892 */
b1edfce0 1893 float border_masking;
115329f1 1894
1457ab52 1895 /**
b1edfce0 1896 * minimum MB lagrange multipler
f5bccd85 1897 * - encoding: Set by user.
64863965 1898 * - decoding: unused
1457ab52 1899 */
b1edfce0 1900 int mb_lmin;
b07a5980
MN
1901
1902 /**
b1edfce0 1903 * maximum MB lagrange multipler
f5bccd85 1904 * - encoding: Set by user.
64863965 1905 * - decoding: unused
b07a5980 1906 */
b1edfce0 1907 int mb_lmax;
70ac76c0 1908
f5fb6b34 1909 /**
b1edfce0 1910 *
f5bccd85 1911 * - encoding: Set by user.
64863965 1912 * - decoding: unused
f5fb6b34 1913 */
b1edfce0 1914 int me_penalty_compensation;
b07a5980 1915
70ac76c0 1916 /**
b1edfce0 1917 *
f5bccd85 1918 * - encoding: Set by user.
64863965 1919 * - decoding: unused
70ac76c0 1920 */
b1edfce0 1921 int bidir_refine;
826f429a 1922
70ac76c0 1923 /**
b1edfce0 1924 *
f5bccd85 1925 * - encoding: Set by user.
64863965 1926 * - decoding: unused
70ac76c0 1927 */
b1edfce0 1928 int brd_scale;
70ac76c0 1929
826f429a 1930 /**
b1edfce0 1931 * minimum GOP size
f5bccd85 1932 * - encoding: Set by user.
64863965 1933 * - decoding: unused
826f429a 1934 */
b1edfce0 1935 int keyint_min;
826f429a 1936
a33c7159 1937 /**
b1edfce0
AK
1938 * number of reference frames
1939 * - encoding: Set by user.
1940 * - decoding: Set by lavc.
a33c7159 1941 */
b1edfce0 1942 int refs;
e2f9490e
FB
1943
1944 /**
b1edfce0
AK
1945 * chroma qp offset from luma
1946 * - encoding: Set by user.
1947 * - decoding: unused
e2f9490e 1948 */
b1edfce0 1949 int chromaoffset;
e2f9490e 1950
ebbcdc9a 1951 /**
b1edfce0 1952 * Multiplied by qscale for each frame and added to scene_change_score.
f5bccd85
DB
1953 * - encoding: Set by user.
1954 * - decoding: unused
ebbcdc9a 1955 */
b1edfce0 1956 int scenechange_factor;
ebbcdc9a 1957
65f7062d 1958 /**
b1edfce0
AK
1959 *
1960 * Note: Value depends upon the compare function used for fullpel ME.
f5bccd85 1961 * - encoding: Set by user.
1984f635
MN
1962 * - decoding: unused
1963 */
b1edfce0 1964 int mv0_threshold;
115329f1 1965
1984f635 1966 /**
b1edfce0 1967 * Adjust sensitivity of b_frame_strategy 1.
f5bccd85 1968 * - encoding: Set by user.
1984f635
MN
1969 * - decoding: unused
1970 */
b1edfce0 1971 int b_sensitivity;
5cd62665
ZK
1972
1973 /**
b1edfce0
AK
1974 * Chromaticity coordinates of the source primaries.
1975 * - encoding: Set by user
1976 * - decoding: Set by libavcodec
5cd62665 1977 */
b1edfce0 1978 enum AVColorPrimaries color_primaries;
115329f1 1979
3d2e8cce 1980 /**
b1edfce0
AK
1981 * Color Transfer Characteristic.
1982 * - encoding: Set by user
1983 * - decoding: Set by libavcodec
3d2e8cce 1984 */
b1edfce0 1985 enum AVColorTransferCharacteristic color_trc;
115329f1 1986
11e659c2 1987 /**
b1edfce0
AK
1988 * YUV colorspace type.
1989 * - encoding: Set by user
1990 * - decoding: Set by libavcodec
1991 */
1992 enum AVColorSpace colorspace;
1993
1994 /**
1995 * MPEG vs JPEG YUV range.
1996 * - encoding: Set by user
1997 * - decoding: Set by libavcodec
1998 */
1999 enum AVColorRange color_range;
2000
2001 /**
2002 * This defines the location of chroma samples.
2003 * - encoding: Set by user
2004 * - decoding: Set by libavcodec
2005 */
2006 enum AVChromaLocation chroma_sample_location;
2007
2008 /**
2009 * Number of slices.
2010 * Indicates number of picture subdivisions. Used for parallelized
2011 * decoding.
2012 * - encoding: Set by user
11e659c2
MN
2013 * - decoding: unused
2014 */
b1edfce0
AK
2015 int slices;
2016
2017 /** Field order
2018 * - encoding: set by libavcodec
2019 * - decoding: Set by libavcodec
2020 */
2021 enum AVFieldOrder field_order;
2022
2023 /* audio only */
2024 int sample_rate; ///< samples per second
2025 int channels; ///< number of audio channels
11e659c2
MN
2026
2027 /**
b1edfce0 2028 * audio sample format
f5bccd85 2029 * - encoding: Set by user.
b1edfce0 2030 * - decoding: Set by libavcodec.
11e659c2 2031 */
b1edfce0 2032 enum AVSampleFormat sample_fmt; ///< sample format
115329f1 2033
b1edfce0 2034 /* The following data should not be initialized. */
3bb07d61 2035 /**
b1edfce0 2036 * Samples per packet, initialized when calling 'init'.
3bb07d61 2037 */
b1edfce0 2038 int frame_size;
c179c9e1
AK
2039
2040 /**
2041 * Frame counter, set by libavcodec.
2042 *
2043 * - decoding: total number of frames returned from the decoder so far.
2044 * - encoding: total number of frames passed to the encoder so far.
2045 *
2046 * @note the counter is not incremented if encoding/decoding resulted in
2047 * an error.
2048 */
2049 int frame_number;
3bb07d61 2050
fb364ada 2051 /**
b1edfce0
AK
2052 * number of bytes per packet if constant and known or 0
2053 * Used by some WAV based audio codecs.
fb364ada 2054 */
b1edfce0 2055 int block_align;
115329f1 2056
7d1c3fc1 2057 /**
b1edfce0 2058 * Audio cutoff bandwidth (0 means "automatic")
f5bccd85 2059 * - encoding: Set by user.
7d1c3fc1
MN
2060 * - decoding: unused
2061 */
b1edfce0 2062 int cutoff;
d6eb3c50 2063
b1edfce0 2064#if FF_API_REQUEST_CHANNELS
d6eb3c50 2065 /**
b1edfce0
AK
2066 * Decoder should decode to this many channels if it can (0 for default)
2067 * - encoding: unused
2068 * - decoding: Set by user.
2069 * @deprecated Deprecated in favor of request_channel_layout.
d6eb3c50 2070 */
b1edfce0
AK
2071 int request_channels;
2072#endif
d6eb3c50
MN
2073
2074 /**
b1edfce0
AK
2075 * Audio channel layout.
2076 * - encoding: set by user.
2077 * - decoding: set by libavcodec.
d6eb3c50 2078 */
b1edfce0 2079 uint64_t channel_layout;
115329f1 2080
541ae140 2081 /**
b1edfce0 2082 * Request decoder to use this channel layout if it can (0 for default)
541ae140 2083 * - encoding: unused
b1edfce0 2084 * - decoding: Set by user.
541ae140 2085 */
b1edfce0 2086 uint64_t request_channel_layout;
05fbd0a2
MN
2087
2088 /**
b1edfce0 2089 * Type of service that the audio stream conveys.
f5bccd85 2090 * - encoding: Set by user.
b1edfce0 2091 * - decoding: Set by libavcodec.
05fbd0a2 2092 */
b1edfce0 2093 enum AVAudioServiceType audio_service_type;
158c7f05
MN
2094
2095 /**
b1edfce0
AK
2096 * Used to request a sample format from the decoder.
2097 * - encoding: unused.
2098 * - decoding: Set by user.
158c7f05 2099 */
b1edfce0 2100 enum AVSampleFormat request_sample_fmt;
158c7f05
MN
2101
2102 /**
b1edfce0
AK
2103 * Called at the beginning of each frame to get a buffer for it.
2104 *
2105 * The function will set AVFrame.data[], AVFrame.linesize[].
2106 * AVFrame.extended_data[] must also be set, but it should be the same as
2107 * AVFrame.data[] except for planar audio with more channels than can fit
2108 * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
2109 * many data pointers as it can hold.
2110 *
2111 * if CODEC_CAP_DR1 is not set then get_buffer() must call
2112 * avcodec_default_get_buffer() instead of providing buffers allocated by
2113 * some other means.
2114 *
2115 * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
2116 * need it. avcodec_default_get_buffer() aligns the output buffer properly,
2117 * but if get_buffer() is overridden then alignment considerations should
2118 * be taken into account.
2119 *
2120 * @see avcodec_default_get_buffer()
2121 *
2122 * Video:
2123 *
2124 * If pic.reference is set then the frame will be read later by libavcodec.
2125 * avcodec_align_dimensions2() should be used to find the required width and
2126 * height, as they normally need to be rounded up to the next multiple of 16.
2127 *
2128 * If frame multithreading is used and thread_safe_callbacks is set,
2129 * it may be called from a different thread, but not from more than one at
2130 * once. Does not need to be reentrant.
2131 *
2132 * @see release_buffer(), reget_buffer()
2133 * @see avcodec_align_dimensions2()
2134 *
2135 * Audio:
2136 *
2137 * Decoders request a buffer of a particular size by setting
2138 * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
2139 * however, utilize only part of the buffer by setting AVFrame.nb_samples
2140 * to a smaller value in the output frame.
2141 *
2142 * Decoders cannot use the buffer after returning from
2143 * avcodec_decode_audio4(), so they will not call release_buffer(), as it
2144 * is assumed to be released immediately upon return.
2145 *
2146 * As a convenience, av_samples_get_buffer_size() and
2147 * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
2148 * functions to find the required data size and to fill data pointers and
2149 * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2150 * since all planes must be the same size.
2151 *
2152 * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2153 *
2154 * - encoding: unused
2155 * - decoding: Set by libavcodec, user can override.
158c7f05 2156 */
b1edfce0 2157 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
2a2bbcb0 2158
821cb11f 2159 /**
b1edfce0
AK
2160 * Called to release buffers which were allocated with get_buffer.
2161 * A released buffer can be reused in get_buffer().
2162 * pic.data[*] must be set to NULL.
2163 * May be called from a different thread if frame multithreading is used,
2164 * but not by more than one thread at once, so does not need to be reentrant.
2165 * - encoding: unused
2166 * - decoding: Set by libavcodec, user can override.
821cb11f 2167 */
b1edfce0 2168 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
115329f1 2169
074c4ca7 2170 /**
f5bccd85
DB
2171 * Called at the beginning of a frame to get cr buffer for it.
2172 * Buffer type (size, hints) must be the same. libavcodec won't check it.
2173 * libavcodec will pass previous buffer in pic, function should return
e1c2a5a0 2174 * same buffer or new buffer with old frame "painted" into it.
f5bccd85 2175 * If pic.data[0] == NULL must behave like get_buffer().
f1b99cc6
MN
2176 * if CODEC_CAP_DR1 is not set then reget_buffer() must call
2177 * avcodec_default_reget_buffer() instead of providing buffers allocated by
2178 * some other means.
074c4ca7 2179 * - encoding: unused
53128bc3 2180 * - decoding: Set by libavcodec, user can override.
074c4ca7 2181 */
e1c2a5a0 2182 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
ba58dabc 2183
ba58dabc 2184
b1edfce0
AK
2185 /* - encoding parameters */
2186 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
2187 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
ba58dabc
MN
2188
2189 /**
b1edfce0 2190 * minimum quantizer
f5bccd85 2191 * - encoding: Set by user.
b1edfce0 2192 * - decoding: unused
ba58dabc 2193 */
b1edfce0 2194 int qmin;
7ebfc0ea
MN
2195
2196 /**
b1edfce0 2197 * maximum quantizer
f5bccd85
DB
2198 * - encoding: Set by user.
2199 * - decoding: unused
7ebfc0ea 2200 */
b1edfce0 2201 int qmax;
115329f1 2202
77ea0d4b 2203 /**
b1edfce0 2204 * maximum quantizer difference between frames
f5bccd85 2205 * - encoding: Set by user.
77ea0d4b
MN
2206 * - decoding: unused
2207 */
b1edfce0 2208 int max_qdiff;
9c3d33d6
MN
2209
2210 /**
b1edfce0
AK
2211 * ratecontrol qmin qmax limiting method
2212 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
f5bccd85 2213 * - encoding: Set by user.
b1edfce0 2214 * - decoding: unused
9c3d33d6 2215 */
b1edfce0 2216 float rc_qsquish;
115329f1 2217
b1edfce0
AK
2218 float rc_qmod_amp;
2219 int rc_qmod_freq;
a4d36c11
MN
2220
2221 /**
b1edfce0 2222 * decoder bitstream buffer size
f5bccd85 2223 * - encoding: Set by user.
f20f8a8b 2224 * - decoding: unused
a4d36c11 2225 */
b1edfce0 2226 int rc_buffer_size;
f20f8a8b
MN
2227
2228 /**
b1edfce0
AK
2229 * ratecontrol override, see RcOverride
2230 * - encoding: Allocated/set/freed by user.
f20f8a8b
MN
2231 * - decoding: unused
2232 */
b1edfce0
AK
2233 int rc_override_count;
2234 RcOverride *rc_override;
bf266e19
MN
2235
2236 /**
b1edfce0
AK
2237 * rate control equation
2238 * - encoding: Set by user
bf266e19
MN
2239 * - decoding: unused
2240 */
b1edfce0 2241 const char *rc_eq;
d4c5d2ad
MN
2242
2243 /**
b1edfce0 2244 * maximum bitrate
f5bccd85 2245 * - encoding: Set by user.
d4c5d2ad
MN
2246 * - decoding: unused
2247 */
b1edfce0 2248 int rc_max_rate;
baced9f5
MN
2249
2250 /**
b1edfce0 2251 * minimum bitrate
f5bccd85 2252 * - encoding: Set by user.
b1edfce0 2253 * - decoding: unused
baced9f5 2254 */
b1edfce0 2255 int rc_min_rate;
0215006a 2256
b1edfce0 2257 float rc_buffer_aggressivity;
c4ab43ff 2258
baced9f5 2259 /**
b1edfce0 2260 * initial complexity for pass1 ratecontrol
f5bccd85 2261 * - encoding: Set by user.
b1edfce0 2262 * - decoding: unused
178fcca8 2263 */
b1edfce0 2264 float rc_initial_cplx;
21adafec
MN
2265
2266 /**
b1edfce0
AK
2267 * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2268 * - encoding: Set by user.
2269 * - decoding: unused.
21adafec 2270 */
b1edfce0 2271 float rc_max_available_vbv_use;
bbf18b21
MN
2272
2273 /**
b1edfce0 2274 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
f5bccd85 2275 * - encoding: Set by user.
b1edfce0 2276 * - decoding: unused.
bbf18b21 2277 */
b1edfce0 2278 float rc_min_vbv_overflow_use;
bbf18b21
MN
2279
2280 /**
b1edfce0 2281 * Number of bits which should be loaded into the rc buffer before decoding starts.
f5bccd85 2282 * - encoding: Set by user.
bbf18b21
MN
2283 * - decoding: unused
2284 */
b1edfce0 2285 int rc_initial_buffer_occupancy;
0fd6aea1 2286
b1edfce0
AK
2287#define FF_CODER_TYPE_VLC 0
2288#define FF_CODER_TYPE_AC 1
2289#define FF_CODER_TYPE_RAW 2
2290#define FF_CODER_TYPE_RLE 3
2291#define FF_CODER_TYPE_DEFLATE 4
0fd6aea1 2292 /**
b1edfce0 2293 * coder type
f5bccd85 2294 * - encoding: Set by user.
0fd6aea1
MN
2295 * - decoding: unused
2296 */
b1edfce0 2297 int coder_type;
0fd6aea1
MN
2298
2299 /**
b1edfce0 2300 * context model
f5bccd85 2301 * - encoding: Set by user.
0fd6aea1
MN
2302 * - decoding: unused
2303 */
b1edfce0 2304 int context_model;
957c743a
CM
2305
2306 /**
b1edfce0 2307 * minimum Lagrange multipler
f5bccd85 2308 * - encoding: Set by user.
957c743a
CM
2309 * - decoding: unused
2310 */
b1edfce0 2311 int lmin;
6e0d8c06
MN
2312
2313 /**
b1edfce0 2314 * maximum Lagrange multipler
f5bccd85 2315 * - encoding: Set by user.
6e0d8c06
MN
2316 * - decoding: unused
2317 */
b1edfce0 2318 int lmax;
6e0d8c06
MN
2319
2320 /**
b1edfce0 2321 * frame skip threshold
f5bccd85 2322 * - encoding: Set by user.
6e0d8c06
MN
2323 * - decoding: unused
2324 */
b1edfce0 2325 int frame_skip_threshold;
09c3e44e
MN
2326
2327 /**
b1edfce0 2328 * frame skip factor
f5bccd85 2329 * - encoding: Set by user.
09c3e44e
MN
2330 * - decoding: unused
2331 */
b1edfce0 2332 int frame_skip_factor;
316a2ec8
MN
2333
2334 /**
b1edfce0 2335 * frame skip exponent
f5bccd85 2336 * - encoding: Set by user.
316a2ec8
MN
2337 * - decoding: unused
2338 */
b1edfce0 2339 int frame_skip_exp;
e8501c93
MN
2340
2341 /**
b1edfce0 2342 * frame skip comparison function
f5bccd85 2343 * - encoding: Set by user.
e8501c93
MN
2344 * - decoding: unused
2345 */
b1edfce0 2346 int frame_skip_cmp;
58f7833e 2347
58f7833e 2348 /**
b1edfce0 2349 * trellis RD quantization
f5bccd85 2350 * - encoding: Set by user.
58f7833e
RS
2351 * - decoding: unused
2352 */
b1edfce0 2353 int trellis;
58f7833e
RS
2354
2355 /**
f5bccd85 2356 * - encoding: Set by user.
b1edfce0 2357 * - decoding: unused
58f7833e 2358 */
b1edfce0 2359 int min_prediction_order;
58f7833e
RS
2360
2361 /**
f5bccd85 2362 * - encoding: Set by user.
58f7833e
RS
2363 * - decoding: unused
2364 */
b1edfce0 2365 int max_prediction_order;
58f7833e 2366
58f7833e 2367 /**
b1edfce0 2368 * GOP timecode frame start number, in non drop frame format
f5bccd85 2369 * - encoding: Set by user.
58f7833e
RS
2370 * - decoding: unused
2371 */
b1edfce0
AK
2372 int64_t timecode_frame_start;
2373
2374 /* The RTP callback: This function is called */
2375 /* every time the encoder has a packet to send. */
2376 /* It depends on the encoder if the data starts */
2377 /* with a Start Code (it should). H.263 does. */
2378 /* mb_nb contains the number of macroblocks */
2379 /* encoded in the RTP payload. */
2380 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
2381
2382 int rtp_payload_size; /* The size of the RTP payload: the coder will */
2383 /* do its best to deliver a chunk with size */
2384 /* below rtp_payload_size, the chunk will start */
2385 /* with a start code on some codecs like H.263. */
2386 /* This doesn't take account of any particular */
2387 /* headers inside the transmitted RTP payload. */
2388
2389 /* statistics, used for 2-pass encoding */
2390 int mv_bits;
2391 int header_bits;
2392 int i_tex_bits;
2393 int p_tex_bits;
2394 int i_count;
2395 int p_count;
2396 int skip_count;
2397 int misc_bits;
58f7833e 2398
14f0c8e2 2399 /**
b1edfce0
AK
2400 * number of bits used for the previously encoded frame
2401 * - encoding: Set by libavcodec.
14f0c8e2
LA
2402 * - decoding: unused
2403 */
b1edfce0 2404 int frame_bits;
39a64e30
CH
2405
2406 /**
b1edfce0
AK
2407 * pass1 encoding statistics output buffer
2408 * - encoding: Set by libavcodec.
39a64e30
CH
2409 * - decoding: unused
2410 */
b1edfce0 2411 char *stats_out;
1dd509b1
MN
2412
2413 /**
b1edfce0
AK
2414 * pass2 encoding statistics input buffer
2415 * Concatenated stuff from stats_out of pass1 should be placed here.
2416 * - encoding: Allocated/set/freed by user.
1dd509b1
MN
2417 * - decoding: unused
2418 */
b1edfce0 2419 char *stats_in;
f9243d34
CH
2420
2421 /**
b1edfce0
AK
2422 * Work around bugs in encoders which sometimes cannot be detected automatically.
2423 * - encoding: Set by user
2424 * - decoding: Set by user
f9243d34 2425 */
b1edfce0
AK
2426 int workaround_bugs;
2427#define FF_BUG_AUTODETECT 1 ///< autodetection
2428#define FF_BUG_OLD_MSMPEG4 2
2429#define FF_BUG_XVID_ILACE 4
2430#define FF_BUG_UMP4 8
2431#define FF_BUG_NO_PADDING 16
2432#define FF_BUG_AMV 32
2433#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
2434#define FF_BUG_QPEL_CHROMA 64
2435#define FF_BUG_STD_QPEL 128
2436#define FF_BUG_QPEL_CHROMA2 256
2437#define FF_BUG_DIRECT_BLOCKSIZE 512
2438#define FF_BUG_EDGE 1024
2439#define FF_BUG_HPEL_CHROMA 2048
2440#define FF_BUG_DC_CLIP 4096
2441#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
2442#define FF_BUG_TRUNCATED 16384
a403fc03
JR
2443
2444 /**
b1edfce0 2445 * strictly follow the standard (MPEG4, ...).
f5bccd85 2446 * - encoding: Set by user.
b1edfce0
AK
2447 * - decoding: Set by user.
2448 * Setting this to STRICT or higher means the encoder and decoder will
2449 * generally do stupid things, whereas setting it to unofficial or lower
2450 * will mean the encoder might produce output that is not supported by all
2451 * spec-compliant decoders. Decoders don't differentiate between normal,
2452 * unofficial and experimental (that is, they always try to decode things
2453 * when they can) unless they are explicitly asked to behave stupidly
2454 * (=strictly conform to the specs)
a403fc03 2455 */
b1edfce0
AK
2456 int strict_std_compliance;
2457#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
2458#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
2459#define FF_COMPLIANCE_NORMAL 0
2460#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
2461#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
a403fc03 2462
a403fc03 2463 /**
b1edfce0
AK
2464 * error concealment flags
2465 * - encoding: unused
2466 * - decoding: Set by user.
a403fc03 2467 */
b1edfce0
AK
2468 int error_concealment;
2469#define FF_EC_GUESS_MVS 1
2470#define FF_EC_DEBLOCK 2
a403fc03
JR
2471
2472 /**
b1edfce0 2473 * debug
f5bccd85 2474 * - encoding: Set by user.
b1edfce0 2475 * - decoding: Set by user.
a403fc03 2476 */
b1edfce0
AK
2477 int debug;
2478#define FF_DEBUG_PICT_INFO 1
2479#define FF_DEBUG_RC 2
2480#define FF_DEBUG_BITSTREAM 4
2481#define FF_DEBUG_MB_TYPE 8
2482#define FF_DEBUG_QP 16
2483#define FF_DEBUG_MV 32
2484#define FF_DEBUG_DCT_COEFF 0x00000040
2485#define FF_DEBUG_SKIP 0x00000080
2486#define FF_DEBUG_STARTCODE 0x00000100
2487#define FF_DEBUG_PTS 0x00000200
2488#define FF_DEBUG_ER 0x00000400
2489#define FF_DEBUG_MMCO 0x00000800
2490#define FF_DEBUG_BUGS 0x00001000
2491#define FF_DEBUG_VIS_QP 0x00002000
2492#define FF_DEBUG_VIS_MB_TYPE 0x00004000
2493#define FF_DEBUG_BUFFERS 0x00008000
2494#define FF_DEBUG_THREADS 0x00010000
188dea1d 2495
80d617f5 2496 /**
b1edfce0 2497 * debug
f5bccd85 2498 * - encoding: Set by user.
b1edfce0 2499 * - decoding: Set by user.
80d617f5 2500 */
b1edfce0
AK
2501 int debug_mv;
2502#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
2503#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
2504#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
b1ec601f
RD
2505
2506 /**
b1edfce0 2507 * Error recognition; may misdetect some more or less valid parts as errors.
85947156
VS
2508 * - encoding: unused
2509 * - decoding: Set by user.
b1ec601f 2510 */
b1edfce0
AK
2511 int err_recognition;
2512#define AV_EF_CRCCHECK (1<<0)
2513#define AV_EF_BITSTREAM (1<<1)
2514#define AV_EF_BUFFER (1<<2)
2515#define AV_EF_EXPLODE (1<<3)
1408352a 2516
79de84f2
MN
2517 /**
2518 * opaque 64bit number (generally a PTS) that will be reordered and
2519 * output in AVFrame.reordered_opaque
81c623fa 2520 * @deprecated in favor of pkt_pts
79de84f2
MN
2521 * - encoding: unused
2522 * - decoding: Set by user.
2523 */
2524 int64_t reordered_opaque;
312420f3
PR
2525
2526 /**
b1edfce0
AK
2527 * Hardware accelerator in use
2528 * - encoding: unused.
2529 * - decoding: Set by libavcodec
312420f3 2530 */
b1edfce0 2531 struct AVHWAccel *hwaccel;
0d72e7d0
PR
2532
2533 /**
b1edfce0
AK
2534 * Hardware accelerator context.
2535 * For some hardware accelerators, a global context needs to be
2536 * provided by the user. In that case, this holds display-dependent
2537 * data Libav cannot instantiate itself. Please refer to the
2538 * Libav HW accelerator documentation to know how to fill this
2539 * is. e.g. for VA API, this is a struct vaapi_context.
2540 * - encoding: unused
2541 * - decoding: Set by user
0d72e7d0 2542 */
b1edfce0 2543 void *hwaccel_context;
0d72e7d0
PR
2544
2545 /**
b1edfce0
AK
2546 * error
2547 * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
2548 * - decoding: unused
0d72e7d0 2549 */
b1edfce0 2550 uint64_t error[AV_NUM_DATA_POINTERS];
3bff4d8b
BC
2551
2552 /**
b1edfce0 2553 * DCT algorithm, see FF_DCT_* below
3bff4d8b 2554 * - encoding: Set by user.
b1edfce0 2555 * - decoding: unused
3bff4d8b 2556 */
b1edfce0
AK
2557 int dct_algo;
2558#define FF_DCT_AUTO 0
2559#define FF_DCT_FASTINT 1
2560#define FF_DCT_INT 2
2561#define FF_DCT_MMX 3
2562#define FF_DCT_ALTIVEC 5
2563#define FF_DCT_FAAN 6
3bff4d8b
BC
2564
2565 /**
b1edfce0 2566 * IDCT algorithm, see FF_IDCT_* below.
3bff4d8b 2567 * - encoding: Set by user.
b1edfce0 2568 * - decoding: Set by user.
3bff4d8b 2569 */
b1edfce0
AK
2570 int idct_algo;
2571#define FF_IDCT_AUTO 0
2572#define FF_IDCT_INT 1
2573#define FF_IDCT_SIMPLE 2
2574#define FF_IDCT_SIMPLEMMX 3
2575#define FF_IDCT_LIBMPEG2MMX 4
2576#define FF_IDCT_MMI 5
2577#define FF_IDCT_ARM 7
2578#define FF_IDCT_ALTIVEC 8
2579#define FF_IDCT_SH4 9
2580#define FF_IDCT_SIMPLEARM 10
2581#define FF_IDCT_H264 11
2582#define FF_IDCT_VP3 12
2583#define FF_IDCT_IPP 13
2584#define FF_IDCT_XVIDMMX 14
2585#define FF_IDCT_CAVS 15
2586#define FF_IDCT_SIMPLEARMV5TE 16
2587#define FF_IDCT_SIMPLEARMV6 17
2588#define FF_IDCT_SIMPLEVIS 18
2589#define FF_IDCT_WMV2 19
2590#define FF_IDCT_FAAN 20
2591#define FF_IDCT_EA 21
2592#define FF_IDCT_SIMPLENEON 22
2593#define FF_IDCT_SIMPLEALPHA 23
2594#define FF_IDCT_BINK 24
40e5d31b 2595
95510be8 2596#if FF_API_DSP_MASK
40e5d31b 2597 /**
95510be8
MR
2598 * Unused.
2599 * @deprecated use av_set_cpu_flags_mask() instead.
40e5d31b 2600 */
95510be8
MR
2601 attribute_deprecated unsigned dsp_mask;
2602#endif
b1edfce0
AK
2603
2604 /**
2605 * bits per sample/pixel from the demuxer (needed for huffyuv).
2606 * - encoding: Set by libavcodec.
2607 * - decoding: Set by user.
2608 */
2609 int bits_per_coded_sample;
2610
2611 /**
2612 * Bits per sample/pixel of internal libavcodec pixel/sample format.
2613 * - encoding: set by user.
2614 * - decoding: set by libavcodec.
2615 */
2616 int bits_per_raw_sample;
3797c74b
MN
2617
2618 /**
b1edfce0
AK
2619 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2620 * - encoding: unused
2621 * - decoding: Set by user.
3797c74b 2622 */
2bcbd984 2623 attribute_deprecated int lowres;
1aea7018
GB
2624
2625 /**
b1edfce0
AK
2626 * the picture in the bitstream
2627 * - encoding: Set by libavcodec.
2628 * - decoding: Set by libavcodec.
1aea7018 2629 */
b1edfce0 2630 AVFrame *coded_frame;
4ee6a5c1
MN
2631
2632 /**
b1edfce0
AK
2633 * thread count
2634 * is used to decide how many independent tasks should be passed to execute()
2635 * - encoding: Set by user.
2636 * - decoding: Set by user.
4ee6a5c1 2637 */
b1edfce0 2638 int thread_count;
4ee6a5c1
MN
2639
2640 /**
b1edfce0
AK
2641 * Which multithreading methods to use.
2642 * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2643 * so clients which cannot provide future frames should not use it.
2644 *
2645 * - encoding: Set by user, otherwise the default is used.
2646 * - decoding: Set by user, otherwise the default is used.
4ee6a5c1 2647 */
b1edfce0
AK
2648 int thread_type;
2649#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
2650#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
4ee6a5c1
MN
2651
2652 /**
b1edfce0
AK
2653 * Which multithreading methods are in use by the codec.
2654 * - encoding: Set by libavcodec.
2655 * - decoding: Set by libavcodec.
4ee6a5c1 2656 */
b1edfce0 2657 int active_thread_type;
4ee6a5c1
MN
2658
2659 /**
b1edfce0 2660 * Set by the client if its custom get_buffer() callback can be called
ad027866 2661 * synchronously from another thread, which allows faster multithreaded decoding.
b1edfce0
AK
2662 * draw_horiz_band() will be called from other threads regardless of this setting.
2663 * Ignored if the default get_buffer() is used.
2664 * - encoding: Set by user.
2665 * - decoding: Set by user.
4ee6a5c1 2666 */
b1edfce0 2667 int thread_safe_callbacks;
580a7465
DC
2668
2669 /**
b1edfce0
AK
2670 * The codec may call this to execute several independent things.
2671 * It will return only after finishing all tasks.
2672 * The user may replace this with some multithreaded implementation,
2673 * the default implementation will execute the parts serially.
2674 * @param count the number of things to execute
2675 * - encoding: Set by libavcodec, user can override.
2676 * - decoding: Set by libavcodec, user can override.
580a7465 2677 */
b1edfce0 2678 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
8d23a86f
RD
2679
2680 /**
2681 * The codec may call this to execute several independent things.
2682 * It will return only after finishing all tasks.
2683 * The user may replace this with some multithreaded implementation,
2684 * the default implementation will execute the parts serially.
2685 * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
2686 * @param c context passed also to func
2687 * @param count the number of things to execute
2688 * @param arg2 argument passed unchanged to func
2689 * @param ret return values of executed functions, must have space for "count" values. May be NULL.
2690 * @param func function that will be called count times, with jobnr from 0 to count-1.
2691 * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
2692 * two instances of func executing at the same time will have the same threadnr.
2693 * @return always 0 currently, but code should handle a future improvement where when any call to func
2694 * returns < 0 no further calls to func may be done and < 0 is returned.
2695 * - encoding: Set by libavcodec, user can override.
2696 * - decoding: Set by libavcodec, user can override.
2697 */
2698 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
096c87f6 2699
b1edfce0
AK
2700 /**
2701 * thread opaque
2702 * Can be used by execute() to store some per AVCodecContext stuff.
2703 * - encoding: set by execute()
2704 * - decoding: set by execute()
2705 */
2706 void *thread_opaque;
23940f14 2707
2aa72ecc 2708 /**
b1edfce0
AK
2709 * noise vs. sse weight for the nsse comparsion function
2710 * - encoding: Set by user.
2aa72ecc
JZ
2711 * - decoding: unused
2712 */
b1edfce0 2713 int nsse_weight;
cb2c971d
AJ
2714
2715 /**
b1edfce0
AK
2716 * profile
2717 * - encoding: Set by user.
2718 * - decoding: Set by libavcodec.
cb2c971d 2719 */
b1edfce0
AK
2720 int profile;
2721#define FF_PROFILE_UNKNOWN -99
2722#define FF_PROFILE_RESERVED -100
2723
2724#define FF_PROFILE_AAC_MAIN 0
2725#define FF_PROFILE_AAC_LOW 1
2726#define FF_PROFILE_AAC_SSR 2
2727#define FF_PROFILE_AAC_LTP 3
372597e5
MS
2728#define FF_PROFILE_AAC_HE 4
2729#define FF_PROFILE_AAC_HE_V2 28
2730#define FF_PROFILE_AAC_LD 22
2731#define FF_PROFILE_AAC_ELD 38
b1edfce0
AK
2732
2733#define FF_PROFILE_DTS 20
2734#define FF_PROFILE_DTS_ES 30
2735#define FF_PROFILE_DTS_96_24 40
2736#define FF_PROFILE_DTS_HD_HRA 50
2737#define FF_PROFILE_DTS_HD_MA 60
2738
2739#define FF_PROFILE_MPEG2_422 0
2740#define FF_PROFILE_MPEG2_HIGH 1
2741#define FF_PROFILE_MPEG2_SS 2
2742#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
2743#define FF_PROFILE_MPEG2_MAIN 4
2744#define FF_PROFILE_MPEG2_SIMPLE 5
2745
2746#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
2747#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
2748
2749#define FF_PROFILE_H264_BASELINE 66
2750#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2751#define FF_PROFILE_H264_MAIN 77
2752#define FF_PROFILE_H264_EXTENDED 88
2753#define FF_PROFILE_H264_HIGH 100
2754#define FF_PROFILE_H264_HIGH_10 110
2755#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
2756#define FF_PROFILE_H264_HIGH_422 122
2757#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
2758#define FF_PROFILE_H264_HIGH_444 144
2759#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
2760#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
2761#define FF_PROFILE_H264_CAVLC_444 44
2762
2763#define FF_PROFILE_VC1_SIMPLE 0
2764#define FF_PROFILE_VC1_MAIN 1
2765#define FF_PROFILE_VC1_COMPLEX 2
2766#define FF_PROFILE_VC1_ADVANCED 3
2767
2768#define FF_PROFILE_MPEG4_SIMPLE 0
2769#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
2770#define FF_PROFILE_MPEG4_CORE 2
2771#define FF_PROFILE_MPEG4_MAIN 3
2772#define FF_PROFILE_MPEG4_N_BIT 4
2773#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
2774#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
2775#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
2776#define FF_PROFILE_MPEG4_HYBRID 8
2777#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
2778#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
2779#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
2780#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
2781#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2782#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
2783#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
393cbb96
MN
2784
2785 /**
b1edfce0
AK
2786 * level
2787 * - encoding: Set by user.
2788 * - decoding: Set by libavcodec.
393cbb96 2789 */
b1edfce0
AK
2790 int level;
2791#define FF_LEVEL_UNKNOWN -99
37b00b47 2792
37b00b47 2793 /**
37b00b47 2794 *
b1edfce0
AK
2795 * - encoding: unused
2796 * - decoding: Set by user.
37b00b47 2797 */
b1edfce0 2798 enum AVDiscard skip_loop_filter;
37b00b47
AS
2799
2800 /**
b1edfce0
AK
2801 *
2802 * - encoding: unused
2803 * - decoding: Set by user.
37b00b47 2804 */
b1edfce0 2805 enum AVDiscard skip_idct;
37b00b47
AS
2806
2807 /**
b1edfce0
AK
2808 *
2809 * - encoding: unused
37b00b47
AS
2810 * - decoding: Set by user.
2811 */
b1edfce0 2812 enum AVDiscard skip_frame;
55bad0c6
CM
2813
2814 /**
b1edfce0
AK
2815 * Header containing style information for text subtitles.
2816 * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
2817 * [Script Info] and [V4+ Styles] section, plus the [Events] line and
2818 * the Format line following. It shouldn't include any Dialogue line.
2819 * - encoding: Set/allocated/freed by user (before avcodec_open2())
2820 * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
55bad0c6 2821 */
b1edfce0
AK
2822 uint8_t *subtitle_header;
2823 int subtitle_header_size;
34b47d7c
JR
2824
2825 /**
b1edfce0 2826 * Simulates errors in the bitstream to test error concealment.
34b47d7c 2827 * - encoding: Set by user.
b1edfce0 2828 * - decoding: unused
64150ff0 2829 */
b1edfce0 2830 int error_rate;
582f2311
DB
2831
2832 /**
b1edfce0
AK
2833 * Current packet as passed into the decoder, to avoid having
2834 * to pass the packet into every function. Currently only valid
2835 * inside lavc and get/release_buffer callbacks.
2836 * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
582f2311 2837 * - encoding: unused
582f2311 2838 */
b1edfce0 2839 AVPacket *pkt;
f3a29b75
JR
2840
2841 /**
b1edfce0
AK
2842 * VBV delay coded in the last frame (in periods of a 27 MHz clock).
2843 * Used for compliant TS muxing.
2844 * - encoding: Set by libavcodec.
2845 * - decoding: unused.
4bf3c8f2 2846 */
b1edfce0 2847 uint64_t vbv_delay;
de6d9b64
FB
2848} AVCodecContext;
2849
64863965 2850/**
060ec0a8
AH
2851 * AVProfile.
2852 */
2853typedef struct AVProfile {
2854 int profile;
2855 const char *name; ///< short name for the profile
2856} AVProfile;
2857
84626b36
AK
2858typedef struct AVCodecDefault AVCodecDefault;
2859
060ec0a8 2860/**
64863965
MN
2861 * AVCodec.
2862 */
de6d9b64 2863typedef struct AVCodec {
6b0cdb6e
NG
2864 /**
2865 * Name of the codec implementation.
2866 * The name is globally unique among encoders and among decoders (but an
2867 * encoder and a decoder can share the same name).
2868 * This is the primary way to find a codec from the user perspective.
2869 */
18f77016 2870 const char *name;
f5f49a66
AK
2871 /**
2872 * Descriptive name for the codec, meant to be more human readable than name.
2873 * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
2874 */
2875 const char *long_name;
72415b2a 2876 enum AVMediaType type;
36ef5369 2877 enum AVCodecID id;
a2d11246
MN
2878 /**
2879 * Codec capabilities.
2880 * see CODEC_CAP_*
2881 */
bf89e6b1 2882 int capabilities;
716e31ea 2883 const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
1beb670a 2884 const enum PixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
3ade5d56 2885 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
5d6e4c16 2886 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
cc276c85 2887 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
2bcbd984 2888 attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
567ad0e3 2889 const AVClass *priv_class; ///< AVClass for the private context
060ec0a8 2890 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
37b00b47 2891
f5f49a66
AK
2892 /*****************************************************************
2893 * No fields below this line are part of the public API. They
2894 * may not be used outside of libavcodec and can be changed and
2895 * removed at will.
2896 * New public fields should be added right above.
2897 *****************************************************************
2898 */
2899 int priv_data_size;
2900 struct AVCodec *next;
37b00b47 2901 /**
21a19b79 2902 * @name Frame-level threading support functions
37b00b47
AS
2903 * @{
2904 */
2905 /**
2906 * If defined, called on thread contexts when they are created.
2907 * If the codec allocates writable tables in init(), re-allocate them here.
2908 * priv_data will be set to a copy of the original.
2909 */
2910 int (*init_thread_copy)(AVCodecContext *);
2911 /**
2912 * Copy necessary context variables from a previous thread context to the current one.
2913 * If not defined, the next thread will start automatically; otherwise, the codec
2914 * must call ff_thread_finish_setup().
2915 *
2916 * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
2917 */
2918 int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
2919 /** @} */
84626b36
AK
2920
2921 /**
2922 * Private codec-specific defaults.
2923 */
2924 const AVCodecDefault *defaults;
d97efd7f
AK
2925
2926 /**
2927 * Initialize codec static data, called from avcodec_register().
2928 */
2929 void (*init_static_data)(struct AVCodec *codec);
b2c75b6e 2930
f5f49a66
AK
2931 int (*init)(AVCodecContext *);
2932 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
b2c75b6e
JR
2933 /**
2934 * Encode data to an AVPacket.
2935 *
2936 * @param avctx codec context
2937 * @param avpkt output AVPacket (may contain a user-provided buffer)
2938 * @param[in] frame AVFrame containing the raw data to be encoded
2939 * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
2940 * non-empty packet was returned in avpkt.
2941 * @return 0 on success, negative error code on failure
2942 */
2943 int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
2944 int *got_packet_ptr);
f5f49a66
AK
2945 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
2946 int (*close)(AVCodecContext *);
2947 /**
2948 * Flush buffers.
2949 * Will be called when seeking
2950 */
2951 void (*flush)(AVCodecContext *);
de6d9b64
FB
2952} AVCodec;
2953
97d96aaa 2954/**
40e5d31b
GB
2955 * AVHWAccel.
2956 */
2957typedef struct AVHWAccel {
2958 /**
2959 * Name of the hardware accelerated codec.
2960 * The name is globally unique among encoders and among decoders (but an
2961 * encoder and a decoder can share the same name).
2962 */
2963 const char *name;
2964
2965 /**
2966 * Type of codec implemented by the hardware accelerator.
2967 *
72415b2a 2968 * See AVMEDIA_TYPE_xxx
40e5d31b 2969 */
72415b2a 2970 enum AVMediaType type;
40e5d31b
GB
2971
2972 /**
2973 * Codec implemented by the hardware accelerator.
2974 *
36ef5369 2975 * See AV_CODEC_ID_xxx
40e5d31b 2976 */
36ef5369 2977 enum AVCodecID id;
40e5d31b
GB
2978
2979 /**
2980 * Supported pixel format.
2981 *
2982 * Only hardware accelerated formats are supported here.
2983 */
2984 enum PixelFormat pix_fmt;
2985
2986 /**
2987 * Hardware accelerated codec capabilities.
2988 * see FF_HWACCEL_CODEC_CAP_*
2989 */
2990 int capabilities;
2991
2992 struct AVHWAccel *next;
2993
2994 /**
2995 * Called at the beginning of each frame or field picture.
2996 *
2997 * Meaningful frame information (codec specific) is guaranteed to
2998 * be parsed at this point. This function is mandatory.
2999 *
bf7e799c 3000 * Note that buf can be NULL along with buf_size set to 0.
40e5d31b
GB
3001 * Otherwise, this means the whole frame is available at this point.
3002 *
3003 * @param avctx the codec context
3004 * @param buf the frame data buffer base
3005 * @param buf_size the size of the frame in bytes
3006 * @return zero if successful, a negative value otherwise
3007 */
3008 int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3009
3010 /**
3011 * Callback for each slice.
3012 *
3013 * Meaningful slice information (codec specific) is guaranteed to
3014 * be parsed at this point. This function is mandatory.
3015 *
3016 * @param avctx the codec context
3017 * @param buf the slice data buffer base
3018 * @param buf_size the size of the slice in bytes
3019 * @return zero if successful, a negative value otherwise
3020 */
3021 int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3022
3023 /**
3024 * Called at the end of each frame or field picture.
3025 *
3026 * The whole picture is parsed at this point and can now be sent
3027 * to the hardware accelerator. This function is mandatory.
3028 *
3029 * @param avctx the codec context
3030 * @return zero if successful, a negative value otherwise
3031 */
3032 int (*end_frame)(AVCodecContext *avctx);
68e5d523
GB
3033
3034 /**
3035 * Size of HW accelerator private data.
3036 *
cd823ff9
GB
3037 * Private data is allocated with av_mallocz() before
3038 * AVCodecContext.get_buffer() and deallocated after
3039 * AVCodecContext.release_buffer().
68e5d523
GB
3040 */
3041 int priv_data_size;
40e5d31b
GB
3042} AVHWAccel;
3043
3044/**
6aadfbda
AK
3045 * @defgroup lavc_picture AVPicture
3046 *
3047 * Functions for working with AVPicture
3048 * @{
3049 */
3050
3051/**
d7425f59
MN
3052 * four components are given, that's all.
3053 * the last component is alpha
3054 */
de6d9b64 3055typedef struct AVPicture {
560f773c
JR
3056 uint8_t *data[AV_NUM_DATA_POINTERS];
3057 int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
de6d9b64
FB
3058} AVPicture;
3059
6aadfbda
AK
3060/**
3061 * @}
3062 */
3063
63e4c8a6
AK
3064#define AVPALETTE_SIZE 1024
3065#define AVPALETTE_COUNT 256
ba118447 3066
c66216ed
MN
3067enum AVSubtitleType {
3068 SUBTITLE_NONE,
3069
3070 SUBTITLE_BITMAP, ///< A bitmap, pict will be set
3071
3072 /**
3073 * Plain text, the text field must be set by the decoder and is
3074 * authoritative. ass and pict fields may contain approximations.
3075 */
3076 SUBTITLE_TEXT,
3077
3078 /**
3079 * Formatted text, the ass field must be set by the decoder and is
3080 * authoritative. pict and text fields may contain approximations.
3081 */
3082 SUBTITLE_ASS,
3083};
3084
c6ec28b1 3085typedef struct AVSubtitleRect {
ebc466bb
MN
3086 int x; ///< top left corner of pict, undefined when pict is not set
3087 int y; ///< top left corner of pict, undefined when pict is not set
3088 int w; ///< width of pict, undefined when pict is not set
3089 int h; ///< height of pict, undefined when pict is not set
3090 int nb_colors; ///< number of colors in pict, undefined when pict is not set
25b4c651
MN
3091
3092 /**
3093 * data+linesize for the bitmap of this subtitle.
3094 * can be set for text/ass as well once they where rendered
3095 */
3096 AVPicture pict;
f656106f
MN
3097 enum AVSubtitleType type;
3098
3099 char *text; ///< 0 terminated plain UTF-8 text
3100
3101 /**
3102 * 0 terminated ASS/SSA compatible event line.
3103 * The pressentation of this is unaffected by the other values in this
3104 * struct.
3105 */
3106 char *ass;
c6ec28b1
MN
3107} AVSubtitleRect;
3108
3109typedef struct AVSubtitle {
3110 uint16_t format; /* 0 = graphics */
3111 uint32_t start_display_time; /* relative to packet pts, in ms */
3112 uint32_t end_display_time; /* relative to packet pts, in ms */
ebc466bb 3113 unsigned num_rects;
db4fac64 3114 AVSubtitleRect **rects;
4bbe788a 3115 int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
240c1657
FB
3116} AVSubtitle;
3117
294b3a50
AK
3118/**
3119 * If c is NULL, returns the first registered codec,
3120 * if c is non-NULL, returns the next registered codec after c,
3121 * or NULL if c is the last one.
3122 */
3123AVCodec *av_codec_next(AVCodec *c);
3124
3125/**
3126 * Return the LIBAVCODEC_VERSION_INT constant.
3127 */
3128unsigned avcodec_version(void);
3129
3130/**
3131 * Return the libavcodec build-time configuration.
3132 */
3133const char *avcodec_configuration(void);
3134
3135/**
3136 * Return the libavcodec license.
3137 */
3138const char *avcodec_license(void);
3139
3140/**
3141 * Register the codec codec and initialize libavcodec.
3142 *
3143 * @warning either this function or avcodec_register_all() must be called
3144 * before any other libavcodec functions.
3145 *
3146 * @see avcodec_register_all()
3147 */
3148void avcodec_register(AVCodec *codec);
3149
3150/**
3151 * Register all the codecs, parsers and bitstream filters which were enabled at
3152 * configuration time. If you do not call this function you can select exactly
3153 * which formats you want to support, by using the individual registration
3154 * functions.
3155 *
3156 * @see avcodec_register
3157 * @see av_register_codec_parser
3158 * @see av_register_bitstream_filter
3159 */
3160void avcodec_register_all(void);
3161
3162/**
3163 * Allocate an AVCodecContext and set its fields to default values. The
3164 * resulting struct can be deallocated by calling avcodec_close() on it followed
3165 * by av_free().
3166 *
3167 * @param codec if non-NULL, allocate private data and initialize defaults
3168 * for the given codec. It is illegal to then call avcodec_open2()
3169 * with a different codec.
3170 * If NULL, then the codec-specific defaults won't be initialized,
3171 * which may result in suboptimal default settings (this is
3172 * important mainly for encoders, e.g. libx264).
3173 *
3174 * @return An AVCodecContext filled with default values or NULL on failure.
3175 * @see avcodec_get_context_defaults
3176 */
3177AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
3178
3179/**
3180 * Set the fields of the given AVCodecContext to default values corresponding
3181 * to the given codec (defaults may be codec-dependent).
3182 *
3183 * Do not call this function if a non-NULL codec has been passed
3184 * to avcodec_alloc_context3() that allocated this AVCodecContext.
3185 * If codec is non-NULL, it is illegal to call avcodec_open2() with a
3186 * different codec on this AVCodecContext.
3187 */
3188int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
3189
3190/**
3191 * Get the AVClass for AVCodecContext. It can be used in combination with
3192 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
3193 *
3194 * @see av_opt_find().
3195 */
3196const AVClass *avcodec_get_class(void);
3197
3198/**
3199 * Copy the settings of the source AVCodecContext into the destination
3200 * AVCodecContext. The resulting destination codec context will be
3201 * unopened, i.e. you are required to call avcodec_open2() before you
3202 * can use this AVCodecContext to decode/encode video/audio data.
3203 *
3204 * @param dest target codec context, should be initialized with
3205 * avcodec_alloc_context3(), but otherwise uninitialized
3206 * @param src source codec context
3207 * @return AVERROR() on error (e.g. memory allocation error), 0 on success
3208 */
3209int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3210
3211/**
3212 * Allocate an AVFrame and set its fields to default values. The resulting
3213 * struct can be deallocated by simply calling av_free().
3214 *
3215 * @return An AVFrame filled with default values or NULL on failure.
3216 * @see avcodec_get_frame_defaults
3217 */
3218AVFrame *avcodec_alloc_frame(void);
3219
3220/**
3221 * Set the fields of the given AVFrame to default values.
3222 *
3223 * @param pic The AVFrame of which the fields should be set to default values.
3224 */
3225void avcodec_get_frame_defaults(AVFrame *pic);
3226
3227/**
3228 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3229 * function the context has to be allocated with avcodec_alloc_context3().
3230 *
3231 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3232 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3233 * retrieving a codec.
3234 *
3235 * @warning This function is not thread safe!
3236 *
3237 * @code
3238 * avcodec_register_all();
3239 * av_dict_set(&opts, "b", "2.5M", 0);
104e10fb 3240 * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
294b3a50
AK
3241 * if (!codec)
3242 * exit(1);
3243 *
3244 * context = avcodec_alloc_context3(codec);
3245 *
3246 * if (avcodec_open2(context, codec, opts) < 0)
3247 * exit(1);
3248 * @endcode
3249 *
3250 * @param avctx The context to initialize.
3251 * @param codec The codec to open this context for. If a non-NULL codec has been
3252 * previously passed to avcodec_alloc_context3() or
3253 * avcodec_get_context_defaults3() for this context, then this
3254 * parameter MUST be either NULL or equal to the previously passed
3255 * codec.
3256 * @param options A dictionary filled with AVCodecContext and codec-private options.
3257 * On return this object will be filled with options that were not found.
3258 *
3259 * @return zero on success, a negative value on error
3260 * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
3261 * av_dict_set(), av_opt_find().
3262 */
3263int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
3264
3265/**
3266 * Close a given AVCodecContext and free all the data associated with it
3267 * (but not the AVCodecContext itself).
3268 *
3269 * Calling this function on an AVCodecContext that hasn't been opened will free
3270 * the codec-specific data allocated in avcodec_alloc_context3() /
3271 * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
3272 * do nothing.
3273 */
3274int avcodec_close(AVCodecContext *avctx);
3275
3276/**
3277 * Free all allocated data in the given subtitle struct.
3278 *
3279 * @param sub AVSubtitle to free.
3280 */
3281void avsubtitle_free(AVSubtitle *sub);
3282
3283/**
3284 * @}
3285 */
3286
30f3f625
AK
3287/**
3288 * @addtogroup lavc_packet
3289 * @{
3290 */
cdd8930e 3291
80d403fc
RD
3292/**
3293 * @deprecated use NULL instead
3294 */
3295attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
cdd8930e
TB
3296
3297/**
3298 * Default packet destructor.
3299 */
3300void av_destruct_packet(AVPacket *pkt);
3301
3302/**
3303 * Initialize optional fields of a packet with default values.
3304 *
7146177d
SE
3305 * Note, this does not touch the data and size members, which have to be
3306 * initialized separately.
3307 *
cdd8930e
TB
3308 * @param pkt packet
3309 */
3310void av_init_packet(AVPacket *pkt);
3311
3312/**
3313 * Allocate the payload of a packet and initialize its fields with
3314 * default values.
3315 *
3316 * @param pkt packet
3317 * @param size wanted payload size
3318 * @return 0 if OK, AVERROR_xxx otherwise
3319 */
3320int av_new_packet(AVPacket *pkt, int size);
3321
3322/**
feb993e5
RD
3323 * Reduce packet size, correctly zeroing padding
3324 *
3325 * @param pkt packet
3326 * @param size new size
3327 */
3328void av_shrink_packet(AVPacket *pkt, int size);
3329
3330/**
a08d918e
RD
3331 * Increase packet size, correctly zeroing padding
3332 *
3333 * @param pkt packet
3334 * @param grow_by number of bytes by which to increase the size of the packet
3335 */
3336int av_grow_packet(AVPacket *pkt, int grow_by);
3337
3338/**
cdd8930e
TB
3339 * @warning This is a hack - the packet memory allocation stuff is broken. The
3340 * packet is allocated if it was not really allocated.
3341 */
3342int av_dup_packet(AVPacket *pkt);
3343
3344/**
3345 * Free a packet.
3346 *
3347 * @param pkt packet to free
3348 */
ce1d9c85 3349void av_free_packet(AVPacket *pkt);
240c1657 3350
4de339e2
KS
3351/**
3352 * Allocate new information of a packet.
3353 *
3354 * @param pkt packet
3355 * @param type side information type
3356 * @param size side information size
3357 * @return pointer to fresh allocated data or NULL otherwise
3358 */
3359uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3360 int size);
3361
3362/**
442c1320
MS
3363 * Shrink the already allocated side data buffer
3364 *
3365 * @param pkt packet
3366 * @param type side information type
3367 * @param size new side information size
3368 * @return 0 on success, < 0 on failure
3369 */
3370int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3371 int size);
3372
3373/**
4de339e2
KS
3374 * Get side information from packet.
3375 *
3376 * @param pkt packet
3377 * @param type desired side information type
3378 * @param size pointer for side information size to store (optional)
3379 * @return pointer to data if present or NULL otherwise
3380 */
3381uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3382 int *size);
3383
30f3f625
AK
3384/**
3385 * @}
3386 */
3387
d1e3c6fd 3388/**
c8ef8464
AK
3389 * @addtogroup lavc_decoding
3390 * @{
d1e3c6fd 3391 */
938b6253
SS
3392
3393/**
c8ef8464 3394 * Find a registered decoder with a matching codec ID.
938b6253