Add Cineform HD Decoder
[libav.git] / libavcodec / avcodec.h
1 /*
2 * copyright (c) 2001 Fabrice Bellard
3 *
4 * This file is part of Libav.
5 *
6 * Libav is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * Libav is distributed in the hope that it will be useful,
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
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef AVCODEC_AVCODEC_H
22 #define AVCODEC_AVCODEC_H
23
24 /**
25 * @file
26 * @ingroup libavc
27 * Libavcodec external API header
28 */
29
30 #include <errno.h>
31 #include "libavutil/samplefmt.h"
32 #include "libavutil/attributes.h"
33 #include "libavutil/avutil.h"
34 #include "libavutil/buffer.h"
35 #include "libavutil/cpu.h"
36 #include "libavutil/dict.h"
37 #include "libavutil/frame.h"
38 #include "libavutil/log.h"
39 #include "libavutil/pixfmt.h"
40 #include "libavutil/rational.h"
41
42 #include "version.h"
43
44 #if FF_API_FAST_MALLOC
45 // to provide fast_*alloc
46 #include "libavutil/mem.h"
47 #endif
48
49 /**
50 * @defgroup libavc Encoding/Decoding Library
51 * @{
52 *
53 * @defgroup lavc_decoding Decoding
54 * @{
55 * @}
56 *
57 * @defgroup lavc_encoding Encoding
58 * @{
59 * @}
60 *
61 * @defgroup lavc_codec Codecs
62 * @{
63 * @defgroup lavc_codec_native Native Codecs
64 * @{
65 * @}
66 * @defgroup lavc_codec_wrappers External library wrappers
67 * @{
68 * @}
69 * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
70 * @{
71 * @}
72 * @}
73 * @defgroup lavc_internal Internal
74 * @{
75 * @}
76 * @}
77 */
78
79 /**
80 * @ingroup libavc
81 * @defgroup lavc_encdec send/receive encoding and decoding API overview
82 * @{
83 *
84 * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
85 * avcodec_receive_packet() functions provide an encode/decode API, which
86 * decouples input and output.
87 *
88 * The API is very similar for encoding/decoding and audio/video, and works as
89 * follows:
90 * - Set up and open the AVCodecContext as usual.
91 * - Send valid input:
92 * - For decoding, call avcodec_send_packet() to give the decoder raw
93 * compressed data in an AVPacket.
94 * - For encoding, call avcodec_send_frame() to give the decoder an AVFrame
95 * containing uncompressed audio or video.
96 * In both cases, it is recommended that AVPackets and AVFrames are
97 * refcounted, or libavcodec might have to copy the input data. (libavformat
98 * always returns refcounted AVPackets, and av_frame_get_buffer() allocates
99 * refcounted AVFrames.)
100 * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
101 * functions and process their output:
102 * - For decoding, call avcodec_receive_frame(). On success, it will return
103 * an AVFrame containing uncompressed audio or video data.
104 * - For encoding, call avcodec_receive_packet(). On success, it will return
105 * an AVPacket with a compressed frame.
106 * Repeat this call until it returns AVERROR(EAGAIN) or an error. The
107 * AVERROR(EAGAIN) return value means that new input data is required to
108 * return new output. In this case, continue with sending input. For each
109 * input frame/packet, the codec will typically return 1 output frame/packet,
110 * but it can also be 0 or more than 1.
111 *
112 * At the beginning of decoding or encoding, the codec might accept multiple
113 * input frames/packets without returning a frame, until its internal buffers
114 * are filled. This situation is handled transparently if you follow the steps
115 * outlined above.
116 *
117 * In theory, sending input can result in EAGAIN - this should happen only if
118 * not all output was received. You can use this to structure alternative decode
119 * or encode loops other than the one suggested above. For example, you could
120 * try sending new input on each iteration, and try to receive output if that
121 * returns EAGAIN.
122 *
123 * End of stream situations. These require "flushing" (aka draining) the codec,
124 * as the codec might buffer multiple frames or packets internally for
125 * performance or out of necessity (consider B-frames).
126 * This is handled as follows:
127 * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
128 * or avcodec_send_frame() (encoding) functions. This will enter draining
129 * mode.
130 * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
131 * (encoding) in a loop until AVERROR_EOF is returned. The functions will
132 * not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
133 * - Before decoding can be resumed again, the codec has to be reset with
134 * avcodec_flush_buffers().
135 *
136 * Using the API as outlined above is highly recommended. But it is also
137 * possible to call functions outside of this rigid schema. For example, you can
138 * call avcodec_send_packet() repeatedly without calling
139 * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
140 * until the codec's internal buffer has been filled up (which is typically of
141 * size 1 per output frame, after initial input), and then reject input with
142 * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
143 * read at least some output.
144 *
145 * Not all codecs will follow a rigid and predictable dataflow; the only
146 * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
147 * one end implies that a receive/send call on the other end will succeed. In
148 * general, no codec will permit unlimited buffering of input or output.
149 *
150 * This API replaces the following legacy functions:
151 * - avcodec_decode_video2() and avcodec_decode_audio4():
152 * Use avcodec_send_packet() to feed input to the decoder, then use
153 * avcodec_receive_frame() to receive decoded frames after each packet.
154 * Unlike with the old video decoding API, multiple frames might result from
155 * a packet. For audio, splitting the input packet into frames by partially
156 * decoding packets becomes transparent to the API user. You never need to
157 * feed an AVPacket to the API twice (unless it is rejected with EAGAIN - then
158 * no data was read from the packet).
159 * Additionally, sending a flush/draining packet is required only once.
160 * - avcodec_encode_video2()/avcodec_encode_audio2():
161 * Use avcodec_send_frame() to feed input to the encoder, then use
162 * avcodec_receive_packet() to receive encoded packets.
163 * Providing user-allocated buffers for avcodec_receive_packet() is not
164 * possible.
165 * - The new API does not handle subtitles yet.
166 *
167 * Mixing new and old function calls on the same AVCodecContext is not allowed,
168 * and will result in arbitrary behavior.
169 *
170 * Some codecs might require using the new API; using the old API will return
171 * an error when calling it. All codecs support the new API.
172 *
173 * A codec is not allowed to return EAGAIN for both sending and receiving. This
174 * would be an invalid state, which could put the codec user into an endless
175 * loop. The API has no concept of time either: it cannot happen that trying to
176 * do avcodec_send_packet() results in EAGAIN, but a repeated call 1 second
177 * later accepts the packet (with no other receive/flush API calls involved).
178 * The API is a strict state machine, and the passage of time is not supposed
179 * to influence it. Some timing-dependent behavior might still be deemed
180 * acceptable in certain cases. But it must never result in both send/receive
181 * returning EAGAIN at the same time at any point. It must also absolutely be
182 * avoided that the current state is "unstable" and can "flip-flop" between
183 * the send/receive APIs allowing progress. For example, it's not allowed that
184 * the codec randomly decides that it actually wants to consume a packet now
185 * instead of returning a frame, after it just returned EAGAIN on an
186 * avcodec_send_packet() call.
187 * @}
188 */
189
190 /**
191 * @defgroup lavc_core Core functions/structures.
192 * @ingroup libavc
193 *
194 * Basic definitions, functions for querying libavcodec capabilities,
195 * allocating core structures, etc.
196 * @{
197 */
198
199
200 /**
201 * Identify the syntax and semantics of the bitstream.
202 * The principle is roughly:
203 * Two decoders with the same ID can decode the same streams.
204 * Two encoders with the same ID can encode compatible streams.
205 * There may be slight deviations from the principle due to implementation
206 * details.
207 *
208 * If you add a codec ID to this list, add it so that
209 * 1. no value of a existing codec ID changes (that would break ABI),
210 * 2. it is as close as possible to similar codecs.
211 *
212 * After adding new codec IDs, do not forget to add an entry to the codec
213 * descriptor list and bump libavcodec minor version.
214 */
215 enum AVCodecID {
216 AV_CODEC_ID_NONE,
217
218 /* video codecs */
219 AV_CODEC_ID_MPEG1VIDEO,
220 AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
221 #if FF_API_XVMC
222 AV_CODEC_ID_MPEG2VIDEO_XVMC,
223 #endif /* FF_API_XVMC */
224 AV_CODEC_ID_H261,
225 AV_CODEC_ID_H263,
226 AV_CODEC_ID_RV10,
227 AV_CODEC_ID_RV20,
228 AV_CODEC_ID_MJPEG,
229 AV_CODEC_ID_MJPEGB,
230 AV_CODEC_ID_LJPEG,
231 AV_CODEC_ID_SP5X,
232 AV_CODEC_ID_JPEGLS,
233 AV_CODEC_ID_MPEG4,
234 AV_CODEC_ID_RAWVIDEO,
235 AV_CODEC_ID_MSMPEG4V1,
236 AV_CODEC_ID_MSMPEG4V2,
237 AV_CODEC_ID_MSMPEG4V3,
238 AV_CODEC_ID_WMV1,
239 AV_CODEC_ID_WMV2,
240 AV_CODEC_ID_H263P,
241 AV_CODEC_ID_H263I,
242 AV_CODEC_ID_FLV1,
243 AV_CODEC_ID_SVQ1,
244 AV_CODEC_ID_SVQ3,
245 AV_CODEC_ID_DVVIDEO,
246 AV_CODEC_ID_HUFFYUV,
247 AV_CODEC_ID_CYUV,
248 AV_CODEC_ID_H264,
249 AV_CODEC_ID_INDEO3,
250 AV_CODEC_ID_VP3,
251 AV_CODEC_ID_THEORA,
252 AV_CODEC_ID_ASV1,
253 AV_CODEC_ID_ASV2,
254 AV_CODEC_ID_FFV1,
255 AV_CODEC_ID_4XM,
256 AV_CODEC_ID_VCR1,
257 AV_CODEC_ID_CLJR,
258 AV_CODEC_ID_MDEC,
259 AV_CODEC_ID_ROQ,
260 AV_CODEC_ID_INTERPLAY_VIDEO,
261 AV_CODEC_ID_XAN_WC3,
262 AV_CODEC_ID_XAN_WC4,
263 AV_CODEC_ID_RPZA,
264 AV_CODEC_ID_CINEPAK,
265 AV_CODEC_ID_WS_VQA,
266 AV_CODEC_ID_MSRLE,
267 AV_CODEC_ID_MSVIDEO1,
268 AV_CODEC_ID_IDCIN,
269 AV_CODEC_ID_8BPS,
270 AV_CODEC_ID_SMC,
271 AV_CODEC_ID_FLIC,
272 AV_CODEC_ID_TRUEMOTION1,
273 AV_CODEC_ID_VMDVIDEO,
274 AV_CODEC_ID_MSZH,
275 AV_CODEC_ID_ZLIB,
276 AV_CODEC_ID_QTRLE,
277 AV_CODEC_ID_TSCC,
278 AV_CODEC_ID_ULTI,
279 AV_CODEC_ID_QDRAW,
280 AV_CODEC_ID_VIXL,
281 AV_CODEC_ID_QPEG,
282 AV_CODEC_ID_PNG,
283 AV_CODEC_ID_PPM,
284 AV_CODEC_ID_PBM,
285 AV_CODEC_ID_PGM,
286 AV_CODEC_ID_PGMYUV,
287 AV_CODEC_ID_PAM,
288 AV_CODEC_ID_FFVHUFF,
289 AV_CODEC_ID_RV30,
290 AV_CODEC_ID_RV40,
291 AV_CODEC_ID_VC1,
292 AV_CODEC_ID_WMV3,
293 AV_CODEC_ID_LOCO,
294 AV_CODEC_ID_WNV1,
295 AV_CODEC_ID_AASC,
296 AV_CODEC_ID_INDEO2,
297 AV_CODEC_ID_FRAPS,
298 AV_CODEC_ID_TRUEMOTION2,
299 AV_CODEC_ID_BMP,
300 AV_CODEC_ID_CSCD,
301 AV_CODEC_ID_MMVIDEO,
302 AV_CODEC_ID_ZMBV,
303 AV_CODEC_ID_AVS,
304 AV_CODEC_ID_SMACKVIDEO,
305 AV_CODEC_ID_NUV,
306 AV_CODEC_ID_KMVC,
307 AV_CODEC_ID_FLASHSV,
308 AV_CODEC_ID_CAVS,
309 AV_CODEC_ID_JPEG2000,
310 AV_CODEC_ID_VMNC,
311 AV_CODEC_ID_VP5,
312 AV_CODEC_ID_VP6,
313 AV_CODEC_ID_VP6F,
314 AV_CODEC_ID_TARGA,
315 AV_CODEC_ID_DSICINVIDEO,
316 AV_CODEC_ID_TIERTEXSEQVIDEO,
317 AV_CODEC_ID_TIFF,
318 AV_CODEC_ID_GIF,
319 AV_CODEC_ID_DXA,
320 AV_CODEC_ID_DNXHD,
321 AV_CODEC_ID_THP,
322 AV_CODEC_ID_SGI,
323 AV_CODEC_ID_C93,
324 AV_CODEC_ID_BETHSOFTVID,
325 AV_CODEC_ID_PTX,
326 AV_CODEC_ID_TXD,
327 AV_CODEC_ID_VP6A,
328 AV_CODEC_ID_AMV,
329 AV_CODEC_ID_VB,
330 AV_CODEC_ID_PCX,
331 AV_CODEC_ID_SUNRAST,
332 AV_CODEC_ID_INDEO4,
333 AV_CODEC_ID_INDEO5,
334 AV_CODEC_ID_MIMIC,
335 AV_CODEC_ID_RL2,
336 AV_CODEC_ID_ESCAPE124,
337 AV_CODEC_ID_DIRAC,
338 AV_CODEC_ID_BFI,
339 AV_CODEC_ID_CMV,
340 AV_CODEC_ID_MOTIONPIXELS,
341 AV_CODEC_ID_TGV,
342 AV_CODEC_ID_TGQ,
343 AV_CODEC_ID_TQI,
344 AV_CODEC_ID_AURA,
345 AV_CODEC_ID_AURA2,
346 AV_CODEC_ID_V210X,
347 AV_CODEC_ID_TMV,
348 AV_CODEC_ID_V210,
349 AV_CODEC_ID_DPX,
350 AV_CODEC_ID_MAD,
351 AV_CODEC_ID_FRWU,
352 AV_CODEC_ID_FLASHSV2,
353 AV_CODEC_ID_CDGRAPHICS,
354 AV_CODEC_ID_R210,
355 AV_CODEC_ID_ANM,
356 AV_CODEC_ID_BINKVIDEO,
357 AV_CODEC_ID_IFF_ILBM,
358 AV_CODEC_ID_IFF_BYTERUN1,
359 AV_CODEC_ID_KGV1,
360 AV_CODEC_ID_YOP,
361 AV_CODEC_ID_VP8,
362 AV_CODEC_ID_PICTOR,
363 AV_CODEC_ID_ANSI,
364 AV_CODEC_ID_A64_MULTI,
365 AV_CODEC_ID_A64_MULTI5,
366 AV_CODEC_ID_R10K,
367 AV_CODEC_ID_MXPEG,
368 AV_CODEC_ID_LAGARITH,
369 AV_CODEC_ID_PRORES,
370 AV_CODEC_ID_JV,
371 AV_CODEC_ID_DFA,
372 AV_CODEC_ID_WMV3IMAGE,
373 AV_CODEC_ID_VC1IMAGE,
374 AV_CODEC_ID_UTVIDEO,
375 AV_CODEC_ID_BMV_VIDEO,
376 AV_CODEC_ID_VBLE,
377 AV_CODEC_ID_DXTORY,
378 AV_CODEC_ID_V410,
379 AV_CODEC_ID_XWD,
380 AV_CODEC_ID_CDXL,
381 AV_CODEC_ID_XBM,
382 AV_CODEC_ID_ZEROCODEC,
383 AV_CODEC_ID_MSS1,
384 AV_CODEC_ID_MSA1,
385 AV_CODEC_ID_TSCC2,
386 AV_CODEC_ID_MTS2,
387 AV_CODEC_ID_CLLC,
388 AV_CODEC_ID_MSS2,
389 AV_CODEC_ID_VP9,
390 AV_CODEC_ID_AIC,
391 AV_CODEC_ID_ESCAPE130,
392 AV_CODEC_ID_G2M,
393 AV_CODEC_ID_WEBP,
394 AV_CODEC_ID_HNM4_VIDEO,
395 AV_CODEC_ID_HEVC,
396 AV_CODEC_ID_FIC,
397 AV_CODEC_ID_ALIAS_PIX,
398 AV_CODEC_ID_BRENDER_PIX,
399 AV_CODEC_ID_PAF_VIDEO,
400 AV_CODEC_ID_EXR,
401 AV_CODEC_ID_VP7,
402 AV_CODEC_ID_SANM,
403 AV_CODEC_ID_SGIRLE,
404 AV_CODEC_ID_MVC1,
405 AV_CODEC_ID_MVC2,
406 AV_CODEC_ID_HQX,
407 AV_CODEC_ID_TDSC,
408 AV_CODEC_ID_HQ_HQA,
409 AV_CODEC_ID_HAP,
410 AV_CODEC_ID_DDS,
411 AV_CODEC_ID_DXV,
412 AV_CODEC_ID_SCREENPRESSO,
413 AV_CODEC_ID_RSCC,
414 AV_CODEC_ID_MAGICYUV,
415 AV_CODEC_ID_TRUEMOTION2RT,
416 AV_CODEC_ID_AV1,
417 AV_CODEC_ID_PIXLET,
418 AV_CODEC_ID_CFHD,
419
420 /* various PCM "codecs" */
421 AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
422 AV_CODEC_ID_PCM_S16LE = 0x10000,
423 AV_CODEC_ID_PCM_S16BE,
424 AV_CODEC_ID_PCM_U16LE,
425 AV_CODEC_ID_PCM_U16BE,
426 AV_CODEC_ID_PCM_S8,
427 AV_CODEC_ID_PCM_U8,
428 AV_CODEC_ID_PCM_MULAW,
429 AV_CODEC_ID_PCM_ALAW,
430 AV_CODEC_ID_PCM_S32LE,
431 AV_CODEC_ID_PCM_S32BE,
432 AV_CODEC_ID_PCM_U32LE,
433 AV_CODEC_ID_PCM_U32BE,
434 AV_CODEC_ID_PCM_S24LE,
435 AV_CODEC_ID_PCM_S24BE,
436 AV_CODEC_ID_PCM_U24LE,
437 AV_CODEC_ID_PCM_U24BE,
438 AV_CODEC_ID_PCM_S24DAUD,
439 AV_CODEC_ID_PCM_ZORK,
440 AV_CODEC_ID_PCM_S16LE_PLANAR,
441 AV_CODEC_ID_PCM_DVD,
442 AV_CODEC_ID_PCM_F32BE,
443 AV_CODEC_ID_PCM_F32LE,
444 AV_CODEC_ID_PCM_F64BE,
445 AV_CODEC_ID_PCM_F64LE,
446 AV_CODEC_ID_PCM_BLURAY,
447 AV_CODEC_ID_PCM_LXF,
448 AV_CODEC_ID_S302M,
449 AV_CODEC_ID_PCM_S8_PLANAR,
450 AV_CODEC_ID_PCM_S24LE_PLANAR,
451 AV_CODEC_ID_PCM_S32LE_PLANAR,
452 AV_CODEC_ID_PCM_S16BE_PLANAR,
453
454 /* various ADPCM codecs */
455 AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
456 AV_CODEC_ID_ADPCM_IMA_WAV,
457 AV_CODEC_ID_ADPCM_IMA_DK3,
458 AV_CODEC_ID_ADPCM_IMA_DK4,
459 AV_CODEC_ID_ADPCM_IMA_WS,
460 AV_CODEC_ID_ADPCM_IMA_SMJPEG,
461 AV_CODEC_ID_ADPCM_MS,
462 AV_CODEC_ID_ADPCM_4XM,
463 AV_CODEC_ID_ADPCM_XA,
464 AV_CODEC_ID_ADPCM_ADX,
465 AV_CODEC_ID_ADPCM_EA,
466 AV_CODEC_ID_ADPCM_G726,
467 AV_CODEC_ID_ADPCM_CT,
468 AV_CODEC_ID_ADPCM_SWF,
469 AV_CODEC_ID_ADPCM_YAMAHA,
470 AV_CODEC_ID_ADPCM_SBPRO_4,
471 AV_CODEC_ID_ADPCM_SBPRO_3,
472 AV_CODEC_ID_ADPCM_SBPRO_2,
473 AV_CODEC_ID_ADPCM_THP,
474 AV_CODEC_ID_ADPCM_IMA_AMV,
475 AV_CODEC_ID_ADPCM_EA_R1,
476 AV_CODEC_ID_ADPCM_EA_R3,
477 AV_CODEC_ID_ADPCM_EA_R2,
478 AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
479 AV_CODEC_ID_ADPCM_IMA_EA_EACS,
480 AV_CODEC_ID_ADPCM_EA_XAS,
481 AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
482 AV_CODEC_ID_ADPCM_IMA_ISS,
483 AV_CODEC_ID_ADPCM_G722,
484 AV_CODEC_ID_ADPCM_IMA_APC,
485 AV_CODEC_ID_ADPCM_VIMA,
486
487 /* AMR */
488 AV_CODEC_ID_AMR_NB = 0x12000,
489 AV_CODEC_ID_AMR_WB,
490
491 /* RealAudio codecs*/
492 AV_CODEC_ID_RA_144 = 0x13000,
493 AV_CODEC_ID_RA_288,
494
495 /* various DPCM codecs */
496 AV_CODEC_ID_ROQ_DPCM = 0x14000,
497 AV_CODEC_ID_INTERPLAY_DPCM,
498 AV_CODEC_ID_XAN_DPCM,
499 AV_CODEC_ID_SOL_DPCM,
500
501 /* audio codecs */
502 AV_CODEC_ID_MP2 = 0x15000,
503 AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
504 AV_CODEC_ID_AAC,
505 AV_CODEC_ID_AC3,
506 AV_CODEC_ID_DTS,
507 AV_CODEC_ID_VORBIS,
508 AV_CODEC_ID_DVAUDIO,
509 AV_CODEC_ID_WMAV1,
510 AV_CODEC_ID_WMAV2,
511 AV_CODEC_ID_MACE3,
512 AV_CODEC_ID_MACE6,
513 AV_CODEC_ID_VMDAUDIO,
514 AV_CODEC_ID_FLAC,
515 AV_CODEC_ID_MP3ADU,
516 AV_CODEC_ID_MP3ON4,
517 AV_CODEC_ID_SHORTEN,
518 AV_CODEC_ID_ALAC,
519 AV_CODEC_ID_WESTWOOD_SND1,
520 AV_CODEC_ID_GSM, ///< as in Berlin toast format
521 AV_CODEC_ID_QDM2,
522 AV_CODEC_ID_COOK,
523 AV_CODEC_ID_TRUESPEECH,
524 AV_CODEC_ID_TTA,
525 AV_CODEC_ID_SMACKAUDIO,
526 AV_CODEC_ID_QCELP,
527 AV_CODEC_ID_WAVPACK,
528 AV_CODEC_ID_DSICINAUDIO,
529 AV_CODEC_ID_IMC,
530 AV_CODEC_ID_MUSEPACK7,
531 AV_CODEC_ID_MLP,
532 AV_CODEC_ID_GSM_MS, /* as found in WAV */
533 AV_CODEC_ID_ATRAC3,
534 #if FF_API_VOXWARE
535 AV_CODEC_ID_VOXWARE,
536 #endif
537 AV_CODEC_ID_APE,
538 AV_CODEC_ID_NELLYMOSER,
539 AV_CODEC_ID_MUSEPACK8,
540 AV_CODEC_ID_SPEEX,
541 AV_CODEC_ID_WMAVOICE,
542 AV_CODEC_ID_WMAPRO,
543 AV_CODEC_ID_WMALOSSLESS,
544 AV_CODEC_ID_ATRAC3P,
545 AV_CODEC_ID_EAC3,
546 AV_CODEC_ID_SIPR,
547 AV_CODEC_ID_MP1,
548 AV_CODEC_ID_TWINVQ,
549 AV_CODEC_ID_TRUEHD,
550 AV_CODEC_ID_MP4ALS,
551 AV_CODEC_ID_ATRAC1,
552 AV_CODEC_ID_BINKAUDIO_RDFT,
553 AV_CODEC_ID_BINKAUDIO_DCT,
554 AV_CODEC_ID_AAC_LATM,
555 AV_CODEC_ID_QDMC,
556 AV_CODEC_ID_CELT,
557 AV_CODEC_ID_G723_1,
558 AV_CODEC_ID_G729,
559 AV_CODEC_ID_8SVX_EXP,
560 AV_CODEC_ID_8SVX_FIB,
561 AV_CODEC_ID_BMV_AUDIO,
562 AV_CODEC_ID_RALF,
563 AV_CODEC_ID_IAC,
564 AV_CODEC_ID_ILBC,
565 AV_CODEC_ID_OPUS,
566 AV_CODEC_ID_COMFORT_NOISE,
567 AV_CODEC_ID_TAK,
568 AV_CODEC_ID_METASOUND,
569 AV_CODEC_ID_PAF_AUDIO,
570 AV_CODEC_ID_ON2AVC,
571 AV_CODEC_ID_DSS_SP,
572
573 /* subtitle codecs */
574 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
575 AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
576 AV_CODEC_ID_DVB_SUBTITLE,
577 AV_CODEC_ID_TEXT, ///< raw UTF-8 text
578 AV_CODEC_ID_XSUB,
579 AV_CODEC_ID_SSA,
580 AV_CODEC_ID_MOV_TEXT,
581 AV_CODEC_ID_HDMV_PGS_SUBTITLE,
582 AV_CODEC_ID_DVB_TELETEXT,
583 AV_CODEC_ID_SRT,
584
585 /* other specific kind of codecs (generally used for attachments) */
586 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
587 AV_CODEC_ID_TTF = 0x18000,
588
589 AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
590
591 AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
592 * stream (only used by libavformat) */
593 AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
594 * stream (only used by libavformat) */
595 AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
596 AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
597 };
598
599 /**
600 * This struct describes the properties of a single codec described by an
601 * AVCodecID.
602 * @see avcodec_descriptor_get()
603 */
604 typedef struct AVCodecDescriptor {
605 enum AVCodecID id;
606 enum AVMediaType type;
607 /**
608 * Name of the codec described by this descriptor. It is non-empty and
609 * unique for each codec descriptor. It should contain alphanumeric
610 * characters and '_' only.
611 */
612 const char *name;
613 /**
614 * A more descriptive name for this codec. May be NULL.
615 */
616 const char *long_name;
617 /**
618 * Codec properties, a combination of AV_CODEC_PROP_* flags.
619 */
620 int props;
621 /**
622 * If non-NULL, an array of profiles recognized for this codec.
623 * Terminated with FF_PROFILE_UNKNOWN.
624 */
625 const struct AVProfile *profiles;
626 } AVCodecDescriptor;
627
628 /**
629 * Codec uses only intra compression.
630 * Video codecs only.
631 */
632 #define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
633 /**
634 * Codec supports lossy compression. Audio and video codecs only.
635 * @note a codec may support both lossy and lossless
636 * compression modes
637 */
638 #define AV_CODEC_PROP_LOSSY (1 << 1)
639 /**
640 * Codec supports lossless compression. Audio and video codecs only.
641 */
642 #define AV_CODEC_PROP_LOSSLESS (1 << 2)
643 /**
644 * Codec supports frame reordering. That is, the coded order (the order in which
645 * the encoded packets are output by the encoders / stored / input to the
646 * decoders) may be different from the presentation order of the corresponding
647 * frames.
648 *
649 * For codecs that do not have this property set, PTS and DTS should always be
650 * equal.
651 */
652 #define AV_CODEC_PROP_REORDER (1 << 3)
653
654 /**
655 * @ingroup lavc_decoding
656 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
657 * This is mainly needed because some optimized bitstream readers read
658 * 32 or 64 bit at once and could read over the end.<br>
659 * Note: If the first 23 bits of the additional bytes are not 0, then damaged
660 * MPEG bitstreams could cause overread and segfault.
661 */
662 #define AV_INPUT_BUFFER_PADDING_SIZE 8
663
664 /**
665 * @ingroup lavc_encoding
666 * minimum encoding buffer size
667 * Used to avoid some checks during header writing.
668 */
669 #define AV_INPUT_BUFFER_MIN_SIZE 16384
670
671 #if FF_API_WITHOUT_PREFIX
672 /**
673 * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead
674 */
675 #define FF_INPUT_BUFFER_PADDING_SIZE 8
676
677 /**
678 * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead
679 */
680 #define FF_MIN_BUFFER_SIZE 16384
681 #endif /* FF_API_WITHOUT_PREFIX */
682
683 /**
684 * @ingroup lavc_encoding
685 * motion estimation type.
686 * @deprecated use codec private option instead
687 */
688 #if FF_API_MOTION_EST
689 enum Motion_Est_ID {
690 ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
691 ME_FULL,
692 ME_LOG,
693 ME_PHODS,
694 ME_EPZS, ///< enhanced predictive zonal search
695 ME_X1, ///< reserved for experiments
696 ME_HEX, ///< hexagon based search
697 ME_UMH, ///< uneven multi-hexagon search
698 ME_TESA, ///< transformed exhaustive search algorithm
699 };
700 #endif
701
702 /**
703 * @ingroup lavc_decoding
704 */
705 enum AVDiscard{
706 /* We leave some space between them for extensions (drop some
707 * keyframes for intra-only or drop just some bidir frames). */
708 AVDISCARD_NONE =-16, ///< discard nothing
709 AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
710 AVDISCARD_NONREF = 8, ///< discard all non reference
711 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
712 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
713 AVDISCARD_ALL = 48, ///< discard all
714 };
715
716 enum AVAudioServiceType {
717 AV_AUDIO_SERVICE_TYPE_MAIN = 0,
718 AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
719 AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
720 AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
721 AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
722 AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
723 AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
724 AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
725 AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
726 AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
727 };
728
729 /**
730 * @ingroup lavc_encoding
731 */
732 typedef struct RcOverride{
733 int start_frame;
734 int end_frame;
735 int qscale; // If this is 0 then quality_factor will be used instead.
736 float quality_factor;
737 } RcOverride;
738
739 #if FF_API_MAX_BFRAMES
740 /**
741 * @deprecated there is no libavcodec-wide limit on the number of B-frames
742 */
743 #define FF_MAX_B_FRAMES 16
744 #endif
745
746 /* encoding support
747 These flags can be passed in AVCodecContext.flags before initialization.
748 Note: Not everything is supported yet.
749 */
750
751 /**
752 * Allow decoders to produce frames with data planes that are not aligned
753 * to CPU requirements (e.g. due to cropping).
754 */
755 #define AV_CODEC_FLAG_UNALIGNED (1 << 0)
756 /**
757 * Use fixed qscale.
758 */
759 #define AV_CODEC_FLAG_QSCALE (1 << 1)
760 /**
761 * 4 MV per MB allowed / advanced prediction for H.263.
762 */
763 #define AV_CODEC_FLAG_4MV (1 << 2)
764 /**
765 * Output even those frames that might be corrupted.
766 */
767 #define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)
768 /**
769 * Use qpel MC.
770 */
771 #define AV_CODEC_FLAG_QPEL (1 << 4)
772 /**
773 * Use internal 2pass ratecontrol in first pass mode.
774 */
775 #define AV_CODEC_FLAG_PASS1 (1 << 9)
776 /**
777 * Use internal 2pass ratecontrol in second pass mode.
778 */
779 #define AV_CODEC_FLAG_PASS2 (1 << 10)
780 /**
781 * loop filter.
782 */
783 #define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)
784 /**
785 * Only decode/encode grayscale.
786 */
787 #define AV_CODEC_FLAG_GRAY (1 << 13)
788 /**
789 * error[?] variables will be set during encoding.
790 */
791 #define AV_CODEC_FLAG_PSNR (1 << 15)
792 /**
793 * Input bitstream might be truncated at a random location
794 * instead of only at frame boundaries.
795 */
796 #define AV_CODEC_FLAG_TRUNCATED (1 << 16)
797 /**
798 * Use interlaced DCT.
799 */
800 #define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)
801 /**
802 * Force low delay.
803 */
804 #define AV_CODEC_FLAG_LOW_DELAY (1 << 19)
805 /**
806 * Place global headers in extradata instead of every keyframe.
807 */
808 #define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
809 /**
810 * Use only bitexact stuff (except (I)DCT).
811 */
812 #define AV_CODEC_FLAG_BITEXACT (1 << 23)
813 /* Fx : Flag for H.263+ extra options */
814 /**
815 * H.263 advanced intra coding / MPEG-4 AC prediction
816 */
817 #define AV_CODEC_FLAG_AC_PRED (1 << 24)
818 /**
819 * interlaced motion estimation
820 */
821 #define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)
822 #define AV_CODEC_FLAG_CLOSED_GOP (1 << 31)
823
824 /**
825 * Allow non spec compliant speedup tricks.
826 */
827 #define AV_CODEC_FLAG2_FAST (1 << 0)
828 /**
829 * Skip bitstream encoding.
830 */
831 #define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)
832 /**
833 * Place global headers at every keyframe instead of in extradata.
834 */
835 #define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
836 /**
837 * Input bitstream might be truncated at a packet boundaries
838 * instead of only at frame boundaries.
839 */
840 #define AV_CODEC_FLAG2_CHUNKS (1 << 15)
841 /**
842 * Discard cropping information from SPS.
843 */
844 #define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)
845
846 /* Unsupported options :
847 * Syntax Arithmetic coding (SAC)
848 * Reference Picture Selection
849 * Independent Segment Decoding */
850 /* /Fx */
851 /* codec capabilities */
852
853 /**
854 * Decoder can use draw_horiz_band callback.
855 */
856 #define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
857 /**
858 * Codec uses get_buffer() for allocating buffers and supports custom allocators.
859 * If not set, it might not use get_buffer() at all or use operations that
860 * assume the buffer was allocated by avcodec_default_get_buffer.
861 */
862 #define AV_CODEC_CAP_DR1 (1 << 1)
863 #define AV_CODEC_CAP_TRUNCATED (1 << 3)
864 /**
865 * Encoder or decoder requires flushing with NULL input at the end in order to
866 * give the complete and correct output.
867 *
868 * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
869 * with NULL data. The user can still send NULL data to the public encode
870 * or decode function, but libavcodec will not pass it along to the codec
871 * unless this flag is set.
872 *
873 * Decoders:
874 * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
875 * avpkt->size=0 at the end to get the delayed data until the decoder no longer
876 * returns frames.
877 *
878 * Encoders:
879 * The encoder needs to be fed with NULL data at the end of encoding until the
880 * encoder no longer returns data.
881 *
882 * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
883 * flag also means that the encoder must set the pts and duration for
884 * each output packet. If this flag is not set, the pts and duration will
885 * be determined by libavcodec from the input frame.
886 */
887 #define AV_CODEC_CAP_DELAY (1 << 5)
888 /**
889 * Codec can be fed a final frame with a smaller size.
890 * This can be used to prevent truncation of the last audio samples.
891 */
892 #define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
893 /**
894 * Codec can output multiple frames per AVPacket
895 * Normally demuxers return one frame at a time, demuxers which do not do
896 * are connected to a parser to split what they return into proper frames.
897 * This flag is reserved to the very rare category of codecs which have a
898 * bitstream that cannot be split into frames without timeconsuming
899 * operations like full decoding. Demuxers carrying such bitstreams thus
900 * may return multiple frames in a packet. This has many disadvantages like
901 * prohibiting stream copy in many cases thus it should only be considered
902 * as a last resort.
903 */
904 #define AV_CODEC_CAP_SUBFRAMES (1 << 8)
905 /**
906 * Codec is experimental and is thus avoided in favor of non experimental
907 * encoders
908 */
909 #define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
910 /**
911 * Codec should fill in channel configuration and samplerate instead of container
912 */
913 #define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
914 /**
915 * Codec supports frame-level multithreading.
916 */
917 #define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
918 /**
919 * Codec supports slice-based (or partition-based) multithreading.
920 */
921 #define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
922 /**
923 * Codec supports changed parameters at any point.
924 */
925 #define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
926 /**
927 * Codec supports avctx->thread_count == 0 (auto).
928 */
929 #define AV_CODEC_CAP_AUTO_THREADS (1 << 15)
930 /**
931 * Audio encoder supports receiving a different number of samples in each call.
932 */
933 #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
934
935 #if FF_API_WITHOUT_PREFIX
936 /**
937 * Allow decoders to produce frames with data planes that are not aligned
938 * to CPU requirements (e.g. due to cropping).
939 */
940 #define CODEC_FLAG_UNALIGNED 0x0001
941 #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
942 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
943 #define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted
944 #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
945 #if FF_API_GMC
946 /**
947 * @deprecated use the "gmc" private option of the libxvid encoder
948 */
949 #define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
950 #endif
951 #if FF_API_MV0
952 /**
953 * @deprecated use the flag "mv0" in the "mpv_flags" private option of the
954 * mpegvideo encoders
955 */
956 #define CODEC_FLAG_MV0 0x0040
957 #endif
958 #if FF_API_INPUT_PRESERVED
959 /**
960 * @deprecated passing reference-counted frames to the encoders replaces this
961 * flag
962 */
963 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
964 #endif
965 #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
966 #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
967 #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
968 #if FF_API_EMU_EDGE
969 /**
970 * @deprecated edges are not used/required anymore. I.e. this flag is now always
971 * set.
972 */
973 #define CODEC_FLAG_EMU_EDGE 0x4000
974 #endif
975 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
976 #define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
977 location instead of only at frame boundaries. */
978 #if FF_API_NORMALIZE_AQP
979 /**
980 * @deprecated use the flag "naq" in the "mpv_flags" private option of the
981 * mpegvideo encoders
982 */
983 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000
984 #endif
985 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
986 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
987 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
988 #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
989 /* Fx : Flag for H.263+ extra options */
990 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
991 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
992 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
993 #define CODEC_FLAG_CLOSED_GOP 0x80000000
994 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
995 #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
996 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
997 #define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS.
998
999 #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
1000
1001 /* Unsupported options :
1002 * Syntax Arithmetic coding (SAC)
1003 * Reference Picture Selection
1004 * Independent Segment Decoding */
1005 /* /Fx */
1006 /* codec capabilities */
1007
1008 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
1009 /**
1010 * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1011 * If not set, it might not use get_buffer() at all or use operations that
1012 * assume the buffer was allocated by avcodec_default_get_buffer.
1013 */
1014 #define CODEC_CAP_DR1 0x0002
1015 #define CODEC_CAP_TRUNCATED 0x0008
1016 #if FF_API_XVMC
1017 /* Codec can export data for HW decoding (XvMC). */
1018 #define CODEC_CAP_HWACCEL 0x0010
1019 #endif /* FF_API_XVMC */
1020 /**
1021 * Encoder or decoder requires flushing with NULL input at the end in order to
1022 * give the complete and correct output.
1023 *
1024 * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1025 * with NULL data. The user can still send NULL data to the public encode
1026 * or decode function, but libavcodec will not pass it along to the codec
1027 * unless this flag is set.
1028 *
1029 * Decoders:
1030 * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1031 * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1032 * returns frames.
1033 *
1034 * Encoders:
1035 * The encoder needs to be fed with NULL data at the end of encoding until the
1036 * encoder no longer returns data.
1037 *
1038 * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1039 * flag also means that the encoder must set the pts and duration for
1040 * each output packet. If this flag is not set, the pts and duration will
1041 * be determined by libavcodec from the input frame.
1042 */
1043 #define CODEC_CAP_DELAY 0x0020
1044 /**
1045 * Codec can be fed a final frame with a smaller size.
1046 * This can be used to prevent truncation of the last audio samples.
1047 */
1048 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
1049 #if FF_API_CAP_VDPAU
1050 /**
1051 * Codec can export data for HW decoding (VDPAU).
1052 */
1053 #define CODEC_CAP_HWACCEL_VDPAU 0x0080
1054 #endif
1055 /**
1056 * Codec can output multiple frames per AVPacket
1057 * Normally demuxers return one frame at a time, demuxers which do not do
1058 * are connected to a parser to split what they return into proper frames.
1059 * This flag is reserved to the very rare category of codecs which have a
1060 * bitstream that cannot be split into frames without timeconsuming
1061 * operations like full decoding. Demuxers carrying such bitstreams thus
1062 * may return multiple frames in a packet. This has many disadvantages like
1063 * prohibiting stream copy in many cases thus it should only be considered
1064 * as a last resort.
1065 */
1066 #define CODEC_CAP_SUBFRAMES 0x0100
1067 /**
1068 * Codec is experimental and is thus avoided in favor of non experimental
1069 * encoders
1070 */
1071 #define CODEC_CAP_EXPERIMENTAL 0x0200
1072 /**
1073 * Codec should fill in channel configuration and samplerate instead of container
1074 */
1075 #define CODEC_CAP_CHANNEL_CONF 0x0400
1076 #if FF_API_NEG_LINESIZES
1077 /**
1078 * @deprecated no codecs use this capability
1079 */
1080 #define CODEC_CAP_NEG_LINESIZES 0x0800
1081 #endif
1082 /**
1083 * Codec supports frame-level multithreading.
1084 */
1085 #define CODEC_CAP_FRAME_THREADS 0x1000
1086 /**
1087 * Codec supports slice-based (or partition-based) multithreading.
1088 */
1089 #define CODEC_CAP_SLICE_THREADS 0x2000
1090 /**
1091 * Codec supports changed parameters at any point.
1092 */
1093 #define CODEC_CAP_PARAM_CHANGE 0x4000
1094 /**
1095 * Codec supports avctx->thread_count == 0 (auto).
1096 */
1097 #define CODEC_CAP_AUTO_THREADS 0x8000
1098 /**
1099 * Audio encoder supports receiving a different number of samples in each call.
1100 */
1101 #define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
1102 #endif /* FF_API_WITHOUT_PREFIX */
1103
1104 #if FF_API_MB_TYPE
1105 //The following defines may change, don't expect compatibility if you use them.
1106 #define MB_TYPE_INTRA4x4 0x0001
1107 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
1108 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
1109 #define MB_TYPE_16x16 0x0008
1110 #define MB_TYPE_16x8 0x0010
1111 #define MB_TYPE_8x16 0x0020
1112 #define MB_TYPE_8x8 0x0040
1113 #define MB_TYPE_INTERLACED 0x0080
1114 #define MB_TYPE_DIRECT2 0x0100 //FIXME
1115 #define MB_TYPE_ACPRED 0x0200
1116 #define MB_TYPE_GMC 0x0400
1117 #define MB_TYPE_SKIP 0x0800
1118 #define MB_TYPE_P0L0 0x1000
1119 #define MB_TYPE_P1L0 0x2000
1120 #define MB_TYPE_P0L1 0x4000
1121 #define MB_TYPE_P1L1 0x8000
1122 #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
1123 #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
1124 #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
1125 #define MB_TYPE_QUANT 0x00010000
1126 #define MB_TYPE_CBP 0x00020000
1127 // Note bits 24-31 are reserved for codec specific use (H.264 ref0, MPEG-1 0mv, ...)
1128 #endif
1129
1130 /**
1131 * Pan Scan area.
1132 * This specifies the area which should be displayed.
1133 * Note there may be multiple such areas for one frame.
1134 */
1135 typedef struct AVPanScan{
1136 /**
1137 * id
1138 * - encoding: Set by user.
1139 * - decoding: Set by libavcodec.
1140 */
1141 int id;
1142
1143 /**
1144 * width and height in 1/16 pel
1145 * - encoding: Set by user.
1146 * - decoding: Set by libavcodec.
1147 */
1148 int width;
1149 int height;
1150
1151 /**
1152 * position of the top left corner in 1/16 pel for up to 3 fields/frames
1153 * - encoding: Set by user.
1154 * - decoding: Set by libavcodec.
1155 */
1156 int16_t position[3][2];
1157 }AVPanScan;
1158
1159 /**
1160 * This structure describes the bitrate properties of an encoded bitstream. It
1161 * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1162 * parameters for H.264/HEVC.
1163 */
1164 typedef struct AVCPBProperties {
1165 /**
1166 * Maximum bitrate of the stream, in bits per second.
1167 * Zero if unknown or unspecified.
1168 */
1169 int max_bitrate;
1170 /**
1171 * Minimum bitrate of the stream, in bits per second.
1172 * Zero if unknown or unspecified.
1173 */
1174 int min_bitrate;
1175 /**
1176 * Average bitrate of the stream, in bits per second.
1177 * Zero if unknown or unspecified.
1178 */
1179 int avg_bitrate;
1180
1181 /**
1182 * The size of the buffer to which the ratecontrol is applied, in bits.
1183 * Zero if unknown or unspecified.
1184 */
1185 int buffer_size;
1186
1187 /**
1188 * The delay between the time the packet this structure is associated with
1189 * is received and the time when it should be decoded, in periods of a 27MHz
1190 * clock.
1191 *
1192 * UINT64_MAX when unknown or unspecified.
1193 */
1194 uint64_t vbv_delay;
1195 } AVCPBProperties;
1196
1197 #if FF_API_QSCALE_TYPE
1198 #define FF_QSCALE_TYPE_MPEG1 0
1199 #define FF_QSCALE_TYPE_MPEG2 1
1200 #define FF_QSCALE_TYPE_H264 2
1201 #define FF_QSCALE_TYPE_VP56 3
1202 #endif
1203
1204 /**
1205 * The decoder will keep a reference to the frame and may reuse it later.
1206 */
1207 #define AV_GET_BUFFER_FLAG_REF (1 << 0)
1208
1209 /**
1210 * @defgroup lavc_packet AVPacket
1211 *
1212 * Types and functions for working with AVPacket.
1213 * @{
1214 */
1215 enum AVPacketSideDataType {
1216 /**
1217 * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1218 * bytes worth of palette. This side data signals that a new palette is
1219 * present.
1220 */
1221 AV_PKT_DATA_PALETTE,
1222
1223 /**
1224 * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1225 * that the extradata buffer was changed and the receiving side should
1226 * act upon it appropriately. The new extradata is embedded in the side
1227 * data buffer and should be immediately used for processing the current
1228 * frame or packet.
1229 */
1230 AV_PKT_DATA_NEW_EXTRADATA,
1231
1232 /**
1233 * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1234 * @code
1235 * u32le param_flags
1236 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1237 * s32le channel_count
1238 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1239 * u64le channel_layout
1240 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1241 * s32le sample_rate
1242 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1243 * s32le width
1244 * s32le height
1245 * @endcode
1246 */
1247 AV_PKT_DATA_PARAM_CHANGE,
1248
1249 /**
1250 * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1251 * structures with info about macroblocks relevant to splitting the
1252 * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1253 * That is, it does not necessarily contain info about all macroblocks,
1254 * as long as the distance between macroblocks in the info is smaller
1255 * than the target payload size.
1256 * Each MB info structure is 12 bytes, and is laid out as follows:
1257 * @code
1258 * u32le bit offset from the start of the packet
1259 * u8 current quantizer at the start of the macroblock
1260 * u8 GOB number
1261 * u16le macroblock address within the GOB
1262 * u8 horizontal MV predictor
1263 * u8 vertical MV predictor
1264 * u8 horizontal MV predictor for block number 3
1265 * u8 vertical MV predictor for block number 3
1266 * @endcode
1267 */
1268 AV_PKT_DATA_H263_MB_INFO,
1269
1270 /**
1271 * This side data should be associated with an audio stream and contains
1272 * ReplayGain information in form of the AVReplayGain struct.
1273 */
1274 AV_PKT_DATA_REPLAYGAIN,
1275
1276 /**
1277 * This side data contains a 3x3 transformation matrix describing an affine
1278 * transformation that needs to be applied to the decoded video frames for
1279 * correct presentation.
1280 *
1281 * See libavutil/display.h for a detailed description of the data.
1282 */
1283 AV_PKT_DATA_DISPLAYMATRIX,
1284
1285 /**
1286 * This side data should be associated with a video stream and contains
1287 * Stereoscopic 3D information in form of the AVStereo3D struct.
1288 */
1289 AV_PKT_DATA_STEREO3D,
1290
1291 /**
1292 * This side data should be associated with an audio stream and corresponds
1293 * to enum AVAudioServiceType.
1294 */
1295 AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1296
1297 /**
1298 * This side data contains an integer value representing the quality
1299 * factor of the compressed frame. Allowed range is between 1 (good)
1300 * and FF_LAMBDA_MAX (bad).
1301 */
1302 AV_PKT_DATA_QUALITY_FACTOR,
1303
1304 /**
1305 * This side data contains an integer value representing the stream index
1306 * of a "fallback" track. A fallback track indicates an alternate
1307 * track to use when the current track can not be decoded for some reason.
1308 * e.g. no decoder available for codec.
1309 */
1310 AV_PKT_DATA_FALLBACK_TRACK,
1311
1312 /**
1313 * This side data corresponds to the AVCPBProperties struct.
1314 */
1315 AV_PKT_DATA_CPB_PROPERTIES,
1316
1317 /**
1318 * This side data should be associated with a video stream and corresponds
1319 * to the AVSphericalMapping structure.
1320 */
1321 AV_PKT_DATA_SPHERICAL,
1322 };
1323
1324 typedef struct AVPacketSideData {
1325 uint8_t *data;
1326 int size;
1327 enum AVPacketSideDataType type;
1328 } AVPacketSideData;
1329
1330 /**
1331 * This structure stores compressed data. It is typically exported by demuxers
1332 * and then passed as input to decoders, or received as output from encoders and
1333 * then passed to muxers.
1334 *
1335 * For video, it should typically contain one compressed frame. For audio it may
1336 * contain several compressed frames. Encoders are allowed to output empty
1337 * packets, with no compressed data, containing only side data
1338 * (e.g. to update some stream parameters at the end of encoding).
1339 *
1340 * AVPacket is one of the few structs in Libav, whose size is a part of public
1341 * ABI. Thus it may be allocated on stack and no new fields can be added to it
1342 * without libavcodec and libavformat major bump.
1343 *
1344 * The semantics of data ownership depends on the buf field.
1345 * If it is set, the packet data is dynamically allocated and is
1346 * valid indefinitely until a call to av_packet_unref() reduces the
1347 * reference count to 0.
1348 *
1349 * If the buf field is not set av_packet_ref() would make a copy instead
1350 * of increasing the reference count.
1351 *
1352 * The side data is always allocated with av_malloc(), copied by
1353 * av_packet_ref() and freed by av_packet_unref().
1354 *
1355 * @see av_packet_ref
1356 * @see av_packet_unref
1357 */
1358 typedef struct AVPacket {
1359 /**
1360 * A reference to the reference-counted buffer where the packet data is
1361 * stored.
1362 * May be NULL, then the packet data is not reference-counted.
1363 */
1364 AVBufferRef *buf;
1365 /**
1366 * Presentation timestamp in AVStream->time_base units; the time at which
1367 * the decompressed packet will be presented to the user.
1368 * Can be AV_NOPTS_VALUE if it is not stored in the file.
1369 * pts MUST be larger or equal to dts as presentation cannot happen before
1370 * decompression, unless one wants to view hex dumps. Some formats misuse
1371 * the terms dts and pts/cts to mean something different. Such timestamps
1372 * must be converted to true pts/dts before they are stored in AVPacket.
1373 */
1374 int64_t pts;
1375 /**
1376 * Decompression timestamp in AVStream->time_base units; the time at which
1377 * the packet is decompressed.
1378 * Can be AV_NOPTS_VALUE if it is not stored in the file.
1379 */
1380 int64_t dts;
1381 uint8_t *data;
1382 int size;
1383 int stream_index;
1384 /**
1385 * A combination of AV_PKT_FLAG values
1386 */
1387 int flags;
1388 /**
1389 * Additional packet data that can be provided by the container.
1390 * Packet can contain several types of side information.
1391 */
1392 AVPacketSideData *side_data;
1393 int side_data_elems;
1394
1395 /**
1396 * Duration of this packet in AVStream->time_base units, 0 if unknown.
1397 * Equals next_pts - this_pts in presentation order.
1398 */
1399 int64_t duration;
1400
1401 int64_t pos; ///< byte position in stream, -1 if unknown
1402
1403 #if FF_API_CONVERGENCE_DURATION
1404 /**
1405 * @deprecated Same as the duration field, but as int64_t. This was required
1406 * for Matroska subtitles, whose duration values could overflow when the
1407 * duration field was still an int.
1408 */
1409 attribute_deprecated
1410 int64_t convergence_duration;
1411 #endif
1412 } AVPacket;
1413 #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
1414 #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
1415
1416 enum AVSideDataParamChangeFlags {
1417 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
1418 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
1419 AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
1420 AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
1421 };
1422 /**
1423 * @}
1424 */
1425
1426 struct AVCodecInternal;
1427
1428 enum AVFieldOrder {
1429 AV_FIELD_UNKNOWN,
1430 AV_FIELD_PROGRESSIVE,
1431 AV_FIELD_TT, //< Top coded_first, top displayed first
1432 AV_FIELD_BB, //< Bottom coded first, bottom displayed first
1433 AV_FIELD_TB, //< Top coded first, bottom displayed first
1434 AV_FIELD_BT, //< Bottom coded first, top displayed first
1435 };
1436
1437 /**
1438 * main external API structure.
1439 * New fields can be added to the end with minor version bumps.
1440 * Removal, reordering and changes to existing fields require a major
1441 * version bump.
1442 * sizeof(AVCodecContext) must not be used outside libav*.
1443 */
1444 typedef struct AVCodecContext {
1445 /**
1446 * information on struct for av_log
1447 * - set by avcodec_alloc_context3
1448 */
1449 const AVClass *av_class;
1450 int log_level_offset;
1451
1452 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1453 const struct AVCodec *codec;
1454 #if FF_API_CODEC_NAME
1455 /**
1456 * @deprecated this field is not used for anything in libavcodec
1457 */
1458 attribute_deprecated
1459 char codec_name[32];
1460 #endif
1461 enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
1462
1463 /**
1464 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1465 * This is used to work around some encoder bugs.
1466 * A demuxer should set this to what is stored in the field used to identify the codec.
1467 * If there are multiple such fields in a container then the demuxer should choose the one
1468 * which maximizes the information about the used codec.
1469 * If the codec tag field in a container is larger than 32 bits then the demuxer should
1470 * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1471 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1472 * first.
1473 * - encoding: Set by user, if not then the default based on codec_id will be used.
1474 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1475 */
1476 unsigned int codec_tag;
1477
1478 #if FF_API_STREAM_CODEC_TAG
1479 /**
1480 * @deprecated this field is unused
1481 */
1482 attribute_deprecated
1483 unsigned int stream_codec_tag;
1484 #endif
1485
1486 void *priv_data;
1487
1488 /**
1489 * Private context used for internal data.
1490 *
1491 * Unlike priv_data, this is not codec-specific. It is used in general
1492 * libavcodec functions.
1493 */
1494 struct AVCodecInternal *internal;
1495
1496 /**
1497 * Private data of the user, can be used to carry app specific stuff.
1498 * - encoding: Set by user.
1499 * - decoding: Set by user.
1500 */
1501 void *opaque;
1502
1503 /**
1504 * the average bitrate
1505 * - encoding: Set by user; unused for constant quantizer encoding.
1506 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
1507 */
1508 int bit_rate;
1509
1510 /**
1511 * number of bits the bitstream is allowed to diverge from the reference.
1512 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
1513 * - encoding: Set by user; unused for constant quantizer encoding.
1514 * - decoding: unused
1515 */
1516 int bit_rate_tolerance;
1517
1518 /**
1519 * Global quality for codecs which cannot change it per frame.
1520 * This should be proportional to MPEG-1/2/4 qscale.
1521 * - encoding: Set by user.
1522 * - decoding: unused
1523 */
1524 int global_quality;
1525
1526 /**
1527 * - encoding: Set by user.
1528 * - decoding: unused
1529 */
1530 int compression_level;
1531 #define FF_COMPRESSION_DEFAULT -1
1532
1533 /**
1534 * AV_CODEC_FLAG_*.
1535 * - encoding: Set by user.
1536 * - decoding: Set by user.
1537 */
1538 int flags;
1539
1540 /**
1541 * AV_CODEC_FLAG2_*
1542 * - encoding: Set by user.
1543 * - decoding: Set by user.
1544 */
1545 int flags2;
1546
1547 /**
1548 * some codecs need / can use extradata like Huffman tables.
1549 * MJPEG: Huffman tables
1550 * rv10: additional flags
1551 * MPEG-4: global headers (they can be in the bitstream or here)
1552 * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
1553 * than extradata_size to avoid problems if it is read with the bitstream reader.
1554 * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1555 * - encoding: Set/allocated/freed by libavcodec.
1556 * - decoding: Set/allocated/freed by user.
1557 */
1558 uint8_t *extradata;
1559 int extradata_size;
1560
1561 /**
1562 * This is the fundamental unit of time (in seconds) in terms
1563 * of which frame timestamps are represented. For fixed-fps content,
1564 * timebase should be 1/framerate and timestamp increments should be
1565 * identically 1.
1566 * - encoding: MUST be set by user.
1567 * - decoding: the use of this field for decoding is deprecated.
1568 * Use framerate instead.
1569 */
1570 AVRational time_base;
1571
1572 /**
1573 * For some codecs, the time base is closer to the field rate than the frame rate.
1574 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
1575 * if no telecine is used ...
1576 *
1577 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
1578 */
1579 int ticks_per_frame;
1580
1581 /**
1582 * Codec delay.
1583 *
1584 * Video:
1585 * Number of frames the decoded output will be delayed relative to the
1586 * encoded input.
1587 *
1588 * Audio:
1589 * For encoding, this field is unused (see initial_padding).
1590 *
1591 * For decoding, this is the number of samples the decoder needs to
1592 * output before the decoder's output is valid. When seeking, you should
1593 * start decoding this many samples prior to your desired seek point.
1594 *
1595 * - encoding: Set by libavcodec.
1596 * - decoding: Set by libavcodec.
1597 */
1598 int delay;
1599
1600
1601 /* video only */
1602 /**
1603 * picture width / height.
1604 *
1605 * @note Those fields may not match the values of the last
1606 * AVFrame output by avcodec_decode_video2 due frame
1607 * reordering.
1608 *
1609 * - encoding: MUST be set by user.
1610 * - decoding: May be set by the user before opening the decoder if known e.g.
1611 * from the container. Some decoders will require the dimensions
1612 * to be set by the caller. During decoding, the decoder may
1613 * overwrite those values as required while parsing the data.
1614 */
1615 int width, height;
1616
1617 /**
1618 * Bitstream width / height, may be different from width/height e.g. when
1619 * the decoded frame is cropped before being output.
1620 *
1621 * @note Those field may not match the value of the last
1622 * AVFrame output by avcodec_receive_frame() due frame
1623 * reordering.
1624 *
1625 * - encoding: unused
1626 * - decoding: May be set by the user before opening the decoder if known
1627 * e.g. from the container. During decoding, the decoder may
1628 * overwrite those values as required while parsing the data.
1629 */
1630 int coded_width, coded_height;
1631
1632 #if FF_API_ASPECT_EXTENDED
1633 #define FF_ASPECT_EXTENDED 15
1634 #endif
1635
1636 /**
1637 * the number of pictures in a group of pictures, or 0 for intra_only
1638 * - encoding: Set by user.
1639 * - decoding: unused
1640 */
1641 int gop_size;
1642
1643 /**
1644 * Pixel format, see AV_PIX_FMT_xxx.
1645 * May be set by the demuxer if known from headers.
1646 * May be overridden by the decoder if it knows better.
1647 *
1648 * @note This field may not match the value of the last
1649 * AVFrame output by avcodec_receive_frame() due frame
1650 * reordering.
1651 *
1652 * - encoding: Set by user.
1653 * - decoding: Set by user if known, overridden by libavcodec while
1654 * parsing the data.
1655 */
1656 enum AVPixelFormat pix_fmt;
1657
1658 #if FF_API_MOTION_EST
1659 /**
1660 * This option does nothing
1661 * @deprecated use codec private options instead
1662 */
1663 attribute_deprecated int me_method;
1664 #endif
1665
1666 /**
1667 * If non NULL, 'draw_horiz_band' is called by the libavcodec
1668 * decoder to draw a horizontal band. It improves cache usage. Not
1669 * all codecs can do that. You must check the codec capabilities
1670 * beforehand.
1671 * When multithreading is used, it may be called from multiple threads
1672 * at the same time; threads might draw different parts of the same AVFrame,
1673 * or multiple AVFrames, and there is no guarantee that slices will be drawn
1674 * in order.
1675 * The function is also used by hardware acceleration APIs.
1676 * It is called at least once during frame decoding to pass
1677 * the data needed for hardware render.
1678 * In that mode instead of pixel data, AVFrame points to
1679 * a structure specific to the acceleration API. The application
1680 * reads the structure and can change some fields to indicate progress
1681 * or mark state.
1682 * - encoding: unused
1683 * - decoding: Set by user.
1684 * @param height the height of the slice
1685 * @param y the y position of the slice
1686 * @param type 1->top field, 2->bottom field, 3->frame
1687 * @param offset offset into the AVFrame.data from which the slice should be read
1688 */
1689 void (*draw_horiz_band)(struct AVCodecContext *s,
1690 const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1691 int y, int type, int height);
1692
1693 /**
1694 * callback to negotiate the pixelFormat
1695 * @param fmt is the list of formats which are supported by the codec,
1696 * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1697 * The first is always the native one.
1698 * @note The callback may be called again immediately if initialization for
1699 * the selected (hardware-accelerated) pixel format failed.
1700 * @warning Behavior is undefined if the callback returns a value not
1701 * in the fmt list of formats.
1702 * @return the chosen format
1703 * - encoding: unused
1704 * - decoding: Set by user, if not set the native format will be chosen.
1705 */
1706 enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
1707
1708 /**
1709 * maximum number of B-frames between non-B-frames
1710 * Note: The output will be delayed by max_b_frames+1 relative to the input.
1711 * - encoding: Set by user.
1712 * - decoding: unused
1713 */
1714 int max_b_frames;
1715
1716 /**
1717 * qscale factor between IP and B-frames
1718 * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
1719 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1720 * - encoding: Set by user.
1721 * - decoding: unused
1722 */
1723 float b_quant_factor;
1724
1725 #if FF_API_RC_STRATEGY
1726 /** @deprecated use codec private option instead */
1727 attribute_deprecated int rc_strategy;
1728 #define FF_RC_STRATEGY_XVID 1
1729 #endif
1730
1731 #if FF_API_PRIVATE_OPT
1732 /** @deprecated use encoder private options instead */
1733 attribute_deprecated
1734 int b_frame_strategy;
1735 #endif
1736
1737 /**
1738 * qscale offset between IP and B-frames
1739 * - encoding: Set by user.
1740 * - decoding: unused
1741 */
1742 float b_quant_offset;
1743
1744 /**
1745 * Size of the frame reordering buffer in the decoder.
1746 * For MPEG-2 it is 1 IPB or 0 low delay IP.
1747 * - encoding: Set by libavcodec.
1748 * - decoding: Set by libavcodec.
1749 */
1750 int has_b_frames;
1751
1752 #if FF_API_PRIVATE_OPT
1753 /** @deprecated use encoder private options instead */
1754 attribute_deprecated
1755 int mpeg_quant;
1756 #endif
1757
1758 /**
1759 * qscale factor between P- and I-frames
1760 * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
1761 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1762 * - encoding: Set by user.
1763 * - decoding: unused
1764 */
1765 float i_quant_factor;
1766
1767 /**
1768 * qscale offset between P and I-frames
1769 * - encoding: Set by user.
1770 * - decoding: unused
1771 */
1772 float i_quant_offset;
1773
1774 /**
1775 * luminance masking (0-> disabled)
1776 * - encoding: Set by user.
1777 * - decoding: unused
1778 */
1779 float lumi_masking;
1780
1781 /**
1782 * temporary complexity masking (0-> disabled)
1783 * - encoding: Set by user.
1784 * - decoding: unused
1785 */
1786 float temporal_cplx_masking;
1787
1788 /**
1789 * spatial complexity masking (0-> disabled)
1790 * - encoding: Set by user.
1791 * - decoding: unused
1792 */
1793 float spatial_cplx_masking;
1794
1795 /**
1796 * p block masking (0-> disabled)
1797 * - encoding: Set by user.
1798 * - decoding: unused
1799 */
1800 float p_masking;
1801
1802 /**
1803 * darkness masking (0-> disabled)
1804 * - encoding: Set by user.
1805 * - decoding: unused
1806 */
1807 float dark_masking;
1808
1809 /**
1810 * slice count
1811 * - encoding: Set by libavcodec.
1812 * - decoding: Set by user (or 0).
1813 */
1814 int slice_count;
1815
1816 #if FF_API_PRIVATE_OPT
1817 /** @deprecated use encoder private options instead */
1818 attribute_deprecated
1819 int prediction_method;
1820 #define FF_PRED_LEFT 0
1821 #define FF_PRED_PLANE 1
1822 #define FF_PRED_MEDIAN 2
1823 #endif
1824
1825 /**
1826 * slice offsets in the frame in bytes
1827 * - encoding: Set/allocated by libavcodec.
1828 * - decoding: Set/allocated by user (or NULL).
1829 */
1830 int *slice_offset;
1831
1832 /**
1833 * sample aspect ratio (0 if unknown)
1834 * That is the width of a pixel divided by the height of the pixel.
1835 * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1836 * - encoding: Set by user.
1837 * - decoding: Set by libavcodec.
1838 */
1839 AVRational sample_aspect_ratio;
1840
1841 /**
1842 * motion estimation comparison function
1843 * - encoding: Set by user.
1844 * - decoding: unused
1845 */
1846 int me_cmp;
1847 /**
1848 * subpixel motion estimation comparison function
1849 * - encoding: Set by user.
1850 * - decoding: unused
1851 */
1852 int me_sub_cmp;
1853 /**
1854 * macroblock comparison function (not supported yet)
1855 * - encoding: Set by user.
1856 * - decoding: unused
1857 */
1858 int mb_cmp;
1859 /**
1860 * interlaced DCT comparison function
1861 * - encoding: Set by user.
1862 * - decoding: unused
1863 */
1864 int ildct_cmp;
1865 #define FF_CMP_SAD 0
1866 #define FF_CMP_SSE 1
1867 #define FF_CMP_SATD 2
1868 #define FF_CMP_DCT 3
1869 #define FF_CMP_PSNR 4
1870 #define FF_CMP_BIT 5
1871 #define FF_CMP_RD 6
1872 #define FF_CMP_ZERO 7
1873 #define FF_CMP_VSAD 8
1874 #define FF_CMP_VSSE 9
1875 #define FF_CMP_NSSE 10
1876 #define FF_CMP_DCTMAX 13
1877 #define FF_CMP_DCT264 14
1878 #define FF_CMP_CHROMA 256
1879
1880 /**
1881 * ME diamond size & shape
1882 * - encoding: Set by user.
1883 * - decoding: unused
1884 */
1885 int dia_size;
1886
1887 /**
1888 * amount of previous MV predictors (2a+1 x 2a+1 square)
1889 * - encoding: Set by user.
1890 * - decoding: unused
1891 */
1892 int last_predictor_count;
1893
1894 #if FF_API_PRIVATE_OPT
1895 /** @deprecated use encoder private options instead */
1896 attribute_deprecated
1897 int pre_me;
1898 #endif
1899
1900 /**
1901 * motion estimation prepass comparison function
1902 * - encoding: Set by user.
1903 * - decoding: unused
1904 */
1905 int me_pre_cmp;
1906
1907 /**
1908 * ME prepass diamond size & shape
1909 * - encoding: Set by user.
1910 * - decoding: unused
1911 */
1912 int pre_dia_size;
1913
1914 /**
1915 * subpel ME quality
1916 * - encoding: Set by user.
1917 * - decoding: unused
1918 */
1919 int me_subpel_quality;
1920
1921 #if FF_API_AFD
1922 /**
1923 * DTG active format information (additional aspect ratio
1924 * information only used in DVB MPEG-2 transport streams)
1925 * 0 if not set.
1926 *
1927 * - encoding: unused
1928 * - decoding: Set by decoder.
1929 * @deprecated Deprecated in favor of AVSideData
1930 */
1931 attribute_deprecated int dtg_active_format;
1932 #define FF_DTG_AFD_SAME 8
1933 #define FF_DTG_AFD_4_3 9
1934 #define FF_DTG_AFD_16_9 10
1935 #define FF_DTG_AFD_14_9 11
1936 #define FF_DTG_AFD_4_3_SP_14_9 13
1937 #define FF_DTG_AFD_16_9_SP_14_9 14
1938 #define FF_DTG_AFD_SP_4_3 15
1939 #endif /* FF_API_AFD */
1940
1941 /**
1942 * maximum motion estimation search range in subpel units
1943 * If 0 then no limit.
1944 *
1945 * - encoding: Set by user.
1946 * - decoding: unused
1947 */
1948 int me_range;
1949
1950 #if FF_API_QUANT_BIAS
1951 /**
1952 * @deprecated use encoder private option instead
1953 */
1954 attribute_deprecated int intra_quant_bias;
1955 #define FF_DEFAULT_QUANT_BIAS 999999
1956
1957 /**
1958 * @deprecated use encoder private option instead
1959 */
1960 attribute_deprecated int inter_quant_bias;
1961 #endif
1962
1963 /**
1964 * slice flags
1965 * - encoding: unused
1966 * - decoding: Set by user.
1967 */
1968 int slice_flags;
1969 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
1970 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
1971 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
1972
1973 #if FF_API_XVMC
1974 /**
1975 * XVideo Motion Acceleration
1976 * - encoding: forbidden
1977 * - decoding: set by decoder
1978 * @deprecated XvMC support is slated for removal.
1979 */
1980 attribute_deprecated int xvmc_acceleration;
1981 #endif /* FF_API_XVMC */
1982
1983 /**
1984 * macroblock decision mode
1985 * - encoding: Set by user.
1986 * - decoding: unused
1987 */
1988 int mb_decision;
1989 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
1990 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
1991 #define FF_MB_DECISION_RD 2 ///< rate distortion
1992
1993 /**
1994 * custom intra quantization matrix
1995 * - encoding: Set by user, can be NULL.
1996 * - decoding: Set by libavcodec.
1997 */
1998 uint16_t *intra_matrix;
1999
2000 /**
2001 * custom inter quantization matrix
2002 * - encoding: Set by user, can be NULL.
2003 * - decoding: Set by libavcodec.
2004 */
2005 uint16_t *inter_matrix;
2006
2007 #if FF_API_PRIVATE_OPT
2008 /** @deprecated use encoder private options instead */
2009 attribute_deprecated
2010 int scenechange_threshold;
2011
2012 /** @deprecated use encoder private options instead */
2013 attribute_deprecated
2014 int noise_reduction;
2015 #endif
2016
2017 #if FF_API_MPV_OPT
2018 /**
2019 * @deprecated this field is unused
2020 */
2021 attribute_deprecated
2022 int me_threshold;
2023
2024 /**
2025 * @deprecated this field is unused
2026 */
2027 attribute_deprecated
2028 int mb_threshold;
2029 #endif
2030
2031 /**
2032 * precision of the intra DC coefficient - 8
2033 * - encoding: Set by user.
2034 * - decoding: unused
2035 */
2036 int intra_dc_precision;
2037
2038 /**
2039 * Number of macroblock rows at the top which are skipped.
2040 * - encoding: unused
2041 * - decoding: Set by user.
2042 */
2043 int skip_top;
2044
2045 /**
2046 * Number of macroblock rows at the bottom which are skipped.
2047 * - encoding: unused
2048 * - decoding: Set by user.
2049 */
2050 int skip_bottom;
2051
2052 #if FF_API_MPV_OPT
2053 /**
2054 * @deprecated use encoder private options instead
2055 */
2056 attribute_deprecated
2057 float border_masking;
2058 #endif
2059
2060 /**
2061 * minimum MB Lagrange multiplier
2062 * - encoding: Set by user.
2063 * - decoding: unused
2064 */
2065 int mb_lmin;
2066
2067 /**
2068 * maximum MB Lagrange multiplier
2069 * - encoding: Set by user.
2070 * - decoding: unused
2071 */
2072 int mb_lmax;
2073
2074 #if FF_API_PRIVATE_OPT
2075 /**
2076 * @deprecated use encoder private options instead
2077 */
2078 attribute_deprecated
2079 int me_penalty_compensation;
2080 #endif
2081
2082 /**
2083 * - encoding: Set by user.
2084 * - decoding: unused
2085 */
2086 int bidir_refine;
2087
2088 #if FF_API_PRIVATE_OPT
2089 /** @deprecated use encoder private options instead */
2090 attribute_deprecated
2091 int brd_scale;
2092 #endif
2093
2094 /**
2095 * minimum GOP size
2096 * - encoding: Set by user.
2097 * - decoding: unused
2098 */
2099 int keyint_min;
2100
2101 /**
2102 * number of reference frames
2103 * - encoding: Set by user.
2104 * - decoding: Set by lavc.
2105 */
2106 int refs;
2107
2108 #if FF_API_PRIVATE_OPT
2109 /** @deprecated use encoder private options instead */
2110 attribute_deprecated
2111 int chromaoffset;
2112 #endif
2113
2114 #if FF_API_UNUSED_MEMBERS
2115 /**
2116 * Multiplied by qscale for each frame and added to scene_change_score.
2117 * - encoding: Set by user.
2118 * - decoding: unused
2119 */
2120 attribute_deprecated int scenechange_factor;
2121 #endif
2122
2123 /**
2124 * Note: Value depends upon the compare function used for fullpel ME.
2125 * - encoding: Set by user.
2126 * - decoding: unused
2127 */
2128 int mv0_threshold;
2129
2130 #if FF_API_PRIVATE_OPT
2131 /** @deprecated use encoder private options instead */
2132 attribute_deprecated
2133 int b_sensitivity;
2134 #endif
2135
2136 /**
2137 * Chromaticity coordinates of the source primaries.
2138 * - encoding: Set by user
2139 * - decoding: Set by libavcodec
2140 */
2141 enum AVColorPrimaries color_primaries;
2142
2143 /**
2144 * Color Transfer Characteristic.
2145 * - encoding: Set by user
2146 * - decoding: Set by libavcodec
2147 */
2148 enum AVColorTransferCharacteristic color_trc;
2149
2150 /**
2151 * YUV colorspace type.
2152 * - encoding: Set by user
2153 * - decoding: Set by libavcodec
2154 */
2155 enum AVColorSpace colorspace;
2156
2157 /**
2158 * MPEG vs JPEG YUV range.
2159 * - encoding: Set by user
2160 * - decoding: Set by libavcodec
2161 */
2162 enum AVColorRange color_range;
2163
2164 /**
2165 * This defines the location of chroma samples.
2166 * - encoding: Set by user
2167 * - decoding: Set by libavcodec
2168 */
2169 enum AVChromaLocation chroma_sample_location;
2170
2171 /**
2172 * Number of slices.
2173 * Indicates number of picture subdivisions. Used for parallelized
2174 * decoding.
2175 * - encoding: Set by user
2176 * - decoding: unused
2177 */
2178 int slices;
2179
2180 /** Field order
2181 * - encoding: set by libavcodec
2182 * - decoding: Set by libavcodec
2183 */
2184 enum AVFieldOrder field_order;
2185
2186 /* audio only */
2187 int sample_rate; ///< samples per second
2188 int channels; ///< number of audio channels
2189
2190 /**
2191 * audio sample format
2192 * - encoding: Set by user.
2193 * - decoding: Set by libavcodec.
2194 */
2195 enum AVSampleFormat sample_fmt; ///< sample format
2196
2197 /* The following data should not be initialized. */
2198 /**
2199 * Number of samples per channel in an audio frame.
2200 *
2201 * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2202 * except the last must contain exactly frame_size samples per channel.
2203 * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2204 * frame size is not restricted.
2205 * - decoding: may be set by some decoders to indicate constant frame size
2206 */
2207 int frame_size;
2208
2209 /**
2210 * Frame counter, set by libavcodec.
2211 *
2212 * - decoding: total number of frames returned from the decoder so far.
2213 * - encoding: total number of frames passed to the encoder so far.
2214 *
2215 * @note the counter is not incremented if encoding/decoding resulted in
2216 * an error.
2217 */
2218 int frame_number;
2219
2220 /**
2221 * number of bytes per packet if constant and known or 0
2222 * Used by some WAV based audio codecs.
2223 */
2224 int block_align;
2225
2226 /**
2227 * Audio cutoff bandwidth (0 means "automatic")
2228 * - encoding: Set by user.
2229 * - decoding: unused
2230 */
2231 int cutoff;
2232
2233 /**
2234 * Audio channel layout.
2235 * - encoding: set by user.
2236 * - decoding: set by libavcodec.
2237 */
2238 uint64_t channel_layout;
2239
2240 /**
2241 * Request decoder to use this channel layout if it can (0 for default)
2242 * - encoding: unused
2243 * - decoding: Set by user.
2244 */
2245 uint64_t request_channel_layout;
2246
2247 /**
2248 * Type of service that the audio stream conveys.
2249 * - encoding: Set by user.
2250 * - decoding: Set by libavcodec.
2251 */
2252 enum AVAudioServiceType audio_service_type;
2253
2254 /**
2255 * Used to request a sample format from the decoder.
2256 * - encoding: unused.
2257 * - decoding: Set by user.
2258 */
2259 enum AVSampleFormat request_sample_fmt;
2260
2261 /**
2262 * This callback is called at the beginning of each frame to get data
2263 * buffer(s) for it. There may be one contiguous buffer for all the data or
2264 * there may be a buffer per each data plane or anything in between. What
2265 * this means is, you may set however many entries in buf[] you feel necessary.
2266 * Each buffer must be reference-counted using the AVBuffer API (see description
2267 * of buf[] below).
2268 *
2269 * The following fields will be set in the frame before this callback is
2270 * called:
2271 * - format
2272 * - width, height (video only)
2273 * - sample_rate, channel_layout, nb_samples (audio only)
2274 * Their values may differ from the corresponding values in
2275 * AVCodecContext. This callback must use the frame values, not the codec
2276 * context values, to calculate the required buffer size.
2277 *
2278 * This callback must fill the following fields in the frame:
2279 * - data[]
2280 * - linesize[]
2281 * - extended_data:
2282 * * if the data is planar audio with more than 8 channels, then this
2283 * callback must allocate and fill extended_data to contain all pointers
2284 * to all data planes. data[] must hold as many pointers as it can.
2285 * extended_data must be allocated with av_malloc() and will be freed in
2286 * av_frame_unref().
2287 * * otherwise extended_data must point to data
2288 * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2289 * the frame's data and extended_data pointers must be contained in these. That
2290 * is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2291 * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2292 * and av_buffer_ref().
2293 * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2294 * this callback and filled with the extra buffers if there are more
2295 * buffers than buf[] can hold. extended_buf will be freed in
2296 * av_frame_unref().
2297 *
2298 * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
2299 * avcodec_default_get_buffer2() instead of providing buffers allocated by
2300 * some other means.
2301 *
2302 * Each data plane must be aligned to the maximum required by the target
2303 * CPU.
2304 *
2305 * @see avcodec_default_get_buffer2()
2306 *
2307 * Video:
2308 *
2309 * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2310 * (read and/or written to if it is writable) later by libavcodec.
2311 *
2312 * avcodec_align_dimensions2() should be used to find the required width and
2313 * height, as they normally need to be rounded up to the next multiple of 16.
2314 *
2315 * If frame multithreading is used and thread_safe_callbacks is set,
2316 * this callback may be called from a different thread, but not from more
2317 * than one at once. Does not need to be reentrant.
2318 *
2319 * @see avcodec_align_dimensions2()
2320 *
2321 * Audio:
2322 *
2323 * Decoders request a buffer of a particular size by setting
2324 * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
2325 * however, utilize only part of the buffer by setting AVFrame.nb_samples
2326 * to a smaller value in the output frame.
2327 *
2328 * As a convenience, av_samples_get_buffer_size() and
2329 * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
2330 * functions to find the required data size and to fill data pointers and
2331 * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2332 * since all planes must be the same size.
2333 *
2334 * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2335 *
2336 * - encoding: unused
2337 * - decoding: Set by libavcodec, user can override.
2338 */
2339 int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
2340
2341 /**
2342 * If non-zero, the decoded audio and video frames returned from
2343 * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
2344 * and are valid indefinitely. The caller must free them with
2345 * av_frame_unref() when they are not needed anymore.
2346 * Otherwise, the decoded frames must not be freed by the caller and are
2347 * only valid until the next decode call.
2348 *
2349 * This is always automatically enabled if avcodec_receive_frame() is used.
2350 *
2351 * - encoding: unused
2352 * - decoding: set by the caller before avcodec_open2().
2353 */
2354 attribute_deprecated int refcounted_frames;
2355
2356 /* - encoding parameters */
2357 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
2358 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
2359
2360 /**
2361 * minimum quantizer
2362 * - encoding: Set by user.
2363 * - decoding: unused
2364 */
2365 int qmin;
2366
2367 /**
2368 * maximum quantizer
2369 * - encoding: Set by user.
2370 * - decoding: unused
2371 */
2372 int qmax;
2373
2374 /**
2375 * maximum quantizer difference between frames
2376 * - encoding: Set by user.
2377 * - decoding: unused
2378 */
2379 int max_qdiff;
2380
2381 #if FF_API_MPV_OPT
2382 /**
2383 * @deprecated use encoder private options instead
2384 */
2385 attribute_deprecated
2386 float rc_qsquish;
2387
2388 attribute_deprecated
2389 float rc_qmod_amp;
2390 attribute_deprecated
2391 int rc_qmod_freq;
2392 #endif
2393
2394 /**
2395 * decoder bitstream buffer size
2396 * - encoding: Set by user.
2397 * - decoding: unused
2398 */
2399 int rc_buffer_size;
2400
2401 /**
2402 * ratecontrol override, see RcOverride
2403 * - encoding: Allocated/set/freed by user.
2404 * - decoding: unused
2405 */
2406 int rc_override_count;
2407 RcOverride *rc_override;
2408
2409 #if FF_API_MPV_OPT
2410 /**
2411 * @deprecated use encoder private options instead
2412 */
2413 attribute_deprecated
2414 const char *rc_eq;
2415 #endif
2416
2417 /**
2418 * maximum bitrate
2419 * - encoding: Set by user.
2420 * - decoding: unused
2421 */
2422 int rc_max_rate;
2423
2424 /**
2425 * minimum bitrate
2426 * - encoding: Set by user.
2427 * - decoding: unused
2428 */
2429 int rc_min_rate;
2430
2431 #if FF_API_MPV_OPT
2432 /**
2433 * @deprecated use encoder private options instead
2434 */
2435 attribute_deprecated
2436 float rc_buffer_aggressivity;
2437
2438 attribute_deprecated
2439 float rc_initial_cplx;
2440 #endif
2441
2442 /**
2443 * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2444 * - encoding: Set by user.
2445 * - decoding: unused.
2446 */
2447 float rc_max_available_vbv_use;
2448
2449 /**
2450 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2451 * - encoding: Set by user.
2452 * - decoding: unused.
2453 */
2454 float rc_min_vbv_overflow_use;
2455
2456 /**
2457 * Number of bits which should be loaded into the rc buffer before decoding starts.
2458 * - encoding: Set by user.
2459 * - decoding: unused
2460 */
2461 int rc_initial_buffer_occupancy;
2462
2463 #if FF_API_CODER_TYPE
2464 #define FF_CODER_TYPE_VLC 0
2465 #define FF_CODER_TYPE_AC 1
2466 #define FF_CODER_TYPE_RAW 2
2467 #define FF_CODER_TYPE_RLE 3
2468 #if FF_API_UNUSED_MEMBERS
2469 #define FF_CODER_TYPE_DEFLATE 4
2470 #endif /* FF_API_UNUSED_MEMBERS */
2471 /**
2472 * @deprecated use encoder private options instead
2473 */
2474 attribute_deprecated
2475 int coder_type;
2476 #endif /* FF_API_CODER_TYPE */
2477
2478 #if FF_API_PRIVATE_OPT
2479 /** @deprecated use encoder private options instead */
2480 attribute_deprecated
2481 int context_model;
2482 #endif
2483
2484 #if FF_API_MPV_OPT
2485 /**
2486 * @deprecated use encoder private options instead
2487 */
2488 attribute_deprecated
2489 int lmin;
2490
2491 /**
2492 * @deprecated use encoder private options instead
2493 */
2494 attribute_deprecated
2495 int lmax;
2496 #endif
2497
2498 #if FF_API_PRIVATE_OPT
2499 /** @deprecated use encoder private options instead */
2500 attribute_deprecated
2501 int frame_skip_threshold;
2502
2503 /** @deprecated use encoder private options instead */
2504 attribute_deprecated
2505 int frame_skip_factor;
2506
2507 /** @deprecated use encoder private options instead */
2508 attribute_deprecated
2509 int frame_skip_exp;
2510
2511 /** @deprecated use encoder private options instead */
2512 attribute_deprecated
2513 int frame_skip_cmp;
2514 #endif /* FF_API_PRIVATE_OPT */
2515
2516 /**
2517 * trellis RD quantization
2518 * - encoding: Set by user.
2519 * - decoding: unused
2520 */
2521 int trellis;
2522
2523 #if FF_API_PRIVATE_OPT
2524 /** @deprecated use encoder private options instead */
2525 attribute_deprecated
2526 int min_prediction_order;
2527
2528 /** @deprecated use encoder private options instead */
2529 attribute_deprecated
2530 int max_prediction_order;
2531
2532 /** @deprecated use encoder private options instead */
2533 attribute_deprecated
2534 int64_t timecode_frame_start;
2535 #endif
2536
2537 #if FF_API_RTP_CALLBACK
2538 /**
2539 * @deprecated unused
2540 */
2541 /* The RTP callback: This function is called */
2542 /* every time the encoder has a packet to send. */
2543 /* It depends on the encoder if the data starts */
2544 /* with a Start Code (it should). H.263 does. */
2545 /* mb_nb contains the number of macroblocks */
2546 /* encoded in the RTP payload. */
2547 attribute_deprecated
2548 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
2549 #endif
2550
2551 #if FF_API_PRIVATE_OPT
2552 /** @deprecated use encoder private options instead */
2553 attribute_deprecated
2554 int rtp_payload_size; /* The size of the RTP payload: the coder will */
2555 /* do its best to deliver a chunk with size */
2556 /* below rtp_payload_size, the chunk will start */
2557 /* with a start code on some codecs like H.263. */
2558 /* This doesn't take account of any particular */
2559 /* headers inside the transmitted RTP payload. */
2560 #endif
2561
2562 #if FF_API_STAT_BITS
2563 /* statistics, used for 2-pass encoding */
2564 attribute_deprecated
2565 int mv_bits;
2566 attribute_deprecated
2567 int header_bits;
2568 attribute_deprecated
2569 int i_tex_bits;
2570 attribute_deprecated
2571 int p_tex_bits;
2572 attribute_deprecated
2573 int i_count;
2574 attribute_deprecated
2575 int p_count;
2576 attribute_deprecated
2577 int skip_count;
2578 attribute_deprecated
2579 int misc_bits;
2580
2581 /** @deprecated this field is unused */
2582 attribute_deprecated
2583 int frame_bits;
2584 #endif
2585
2586 /**
2587 * pass1 encoding statistics output buffer
2588 * - encoding: Set by libavcodec.
2589 * - decoding: unused
2590 */
2591 char *stats_out;
2592
2593 /**
2594 * pass2 encoding statistics input buffer
2595 * Concatenated stuff from stats_out of pass1 should be placed here.
2596 * - encoding: Allocated/set/freed by user.
2597 * - decoding: unused
2598 */
2599 char *stats_in;
2600
2601 /**
2602 * Work around bugs in encoders which sometimes cannot be detected automatically.
2603 * - encoding: Set by user
2604 * - decoding: Set by user
2605 */
2606 int workaround_bugs;
2607 #define FF_BUG_AUTODETECT 1 ///< autodetection
2608 #if FF_API_OLD_MSMPEG4
2609 #define FF_BUG_OLD_MSMPEG4 2
2610 #endif
2611 #define FF_BUG_XVID_ILACE 4
2612 #define FF_BUG_UMP4 8
2613 #define FF_BUG_NO_PADDING 16
2614 #define FF_BUG_AMV 32
2615 #if FF_API_AC_VLC
2616 #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
2617 #endif
2618 #define FF_BUG_QPEL_CHROMA 64
2619 #define FF_BUG_STD_QPEL 128
2620 #define FF_BUG_QPEL_CHROMA2 256
2621 #define FF_BUG_DIRECT_BLOCKSIZE 512
2622 #define FF_BUG_EDGE 1024
2623 #define FF_BUG_HPEL_CHROMA 2048
2624 #define FF_BUG_DC_CLIP 4096
2625 #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
2626 #define FF_BUG_TRUNCATED 16384
2627
2628 /**
2629 * strictly follow the standard (MPEG-4, ...).
2630 * - encoding: Set by user.
2631 * - decoding: Set by user.
2632 * Setting this to STRICT or higher means the encoder and decoder will
2633 * generally do stupid things, whereas setting it to unofficial or lower
2634 * will mean the encoder might produce output that is not supported by all
2635 * spec-compliant decoders. Decoders don't differentiate between normal,
2636 * unofficial and experimental (that is, they always try to decode things
2637 * when they can) unless they are explicitly asked to behave stupidly
2638 * (=strictly conform to the specs)
2639 */
2640 int strict_std_compliance;
2641 #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
2642 #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
2643 #define FF_COMPLIANCE_NORMAL 0
2644 #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
2645 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
2646
2647 /**
2648 * error concealment flags
2649 * - encoding: unused
2650 * - decoding: Set by user.
2651 */
2652 int error_concealment;
2653 #define FF_EC_GUESS_MVS 1
2654 #define FF_EC_DEBLOCK 2
2655
2656 /**
2657 * debug
2658 * - encoding: Set by user.
2659 * - decoding: Set by user.
2660 */
2661 int debug;
2662 #define FF_DEBUG_PICT_INFO 1
2663 #define FF_DEBUG_RC 2
2664 #define FF_DEBUG_BITSTREAM 4
2665 #define FF_DEBUG_MB_TYPE 8
2666 #define FF_DEBUG_QP 16
2667 #if FF_API_DEBUG_MV
2668 /**
2669 * @deprecated this option does nothing
2670 */
2671 #define FF_DEBUG_MV 32
2672 #endif
2673 #define FF_DEBUG_DCT_COEFF 0x00000040
2674 #define FF_DEBUG_SKIP 0x00000080
2675 #define FF_DEBUG_STARTCODE 0x00000100
2676 #if FF_API_UNUSED_MEMBERS
2677 #define FF_DEBUG_PTS 0x00000200
2678 #endif /* FF_API_UNUSED_MEMBERS */
2679 #define FF_DEBUG_ER 0x00000400
2680 #define FF_DEBUG_MMCO 0x00000800
2681 #define FF_DEBUG_BUGS 0x00001000
2682 #if FF_API_DEBUG_MV
2683 #define FF_DEBUG_VIS_QP 0x00002000
2684 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
2685 #endif
2686 #define FF_DEBUG_BUFFERS 0x00008000
2687 #define FF_DEBUG_THREADS 0x00010000
2688
2689 #if FF_API_DEBUG_MV
2690 /**
2691 * @deprecated this option does not have any effect
2692 */
2693 attribute_deprecated
2694 int debug_mv;
2695 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
2696 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
2697 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
2698 #endif
2699
2700 /**
2701 * Error recognition; may misdetect some more or less valid parts as errors.
2702 * - encoding: unused
2703 * - decoding: Set by user.
2704 */
2705 int err_recognition;
2706
2707 /**
2708 * Verify checksums embedded in the bitstream (could be of either encoded or
2709 * decoded data, depending on the codec) and print an error message on mismatch.
2710 * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
2711 * decoder returning an error.
2712 */
2713 #define AV_EF_CRCCHECK (1<<0)
2714 #define AV_EF_BITSTREAM (1<<1)
2715 #define AV_EF_BUFFER (1<<2)
2716 #define AV_EF_EXPLODE (1<<3)
2717
2718 /**
2719 * opaque 64-bit number (generally a PTS) that will be reordered and
2720 * output in AVFrame.reordered_opaque
2721 * - encoding: unused
2722 * - decoding: Set by user.
2723 */
2724 int64_t reordered_opaque;
2725
2726 /**
2727 * Hardware accelerator in use
2728 * - encoding: unused.
2729 * - decoding: Set by libavcodec
2730 */
2731 struct AVHWAccel *hwaccel;
2732
2733 /**
2734 * Hardware accelerator context.
2735 * For some hardware accelerators, a global context needs to be
2736 * provided by the user. In that case, this holds display-dependent
2737 * data Libav cannot instantiate itself. Please refer to the
2738 * Libav HW accelerator documentation to know how to fill this
2739 * is. e.g. for VA API, this is a struct vaapi_context.
2740 * - encoding: unused
2741 * - decoding: Set by user
2742 */
2743 void *hwaccel_context;
2744
2745 /**
2746 * error
2747 * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
2748 * - decoding: unused
2749 */
2750 uint64_t error[AV_NUM_DATA_POINTERS];
2751
2752 /**
2753 * DCT algorithm, see FF_DCT_* below
2754 * - encoding: Set by user.
2755 * - decoding: unused
2756 */
2757 int dct_algo;
2758 #define FF_DCT_AUTO 0
2759 #define FF_DCT_FASTINT 1
2760 #define FF_DCT_INT 2
2761 #define FF_DCT_MMX 3
2762 #define FF_DCT_ALTIVEC 5
2763 #define FF_DCT_FAAN 6
2764
2765 /**
2766 * IDCT algorithm, see FF_IDCT_* below.
2767 * - encoding: Set by user.
2768 * - decoding: Set by user.
2769 */
2770 int idct_algo;
2771 #define FF_IDCT_AUTO 0
2772 #define FF_IDCT_INT 1
2773 #define FF_IDCT_SIMPLE 2
2774 #define FF_IDCT_SIMPLEMMX 3
2775 #define FF_IDCT_ARM 7
2776 #define FF_IDCT_ALTIVEC 8
2777 #if FF_API_ARCH_SH4
2778 #define FF_IDCT_SH4 9
2779 #endif
2780 #define FF_IDCT_SIMPLEARM 10
2781 #if FF_API_UNUSED_MEMBERS
2782 #define FF_IDCT_IPP 13
2783 #endif /* FF_API_UNUSED_MEMBERS */
2784 #define FF_IDCT_XVID 14
2785 #if FF_API_IDCT_XVIDMMX
2786 #define FF_IDCT_XVIDMMX 14
2787 #endif /* FF_API_IDCT_XVIDMMX */
2788 #define FF_IDCT_SIMPLEARMV5TE 16
2789 #define FF_IDCT_SIMPLEARMV6 17
2790 #if FF_API_ARCH_SPARC
2791 #define FF_IDCT_SIMPLEVIS 18
2792 #endif
2793 #define FF_IDCT_FAAN 20
2794 #define FF_IDCT_SIMPLENEON 22
2795 #if FF_API_ARCH_ALPHA
2796 #define FF_IDCT_SIMPLEALPHA 23
2797 #endif
2798
2799 /**
2800 * bits per sample/pixel from the demuxer (needed for huffyuv).
2801 * - encoding: Set by libavcodec.
2802 * - decoding: Set by user.
2803 */
2804 int bits_per_coded_sample;
2805
2806 /**
2807 * Bits per sample/pixel of internal libavcodec pixel/sample format.
2808 * - encoding: set by user.
2809 * - decoding: set by libavcodec.
2810 */
2811 int bits_per_raw_sample;
2812
2813 #if FF_API_LOWRES
2814 /**
2815 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2816 * - encoding: unused
2817 * - decoding: Set by user.
2818 *
2819 * @deprecated use decoder private options instead
2820 */
2821 attribute_deprecated int lowres;
2822 #endif
2823
2824 #if FF_API_CODED_FRAME
2825 /**
2826 * the picture in the bitstream
2827 * - encoding: Set by libavcodec.
2828 * - decoding: unused
2829 *
2830 * @deprecated use the quality factor packet side data instead
2831 */
2832 attribute_deprecated AVFrame *coded_frame;
2833 #endif
2834
2835 /**
2836 * thread count
2837 * is used to decide how many independent tasks should be passed to execute()
2838 * - encoding: Set by user.
2839 * - decoding: Set by user.
2840 */
2841 int thread_count;
2842
2843 /**
2844 * Which multithreading methods to use.
2845 * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2846 * so clients which cannot provide future frames should not use it.
2847 *
2848 * - encoding: Set by user, otherwise the default is used.
2849 * - decoding: Set by user, otherwise the default is used.
2850 */
2851 int thread_type;
2852 #define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
2853 #define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
2854
2855 /**
2856 * Which multithreading methods are in use by the codec.
2857 * - encoding: Set by libavcodec.
2858 * - decoding: Set by libavcodec.
2859 */
2860 int active_thread_type;
2861
2862 /**
2863 * Set by the client if its custom get_buffer() callback can be called
2864 * synchronously from another thread, which allows faster multithreaded decoding.
2865 * draw_horiz_band() will be called from other threads regardless of this setting.
2866 * Ignored if the default get_buffer() is used.
2867 * - encoding: Set by user.
2868 * - decoding: Set by user.
2869 */
2870 int thread_safe_callbacks;
2871
2872 /**
2873 * The codec may call this to execute several independent things.
2874 * It will return only after finishing all tasks.
2875 * The user may replace this with some multithreaded implementation,
2876 * the default implementation will execute the parts serially.
2877 * @param count the number of things to execute
2878 * - encoding: Set by libavcodec, user can override.
2879 * - decoding: Set by libavcodec, user can override.
2880 */
2881 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
2882
2883 /**
2884 * The codec may call this to execute several independent things.
2885 * It will return only after finishing all tasks.
2886 * The user may replace this with some multithreaded implementation,
2887 * the default implementation will execute the parts serially.
2888 * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
2889 * @param c context passed also to func
2890 * @param count the number of things to execute
2891 * @param arg2 argument passed unchanged to func
2892 * @param ret return values of executed functions, must have space for "count" values. May be NULL.
2893 * @param func function that will be called count times, with jobnr from 0 to count-1.
2894 * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
2895 * two instances of func executing at the same time will have the same threadnr.
2896 * @return always 0 currently, but code should handle a future improvement where when any call to func
2897 * returns < 0 no further calls to func may be done and < 0 is returned.
2898 * - encoding: Set by libavcodec, user can override.
2899 * - decoding: Set by libavcodec, user can override.
2900 */
2901 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
2902
2903 /**
2904 * noise vs. sse weight for the nsse comparison function
2905 * - encoding: Set by user.
2906 * - decoding: unused
2907 */
2908 int nsse_weight;
2909
2910 /**
2911 * profile
2912 * - encoding: Set by user.
2913 * - decoding: Set by libavcodec.
2914 */
2915 int profile;
2916 #define FF_PROFILE_UNKNOWN -99
2917 #define FF_PROFILE_RESERVED -100
2918
2919 #define FF_PROFILE_AAC_MAIN 0
2920 #define FF_PROFILE_AAC_LOW 1
2921 #define FF_PROFILE_AAC_SSR 2
2922 #define FF_PROFILE_AAC_LTP 3
2923 #define FF_PROFILE_AAC_HE 4
2924 #define FF_PROFILE_AAC_HE_V2 28
2925 #define FF_PROFILE_AAC_LD 22
2926 #define FF_PROFILE_AAC_ELD 38
2927 #define FF_PROFILE_MPEG2_AAC_LOW 128
2928 #define FF_PROFILE_MPEG2_AAC_HE 131
2929
2930 #define FF_PROFILE_DTS 20
2931 #define FF_PROFILE_DTS_ES 30
2932 #define FF_PROFILE_DTS_96_24 40
2933 #define FF_PROFILE_DTS_HD_HRA 50
2934 #define FF_PROFILE_DTS_HD_MA 60
2935 #define FF_PROFILE_DTS_EXPRESS 70
2936
2937 #define FF_PROFILE_MPEG2_422 0
2938 #define FF_PROFILE_MPEG2_HIGH 1
2939 #define FF_PROFILE_MPEG2_SS 2
2940 #define FF_PROFILE_MPEG2_SNR_SCALABLE 3
2941 #define FF_PROFILE_MPEG2_MAIN 4
2942 #define FF_PROFILE_MPEG2_SIMPLE 5
2943
2944 #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
2945 #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
2946
2947 #define FF_PROFILE_H264_BASELINE 66
2948 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2949 #define FF_PROFILE_H264_MAIN 77
2950 #define FF_PROFILE_H264_EXTENDED 88
2951 #define FF_PROFILE_H264_HIGH 100
2952 #define FF_PROFILE_H264_HIGH_10 110
2953 #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
2954 #define FF_PROFILE_H264_MULTIVIEW_HIGH 118
2955 #define FF_PROFILE_H264_HIGH_422 122
2956 #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
2957 #define FF_PROFILE_H264_STEREO_HIGH 128
2958 #define FF_PROFILE_H264_HIGH_444 144
2959 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
2960 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
2961 #define FF_PROFILE_H264_CAVLC_444 44
2962
2963 #define FF_PROFILE_VC1_SIMPLE 0
2964 #define FF_PROFILE_VC1_MAIN 1
2965 #define FF_PROFILE_VC1_COMPLEX 2
2966 #define FF_PROFILE_VC1_ADVANCED 3
2967
2968 #define FF_PROFILE_MPEG4_SIMPLE 0
2969 #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
2970 #define FF_PROFILE_MPEG4_CORE 2
2971 #define FF_PROFILE_MPEG4_MAIN 3
2972 #define FF_PROFILE_MPEG4_N_BIT 4
2973 #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
2974 #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
2975 #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
2976 #define FF_PROFILE_MPEG4_HYBRID 8
2977 #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
2978 #define FF_PROFILE_MPEG4_CORE_SCALABLE 10
2979 #define FF_PROFILE_MPEG4_ADVANCED_CODING 11
2980 #define FF_PROFILE_MPEG4_ADVANCED_CORE 12
2981 #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2982 #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
2983 #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
2984
2985 #define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
2986 #define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
2987 #define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
2988 #define FF_PROFILE_JPEG2000_DCINEMA_2K 3
2989 #define FF_PROFILE_JPEG2000_DCINEMA_4K 4
2990
2991 #define FF_PROFILE_VP9_0 0
2992 #define FF_PROFILE_VP9_1 1
2993 #define FF_PROFILE_VP9_2 2
2994 #define FF_PROFILE_VP9_3 3
2995
2996 #define FF_PROFILE_HEVC_MAIN 1
2997 #define FF_PROFILE_HEVC_MAIN_10 2
2998 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
2999 #define FF_PROFILE_HEVC_REXT 4
3000
3001 /**
3002 * level
3003 * - encoding: Set by user.
3004 * - decoding: Set by libavcodec.
3005 */
3006 int level;
3007 #define FF_LEVEL_UNKNOWN -99
3008
3009 /**
3010 * - encoding: unused
3011 * - decoding: Set by user.
3012 */
3013 enum AVDiscard skip_loop_filter;
3014
3015 /**
3016 * - encoding: unused
3017 * - decoding: Set by user.
3018 */
3019 enum AVDiscard skip_idct;
3020
3021 /**
3022 * - encoding: unused
3023 * - decoding: Set by user.
3024 */
3025 enum AVDiscard skip_frame;
3026
3027 /**
3028 * Header containing style information for text subtitles.
3029 * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3030 * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3031 * the Format line following. It shouldn't include any Dialogue line.
3032 * - encoding: Set/allocated/freed by user (before avcodec_open2())
3033 * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3034 */
3035 uint8_t *subtitle_header;
3036 int subtitle_header_size;
3037
3038 #if FF_API_ERROR_RATE
3039 /**
3040 * @deprecated use the 'error_rate' private AVOption of the mpegvideo
3041 * encoders
3042 */
3043 attribute_deprecated
3044 int error_rate;
3045 #endif
3046
3047 #if FF_API_VBV_DELAY
3048 /**
3049 * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3050 * Used for compliant TS muxing.
3051 * - encoding: Set by libavcodec.
3052 * - decoding: unused.
3053 * @deprecated this value is now exported as a part of
3054 * AV_PKT_DATA_CPB_PROPERTIES packet side data
3055 */
3056 attribute_deprecated
3057 uint64_t vbv_delay;
3058 #endif
3059
3060 #if FF_API_SIDEDATA_ONLY_PKT
3061 /**
3062 * Encoding only and set by default. Allow encoders to output packets
3063 * that do not contain any encoded data, only side data.
3064 *
3065 * Some encoders need to output such packets, e.g. to update some stream
3066 * parameters at the end of encoding.
3067 *
3068 * @deprecated this field disables the default behaviour and
3069 * it is kept only for compatibility.
3070 */
3071 attribute_deprecated
3072 int side_data_only_packets;
3073 #endif
3074
3075 /**
3076 * Audio only. The number of "priming" samples (padding) inserted by the
3077 * encoder at the beginning of the audio. I.e. this number of leading
3078 * decoded samples must be discarded by the caller to get the original audio
3079 * without leading padding.
3080 *
3081 * - decoding: unused
3082 * - encoding: Set by libavcodec. The timestamps on the output packets are
3083 * adjusted by the encoder so that they always refer to the
3084 * first sample of the data actually contained in the packet,
3085 * including any added padding. E.g. if the timebase is
3086 * 1/samplerate and the timestamp of the first input sample is
3087 * 0, the timestamp of the first output packet will be
3088 * -initial_padding.
3089 */
3090 int initial_padding;
3091
3092 /*
3093 * - decoding: For codecs that store a framerate value in the compressed
3094 * bitstream, the decoder may export it here. { 0, 1} when
3095 * unknown.
3096 * - encoding: May be used to signal the framerate of CFR content to an
3097 * encoder.
3098 */
3099 AVRational framerate;
3100
3101 /**
3102 * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3103 * - encoding: unused.
3104 * - decoding: Set by libavcodec before calling get_format()
3105 */
3106 enum AVPixelFormat sw_pix_fmt;
3107
3108 /**
3109 * Additional data associated with the entire coded stream.
3110 *
3111 * - decoding: unused
3112 * - encoding: may be set by libavcodec after avcodec_open2().
3113 */
3114 AVPacketSideData *coded_side_data;
3115 int nb_coded_side_data;
3116
3117 /**
3118 * A reference to the AVHWFramesContext describing the input (for encoding)
3119 * or output (decoding) frames. The reference is set by the caller and
3120 * afterwards owned (and freed) by libavcodec - it should never be read by
3121 * the caller after being set.
3122 *
3123 * - decoding: This field should be set by the caller from the get_format()
3124 * callback. The previous reference (if any) will always be
3125 * unreffed by libavcodec before the get_format() call.
3126 *
3127 * If the default get_buffer2() is used with a hwaccel pixel
3128 * format, then this AVHWFramesContext will be used for
3129 * allocating the frame buffers.
3130 *
3131 * - encoding: For hardware encoders configured to use a hwaccel pixel
3132 * format, this field should be set by the caller to a reference
3133 * to the AVHWFramesContext describing input frames.
3134 * AVHWFramesContext.format must be equal to
3135 * AVCodecContext.pix_fmt.
3136 *
3137 * This field should be set before avcodec_open2() is called.
3138 */
3139 AVBufferRef *hw_frames_ctx;
3140
3141 /**
3142 * Video decoding only. Certain video codecs support cropping, meaning that
3143 * only a sub-rectangle of the decoded frame is intended for display. This
3144 * option controls how cropping is handled by libavcodec.
3145 *
3146 * When set to 1 (the default), libavcodec will apply cropping internally.
3147 * I.e. it will modify the output frame width/height fields and offset the
3148 * data pointers (only by as much as possible while preserving alignment, or
3149 * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3150 * the frames output by the decoder refer only to the cropped area. The
3151 * crop_* fields of the output frames will be zero.
3152 *
3153 * When set to 0, the width/height fields of the output frames will be set
3154 * to the coded dimensions and the crop_* fields will describe the cropping
3155 * rectangle. Applying the cropping is left to the caller.
3156 *
3157 * @warning When hardware acceleration with opaque output frames is used,
3158 * libavcodec is unable to apply cropping from the top/left border.
3159 *
3160 * @note when this option is set to zero, the width/height fields of the
3161 * AVCodecContext and output AVFrames have different meanings. The codec
3162 * context fields store display dimensions (with the coded dimensions in
3163 * coded_width/height), while the frame fields store the coded dimensions
3164 * (with the display dimensions being determined by the crop_* fields).
3165 */
3166 int apply_cropping;
3167
3168 /**
3169 * A reference to the AVHWDeviceContext describing the device which will
3170 * be used by a hardware encoder/decoder. The reference is set by the
3171 * caller and afterwards owned (and freed) by libavcodec.
3172 *
3173 * This should be used if either the codec device does not require
3174 * hardware frames or any that are used are to be allocated internally by
3175 * libavcodec. If the user wishes to supply any of the frames used as
3176 * encoder input or decoder output then hw_frames_ctx should be used
3177 * instead. When hw_frames_ctx is set in get_format() for a decoder, this
3178 * field will be ignored while decoding the associated stream segment, but
3179 * may again be used on a following one after another get_format() call.
3180 *
3181 * For both encoders and decoders this field should be set before
3182 * avcodec_open2() is called and must not be written to thereafter.
3183 *
3184 * Note that some decoders may require this field to be set initially in
3185 * order to support hw_frames_ctx at all - in that case, all frames
3186 * contexts used must be created on the same device.
3187 */
3188 AVBufferRef *hw_device_ctx;
3189 } AVCodecContext;
3190
3191 /**
3192 * AVProfile.
3193 */
3194 typedef struct AVProfile {
3195 int profile;
3196 const char *name; ///< short name for the profile
3197 } AVProfile;
3198
3199 typedef struct AVCodecDefault AVCodecDefault;
3200
3201 struct AVSubtitle;
3202
3203 /**
3204 * AVCodec.
3205 */
3206 typedef struct AVCodec {
3207 /**
3208 * Name of the codec implementation.
3209 * The name is globally unique among encoders and among decoders (but an
3210 * encoder and a decoder can share the same name).
3211 * This is the primary way to find a codec from the user perspective.
3212 */
3213 const char *name;
3214 /**
3215 * Descriptive name for the codec, meant to be more human readable than name.
3216 * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
3217 */
3218 const char *long_name;
3219 enum AVMediaType type;
3220 enum AVCodecID id;
3221 /**
3222 * Codec capabilities.
3223 * see AV_CODEC_CAP_*
3224 */
3225 int capabilities;
3226 const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
3227 const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
3228 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
3229 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
3230 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
3231 #if FF_API_LOWRES
3232 attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
3233 #endif
3234 const AVClass *priv_class; ///< AVClass for the private context
3235 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
3236
3237 /*****************************************************************
3238 * No fields below this line are part of the public API. They
3239 * may not be used outside of libavcodec and can be changed and
3240 * removed at will.
3241 * New public fields should be added right above.
3242 *****************************************************************
3243 */
3244 int priv_data_size;
3245 struct AVCodec *next;
3246 /**
3247 * @name Frame-level threading support functions
3248 * @{
3249 */
3250 /**
3251 * If defined, called on thread contexts when they are created.
3252 * If the codec allocates writable tables in init(), re-allocate them here.
3253 * priv_data will be set to a copy of the original.
3254 */
3255 int (*init_thread_copy)(AVCodecContext *);
3256 /**
3257 * Copy necessary context variables from a previous thread context to the current one.
3258 * If not defined, the next thread will start automatically; otherwise, the codec
3259 * must call ff_thread_finish_setup().
3260 *
3261 * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
3262 */
3263 int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
3264 /** @} */
3265
3266 /**
3267 * Private codec-specific defaults.
3268 */
3269 const AVCodecDefault *defaults;
3270
3271 /**
3272 * Initialize codec static data, called from avcodec_register().
3273 */
3274 void (*init_static_data)(struct AVCodec *codec);
3275
3276 int (*init)(AVCodecContext *);
3277 int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
3278 const struct AVSubtitle *sub);
3279 /**
3280 * Encode data to an AVPacket.
3281 *
3282 * @param avctx codec context
3283 * @param avpkt output AVPacket (may contain a user-provided buffer)
3284 * @param[in] frame AVFrame containing the raw data to be encoded
3285 * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
3286 * non-empty packet was returned in avpkt.
3287 * @return 0 on success, negative error code on failure
3288 */
3289 int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
3290 int *got_packet_ptr);
3291 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
3292 int (*close)(AVCodecContext *);
3293 /**
3294 * Encode API with decoupled packet/frame dataflow. The API is the
3295 * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
3296 * that:
3297 * - never called if the codec is closed or the wrong type,
3298 * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
3299 * - only one drain frame is ever passed down,
3300 */
3301 int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
3302 int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
3303
3304 /**
3305 * Decode API with decoupled packet/frame dataflow. This function is called
3306 * to get one output frame. It should call ff_decode_get_packet() to obtain
3307 * input data.
3308 */
3309 int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
3310 /**
3311 * Flush buffers.
3312 * Will be called when seeking
3313 */
3314 void (*flush)(AVCodecContext *);
3315 /**
3316 * Internal codec capabilities.
3317 * See FF_CODEC_CAP_* in internal.h
3318 */
3319 int caps_internal;
3320
3321 /**
3322 * Decoding only, a comma-separated list of bitstream filters to apply to
3323 * packets before decoding.
3324 */
3325 const char *bsfs;
3326 } AVCodec;
3327
3328 /**
3329 * @defgroup lavc_hwaccel AVHWAccel
3330 * @{
3331 */
3332 typedef struct AVHWAccel {
3333 /**
3334 * Name of the hardware accelerated codec.
3335 * The name is globally unique among encoders and among decoders (but an
3336 * encoder and a decoder can share the same name).
3337 */
3338 const char *name;
3339
3340 /**
3341 * Type of codec implemented by the hardware accelerator.
3342 *
3343 * See AVMEDIA_TYPE_xxx
3344 */
3345 enum AVMediaType type;
3346
3347 /**
3348 * Codec implemented by the hardware accelerator.
3349 *
3350 * See AV_CODEC_ID_xxx
3351 */
3352 enum AVCodecID id;
3353
3354 /**
3355 * Supported pixel format.
3356 *
3357 * Only hardware accelerated formats are supported here.
3358 */
3359 enum AVPixelFormat pix_fmt;
3360
3361 /**
3362 * Hardware accelerated codec capabilities.
3363 * see FF_HWACCEL_CODEC_CAP_*
3364 */
3365 int capabilities;
3366
3367 /*****************************************************************
3368 * No fields below this line are part of the public API. They
3369 * may not be used outside of libavcodec and can be changed and
3370 * removed at will.
3371 * New public fields should be added right above.
3372 *****************************************************************
3373 */
3374 struct AVHWAccel *next;
3375
3376 /**
3377 * Allocate a custom buffer
3378 */
3379 int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
3380
3381 /**
3382 * Called at the beginning of each frame or field picture.
3383 *
3384 * Meaningful frame information (codec specific) is guaranteed to
3385 * be parsed at this point. This function is mandatory.
3386 *
3387 * Note that buf can be NULL along with buf_size set to 0.
3388 * Otherwise, this means the whole frame is available at this point.
3389 *
3390 * @param avctx the codec context
3391 * @param buf the frame data buffer base
3392 * @param buf_size the size of the frame in bytes
3393 * @return zero if successful, a negative value otherwise
3394 */
3395 int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3396
3397 /**
3398 * Callback for each slice.
3399 *
3400 * Meaningful slice information (codec specific) is guaranteed to
3401 * be parsed at this point. This function is mandatory.
3402 *
3403 * @param avctx the codec context
3404 * @param buf the slice data buffer base
3405 * @param buf_size the size of the slice in bytes
3406 * @return zero if successful, a negative value otherwise
3407 */
3408 int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3409
3410 /**
3411 * Called at the end of each frame or field picture.
3412 *
3413 * The whole picture is parsed at this point and can now be sent
3414 * to the hardware accelerator. This function is mandatory.
3415 *
3416 * @param avctx the codec context
3417 * @return zero if successful, a negative value otherwise
3418 */
3419 int (*end_frame)(AVCodecContext *avctx);
3420
3421 /**
3422 * Size of per-frame hardware accelerator private data.
3423 *
3424 * Private data is allocated with av_mallocz() before
3425 * AVCodecContext.get_buffer() and deallocated after
3426 * AVCodecContext.release_buffer().
3427 */
3428 int frame_priv_data_size;
3429
3430 /**
3431 * Initialize the hwaccel private data.
3432 *
3433 * This will be called from ff_get_format(), after hwaccel and
3434 * hwaccel_context are set and the hwaccel private data in AVCodecInternal
3435 * is allocated.
3436 */
3437 int (*init)(AVCodecContext *avctx);
3438
3439 /**
3440 * Uninitialize the hwaccel private data.
3441 *
3442 * This will be called from get_format() or avcodec_close(), after hwaccel
3443 * and hwaccel_context are already uninitialized.
3444 */
3445 int (*uninit)(AVCodecContext *avctx);
3446
3447 /**
3448 * Size of the private data to allocate in
3449 * AVCodecInternal.hwaccel_priv_data.
3450 */
3451 int priv_data_size;
3452
3453 /**
3454 * Internal hwaccel capabilities.
3455 */
3456 int caps_internal;
3457 } AVHWAccel;
3458
3459 /**
3460 * Hardware acceleration should be used for decoding even if the codec level
3461 * used is unknown or higher than the maximum supported level reported by the
3462 * hardware driver.
3463 */
3464 #define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
3465
3466 /**
3467 * Hardware acceleration can output YUV pixel formats with a different chroma
3468 * sampling than 4:2:0 and/or other than 8 bits per component.
3469 */
3470 #define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
3471
3472 /**
3473 * @}
3474 */
3475
3476 #if FF_API_AVPICTURE
3477 /**
3478 * @defgroup lavc_picture AVPicture
3479 *
3480 * Functions for working with AVPicture
3481 * @{
3482 */
3483
3484 /**
3485 * four components are given, that's all.
3486 * the last component is alpha
3487 * @deprecated Use the imgutils functions
3488 */
3489 typedef struct AVPicture {
3490 attribute_deprecated
3491 uint8_t *data[AV_NUM_DATA_POINTERS];
3492 attribute_deprecated
3493 int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
3494 } AVPicture;
3495
3496 /**
3497 * @}
3498 */
3499 #endif
3500
3501 #define AVPALETTE_SIZE 1024
3502 #define AVPALETTE_COUNT 256
3503
3504 enum AVSubtitleType {
3505 SUBTITLE_NONE,
3506
3507 SUBTITLE_BITMAP, ///< A bitmap, pict will be set
3508
3509 /**
3510 * Plain text, the text field must be set by the decoder and is
3511 * authoritative. ass and pict fields may contain approximations.
3512 */
3513 SUBTITLE_TEXT,
3514
3515 /**
3516 * Formatted text, the ass field must be set by the decoder and is
3517 * authoritative. pict and text fields may contain approximations.
3518 */
3519 SUBTITLE_ASS,
3520 };
3521
3522 #define AV_SUBTITLE_FLAG_FORCED 0x00000001
3523
3524 typedef struct AVSubtitleRect {
3525 int x; ///< top left corner of pict, undefined when pict is not set
3526 int y; ///< top left corner of pict, undefined when pict is not set
3527 int w; ///< width of pict, undefined when pict is not set
3528 int h; ///< height of pict, undefined when pict is not set
3529 int nb_colors; ///< number of colors in pict, undefined when pict is not set
3530
3531 #if FF_API_AVPICTURE
3532 /**
3533 * @deprecated unused
3534 */
3535 attribute_deprecated
3536 AVPicture pict;
3537 #endif
3538 /**
3539 * data+linesize for the bitmap of this subtitle.
3540 * Can be set for text/ass as well once they are rendered.
3541 */
3542 uint8_t *data[4];
3543 int linesize[4];
3544
3545 enum AVSubtitleType type;
3546
3547 char *text; ///< 0 terminated plain UTF-8 text
3548
3549 /**
3550 * 0 terminated ASS/SSA compatible event line.
3551 * The presentation of this is unaffected by the other values in this
3552 * struct.
3553 */
3554 char *ass;
3555 int flags;
3556 } AVSubtitleRect;
3557
3558 typedef struct AVSubtitle {
3559 uint16_t format; /* 0 = graphics */
3560 uint32_t start_display_time; /* relative to packet pts, in ms */
3561 uint32_t end_display_time; /* relative to packet pts, in ms */
3562 unsigned num_rects;
3563 AVSubtitleRect **rects;
3564 int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
3565 } AVSubtitle;
3566
3567 /**
3568 * This struct describes the properties of an encoded stream.
3569 *
3570 * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
3571 * be allocated with avcodec_parameters_alloc() and freed with
3572 * avcodec_parameters_free().
3573 */
3574 typedef struct AVCodecParameters {
3575 /**
3576 * General type of the encoded data.
3577 */
3578 enum AVMediaType codec_type;
3579 /**
3580 * Specific type of the encoded data (the codec used).
3581 */
3582 enum AVCodecID codec_id;
3583 /**
3584 * Additional information about the codec (corresponds to the AVI FOURCC).
3585 */
3586 uint32_t codec_tag;
3587
3588 /**
3589 * Extra binary data needed for initializing the decoder, codec-dependent.
3590 *
3591 * Must be allocated with av_malloc() and will be freed by
3592 * avcodec_parameters_free(). The allocated size of extradata must be at
3593 * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
3594 * bytes zeroed.
3595 */
3596 uint8_t *extradata;
3597 /**
3598 * Size of the extradata content in bytes.
3599 */
3600 int extradata_size;
3601
3602 /**
3603 * - video: the pixel format, the value corresponds to enum AVPixelFormat.
3604 * - audio: the sample format, the value corresponds to enum AVSampleFormat.
3605 */
3606 int format;
3607
3608 /**
3609 * The average bitrate of the encoded data (in bits per second).
3610 */
3611 int bit_rate;
3612
3613 int bits_per_coded_sample;
3614
3615 /**
3616 * Codec-specific bitstream restrictions that the stream conforms to.
3617 */
3618 int profile;
3619 int level;
3620
3621 /**
3622 * Video only. The dimensions of the video frame in pixels.
3623 */
3624 int width;
3625 int height;
3626
3627 /**
3628 * Video only. The aspect ratio (width / height) which a single pixel
3629 * should have when displayed.
3630 *
3631 * When the aspect ratio is unknown / undefined, the numerator should be
3632 * set to 0 (the denominator may have any value).
3633 */
3634 AVRational sample_aspect_ratio;
3635
3636 /**
3637 * Video only. The order of the fields in interlaced video.
3638 */
3639 enum AVFieldOrder field_order;
3640
3641 /**
3642 * Video only. Additional colorspace characteristics.
3643 */
3644 enum AVColorRange color_range;
3645 enum AVColorPrimaries color_primaries;
3646 enum AVColorTransferCharacteristic color_trc;
3647 enum AVColorSpace color_space;
3648 enum AVChromaLocation chroma_location;
3649
3650 /**
3651 * Audio only. The channel layout bitmask. May be 0 if the channel layout is
3652 * unknown or unspecified, otherwise the number of bits set must be equal to
3653 * the channels field.
3654 */
3655 uint64_t channel_layout;
3656 /**
3657 * Audio only. The number of audio channels.
3658 */
3659 int channels;
3660 /**
3661 * Audio only. The number of audio samples per second.
3662 */
3663 int sample_rate;
3664 /**
3665 * Audio only. The number of bytes per coded audio frame, required by some
3666 * formats.
3667 *
3668 * Corresponds to nBlockAlign in WAVEFORMATEX.
3669 */
3670 int block_align;
3671
3672 /**
3673 * Audio only. The amount of padding (in samples) inserted by the encoder at
3674 * the beginning of the audio. I.e. this number of leading decoded samples
3675 * must be discarded by the caller to get the original audio without leading
3676 * padding.
3677 */
3678 int initial_padding;
3679 /**
3680 * Audio only. The amount of padding (in samples) appended by the encoder to
3681 * the end of the audio. I.e. this number of decoded samples must be
3682 * discarded by the caller from the end of the stream to get the original
3683 * audio without any trailing padding.
3684 */
3685 int trailing_padding;
3686 } AVCodecParameters;
3687
3688 /**
3689 * If c is NULL, returns the first registered codec,
3690 * if c is non-NULL, returns the next registered codec after c,
3691 * or NULL if c is the last one.
3692 */
3693 AVCodec *av_codec_next(const AVCodec *c);
3694
3695 /**
3696 * Return the LIBAVCODEC_VERSION_INT constant.
3697 */
3698 unsigned avcodec_version(void);
3699
3700 /**
3701 * Return the libavcodec build-time configuration.
3702 */
3703 const char *avcodec_configuration(void);
3704
3705 /**
3706 * Return the libavcodec license.
3707 */
3708 const char *avcodec_license(void);
3709
3710 /**
3711 * Register the codec codec and initialize libavcodec.
3712 *
3713 * @warning either this function or avcodec_register_all() must be called
3714 * before any other libavcodec functions.
3715 *
3716 * @see avcodec_register_all()
3717 */
3718 void avcodec_register(AVCodec *codec);
3719
3720 /**
3721 * Register all the codecs, parsers and bitstream filters which were enabled at
3722 * configuration time. If you do not call this function you can select exactly
3723 * which formats you want to support, by using the individual registration
3724 * functions.
3725 *
3726 * @see avcodec_register
3727 * @see av_register_codec_parser
3728 * @see av_register_bitstream_filter
3729 */
3730 void avcodec_register_all(void);
3731
3732 /**
3733 * Allocate an AVCodecContext and set its fields to default values. The
3734 * resulting struct should be freed with avcodec_free_context().
3735 *
3736 * @param codec if non-NULL, allocate private data and initialize defaults
3737 * for the given codec. It is illegal to then call avcodec_open2()
3738 * with a different codec.
3739 * If NULL, then the codec-specific defaults won't be initialized,
3740 * which may result in suboptimal default settings (this is
3741 * important mainly for encoders, e.g. libx264).
3742 *
3743 * @return An AVCodecContext filled with default values or NULL on failure.
3744 */
3745 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
3746
3747 /**
3748 * Free the codec context and everything associated with it and write NULL to
3749 * the provided pointer.
3750 */
3751 void avcodec_free_context(AVCodecContext **avctx);
3752
3753 #if FF_API_GET_CONTEXT_DEFAULTS
3754 /**
3755 * @deprecated This function should not be used, as closing and opening a codec
3756 * context multiple time is not supported. A new codec context should be
3757 * allocated for each new use.
3758 */
3759 int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
3760 #endif
3761
3762 /**
3763 * Get the AVClass for AVCodecContext. It can be used in combination with
3764 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
3765 *
3766 * @see av_opt_find().
3767 */
3768 const AVClass *avcodec_get_class(void);
3769
3770 #if FF_API_COPY_CONTEXT
3771 /**
3772 * Copy the settings of the source AVCodecContext into the destination
3773 * AVCodecContext. The resulting destination codec context will be
3774 * unopened, i.e. you are required to call avcodec_open2() before you
3775 * can use this AVCodecContext to decode/encode video/audio data.
3776 *
3777 * @param dest target codec context, should be initialized with
3778 * avcodec_alloc_context3(), but otherwise uninitialized
3779 * @param src source codec context
3780 * @return AVERROR() on error (e.g. memory allocation error), 0 on success
3781 *
3782 * @deprecated The semantics of this function are ill-defined and it should not
3783 * be used. If you need to transfer the stream parameters from one codec context
3784 * to another, use an intermediate AVCodecParameters instance and the
3785 * avcodec_parameters_from_context() / avcodec_parameters_to_context()
3786 * functions.
3787 */
3788 attribute_deprecated
3789 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3790 #endif
3791
3792 /**
3793 * Allocate a new AVCodecParameters and set its fields to default values
3794 * (unknown/invalid/0). The returned struct must be freed with
3795 * avcodec_parameters_free().
3796 */
3797 AVCodecParameters *avcodec_parameters_alloc(void);
3798
3799 /**
3800 * Free an AVCodecParameters instance and everything associated with it and
3801 * write NULL to the supplied pointer.
3802 */
3803 void avcodec_parameters_free(AVCodecParameters **par);
3804
3805 /**
3806 * Copy the contents of src to dst. Any allocated fields in dst are freed and
3807 * replaced with newly allocated duplicates of the corresponding fields in src.
3808 *
3809 * @return >= 0 on success, a negative AVERROR code on failure.
3810 */
3811 int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
3812
3813 /**
3814 * Fill the parameters struct based on the values from the supplied codec
3815 * context. Any allocated fields in par are freed and replaced with duplicates
3816 * of the corresponding fields in codec.
3817 *
3818 * @return >= 0 on success, a negative AVERROR code on failure
3819 */
3820 int avcodec_parameters_from_context(AVCodecParameters *par,
3821 const AVCodecContext *codec);
3822
3823 /**
3824 * Fill the codec context based on the values from the supplied codec
3825 * parameters. Any allocated fields in codec that have a corresponding field in
3826 * par are freed and replaced with duplicates of the corresponding field in par.
3827 * Fields in codec that do not have a counterpart in par are not touched.
3828 *
3829 * @return >= 0 on success, a negative AVERROR code on failure.
3830 */
3831 int avcodec_parameters_to_context(AVCodecContext *codec,
3832 const AVCodecParameters *par);
3833
3834 /**
3835 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3836 * function the context has to be allocated with avcodec_alloc_context3().
3837 *
3838 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3839 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3840 * retrieving a codec.
3841 *
3842 * @warning This function is not thread safe!
3843 *
3844 * @note Always call this function before using decoding routines (such as
3845 * @ref avcodec_receive_frame()).
3846 *
3847 * @code
3848 * avcodec_register_all();
3849 * av_dict_set(&opts, "b", "2.5M", 0);
3850 * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
3851 * if (!codec)
3852 * exit(1);
3853 *
3854 * context = avcodec_alloc_context3(codec);
3855 *
3856 * if (avcodec_open2(context, codec, opts) < 0)
3857 * exit(1);
3858 * @endcode
3859 *
3860 * @param avctx The context to initialize.
3861 * @param codec The codec to open this context for. If a non-NULL codec has been
3862 * previously passed to avcodec_alloc_context3() or
3863 * for this context, then this parameter MUST be either NULL or
3864 * equal to the previously passed codec.
3865 * @param options A dictionary filled with AVCodecContext and codec-private options.
3866 * On return this object will be filled with options that were not found.
3867 *
3868 * @return zero on success, a negative value on error
3869 * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
3870 * av_dict_set(), av_opt_find().
3871 */
3872 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
3873
3874 /**
3875 * Close a given AVCodecContext and free all the data associated with it
3876 * (but not the AVCodecContext itself).