1 /*
2  * copyright (c) 2001 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg 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  * FFmpeg 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 FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 module ffmpeg.libavcodec.avcodec;
22 
23 import std.stdint;
24 import core.vararg;
25 
26 //#include <errno.h>
27 import ffmpeg.libavutil.samplefmt; //#include "libavutil/samplefmt.h"
28 //#include "libavutil/attributes.h"
29 import ffmpeg.libavutil.avutil; //#include "libavutil/avutil.h"
30 import ffmpeg.libavutil.buffer; //#include "libavutil/buffer.h"
31 //#include "libavutil/cpu.h"
32 import ffmpeg.libavutil.channel_layout; //#include "libavutil/channel_layout.h"
33 import ffmpeg.libavutil.dict; //#include "libavutil/dict.h"
34 import ffmpeg.libavutil.frame; //#include "libavutil/frame.h"
35 import ffmpeg.libavutil.log; //#include "libavutil/log.h"
36 import ffmpeg.libavutil.pixfmt; //#include "libavutil/pixfmt.h"
37 import ffmpeg.libavutil.rational; //#include "libavutil/rational.h"
38 
39 import ffmpeg.libavcodec.avcodec_version; //#include "version.h"
40 
41 @nogc nothrow extern(C):
42 
43 /**
44  * @defgroup libavc Encoding/Decoding Library
45  * @{
46  *
47  * @defgroup lavc_decoding Decoding
48  * @{
49  * @}
50  *
51  * @defgroup lavc_encoding Encoding
52  * @{
53  * @}
54  *
55  * @defgroup lavc_codec Codecs
56  * @{
57  * @defgroup lavc_codec_native Native Codecs
58  * @{
59  * @}
60  * @defgroup lavc_codec_wrappers External library wrappers
61  * @{
62  * @}
63  * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
64  * @{
65  * @}
66  * @}
67  * @defgroup lavc_internal Internal
68  * @{
69  * @}
70  * @}
71  *
72  */
73 
74 /**
75  * @defgroup lavc_core Core functions/structures.
76  * @ingroup libavc
77  *
78  * Basic definitions, functions for querying libavcodec capabilities,
79  * allocating core structures, etc.
80  * @{
81  */
82 
83 
84 
85 /**
86  * Identify the syntax and semantics of the bitstream.
87  * The principle is roughly:
88  * Two decoders with the same ID can decode the same streams.
89  * Two encoders with the same ID can encode compatible streams.
90  * There may be slight deviations from the principle due to implementation
91  * details.
92  *
93  * If you add a codec ID to this list, add it so that
94  * 1. no value of a existing codec ID changes (that would break ABI),
95  * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec.
96  *    This ensures that 2 forks can independently add AVCodecIDs without producing conflicts.
97  *
98  * After adding new codec IDs, do not forget to add an entry to the codec
99  * descriptor list and bump libavcodec minor version.
100  */
101 enum AVCodecID {
102     AV_CODEC_ID_NONE,
103 
104     /* video codecs */
105     AV_CODEC_ID_MPEG1VIDEO,
106     AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
107 //if(FF_API_XVMC) { - Always assume XVMC is available
108     AV_CODEC_ID_MPEG2VIDEO_XVMC,
109 //}
110     AV_CODEC_ID_H261,
111     AV_CODEC_ID_H263,
112     AV_CODEC_ID_RV10,
113     AV_CODEC_ID_RV20,
114     AV_CODEC_ID_MJPEG,
115     AV_CODEC_ID_MJPEGB,
116     AV_CODEC_ID_LJPEG,
117     AV_CODEC_ID_SP5X,
118     AV_CODEC_ID_JPEGLS,
119     AV_CODEC_ID_MPEG4,
120     AV_CODEC_ID_RAWVIDEO,
121     AV_CODEC_ID_MSMPEG4V1,
122     AV_CODEC_ID_MSMPEG4V2,
123     AV_CODEC_ID_MSMPEG4V3,
124     AV_CODEC_ID_WMV1,
125     AV_CODEC_ID_WMV2,
126     AV_CODEC_ID_H263P,
127     AV_CODEC_ID_H263I,
128     AV_CODEC_ID_FLV1,
129     AV_CODEC_ID_SVQ1,
130     AV_CODEC_ID_SVQ3,
131     AV_CODEC_ID_DVVIDEO,
132     AV_CODEC_ID_HUFFYUV,
133     AV_CODEC_ID_CYUV,
134     AV_CODEC_ID_H264,
135     AV_CODEC_ID_INDEO3,
136     AV_CODEC_ID_VP3,
137     AV_CODEC_ID_THEORA,
138     AV_CODEC_ID_ASV1,
139     AV_CODEC_ID_ASV2,
140     AV_CODEC_ID_FFV1,
141     AV_CODEC_ID_4XM,
142     AV_CODEC_ID_VCR1,
143     AV_CODEC_ID_CLJR,
144     AV_CODEC_ID_MDEC,
145     AV_CODEC_ID_ROQ,
146     AV_CODEC_ID_INTERPLAY_VIDEO,
147     AV_CODEC_ID_XAN_WC3,
148     AV_CODEC_ID_XAN_WC4,
149     AV_CODEC_ID_RPZA,
150     AV_CODEC_ID_CINEPAK,
151     AV_CODEC_ID_WS_VQA,
152     AV_CODEC_ID_MSRLE,
153     AV_CODEC_ID_MSVIDEO1,
154     AV_CODEC_ID_IDCIN,
155     AV_CODEC_ID_8BPS,
156     AV_CODEC_ID_SMC,
157     AV_CODEC_ID_FLIC,
158     AV_CODEC_ID_TRUEMOTION1,
159     AV_CODEC_ID_VMDVIDEO,
160     AV_CODEC_ID_MSZH,
161     AV_CODEC_ID_ZLIB,
162     AV_CODEC_ID_QTRLE,
163     AV_CODEC_ID_TSCC,
164     AV_CODEC_ID_ULTI,
165     AV_CODEC_ID_QDRAW,
166     AV_CODEC_ID_VIXL,
167     AV_CODEC_ID_QPEG,
168     AV_CODEC_ID_PNG,
169     AV_CODEC_ID_PPM,
170     AV_CODEC_ID_PBM,
171     AV_CODEC_ID_PGM,
172     AV_CODEC_ID_PGMYUV,
173     AV_CODEC_ID_PAM,
174     AV_CODEC_ID_FFVHUFF,
175     AV_CODEC_ID_RV30,
176     AV_CODEC_ID_RV40,
177     AV_CODEC_ID_VC1,
178     AV_CODEC_ID_WMV3,
179     AV_CODEC_ID_LOCO,
180     AV_CODEC_ID_WNV1,
181     AV_CODEC_ID_AASC,
182     AV_CODEC_ID_INDEO2,
183     AV_CODEC_ID_FRAPS,
184     AV_CODEC_ID_TRUEMOTION2,
185     AV_CODEC_ID_BMP,
186     AV_CODEC_ID_CSCD,
187     AV_CODEC_ID_MMVIDEO,
188     AV_CODEC_ID_ZMBV,
189     AV_CODEC_ID_AVS,
190     AV_CODEC_ID_SMACKVIDEO,
191     AV_CODEC_ID_NUV,
192     AV_CODEC_ID_KMVC,
193     AV_CODEC_ID_FLASHSV,
194     AV_CODEC_ID_CAVS,
195     AV_CODEC_ID_JPEG2000,
196     AV_CODEC_ID_VMNC,
197     AV_CODEC_ID_VP5,
198     AV_CODEC_ID_VP6,
199     AV_CODEC_ID_VP6F,
200     AV_CODEC_ID_TARGA,
201     AV_CODEC_ID_DSICINVIDEO,
202     AV_CODEC_ID_TIERTEXSEQVIDEO,
203     AV_CODEC_ID_TIFF,
204     AV_CODEC_ID_GIF,
205     AV_CODEC_ID_DXA,
206     AV_CODEC_ID_DNXHD,
207     AV_CODEC_ID_THP,
208     AV_CODEC_ID_SGI,
209     AV_CODEC_ID_C93,
210     AV_CODEC_ID_BETHSOFTVID,
211     AV_CODEC_ID_PTX,
212     AV_CODEC_ID_TXD,
213     AV_CODEC_ID_VP6A,
214     AV_CODEC_ID_AMV,
215     AV_CODEC_ID_VB,
216     AV_CODEC_ID_PCX,
217     AV_CODEC_ID_SUNRAST,
218     AV_CODEC_ID_INDEO4,
219     AV_CODEC_ID_INDEO5,
220     AV_CODEC_ID_MIMIC,
221     AV_CODEC_ID_RL2,
222     AV_CODEC_ID_ESCAPE124,
223     AV_CODEC_ID_DIRAC,
224     AV_CODEC_ID_BFI,
225     AV_CODEC_ID_CMV,
226     AV_CODEC_ID_MOTIONPIXELS,
227     AV_CODEC_ID_TGV,
228     AV_CODEC_ID_TGQ,
229     AV_CODEC_ID_TQI,
230     AV_CODEC_ID_AURA,
231     AV_CODEC_ID_AURA2,
232     AV_CODEC_ID_V210X,
233     AV_CODEC_ID_TMV,
234     AV_CODEC_ID_V210,
235     AV_CODEC_ID_DPX,
236     AV_CODEC_ID_MAD,
237     AV_CODEC_ID_FRWU,
238     AV_CODEC_ID_FLASHSV2,
239     AV_CODEC_ID_CDGRAPHICS,
240     AV_CODEC_ID_R210,
241     AV_CODEC_ID_ANM,
242     AV_CODEC_ID_BINKVIDEO,
243     AV_CODEC_ID_IFF_ILBM,
244 //#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
245     AV_CODEC_ID_KGV1,
246     AV_CODEC_ID_YOP,
247     AV_CODEC_ID_VP8,
248     AV_CODEC_ID_PICTOR,
249     AV_CODEC_ID_ANSI,
250     AV_CODEC_ID_A64_MULTI,
251     AV_CODEC_ID_A64_MULTI5,
252     AV_CODEC_ID_R10K,
253     AV_CODEC_ID_MXPEG,
254     AV_CODEC_ID_LAGARITH,
255     AV_CODEC_ID_PRORES,
256     AV_CODEC_ID_JV,
257     AV_CODEC_ID_DFA,
258     AV_CODEC_ID_WMV3IMAGE,
259     AV_CODEC_ID_VC1IMAGE,
260     AV_CODEC_ID_UTVIDEO,
261     AV_CODEC_ID_BMV_VIDEO,
262     AV_CODEC_ID_VBLE,
263     AV_CODEC_ID_DXTORY,
264     AV_CODEC_ID_V410,
265     AV_CODEC_ID_XWD,
266     AV_CODEC_ID_CDXL,
267     AV_CODEC_ID_XBM,
268     AV_CODEC_ID_ZEROCODEC,
269     AV_CODEC_ID_MSS1,
270     AV_CODEC_ID_MSA1,
271     AV_CODEC_ID_TSCC2,
272     AV_CODEC_ID_MTS2,
273     AV_CODEC_ID_CLLC,
274     AV_CODEC_ID_MSS2,
275     AV_CODEC_ID_VP9,
276     AV_CODEC_ID_AIC,
277     AV_CODEC_ID_ESCAPE130,
278     AV_CODEC_ID_G2M,
279     AV_CODEC_ID_WEBP,
280     AV_CODEC_ID_HNM4_VIDEO,
281     AV_CODEC_ID_HEVC,
282 //#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
283     AV_CODEC_ID_FIC,
284     AV_CODEC_ID_ALIAS_PIX,
285     AV_CODEC_ID_BRENDER_PIX,
286     AV_CODEC_ID_PAF_VIDEO,
287     AV_CODEC_ID_EXR,
288     AV_CODEC_ID_VP7,
289     AV_CODEC_ID_SANM,
290     AV_CODEC_ID_SGIRLE,
291     AV_CODEC_ID_MVC1,
292     AV_CODEC_ID_MVC2,
293     AV_CODEC_ID_HQX,
294     AV_CODEC_ID_TDSC,
295     AV_CODEC_ID_HQ_HQA,
296     AV_CODEC_ID_HAP,
297     AV_CODEC_ID_DDS,
298     AV_CODEC_ID_DXV,
299     AV_CODEC_ID_SCREENPRESSO,
300     AV_CODEC_ID_RSCC,
301 
302     AV_CODEC_ID_Y41P = 0x8000,
303     AV_CODEC_ID_AVRP,
304     AV_CODEC_ID_012V,
305     AV_CODEC_ID_AVUI,
306     AV_CODEC_ID_AYUV,
307     AV_CODEC_ID_TARGA_Y216,
308     AV_CODEC_ID_V308,
309     AV_CODEC_ID_V408,
310     AV_CODEC_ID_YUV4,
311     AV_CODEC_ID_AVRN,
312     AV_CODEC_ID_CPIA,
313     AV_CODEC_ID_XFACE,
314     AV_CODEC_ID_SNOW,
315     AV_CODEC_ID_SMVJPEG,
316     AV_CODEC_ID_APNG,
317     AV_CODEC_ID_DAALA,
318     AV_CODEC_ID_CFHD,
319 
320     /* various PCM "codecs" */
321     AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
322     AV_CODEC_ID_PCM_S16LE = 0x10000,
323     AV_CODEC_ID_PCM_S16BE,
324     AV_CODEC_ID_PCM_U16LE,
325     AV_CODEC_ID_PCM_U16BE,
326     AV_CODEC_ID_PCM_S8,
327     AV_CODEC_ID_PCM_U8,
328     AV_CODEC_ID_PCM_MULAW,
329     AV_CODEC_ID_PCM_ALAW,
330     AV_CODEC_ID_PCM_S32LE,
331     AV_CODEC_ID_PCM_S32BE,
332     AV_CODEC_ID_PCM_U32LE,
333     AV_CODEC_ID_PCM_U32BE,
334     AV_CODEC_ID_PCM_S24LE,
335     AV_CODEC_ID_PCM_S24BE,
336     AV_CODEC_ID_PCM_U24LE,
337     AV_CODEC_ID_PCM_U24BE,
338     AV_CODEC_ID_PCM_S24DAUD,
339     AV_CODEC_ID_PCM_ZORK,
340     AV_CODEC_ID_PCM_S16LE_PLANAR,
341     AV_CODEC_ID_PCM_DVD,
342     AV_CODEC_ID_PCM_F32BE,
343     AV_CODEC_ID_PCM_F32LE,
344     AV_CODEC_ID_PCM_F64BE,
345     AV_CODEC_ID_PCM_F64LE,
346     AV_CODEC_ID_PCM_BLURAY,
347     AV_CODEC_ID_PCM_LXF,
348     AV_CODEC_ID_S302M,
349     AV_CODEC_ID_PCM_S8_PLANAR,
350     AV_CODEC_ID_PCM_S24LE_PLANAR,
351     AV_CODEC_ID_PCM_S32LE_PLANAR,
352     AV_CODEC_ID_PCM_S16BE_PLANAR,
353     /* new PCM "codecs" should be added right below this line starting with
354      * an explicit value of for example 0x10800
355      */
356 
357     /* various ADPCM codecs */
358     AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
359     AV_CODEC_ID_ADPCM_IMA_WAV,
360     AV_CODEC_ID_ADPCM_IMA_DK3,
361     AV_CODEC_ID_ADPCM_IMA_DK4,
362     AV_CODEC_ID_ADPCM_IMA_WS,
363     AV_CODEC_ID_ADPCM_IMA_SMJPEG,
364     AV_CODEC_ID_ADPCM_MS,
365     AV_CODEC_ID_ADPCM_4XM,
366     AV_CODEC_ID_ADPCM_XA,
367     AV_CODEC_ID_ADPCM_ADX,
368     AV_CODEC_ID_ADPCM_EA,
369     AV_CODEC_ID_ADPCM_G726,
370     AV_CODEC_ID_ADPCM_CT,
371     AV_CODEC_ID_ADPCM_SWF,
372     AV_CODEC_ID_ADPCM_YAMAHA,
373     AV_CODEC_ID_ADPCM_SBPRO_4,
374     AV_CODEC_ID_ADPCM_SBPRO_3,
375     AV_CODEC_ID_ADPCM_SBPRO_2,
376     AV_CODEC_ID_ADPCM_THP,
377     AV_CODEC_ID_ADPCM_IMA_AMV,
378     AV_CODEC_ID_ADPCM_EA_R1,
379     AV_CODEC_ID_ADPCM_EA_R3,
380     AV_CODEC_ID_ADPCM_EA_R2,
381     AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
382     AV_CODEC_ID_ADPCM_IMA_EA_EACS,
383     AV_CODEC_ID_ADPCM_EA_XAS,
384     AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
385     AV_CODEC_ID_ADPCM_IMA_ISS,
386     AV_CODEC_ID_ADPCM_G722,
387     AV_CODEC_ID_ADPCM_IMA_APC,
388     AV_CODEC_ID_ADPCM_VIMA,
389 //#if FF_API_VIMA_DECODER // - Always assume VIMA is available
390     AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA,
391 //#endif
392 
393     AV_CODEC_ID_ADPCM_AFC = 0x11800,
394     AV_CODEC_ID_ADPCM_IMA_OKI,
395     AV_CODEC_ID_ADPCM_DTK,
396     AV_CODEC_ID_ADPCM_IMA_RAD,
397     AV_CODEC_ID_ADPCM_G726LE,
398     AV_CODEC_ID_ADPCM_THP_LE,
399     AV_CODEC_ID_ADPCM_PSX,
400     AV_CODEC_ID_ADPCM_AICA,
401 
402     /* AMR */
403     AV_CODEC_ID_AMR_NB = 0x12000,
404     AV_CODEC_ID_AMR_WB,
405 
406     /* RealAudio codecs*/
407     AV_CODEC_ID_RA_144 = 0x13000,
408     AV_CODEC_ID_RA_288,
409 
410     /* various DPCM codecs */
411     AV_CODEC_ID_ROQ_DPCM = 0x14000,
412     AV_CODEC_ID_INTERPLAY_DPCM,
413     AV_CODEC_ID_XAN_DPCM,
414     AV_CODEC_ID_SOL_DPCM,
415 
416     AV_CODEC_ID_SDX2_DPCM = 0x14800,
417 
418     /* audio codecs */
419     AV_CODEC_ID_MP2 = 0x15000,
420     AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
421     AV_CODEC_ID_AAC,
422     AV_CODEC_ID_AC3,
423     AV_CODEC_ID_DTS,
424     AV_CODEC_ID_VORBIS,
425     AV_CODEC_ID_DVAUDIO,
426     AV_CODEC_ID_WMAV1,
427     AV_CODEC_ID_WMAV2,
428     AV_CODEC_ID_MACE3,
429     AV_CODEC_ID_MACE6,
430     AV_CODEC_ID_VMDAUDIO,
431     AV_CODEC_ID_FLAC,
432     AV_CODEC_ID_MP3ADU,
433     AV_CODEC_ID_MP3ON4,
434     AV_CODEC_ID_SHORTEN,
435     AV_CODEC_ID_ALAC,
436     AV_CODEC_ID_WESTWOOD_SND1,
437     AV_CODEC_ID_GSM, ///< as in Berlin toast format
438     AV_CODEC_ID_QDM2,
439     AV_CODEC_ID_COOK,
440     AV_CODEC_ID_TRUESPEECH,
441     AV_CODEC_ID_TTA,
442     AV_CODEC_ID_SMACKAUDIO,
443     AV_CODEC_ID_QCELP,
444     AV_CODEC_ID_WAVPACK,
445     AV_CODEC_ID_DSICINAUDIO,
446     AV_CODEC_ID_IMC,
447     AV_CODEC_ID_MUSEPACK7,
448     AV_CODEC_ID_MLP,
449     AV_CODEC_ID_GSM_MS, /* as found in WAV */
450     AV_CODEC_ID_ATRAC3,
451 //#if FF_API_VOXWARE // - Always assume VOXWARE is available
452     AV_CODEC_ID_VOXWARE,
453 //#endif
454     AV_CODEC_ID_APE,
455     AV_CODEC_ID_NELLYMOSER,
456     AV_CODEC_ID_MUSEPACK8,
457     AV_CODEC_ID_SPEEX,
458     AV_CODEC_ID_WMAVOICE,
459     AV_CODEC_ID_WMAPRO,
460     AV_CODEC_ID_WMALOSSLESS,
461     AV_CODEC_ID_ATRAC3P,
462     AV_CODEC_ID_EAC3,
463     AV_CODEC_ID_SIPR,
464     AV_CODEC_ID_MP1,
465     AV_CODEC_ID_TWINVQ,
466     AV_CODEC_ID_TRUEHD,
467     AV_CODEC_ID_MP4ALS,
468     AV_CODEC_ID_ATRAC1,
469     AV_CODEC_ID_BINKAUDIO_RDFT,
470     AV_CODEC_ID_BINKAUDIO_DCT,
471     AV_CODEC_ID_AAC_LATM,
472     AV_CODEC_ID_QDMC,
473     AV_CODEC_ID_CELT,
474     AV_CODEC_ID_G723_1,
475     AV_CODEC_ID_G729,
476     AV_CODEC_ID_8SVX_EXP,
477     AV_CODEC_ID_8SVX_FIB,
478     AV_CODEC_ID_BMV_AUDIO,
479     AV_CODEC_ID_RALF,
480     AV_CODEC_ID_IAC,
481     AV_CODEC_ID_ILBC,
482     AV_CODEC_ID_OPUS,
483     AV_CODEC_ID_COMFORT_NOISE,
484     AV_CODEC_ID_TAK,
485     AV_CODEC_ID_METASOUND,
486     AV_CODEC_ID_PAF_AUDIO,
487     AV_CODEC_ID_ON2AVC,
488     AV_CODEC_ID_DSS_SP,
489 
490     AV_CODEC_ID_FFWAVESYNTH = 0x15800,
491     AV_CODEC_ID_SONIC,
492     AV_CODEC_ID_SONIC_LS,
493     AV_CODEC_ID_EVRC,
494     AV_CODEC_ID_SMV,
495     AV_CODEC_ID_DSD_LSBF,
496     AV_CODEC_ID_DSD_MSBF,
497     AV_CODEC_ID_DSD_LSBF_PLANAR,
498     AV_CODEC_ID_DSD_MSBF_PLANAR,
499     AV_CODEC_ID_4GV,
500     AV_CODEC_ID_INTERPLAY_ACM,
501     AV_CODEC_ID_XMA1,
502     AV_CODEC_ID_XMA2,
503     AV_CODEC_ID_DST,
504 
505     /* subtitle codecs */
506     AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
507     AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
508     AV_CODEC_ID_DVB_SUBTITLE,
509     AV_CODEC_ID_TEXT,  ///< raw UTF-8 text
510     AV_CODEC_ID_XSUB,
511     AV_CODEC_ID_SSA,
512     AV_CODEC_ID_MOV_TEXT,
513     AV_CODEC_ID_HDMV_PGS_SUBTITLE,
514     AV_CODEC_ID_DVB_TELETEXT,
515     AV_CODEC_ID_SRT,
516 
517     AV_CODEC_ID_MICRODVD   = 0x17800,
518     AV_CODEC_ID_EIA_608,
519     AV_CODEC_ID_JACOSUB,
520     AV_CODEC_ID_SAMI,
521     AV_CODEC_ID_REALTEXT,
522     AV_CODEC_ID_STL,
523     AV_CODEC_ID_SUBVIEWER1,
524     AV_CODEC_ID_SUBVIEWER,
525     AV_CODEC_ID_SUBRIP,
526     AV_CODEC_ID_WEBVTT,
527     AV_CODEC_ID_MPL2,
528     AV_CODEC_ID_VPLAYER,
529     AV_CODEC_ID_PJS,
530     AV_CODEC_ID_ASS,
531     AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
532 
533     /* other specific kind of codecs (generally used for attachments) */
534     AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
535     AV_CODEC_ID_TTF = 0x18000,
536 
537     AV_CODEC_ID_BINTEXT    = 0x18800,
538     AV_CODEC_ID_XBIN,
539     AV_CODEC_ID_IDF,
540     AV_CODEC_ID_OTF,
541     AV_CODEC_ID_SMPTE_KLV,
542     AV_CODEC_ID_DVD_NAV,
543     AV_CODEC_ID_TIMED_ID3,
544     AV_CODEC_ID_BIN_DATA,
545 
546 
547     AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
548 
549     AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
550                                 * stream (only used by libavformat) */
551     AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
552                                 * stream (only used by libavformat) */
553     AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
554     AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
555 }
556 
557 /**
558  * This struct describes the properties of a single codec described by an
559  * AVCodecID.
560  * @see avcodec_get_descriptor()
561  */
562 struct AVCodecDescriptor {
563     AVCodecID     id;
564     AVMediaType type;
565     /**
566      * Name of the codec described by this descriptor. It is non-empty and
567      * unique for each codec descriptor. It should contain alphanumeric
568      * characters and '_' only.
569      */
570     const char      *name;
571     /**
572      * A more descriptive name for this codec. May be NULL.
573      */
574     const char *long_name;
575     /**
576      * Codec properties, a combination of AV_CODEC_PROP_* flags.
577      */
578     int             props;
579 
580     /**
581      * MIME type(s) associated with the codec.
582      * May be NULL; if not, a NULL-terminated array of MIME types.
583      * The first item is always non-NULL and is the preferred MIME type.
584      */
585     const char *mime_types;
586 
587     const AVProfile *profiles;
588 } 
589 
590 /**
591  * Codec uses only intra compression.
592  * Video codecs only.
593  */
594 enum AV_CODEC_PROP_INTRA_ONLY =  (1 << 0);
595 /**
596  * Codec supports lossy compression. Audio and video codecs only.
597  * @note a codec may support both lossy and lossless
598  * compression modes
599  */
600 enum AV_CODEC_PROP_LOSSY   =     (1 << 1);
601 /**
602  * Codec supports lossless compression. Audio and video codecs only.
603  */
604 enum AV_CODEC_PROP_LOSSLESS  =   (1 << 2);
605 /**
606  * Codec supports frame reordering. That is, the coded order (the order in which
607  * the encoded packets are output by the encoders / stored / input to the
608  * decoders) may be different from the presentation order of the corresponding
609  * frames.
610  *
611  * For codecs that do not have this property set, PTS and DTS should always be
612  * equal.
613  */
614 enum AV_CODEC_PROP_REORDER   =   (1 << 3);
615 /**
616  * Subtitle codec is bitmap based
617  * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
618  */
619 enum AV_CODEC_PROP_BITMAP_SUB =  (1 << 16);
620 /**
621  * Subtitle codec is text based.
622  * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
623  */
624 enum AV_CODEC_PROP_TEXT_SUB   =  (1 << 17);
625 
626 /**
627  * @ingroup lavc_decoding
628  * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
629  * This is mainly needed because some optimized bitstream readers read
630  * 32 or 64 bit at once and could read over the end.<br>
631  * Note: If the first 23 bits of the additional bytes are not 0, then damaged
632  * MPEG bitstreams could cause overread and segfault.
633  */
634 enum AV_INPUT_BUFFER_PADDING_SIZE = 32;
635 
636 /**
637  * @ingroup lavc_encoding
638  * minimum encoding buffer size
639  * Used to avoid some checks during header writing.
640  */
641 enum AV_INPUT_BUFFER_MIN_SIZE = 16384;
642 
643 static if(FF_API_WITHOUT_PREFIX){
644     /**
645      * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead
646      */
647     enum FF_INPUT_BUFFER_PADDING_SIZE = 32;
648 
649     /**
650      * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead
651      */
652     enum FF_MIN_BUFFER_SIZE = 16384;
653 }
654 
655 
656 
657 static if(FF_API_MOTION_EST){
658     /**
659      * @ingroup lavc_encoding
660      * motion estimation type.
661      * @deprecated use codec private option instead
662      */
663     enum Motion_Est_ID {
664         ME_ZERO = 1,    ///< no search, that is use 0,0 vector whenever one is needed
665         ME_FULL,
666         ME_LOG,
667         ME_PHODS,
668         ME_EPZS,        ///< enhanced predictive zonal search
669         ME_X1,          ///< reserved for experiments
670         ME_HEX,         ///< hexagon based search
671         ME_UMH,         ///< uneven multi-hexagon search
672         ME_TESA,        ///< transformed exhaustive search algorithm
673         ME_ITER=50,     ///< iterative search
674     };
675 }
676 
677 
678 /**
679  * @ingroup lavc_decoding
680  */
681 enum AVDiscard{
682     /* We leave some space between them for extensions (drop some
683      * keyframes for intra-only or drop just some bidir frames). */
684     AVDISCARD_NONE    =-16, ///< discard nothing
685     AVDISCARD_DEFAULT =  0, ///< discard useless packets like 0 size packets in avi
686     AVDISCARD_NONREF  =  8, ///< discard all non reference
687     AVDISCARD_BIDIR   = 16, ///< discard all bidirectional frames
688     AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
689     AVDISCARD_NONKEY  = 32, ///< discard all frames except keyframes
690     AVDISCARD_ALL     = 48, ///< discard all
691 }
692 
693 enum AVAudioServiceType {
694     AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
695     AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
696     AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
697     AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
698     AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
699     AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
700     AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
701     AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
702     AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
703     AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
704 }
705 
706 /**
707  * @ingroup lavc_encoding
708  */
709 struct RcOverride{
710     int start_frame;
711     int end_frame;
712     int qscale; // If this is 0 then quality_factor will be used instead.
713     float quality_factor;
714 }
715 
716 static if (FF_API_MAX_BFRAMES) {
717     /**
718      * @deprecated there is no libavcodec-wide limit on the number of B-frames
719      */
720         enum FF_MAX_B_FRAMES = 16;
721 }
722 
723 /* encoding support
724    These flags can be passed in AVCodecContext.flags before initialization.
725    Note: Not everything is supported yet.
726 */
727 
728 /**
729  * Allow decoders to produce frames with data planes that are not aligned
730  * to CPU requirements (e.g. due to cropping).
731  */
732 enum AV_CODEC_FLAG_UNALIGNED      = (1 <<  0);
733 /**
734  * Use fixed qscale.
735  */
736 enum AV_CODEC_FLAG_QSCALE         = (1 <<  1);
737 /**
738  * 4 MV per MB allowed / advanced prediction for H.263.
739  */
740 enum AV_CODEC_FLAG_4MV            = (1 <<  2);
741 /**
742  * Output even those frames that might be corrupted.
743  */
744 enum AV_CODEC_FLAG_OUTPUT_CORRUPT = (1 <<  3);
745 /**
746  * Use qpel MC.
747  */
748 enum AV_CODEC_FLAG_QPEL           = (1 <<  4);
749 /**
750  * Use internal 2pass ratecontrol in first pass mode.
751  */
752 enum AV_CODEC_FLAG_PASS1          = (1 <<  9);
753 /**
754  * Use internal 2pass ratecontrol in second pass mode.
755  */
756 enum AV_CODEC_FLAG_PASS2          = (1 << 10);
757 /**
758  * loop filter.
759  */
760 enum AV_CODEC_FLAG_LOOP_FILTER    = (1 << 11);
761 /**
762  * Only decode/encode grayscale.
763  */
764 enum AV_CODEC_FLAG_GRAY           = (1 << 13);
765 /**
766  * error[?] variables will be set during encoding.
767  */
768 enum AV_CODEC_FLAG_PSNR           = (1 << 15);
769 /**
770  * Input bitstream might be truncated at a random location
771  * instead of only at frame boundaries.
772  */
773 enum AV_CODEC_FLAG_TRUNCATED      = (1 << 16);
774 /**
775  * Use interlaced DCT.
776  */
777 enum AV_CODEC_FLAG_INTERLACED_DCT = (1 << 18);
778 /**
779  * Force low delay.
780  */
781 enum AV_CODEC_FLAG_LOW_DELAY      = (1 << 19);
782 /**
783  * Place global headers in extradata instead of every keyframe.
784  */
785 enum AV_CODEC_FLAG_GLOBAL_HEADER  = (1 << 22);
786 /**
787  * Use only bitexact stuff (except (I)DCT).
788  */
789 enum AV_CODEC_FLAG_BITEXACT       = (1 << 23);
790 /* Fx : Flag for H.263+ extra options */
791 /**
792  * H.263 advanced intra coding / MPEG-4 AC prediction
793  */
794 enum AV_CODEC_FLAG_AC_PRED        = (1 << 24);
795 /**
796  * interlaced motion estimation
797  */
798 enum AV_CODEC_FLAG_INTERLACED_ME  = (1 << 29);
799 enum AV_CODEC_FLAG_CLOSED_GOP     = (1U << 31);
800 
801 /**
802  * Allow non spec compliant speedup tricks.
803  */
804 enum AV_CODEC_FLAG2_FAST          = (1 <<  0);
805 /**
806  * Skip bitstream encoding.
807  */
808 enum AV_CODEC_FLAG2_NO_OUTPUT     = (1 <<  2);
809 /**
810  * Place global headers at every keyframe instead of in extradata.
811  */
812 enum AV_CODEC_FLAG2_LOCAL_HEADER  = (1 <<  3);
813 
814 /**
815  * timecode is in drop frame format. DEPRECATED!!!!
816  */
817 enum AV_CODEC_FLAG2_DROP_FRAME_TIMECODE = (1 << 13);
818 
819 /**
820  * Input bitstream might be truncated at a packet boundaries
821  * instead of only at frame boundaries.
822  */
823 enum AV_CODEC_FLAG2_CHUNKS        = (1 << 15);
824 /**
825  * Discard cropping information from SPS.
826  */
827 enum AV_CODEC_FLAG2_IGNORE_CROP   = (1 << 16);
828 
829 /**
830  * Show all frames before the first keyframe
831  */
832 enum AV_CODEC_FLAG2_SHOW_ALL      = (1 << 22);
833 /**
834  * Export motion vectors through frame side data
835  */
836 enum AV_CODEC_FLAG2_EXPORT_MVS    = (1 << 28);
837 /**
838  * Do not skip samples and export skip information as frame side data
839  */
840 enum AV_CODEC_FLAG2_SKIP_MANUAL   = (1 << 29);
841 
842 /* Unsupported options :
843  *              Syntax Arithmetic coding (SAC)
844  *              Reference Picture Selection
845  *              Independent Segment Decoding */
846 /* /Fx */
847 /* codec capabilities */
848 
849 /**
850  * Decoder can use draw_horiz_band callback.
851  */
852 enum AV_CODEC_CAP_DRAW_HORIZ_BAND    = (1 <<  0);
853 /**
854  * Codec uses get_buffer() for allocating buffers and supports custom allocators.
855  * If not set, it might not use get_buffer() at all or use operations that
856  * assume the buffer was allocated by avcodec_default_get_buffer.
857  */
858 enum AV_CODEC_CAP_DR1                = (1 <<  1);
859 enum AV_CODEC_CAP_TRUNCATED          = (1 <<  3);
860 /**
861  * Encoder or decoder requires flushing with NULL input at the end in order to
862  * give the complete and correct output.
863  *
864  * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
865  *       with NULL data. The user can still send NULL data to the public encode
866  *       or decode function, but libavcodec will not pass it along to the codec
867  *       unless this flag is set.
868  *
869  * Decoders:
870  * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
871  * avpkt->size=0 at the end to get the delayed data until the decoder no longer
872  * returns frames.
873  *
874  * Encoders:
875  * The encoder needs to be fed with NULL data at the end of encoding until the
876  * encoder no longer returns data.
877  *
878  * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
879  *       flag also means that the encoder must set the pts and duration for
880  *       each output packet. If this flag is not set, the pts and duration will
881  *       be determined by libavcodec from the input frame.
882  */
883 enum AV_CODEC_CAP_DELAY              = (1 <<  5);
884 /**
885  * Codec can be fed a final frame with a smaller size.
886  * This can be used to prevent truncation of the last audio samples.
887  */
888 enum AV_CODEC_CAP_SMALL_LAST_FRAME   = (1 <<  6);
889 
890 static if (FF_API_CAP_VDPAU){
891     /**
892      * Codec can export data for HW decoding (VDPAU).
893      */
894     enum AV_CODEC_CAP_HWACCEL_VDPAU      = (1 <<  7);
895 }
896 
897 /**
898  * Codec can output multiple frames per AVPacket
899  * Normally demuxers return one frame at a time, demuxers which do not do
900  * are connected to a parser to split what they return into proper frames.
901  * This flag is reserved to the very rare category of codecs which have a
902  * bitstream that cannot be split into frames without timeconsuming
903  * operations like full decoding. Demuxers carrying such bitstreams thus
904  * may return multiple frames in a packet. This has many disadvantages like
905  * prohibiting stream copy in many cases thus it should only be considered
906  * as a last resort.
907  */
908 enum AV_CODEC_CAP_SUBFRAMES          = (1 <<  8);
909 /**
910  * Codec is experimental and is thus avoided in favor of non experimental
911  * encoders
912  */
913 enum AV_CODEC_CAP_EXPERIMENTAL       = (1 <<  9);
914 /**
915  * Codec should fill in channel configuration and samplerate instead of container
916  */
917 enum AV_CODEC_CAP_CHANNEL_CONF       = (1 << 10);
918 /**
919  * Codec supports frame-level multithreading.
920  */
921 enum AV_CODEC_CAP_FRAME_THREADS      = (1 << 12);
922 /**
923  * Codec supports slice-based (or partition-based) multithreading.
924  */
925 enum AV_CODEC_CAP_SLICE_THREADS      = (1 << 13);
926 /**
927  * Codec supports changed parameters at any point.
928  */
929 enum AV_CODEC_CAP_PARAM_CHANGE       = (1 << 14);
930 /**
931  * Codec supports avctx->thread_count == 0 (auto).
932  */
933 enum AV_CODEC_CAP_AUTO_THREADS       = (1 << 15);
934 /**
935  * Audio encoder supports receiving a different number of samples in each call.
936  */
937 enum AV_CODEC_CAP_VARIABLE_FRAME_SIZE= (1 << 16);
938 /**
939  * Codec is intra only.
940  */
941 enum AV_CODEC_CAP_INTRA_ONLY      = 0x40000000;
942 /**
943  * Codec is lossless.
944  */
945 enum AV_CODEC_CAP_LOSSLESS        = 0x80000000;
946 
947 static if (FF_API_WITHOUT_PREFIX) {
948 
949     /**
950      * Allow decoders to produce frames with data planes that are not aligned
951      * to CPU requirements (e.g. due to cropping).
952      */
953 
954     enum CODEC_FLAG_UNALIGNED   = AV_CODEC_FLAG_UNALIGNED;
955     enum CODEC_FLAG_QSCALE      = AV_CODEC_FLAG_QSCALE;
956     enum CODEC_FLAG_4MV         = AV_CODEC_FLAG_4MV;
957     enum CODEC_FLAG_OUTPUT_CORRUPT=AV_CODEC_FLAG_OUTPUT_CORRUPT;
958     enum CODEC_FLAG_QPEL        = AV_CODEC_FLAG_QPEL;
959     static if (FF_API_GMC) {
960         /**
961          * @deprecated use the "gmc" private option of the libxvid encoder
962          */
963         enum CODEC_FLAG_GMC =  0x0020;  ///< Use GMC.
964     }
965     static if (FF_API_MV0) {
966         /**
967          * @deprecated use the flag "mv0" in the "mpv_flags" private option of the
968          * mpegvideo encoders
969          */
970         enum CODEC_FLAG_MV0 =  0x0040;
971     }
972     static if (FF_API_INPUT_PRESERVED) {
973         /**
974          * @deprecated passing reference-counted frames to the encoders replaces this
975          * flag
976          */
977         enum CODEC_FLAG_INPUT_PRESERVED=0x0100;
978     }
979     enum CODEC_FLAG_PASS1     =     AV_CODEC_FLAG_PASS1;
980     enum CODEC_FLAG_PASS2     =     AV_CODEC_FLAG_PASS2;
981     enum CODEC_FLAG_GRAY      =     AV_CODEC_FLAG_GRAY;
982     static if (FF_API_EMU_EDGE) {
983         /**
984          * @deprecated edges are not used/required anymore. I.e. this flag is now always
985          * set.
986          */
987         enum CODEC_FLAG_EMU_EDGE   =    0x4000;
988     }
989     enum CODEC_FLAG_PSNR       =    AV_CODEC_FLAG_PSNR;
990     enum CODEC_FLAG_TRUNCATED  =    AV_CODEC_FLAG_TRUNCATED;
991 
992     static if (FF_API_NORMALIZE_AQP) {
993         /**
994          * @deprecated use the flag "naq" in the "mpv_flags" private option of the
995          * mpegvideo encoders
996          */
997         enum CODEC_FLAG_NORMALIZE_AQP= 0x00020000;
998     }
999     enum CODEC_FLAG_INTERLACED_DCT=AV_CODEC_FLAG_INTERLACED_DCT;
1000     enum CODEC_FLAG_LOW_DELAY     =AV_CODEC_FLAG_LOW_DELAY;
1001     enum CODEC_FLAG_GLOBAL_HEADER =AV_CODEC_FLAG_GLOBAL_HEADER;
1002     enum CODEC_FLAG_BITEXACT      =AV_CODEC_FLAG_BITEXACT;
1003     enum CODEC_FLAG_AC_PRED       =AV_CODEC_FLAG_AC_PRED;
1004     enum CODEC_FLAG_LOOP_FILTER  = AV_CODEC_FLAG_LOOP_FILTER;
1005     enum CODEC_FLAG_INTERLACED_ME =AV_CODEC_FLAG_INTERLACED_ME;
1006     enum CODEC_FLAG_CLOSED_GOP  =  AV_CODEC_FLAG_CLOSED_GOP;
1007     enum CODEC_FLAG2_FAST       =  AV_CODEC_FLAG2_FAST;
1008     enum CODEC_FLAG2_NO_OUTPUT  =  AV_CODEC_FLAG2_NO_OUTPUT;
1009     enum CODEC_FLAG2_LOCAL_HEADER= AV_CODEC_FLAG2_LOCAL_HEADER;
1010     enum CODEC_FLAG2_DROP_FRAME_TIMECODE=AV_CODEC_FLAG2_DROP_FRAME_TIMECODE;
1011     enum CODEC_FLAG2_IGNORE_CROP = AV_CODEC_FLAG2_IGNORE_CROP;
1012 
1013     enum CODEC_FLAG2_CHUNKS    =   AV_CODEC_FLAG2_CHUNKS;
1014     enum CODEC_FLAG2_SHOW_ALL  =   AV_CODEC_FLAG2_SHOW_ALL;
1015     enum CODEC_FLAG2_EXPORT_MVS  = AV_CODEC_FLAG2_EXPORT_MVS;
1016     enum CODEC_FLAG2_SKIP_MANUAL = AV_CODEC_FLAG2_SKIP_MANUAL;
1017 
1018     /* Unsupported options :
1019      *              Syntax Arithmetic coding (SAC)
1020      *              Reference Picture Selection
1021      *              Independent Segment Decoding */
1022     /* /Fx */
1023     /* codec capabilities */
1024 
1025     const uint CODEC_CAP_DRAW_HORIZ_BAND = AV_CODEC_CAP_DRAW_HORIZ_BAND; ///< Decoder can use draw_horiz_band callback.
1026     /**
1027      * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1028      * If not set, it might not use get_buffer() at all or use operations that
1029      * assume the buffer was allocated by avcodec_default_get_buffer.
1030      */
1031     const uint CODEC_CAP_DR1 =           AV_CODEC_CAP_DR1;
1032     const uint CODEC_CAP_TRUNCATED =     AV_CODEC_CAP_TRUNCATED;
1033     /* Codec can export data for HW decoding (XvMC). */
1034     //#if FF_API_XVMC // always assume XVMC
1035     /* Codec can export data for HW decoding. This flag indicates that
1036      * the codec would call get_format() with list that might contain HW accelerated
1037      * pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them
1038      * including raw image format.
1039      * The application can use the passed context to determine bitstream version,
1040      * chroma format, resolution etc.
1041      */
1042     const uint CODEC_CAP_HWACCEL =       0x0010;
1043     //#endif /* FF_API_XVMC */
1044     /**
1045      * Encoder or decoder requires flushing with NULL input at the end in order to
1046      * give the complete and correct output.
1047      *
1048      * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1049      *       with NULL data. The user can still send NULL data to the public encode
1050      *       or decode function, but libavcodec will not pass it along to the codec
1051      *       unless this flag is set.
1052      *
1053      * Decoders:
1054      * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1055      * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1056      * returns frames.
1057      *
1058      * Encoders:
1059      * The encoder needs to be fed with NULL data at the end of encoding until the
1060      * encoder no longer returns data.
1061      *
1062      * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1063      *       flag also means that the encoder must set the pts and duration for
1064      *       each output packet. If this flag is not set, the pts and duration will
1065      *       be determined by libavcodec from the input frame.
1066      */
1067     const uint CODEC_CAP_DELAY =         AV_CODEC_CAP_DELAY;
1068     /**
1069      * Codec can be fed a final frame with a smaller size.
1070      * This can be used to prevent truncation of the last audio samples.
1071      */
1072     const uint CODEC_CAP_SMALL_LAST_FRAME = AV_CODEC_CAP_SMALL_LAST_FRAME;
1073     static if(FF_API_CAP_VDPAU) {
1074         /**
1075          * Codec can export data for HW decoding (VDPAU).
1076          */
1077         const uint CODEC_CAP_HWACCEL_VDPAU =  AV_CODEC_CAP_HWACCEL_VDPAU;
1078     }
1079     /**
1080      * Codec can output multiple frames per AVPacket
1081      * Normally demuxers return one frame at a time, demuxers which do not do
1082      * are connected to a parser to split what they return into proper frames.
1083      * This flag is reserved to the very rare category of codecs which have a
1084      * bitstream that cannot be split into frames without timeconsuming
1085      * operations like full decoding. Demuxers carring such bitstreams thus
1086      * may return multiple frames in a packet. This has many disadvantages like
1087      * prohibiting stream copy in many cases thus it should only be considered
1088      * as a last resort.
1089      */
1090     const uint CODEC_CAP_SUBFRAMES =      AV_CODEC_CAP_SUBFRAMES;
1091     /**
1092      * Codec is experimental and is thus avoided in favor of non experimental
1093      * encoders
1094      */
1095     const uint CODEC_CAP_EXPERIMENTAL =   AV_CODEC_CAP_EXPERIMENTAL;
1096     /**
1097      * Codec should fill in channel configuration and samplerate instead of container
1098      */
1099     const uint CODEC_CAP_CHANNEL_CONF =   AV_CODEC_CAP_CHANNEL_CONF;
1100     static if(FF_API_NEG_LINESIZES) {
1101         /**
1102          * @deprecated no codecs use this capability
1103          */
1104         const uint CODEC_CAP_NEG_LINESIZES =  0x0800;
1105     }
1106     /**
1107      * Codec supports frame-level multithreading.
1108      */
1109     const uint CODEC_CAP_FRAME_THREADS =  AV_CODEC_CAP_FRAME_THREADS;
1110     /**
1111      * Codec supports slice-based (or partition-based) multithreading.
1112      */
1113     const uint CODEC_CAP_SLICE_THREADS =  AV_CODEC_CAP_SLICE_THREADS;
1114     /**
1115      * Codec supports changed parameters at any point.
1116      */
1117     const uint CODEC_CAP_PARAM_CHANGE =   AV_CODEC_CAP_PARAM_CHANGE;
1118     /**
1119      * Codec supports avctx->thread_count == 0 (auto).
1120      */
1121     const uint CODEC_CAP_AUTO_THREADS =   AV_CODEC_CAP_AUTO_THREADS;
1122     /**
1123      * Audio encoder supports receiving a different number of samples in each call.
1124      */
1125     const uint CODEC_CAP_VARIABLE_FRAME_SIZE = AV_CODEC_CAP_VARIABLE_FRAME_SIZE;
1126     /**
1127      * Codec is intra only.
1128      */
1129     enum CODEC_CAP_INTRA_ONLY   =   AV_CODEC_CAP_INTRA_ONLY;
1130     /**
1131      * Codec is lossless.
1132      */
1133     enum CODEC_CAP_LOSSLESS =       AV_CODEC_CAP_LOSSLESS;
1134 
1135     enum HWACCEL_CODEC_CAP_EXPERIMENTAL =    0x0200;
1136 
1137 }
1138 
1139 static if (FF_API_MB_TYPE) {
1140 //The following defines may change, don't expect compatibility if you use them.
1141 const uint MB_TYPE_INTRA4x4 =  0x0001;
1142 const uint MB_TYPE_INTRA16x16 = 0x0002; //FIXME H.264-specific
1143 const uint MB_TYPE_INTRA_PCM = 0x0004; //FIXME H.264-specific
1144 const uint MB_TYPE_16x16 =    0x0008;
1145 const uint MB_TYPE_16x8 =     0x0010;
1146 const uint MB_TYPE_8x16 =     0x0020;
1147 const uint MB_TYPE_8x8 =      0x0040;
1148 const uint MB_TYPE_INTERLACED = 0x0080;
1149 const uint MB_TYPE_DIRECT2 =  0x0100; //FIXME
1150 const uint MB_TYPE_ACPRED =   0x0200;
1151 const uint MB_TYPE_GMC =      0x0400;
1152 const uint MB_TYPE_SKIP =     0x0800;
1153 const uint MB_TYPE_P0L0 =     0x1000;
1154 const uint MB_TYPE_P1L0 =     0x2000;
1155 const uint MB_TYPE_P0L1 =     0x4000;
1156 const uint MB_TYPE_P1L1 =     0x8000;
1157 const uint MB_TYPE_L0  =      (MB_TYPE_P0L0 | MB_TYPE_P1L0);
1158 const uint MB_TYPE_L1  =      (MB_TYPE_P0L1 | MB_TYPE_P1L1);
1159 const uint MB_TYPE_L0L1 =     (MB_TYPE_L0   | MB_TYPE_L1);
1160 const uint MB_TYPE_QUANT =    0x00010000;
1161 const uint MB_TYPE_CBP =      0x00020000;
1162 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
1163 }
1164 
1165 /**
1166  * Pan Scan area.
1167  * This specifies the area which should be displayed.
1168  * Note there may be multiple such areas for one frame.
1169  */
1170 struct AVPanScan {
1171     /**
1172      * id
1173      * - encoding: Set by user.
1174      * - decoding: Set by libavcodec.
1175      */
1176     int id;
1177 
1178     /**
1179      * width and height in 1/16 pel
1180      * - encoding: Set by user.
1181      * - decoding: Set by libavcodec.
1182      */
1183     int width;
1184     int height;
1185 
1186     /**
1187      * position of the top left corner in 1/16 pel for up to 3 fields/frames
1188      * - encoding: Set by user.
1189      * - decoding: Set by libavcodec.
1190      */
1191     int16_t [3][2]position;
1192 }
1193 
1194 struct AVCPBProperties {
1195     /**
1196      * Maximum bitrate of the stream, in bits per second.
1197      * Zero if unknown or unspecified.
1198      */
1199     int max_bitrate;
1200     /**
1201      * Minimum bitrate of the stream, in bits per second.
1202      * Zero if unknown or unspecified.
1203      */
1204     int min_bitrate;
1205     /**
1206      * Average bitrate of the stream, in bits per second.
1207      * Zero if unknown or unspecified.
1208      */
1209     int avg_bitrate;
1210 
1211     /**
1212      * The size of the buffer to which the ratecontrol is applied, in bits.
1213      * Zero if unknown or unspecified.
1214      */
1215     int buffer_size;
1216 
1217     /**
1218      * The delay between the time the packet this structure is associated with
1219      * is received and the time when it should be decoded, in periods of a 27MHz
1220      * clock.
1221      *
1222      * UINT64_MAX when unknown or unspecified.
1223      */
1224     uint64_t vbv_delay;
1225 }
1226 
1227 static if (FF_API_QSCALE_TYPE) {
1228 enum FF_QSCALE_TYPE_MPEG1 = 0;
1229 enum FF_QSCALE_TYPE_MPEG2 = 1;
1230 enum FF_QSCALE_TYPE_H264  = 2;
1231 enum FF_QSCALE_TYPE_VP56 = 3;
1232 }
1233 
1234 /**
1235  * The decoder will keep a reference to the frame and may reuse it later.
1236  */
1237 enum AV_GET_BUFFER_FLAG_REF = (1 << 0);
1238 
1239 /**
1240  * @defgroup lavc_packet AVPacket
1241  *
1242  * Types and functions for working with AVPacket.
1243  * @{
1244  */
1245 enum AVPacketSideDataType {
1246     AV_PKT_DATA_PALETTE,
1247 
1248     /**
1249          * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1250          * that the extradata buffer was changed and the receiving side should
1251          * act upon it appropriately. The new extradata is embedded in the side
1252          * data buffer and should be immediately used for processing the current
1253          * frame or packet.
1254          */
1255     AV_PKT_DATA_NEW_EXTRADATA,
1256 
1257     /**
1258      * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1259      * @code
1260      * u32le param_flags
1261      * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1262      *     s32le channel_count
1263      * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1264      *     u64le channel_layout
1265      * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1266      *     s32le sample_rate
1267      * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1268      *     s32le width
1269      *     s32le height
1270      * @endcode
1271      */
1272     AV_PKT_DATA_PARAM_CHANGE,
1273 
1274     /**
1275      * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1276      * structures with info about macroblocks relevant to splitting the
1277      * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1278      * That is, it does not necessarily contain info about all macroblocks,
1279      * as long as the distance between macroblocks in the info is smaller
1280      * than the target payload size.
1281      * Each MB info structure is 12 bytes, and is laid out as follows:
1282      * @code
1283      * u32le bit offset from the start of the packet
1284      * u8    current quantizer at the start of the macroblock
1285      * u8    GOB number
1286      * u16le macroblock address within the GOB
1287      * u8    horizontal MV predictor
1288      * u8    vertical MV predictor
1289      * u8    horizontal MV predictor for block number 3
1290      * u8    vertical MV predictor for block number 3
1291      * @endcode
1292      */
1293     AV_PKT_DATA_H263_MB_INFO,
1294 
1295     /**
1296      * This side data should be associated with an audio stream and contains
1297      * ReplayGain information in form of the AVReplayGain struct.
1298      */
1299     AV_PKT_DATA_REPLAYGAIN,
1300 
1301     /**
1302      * This side data contains a 3x3 transformation matrix describing an affine
1303      * transformation that needs to be applied to the decoded video frames for
1304      * correct presentation.
1305      *
1306      * See libavutil/display.h for a detailed description of the data.
1307      */
1308     AV_PKT_DATA_DISPLAYMATRIX,
1309 
1310     /**
1311      * This side data should be associated with a video stream and contains
1312      * Stereoscopic 3D information in form of the AVStereo3D struct.
1313      */
1314     AV_PKT_DATA_STEREO3D,
1315 
1316     /**
1317      * This side data should be associated with an audio stream and corresponds
1318      * to enum AVAudioServiceType.
1319      */
1320     AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1321 
1322     /**
1323      * This side data contains quality related information from the encoder.
1324      * @code
1325      * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1326      * u8    picture type
1327      * u8    error count
1328      * u16   reserved
1329      * u64le[error count] sum of squared differences between encoder in and output
1330      * @endcode
1331      */
1332     AV_PKT_DATA_QUALITY_STATS,
1333 
1334     /**
1335      * This side data contains an integer value representing the stream index
1336      * of a "fallback" track.  A fallback track indicates an alternate
1337      * track to use when the current track can not be decoded for some reason.
1338      * e.g. no decoder available for codec.
1339      */
1340     AV_PKT_DATA_FALLBACK_TRACK,
1341 
1342     /**
1343      * This side data corresponds to the AVCPBProperties struct.
1344      */
1345     AV_PKT_DATA_CPB_PROPERTIES,
1346 
1347     /**
1348      * Recommmends skipping the specified number of samples
1349      * @code
1350      * u32le number of samples to skip from start of this packet
1351      * u32le number of samples to skip from end of this packet
1352      * u8    reason for start skip
1353      * u8    reason for end   skip (0=padding silence, 1=convergence)
1354      * @endcode
1355      */
1356     AV_PKT_DATA_SKIP_SAMPLES=70,
1357 
1358     /**
1359      * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1360      * the packet may contain "dual mono" audio specific to Japanese DTV
1361      * and if it is true, recommends only the selected channel to be used.
1362      * @code
1363      * u8    selected channels (0=mail/left, 1=sub/right, 2=both)
1364      * @endcode
1365      */
1366     AV_PKT_DATA_JP_DUALMONO,
1367 
1368     /**
1369      * A list of zero terminated key/value strings. There is no end marker for
1370      * the list, so it is required to rely on the side data size to stop.
1371      */
1372     AV_PKT_DATA_STRINGS_METADATA,
1373 
1374     /**
1375      * Subtitle event position
1376      * @code
1377      * u32le x1
1378      * u32le y1
1379      * u32le x2
1380      * u32le y2
1381      * @endcode
1382      */
1383     AV_PKT_DATA_SUBTITLE_POSITION,
1384 
1385     /**
1386      * Data found in BlockAdditional element of matroska container. There is
1387      * no end marker for the data, so it is required to rely on the side data
1388      * size to recognize the end. 8 byte id (as found in BlockAddId) followed
1389      * by data.
1390      */
1391     AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
1392 
1393     /**
1394      * The optional first identifier line of a WebVTT cue.
1395      */
1396     AV_PKT_DATA_WEBVTT_IDENTIFIER,
1397 
1398     /**
1399      * The optional settings (rendering instructions) that immediately
1400      * follow the timestamp specifier of a WebVTT cue.
1401      */
1402     AV_PKT_DATA_WEBVTT_SETTINGS,
1403 
1404     /**
1405      * A list of zero terminated key/value strings. There is no end marker for
1406      * the list, so it is required to rely on the side data size to stop. This
1407      * side data includes updated metadata which appeared in the stream.
1408      */
1409     AV_PKT_DATA_METADATA_UPDATE,
1410 
1411     /**
1412      * The number of side data elements (in fact a bit more than it).
1413      * This is not part of the public API/ABI in the sense that it may
1414      * change when new side data types are added.
1415      * This must stay the last enum value.
1416      * If its value becomes huge, some code using it
1417      * needs to be updated as it assumes it to be smaller than other limits.
1418      */
1419     AV_PKT_DATA_NB
1420 
1421 }
1422 
1423 enum AV_PKT_DATA_QUALITY_FACTOR = AVPacketSideDataType.AV_PKT_DATA_QUALITY_STATS; //DEPRECATED
1424 
1425 struct AVPacketSideData {
1426     uint8_t *data;
1427     int      size;
1428     AVPacketSideDataType type;
1429 }
1430 
1431 /**
1432  * This structure stores compressed data. It is typically exported by demuxers
1433  * and then passed as input to decoders, or received as output from encoders and
1434  * then passed to muxers.
1435  *
1436  * For video, it should typically contain one compressed frame. For audio it may
1437  * contain several compressed frames.
1438  *
1439  * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
1440  * ABI. Thus it may be allocated on stack and no new fields can be added to it
1441  * without libavcodec and libavformat major bump.
1442  *
1443  * The semantics of data ownership depends on the buf or destruct (deprecated)
1444  * fields. If either is set, the packet data is dynamically allocated and is
1445  * valid indefinitely until av_free_packet() is called (which in turn calls
1446  * av_buffer_unref()/the destruct callback to free the data). If neither is set,
1447  * the packet data is typically backed by some static buffer somewhere and is
1448  * only valid for a limited time (e.g. until the next read call when demuxing).
1449  *
1450  * The side data is always allocated with av_malloc() and is freed in
1451  * av_free_packet().
1452  */
1453 struct AVPacket {
1454     /**
1455      * A reference to the reference-counted buffer where the packet data is
1456      * stored.
1457      * May be NULL, then the packet data is not reference-counted.
1458      */
1459     AVBufferRef *buf;
1460     /**
1461      * Presentation timestamp in AVStream->time_base units; the time at which
1462      * the decompressed packet will be presented to the user.
1463      * Can be AV_NOPTS_VALUE if it is not stored in the file.
1464      * pts MUST be larger or equal to dts as presentation cannot happen before
1465      * decompression, unless one wants to view hex dumps. Some formats misuse
1466      * the terms dts and pts/cts to mean something different. Such timestamps
1467      * must be converted to true pts/dts before they are stored in AVPacket.
1468      */
1469     int64_t pts;
1470     /**
1471      * Decompression timestamp in AVStream->time_base units; the time at which
1472      * the packet is decompressed.
1473      * Can be AV_NOPTS_VALUE if it is not stored in the file.
1474      */
1475     int64_t dts;
1476     uint8_t *data;
1477     int   size;
1478     int   stream_index;
1479     /**
1480      * A combination of AV_PKT_FLAG values
1481      */
1482     int   flags;
1483     /**
1484      * Additional packet data that can be provided by the container.
1485      * Packet can contain several types of side information.
1486      */
1487     AVPacketSideData *side_data;
1488     int side_data_elems;
1489 
1490     /**
1491      * Duration of this packet in AVStream->time_base units, 0 if unknown.
1492      * Equals next_pts - this_pts in presentation order.
1493      */
1494     int64_t duration;
1495 
1496     int64_t pos;                            ///< byte position in stream, -1 if unknown
1497 
1498 static if(FF_API_CONVERGENCE_DURATION){
1499     /**
1500      * @deprecated Same as the duration field, but as int64_t. This was required
1501      * for Matroska subtitles, whose duration values could overflow when the
1502      * duration field was still an int.
1503      */
1504     deprecated
1505         int64_t convergence_duration;
1506 }
1507 
1508 }
1509 enum AV_PKT_FLAG_KEY =   0x0001; ///< The packet contains a keyframe
1510 enum AV_PKT_FLAG_CORRUPT = 0x0002; ///< The packet content is corrupted
1511 
1512 enum AVSideDataParamChangeFlags {
1513     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
1514     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
1515     AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
1516     AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
1517 }
1518 /**
1519  * @}
1520  */
1521 
1522 struct AVCodecInternal;
1523 
1524 enum AVFieldOrder {
1525     AV_FIELD_UNKNOWN,
1526     AV_FIELD_PROGRESSIVE,
1527     AV_FIELD_TT,          //< Top coded_first, top displayed first
1528     AV_FIELD_BB,          //< Bottom coded first, bottom displayed first
1529     AV_FIELD_TB,          //< Top coded first, bottom displayed first
1530     AV_FIELD_BT,          //< Bottom coded first, top displayed first
1531 }
1532 
1533 /**
1534  * main external API structure.
1535  * New fields can be added to the end with minor version bumps.
1536  * Removal, reordering and changes to existing fields require a major
1537  * version bump.
1538  * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user
1539  * applications.
1540  * sizeof(AVCodecContext) must not be used outside libav*.
1541  */
1542 struct AVCodecContext {
1543     /**
1544      * information on struct for av_log
1545      * - set by avcodec_alloc_context3
1546      */
1547     const AVClass *av_class;
1548     int log_level_offset;
1549 
1550     AVMediaType codec_type;  /* see AVMEDIA_TYPE_xxx */
1551     const AVCodec *codec;
1552 static if (FF_API_CODEC_NAME) {
1553     /**
1554      * @deprecated this field is not used for anything in libavcodec
1555      */
1556     deprecated
1557         char            [32] codec_name;
1558 }
1559     AVCodecID     codec_id; /* see AV_CODEC_ID_xxx */
1560 
1561     /**
1562      * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1563      * This is used to work around some encoder bugs.
1564      * A demuxer should set this to what is stored in the field used to identify the codec.
1565      * If there are multiple such fields in a container then the demuxer should choose the one
1566      * which maximizes the information about the used codec.
1567      * If the codec tag field in a container is larger than 32 bits then the demuxer should
1568      * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
1569      * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
1570      * first.
1571      * - encoding: Set by user, if not then the default based on codec_id will be used.
1572      * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1573      */
1574     uint codec_tag;
1575 
1576 static if (FF_API_STREAM_CODEC_TAG) {
1577     /**
1578      * @deprecated this field is unused
1579      */
1580     deprecated
1581         uint stream_codec_tag;
1582 }
1583 
1584     void *priv_data;
1585 
1586     /**
1587      * Private context used for internal data.
1588      *
1589      * Unlike priv_data, this is not codec-specific. It is used in general
1590      * libavcodec functions.
1591      */
1592     AVCodecInternal *internal;
1593 
1594     /**
1595      * Private data of the user, can be used to carry app specific stuff.
1596      * - encoding: Set by user.
1597      * - decoding: Set by user.
1598      */
1599     void *opaque;
1600 
1601     /**
1602      * the average bitrate
1603      * - encoding: Set by user; unused for constant quantizer encoding.
1604      * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
1605      */
1606     int64_t bit_rate;
1607 
1608     /**
1609      * number of bits the bitstream is allowed to diverge from the reference.
1610      *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
1611      * - encoding: Set by user; unused for constant quantizer encoding.
1612      * - decoding: unused
1613      */
1614     int bit_rate_tolerance;
1615 
1616     /**
1617      * Global quality for codecs which cannot change it per frame.
1618      * This should be proportional to MPEG-1/2/4 qscale.
1619      * - encoding: Set by user.
1620      * - decoding: unused
1621      */
1622     int global_quality;
1623 
1624     /**
1625      * - encoding: Set by user.
1626      * - decoding: unused
1627      */
1628     int compression_level;
1629 //#define FF_COMPRESSION_DEFAULT -1
1630 
1631     /**
1632      * CODEC_FLAG_*.
1633      * - encoding: Set by user.
1634      * - decoding: Set by user.
1635      */
1636     int flags;
1637 
1638     /**
1639      * CODEC_FLAG2_*
1640      * - encoding: Set by user.
1641      * - decoding: Set by user.
1642      */
1643     int flags2;
1644 
1645     /**
1646      * some codecs need / can use extradata like Huffman tables.
1647      * mjpeg: Huffman tables
1648      * rv10: additional flags
1649      * mpeg4: global headers (they can be in the bitstream or here)
1650      * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
1651      * than extradata_size to avoid problems if it is read with the bitstream reader.
1652      * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1653      * - encoding: Set/allocated/freed by libavcodec.
1654      * - decoding: Set/allocated/freed by user.
1655      */
1656     uint8_t *extradata;
1657     int extradata_size;
1658 
1659     /**
1660      * This is the fundamental unit of time (in seconds) in terms
1661      * of which frame timestamps are represented. For fixed-fps content,
1662      * timebase should be 1/framerate and timestamp increments should be
1663      * identically 1.
1664      * This often, but not always is the inverse of the frame rate or field rate
1665      * for video.
1666      * - encoding: MUST be set by user.
1667      * - decoding: the use of this field for decoding is deprecated.
1668      *             Use framerate instead.
1669      */
1670     AVRational time_base;
1671 
1672     /**
1673      * For some codecs, the time base is closer to the field rate than the frame rate.
1674      * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
1675      * if no telecine is used ...
1676      *
1677      * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
1678      */
1679     int ticks_per_frame;
1680 
1681     /**
1682      * Codec delay.
1683      *
1684      * Encoding: Number of frames delay there will be from the encoder input to
1685      *           the decoder output. (we assume the decoder matches the spec)
1686      * Decoding: Number of frames delay in addition to what a standard decoder
1687      *           as specified in the spec would produce.
1688      *
1689      * Video:
1690      *   Number of frames the decoded output will be delayed relative to the
1691      *   encoded input.
1692      *
1693      * Audio:
1694      *   For encoding, this field is unused (see initial_padding).
1695      *
1696      *   For decoding, this is the number of samples the decoder needs to
1697      *   output before the decoder's output is valid. When seeking, you should
1698      *   start decoding this many samples prior to your desired seek point.
1699      *
1700      * - encoding: Set by libavcodec.
1701      * - decoding: Set by libavcodec.
1702      */
1703     int delay;
1704 
1705 
1706     /* video only */
1707     /**
1708      * picture width / height.
1709      *
1710      * @note Those fields may not match the values of the last
1711      * AVFrame outputted by avcodec_decode_video2 due frame
1712      * reordering.
1713      *
1714      * - encoding: MUST be set by user.
1715      * - decoding: May be set by the user before opening the decoder if known e.g.
1716      *             from the container. Some decoders will require the dimensions
1717      *             to be set by the caller. During decoding, the decoder may
1718      *             overwrite those values as required while parsing the data.
1719      */
1720     int width, height;
1721 
1722     /**
1723      * Bitstream width / height, may be different from width/height e.g. when
1724      * the decoded frame is cropped before being output or lowres is enabled.
1725      *
1726      * @note Those field may not match the value of the last
1727      * AVFrame outputted by avcodec_decode_video2 due frame
1728      * reordering.
1729      *
1730      * - encoding: unused
1731      * - decoding: May be set by the user before opening the decoder if known
1732      *             e.g. from the container. During decoding, the decoder may
1733      *             overwrite those values as required while parsing the data.
1734      */
1735     int coded_width, coded_height;
1736 
1737 //#if FF_API_ASPECT_EXTENDED
1738 //#define FF_ASPECT_EXTENDED 15
1739 //#endif
1740 
1741     /**
1742      * the number of pictures in a group of pictures, or 0 for intra_only
1743      * - encoding: Set by user.
1744      * - decoding: unused
1745      */
1746     int gop_size;
1747 
1748     /**
1749      * Pixel format, see AV_PIX_FMT_xxx.
1750      * May be set by the demuxer if known from headers.
1751      * May be overridden by the decoder if it knows better.
1752      *
1753      * @note This field may not match the value of the last
1754      * AVFrame outputted by avcodec_decode_video2 due frame
1755      * reordering.
1756      *
1757      * - encoding: Set by user.
1758      * - decoding: Set by user if known, overridden by libavcodec while
1759      *             parsing the data.
1760      */
1761     AVPixelFormat pix_fmt;
1762 
1763 static if (FF_API_MOTION_EST) {
1764     /**
1765      * This option does nothing
1766      * @deprecated use codec private options instead
1767      */
1768     deprecated
1769         int me_method;
1770 }
1771 
1772     /**
1773      * If non NULL, 'draw_horiz_band' is called by the libavcodec
1774      * decoder to draw a horizontal band. It improves cache usage. Not
1775      * all codecs can do that. You must check the codec capabilities
1776      * beforehand.
1777      * When multithreading is used, it may be called from multiple threads
1778      * at the same time; threads might draw different parts of the same AVFrame,
1779      * or multiple AVFrames, and there is no guarantee that slices will be drawn
1780      * in order.
1781      * The function is also used by hardware acceleration APIs.
1782      * It is called at least once during frame decoding to pass
1783      * the data needed for hardware render.
1784      * In that mode instead of pixel data, AVFrame points to
1785      * a structure specific to the acceleration API. The application
1786      * reads the structure and can change some fields to indicate progress
1787      * or mark state.
1788      * - encoding: unused
1789      * - decoding: Set by user.
1790      * @param height the height of the slice
1791      * @param y the y position of the slice
1792      * @param type 1->top field, 2->bottom field, 3->frame
1793      * @param offset offset into the AVFrame.data from which the slice should be read
1794      */
1795     void function(AVCodecContext *s, 
1796                             const AVFrame *src, int [AV_NUM_DATA_POINTERS]offset, 
1797                             int y, int type, int height) draw_horiz_band;
1798 
1799     /**
1800      * callback to negotiate the pixelFormat
1801      * @param fmt is the list of formats which are supported by the codec,
1802      * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1803      * The first is always the native one.
1804      * @note The callback may be called again immediately if initialization for
1805      * the selected (hardware-accelerated) pixel format failed.
1806      * @warning Behavior is undefined if the callback returns a value not
1807      * in the fmt list of formats.
1808      * @return the chosen format
1809      * - encoding: unused
1810      * - decoding: Set by user, if not set the native format will be chosen.
1811      */
1812     AVPixelFormat function(AVCodecContext *s, const  AVPixelFormat * fmt) get_format;
1813 
1814     /**
1815      * maximum number of B-frames between non-B-frames
1816      * Note: The output will be delayed by max_b_frames+1 relative to the input.
1817      * - encoding: Set by user.
1818      * - decoding: unused
1819      */
1820     int max_b_frames;
1821 
1822     /**
1823      * qscale factor between IP and B-frames
1824      * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
1825      * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1826      * - encoding: Set by user.
1827      * - decoding: unused
1828      */
1829     float b_quant_factor;
1830 
1831 static if (FF_API_RC_STRATEGY) {
1832     /** @deprecated use codec private option instead */
1833     deprecated
1834         int rc_strategy;
1835     //#define FF_RC_STRATEGY_XVID 1
1836 }
1837 static if (FF_API_PRIVATE_OPT) {
1838     /** @deprecated use encoder private options instead */
1839     deprecated
1840         int b_frame_strategy;
1841 }
1842     /**
1843      * qscale offset between IP and B-frames
1844      * - encoding: Set by user.
1845      * - decoding: unused
1846      */
1847     float b_quant_offset;
1848 
1849     /**
1850      * Size of the frame reordering buffer in the decoder.
1851      * For MPEG-2 it is 1 IPB or 0 low delay IP.
1852      * - encoding: Set by libavcodec.
1853      * - decoding: Set by libavcodec.
1854      */
1855     int has_b_frames;
1856 
1857 static if (FF_API_PRIVATE_OPT) {
1858     /** @deprecated use encoder private options instead */
1859     deprecated
1860         int mpeg_quant;
1861 }
1862 
1863     /**
1864      * qscale factor between P and I-frames
1865      * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1866      * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1867      * - encoding: Set by user.
1868      * - decoding: unused
1869      */
1870     float i_quant_factor;
1871 
1872     /**
1873      * qscale offset between P and I-frames
1874      * - encoding: Set by user.
1875      * - decoding: unused
1876      */
1877     float i_quant_offset;
1878 
1879     /**
1880      * luminance masking (0-> disabled)
1881      * - encoding: Set by user.
1882      * - decoding: unused
1883      */
1884     float lumi_masking;
1885 
1886     /**
1887      * temporary complexity masking (0-> disabled)
1888      * - encoding: Set by user.
1889      * - decoding: unused
1890      */
1891     float temporal_cplx_masking;
1892 
1893     /**
1894      * spatial complexity masking (0-> disabled)
1895      * - encoding: Set by user.
1896      * - decoding: unused
1897      */
1898     float spatial_cplx_masking;
1899 
1900     /**
1901      * p block masking (0-> disabled)
1902      * - encoding: Set by user.
1903      * - decoding: unused
1904      */
1905     float p_masking;
1906 
1907     /**
1908      * darkness masking (0-> disabled)
1909      * - encoding: Set by user.
1910      * - decoding: unused
1911      */
1912     float dark_masking;
1913 
1914     /**
1915      * slice count
1916      * - encoding: Set by libavcodec.
1917      * - decoding: Set by user (or 0).
1918      */
1919     int slice_count;
1920 
1921 static if (FF_API_PRIVATE_OPT) {
1922     /** @deprecated use encoder private options instead */
1923     deprecated
1924         int prediction_method;
1925 //#define FF_PRED_LEFT   0
1926 //#define FF_PRED_PLANE  1
1927 //#define FF_PRED_MEDIAN 2
1928 }
1929 
1930     /**
1931      * slice offsets in the frame in bytes
1932      * - encoding: Set/allocated by libavcodec.
1933      * - decoding: Set/allocated by user (or NULL).
1934      */
1935     int *slice_offset;
1936 
1937     /**
1938      * sample aspect ratio (0 if unknown)
1939      * That is the width of a pixel divided by the height of the pixel.
1940      * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1941      * - encoding: Set by user.
1942      * - decoding: Set by libavcodec.
1943      */
1944     AVRational sample_aspect_ratio;
1945 
1946     /**
1947      * motion estimation comparison function
1948      * - encoding: Set by user.
1949      * - decoding: unused
1950      */
1951     int me_cmp;
1952     /**
1953      * subpixel motion estimation comparison function
1954      * - encoding: Set by user.
1955      * - decoding: unused
1956      */
1957     int me_sub_cmp;
1958     /**
1959      * macroblock comparison function (not supported yet)
1960      * - encoding: Set by user.
1961      * - decoding: unused
1962      */
1963     int mb_cmp;
1964     /**
1965      * interlaced DCT comparison function
1966      * - encoding: Set by user.
1967      * - decoding: unused
1968      */
1969     int ildct_cmp;
1970 //#define FF_CMP_SAD    0
1971 //#define FF_CMP_SSE    1
1972 //#define FF_CMP_SATD   2
1973 //#define FF_CMP_DCT    3
1974 //#define FF_CMP_PSNR   4
1975 //#define FF_CMP_BIT    5
1976 //#define FF_CMP_RD     6
1977 //#define FF_CMP_ZERO   7
1978 //#define FF_CMP_VSAD   8
1979 //#define FF_CMP_VSSE   9
1980 //#define FF_CMP_NSSE   10
1981 //#define FF_CMP_W53    11
1982 //#define FF_CMP_W97    12
1983 //#define FF_CMP_DCTMAX 13
1984 //#define FF_CMP_DCT264 14
1985 //#define FF_CMP_CHROMA 256
1986 
1987     /**
1988      * ME diamond size & shape
1989      * - encoding: Set by user.
1990      * - decoding: unused
1991      */
1992     int dia_size;
1993 
1994     /**
1995      * amount of previous MV predictors (2a+1 x 2a+1 square)
1996      * - encoding: Set by user.
1997      * - decoding: unused
1998      */
1999     int last_predictor_count;
2000 
2001 static if (FF_API_PRIVATE_OPT) {
2002     /** @deprecated use encoder private options instead */
2003     deprecated
2004         int pre_me;
2005 }
2006 
2007     /**
2008      * motion estimation prepass comparison function
2009      * - encoding: Set by user.
2010      * - decoding: unused
2011      */
2012     int me_pre_cmp;
2013 
2014     /**
2015      * ME prepass diamond size & shape
2016      * - encoding: Set by user.
2017      * - decoding: unused
2018      */
2019     int pre_dia_size;
2020 
2021     /**
2022      * subpel ME quality
2023      * - encoding: Set by user.
2024      * - decoding: unused
2025      */
2026     int me_subpel_quality;
2027 
2028 static if (FF_API_AFD) {
2029     /**
2030      * DTG active format information (additional aspect ratio
2031      * information only used in DVB MPEG-2 transport streams)
2032      * 0 if not set.
2033      *
2034      * - encoding: unused
2035      * - decoding: Set by decoder.
2036      * @deprecated Deprecated in favor of AVSideData
2037      */
2038     deprecated int dtg_active_format;
2039 //#define FF_DTG_AFD_SAME         8
2040 //#define FF_DTG_AFD_4_3          9
2041 //#define FF_DTG_AFD_16_9         10
2042 //#define FF_DTG_AFD_14_9         11
2043 //#define FF_DTG_AFD_4_3_SP_14_9  13
2044 //#define FF_DTG_AFD_16_9_SP_14_9 14
2045 //#define FF_DTG_AFD_SP_4_3       15
2046 }
2047     /**
2048      * maximum motion estimation search range in subpel units
2049      * If 0 then no limit.
2050      *
2051      * - encoding: Set by user.
2052      * - decoding: unused
2053      */
2054     int me_range;
2055 
2056 static if (FF_API_QUANT_BIAS) {
2057     /** @deprecated use encoder private option instead */
2058     deprecated
2059         int intra_quant_bias;
2060 //#define FF_DEFAULT_QUANT_BIAS 999999
2061 
2062     /** @deprecated use encoder private option instead */
2063     deprecated
2064         int inter_quant_bias;
2065 }
2066 
2067     /**
2068      * slice flags
2069      * - encoding: unused
2070      * - decoding: Set by user.
2071      */
2072     int slice_flags;
2073 //#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
2074 //#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
2075 //#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2076 
2077 static if (ffmpeg.libavcodec.avcodec_version.FF_API_XVMC) {
2078     /**
2079      * XVideo Motion Acceleration
2080      * - encoding: forbidden
2081      * - decoding: set by decoder
2082      * @deprecated XvMC doesn't need it anymore.
2083      */
2084    deprecated int xvmc_acceleration;
2085 }
2086 
2087     /**
2088      * macroblock decision mode
2089      * - encoding: Set by user.
2090      * - decoding: unused
2091      */
2092     int mb_decision;
2093 //#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
2094 //#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
2095 //#define FF_MB_DECISION_RD     2        ///< rate distortion
2096 
2097     /**
2098      * custom intra quantization matrix
2099      * - encoding: Set by user, can be NULL.
2100      * - decoding: Set by libavcodec.
2101      */
2102     uint16_t *intra_matrix;
2103 
2104     /**
2105      * custom inter quantization matrix
2106      * - encoding: Set by user, can be NULL.
2107      * - decoding: Set by libavcodec.
2108      */
2109     uint16_t *inter_matrix;
2110 
2111 static if (FF_API_PRIVATE_OPT) {
2112     /** @deprecated use encoder private options instead */
2113     deprecated
2114         int scenechange_threshold;
2115     /** @deprecated use encoder private options instead */
2116     deprecated
2117         int noise_reduction;
2118 }
2119 
2120 static if (FF_API_MPV_OPT) {
2121     /** @deprecated this field is unused */
2122     deprecated
2123         int me_threshold;
2124     /** @deprecated this field is unused */
2125     deprecated
2126         int mb_threshold;
2127 }
2128 
2129     /**
2130      * precision of the intra DC coefficient - 8
2131      * - encoding: Set by user.
2132      * - decoding: unused
2133      */
2134     int intra_dc_precision;
2135 
2136     /**
2137      * Number of macroblock rows at the top which are skipped.
2138      * - encoding: unused
2139      * - decoding: Set by user.
2140      */
2141     int skip_top;
2142 
2143     /**
2144      * Number of macroblock rows at the bottom which are skipped.
2145      * - encoding: unused
2146      * - decoding: Set by user.
2147      */
2148     int skip_bottom;
2149 
2150 static if (FF_API_MPV_OPT) {
2151     /** @deprecated use encoder private options instead */
2152     deprecated
2153         float border_masking;
2154 }
2155 
2156     /**
2157      * minimum MB lagrange multipler
2158      * - encoding: Set by user.
2159      * - decoding: unused
2160      */
2161     int mb_lmin;
2162 
2163     /**
2164      * maximum MB lagrange multipler
2165      * - encoding: Set by user.
2166      * - decoding: unused
2167      */
2168     int mb_lmax;
2169 
2170 static if (FF_API_PRIVATE_OPT) {
2171     /** @deprecated use encoder private options instead */
2172     deprecated
2173         int me_penalty_compensation;
2174 }
2175 
2176     /**
2177      *
2178      * - encoding: Set by user.
2179      * - decoding: unused
2180      */
2181     int bidir_refine;
2182 
2183 static if (FF_API_PRIVATE_OPT) {
2184     /** @deprecated use encoder private options instead */
2185     deprecated
2186         int brd_scale;
2187 }
2188 
2189     /**
2190      * minimum GOP size
2191      * - encoding: Set by user.
2192      * - decoding: unused
2193      */
2194     int keyint_min;
2195 
2196     /**
2197      * number of reference frames
2198      * - encoding: Set by user.
2199      * - decoding: Set by lavc.
2200      */
2201     int refs;
2202 
2203 static if (FF_API_PRIVATE_OPT) {
2204     /** @deprecated use encoder private options instead */
2205     deprecated
2206         int chromaoffset;
2207 }
2208 
2209 static if (FF_API_UNUSED_MEMBERS) {
2210     /**
2211      * Multiplied by qscale for each frame and added to scene_change_score.
2212      * - encoding: Set by user.
2213      * - decoding: unused
2214      */
2215     deprecated int scenechange_factor;
2216 }
2217 
2218     /**
2219      *
2220      * Note: Value depends upon the compare function used for fullpel ME.
2221      * - encoding: Set by user.
2222      * - decoding: unused
2223      */
2224     int mv0_threshold;
2225 
2226 static if (FF_API_PRIVATE_OPT) {
2227     /** @deprecated use encoder private options instead */
2228     deprecated
2229         int b_sensitivity;
2230 }
2231 
2232     /**
2233      * Chromaticity coordinates of the source primaries.
2234      * - encoding: Set by user
2235      * - decoding: Set by libavcodec
2236      */
2237     AVColorPrimaries color_primaries;
2238 
2239     /**
2240      * Color Transfer Characteristic.
2241      * - encoding: Set by user
2242      * - decoding: Set by libavcodec
2243      */
2244     AVColorTransferCharacteristic color_trc;
2245 
2246     /**
2247      * YUV colorspace type.
2248      * - encoding: Set by user
2249      * - decoding: Set by libavcodec
2250      */
2251     AVColorSpace colorspace;
2252 
2253     /**
2254      * MPEG vs JPEG YUV range.
2255      * - encoding: Set by user
2256      * - decoding: Set by libavcodec
2257      */
2258     AVColorRange color_range;
2259 
2260     /**
2261      * This defines the location of chroma samples.
2262      * - encoding: Set by user
2263      * - decoding: Set by libavcodec
2264      */
2265     AVChromaLocation chroma_sample_location;
2266 
2267     /**
2268      * Number of slices.
2269      * Indicates number of picture subdivisions. Used for parallelized
2270      * decoding.
2271      * - encoding: Set by user
2272      * - decoding: unused
2273      */
2274     int slices;
2275 
2276     /** Field order
2277      * - encoding: set by libavcodec
2278      * - decoding: Set by user.
2279      */
2280     AVFieldOrder field_order;
2281 
2282     /* audio only */
2283     int sample_rate; ///< samples per second
2284     int channels;    ///< number of audio channels
2285 
2286     /**
2287      * audio sample format
2288      * - encoding: Set by user.
2289      * - decoding: Set by libavcodec.
2290      */
2291     AVSampleFormat sample_fmt;  ///< sample format
2292 
2293     /* The following data should not be initialized. */
2294     /**
2295      * Number of samples per channel in an audio frame.
2296      *
2297      * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2298      *   except the last must contain exactly frame_size samples per channel.
2299      *   May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2300      *   frame size is not restricted.
2301      * - decoding: may be set by some decoders to indicate constant frame size
2302      */
2303     int frame_size;
2304 
2305     /**
2306      * Frame counter, set by libavcodec.
2307      *
2308      * - decoding: total number of frames returned from the decoder so far.
2309      * - encoding: total number of frames passed to the encoder so far.
2310      *
2311      *   @note the counter is not incremented if encoding/decoding resulted in
2312      *   an error.
2313      */
2314     int frame_number;
2315 
2316     /**
2317      * number of bytes per packet if constant and known or 0
2318      * Used by some WAV based audio codecs.
2319      */
2320     int block_align;
2321 
2322     /**
2323      * Audio cutoff bandwidth (0 means "automatic")
2324      * - encoding: Set by user.
2325      * - decoding: unused
2326      */
2327     int cutoff;
2328 
2329     /**
2330      * Audio channel layout.
2331      * - encoding: set by user.
2332      * - decoding: set by user, may be overwritten by libavcodec.
2333      */
2334     uint64_t channel_layout;
2335 
2336     /**
2337      * Request decoder to use this channel layout if it can (0 for default)
2338      * - encoding: unused
2339      * - decoding: Set by user.
2340      */
2341     uint64_t request_channel_layout;
2342 
2343     /**
2344      * Type of service that the audio stream conveys.
2345      * - encoding: Set by user.
2346      * - decoding: Set by libavcodec.
2347      */
2348     AVAudioServiceType audio_service_type;
2349 
2350     /**
2351      * desired sample format
2352      * - encoding: Not used.
2353      * - decoding: Set by user.
2354      * Decoder will decode to this format if it can.
2355      */
2356     AVSampleFormat request_sample_fmt;
2357 
2358     /**
2359      * This callback is called at the beginning of each frame to get data
2360      * buffer(s) for it. There may be one contiguous buffer for all the data or
2361      * there may be a buffer per each data plane or anything in between. What
2362      * this means is, you may set however many entries in buf[] you feel necessary.
2363      * Each buffer must be reference-counted using the AVBuffer API (see description
2364      * of buf[] below).
2365      *
2366      * The following fields will be set in the frame before this callback is
2367      * called:
2368      * - format
2369      * - width, height (video only)
2370      * - sample_rate, channel_layout, nb_samples (audio only)
2371      * Their values may differ from the corresponding values in
2372      * AVCodecContext. This callback must use the frame values, not the codec
2373      * context values, to calculate the required buffer size.
2374      *
2375      * This callback must fill the following fields in the frame:
2376      * - data[]
2377      * - linesize[]
2378      * - extended_data:
2379      *   * if the data is planar audio with more than 8 channels, then this
2380      *     callback must allocate and fill extended_data to contain all pointers
2381      *     to all data planes. data[] must hold as many pointers as it can.
2382      *     extended_data must be allocated with av_malloc() and will be freed in
2383      *     av_frame_unref().
2384      *   * otherwise exended_data must point to data
2385      * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2386      *   the frame's data and extended_data pointers must be contained in these. That
2387      *   is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2388      *   AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2389      *   and av_buffer_ref().
2390      * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2391      *   this callback and filled with the extra buffers if there are more
2392      *   buffers than buf[] can hold. extended_buf will be freed in
2393      *   av_frame_unref().
2394      *
2395      * If CODEC_CAP_DR1 is not set then get_buffer2() must call
2396      * avcodec_default_get_buffer2() instead of providing buffers allocated by
2397      * some other means.
2398      *
2399      * Each data plane must be aligned to the maximum required by the target
2400      * CPU.
2401      *
2402      * @see avcodec_default_get_buffer2()
2403      *
2404      * Video:
2405      *
2406      * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2407      * (read and/or written to if it is writable) later by libavcodec.
2408      *
2409      * avcodec_align_dimensions2() should be used to find the required width and
2410      * height, as they normally need to be rounded up to the next multiple of 16.
2411      *
2412      * Some decoders do not support linesizes changing between frames.
2413      *
2414      * If frame multithreading is used and thread_safe_callbacks is set,
2415      * this callback may be called from a different thread, but not from more
2416      * than one at once. Does not need to be reentrant.
2417      *
2418      * @see avcodec_align_dimensions2()
2419      *
2420      * Audio:
2421      *
2422      * Decoders request a buffer of a particular size by setting
2423      * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
2424      * however, utilize only part of the buffer by setting AVFrame.nb_samples
2425      * to a smaller value in the output frame.
2426      *
2427      * As a convenience, av_samples_get_buffer_size() and
2428      * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
2429      * functions to find the required data size and to fill data pointers and
2430      * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2431      * since all planes must be the same size.
2432      *
2433      * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2434      *
2435      * - encoding: unused
2436      * - decoding: Set by libavcodec, user can override.
2437      */
2438     int function(AVCodecContext *s, AVFrame *frame, int flags) get_buffer2;
2439 
2440     /**
2441      * If non-zero, the decoded audio and video frames returned from
2442      * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
2443      * and are valid indefinitely. The caller must free them with
2444      * av_frame_unref() when they are not needed anymore.
2445      * Otherwise, the decoded frames must not be freed by the caller and are
2446      * only valid until the next decode call.
2447      *
2448      * - encoding: unused
2449      * - decoding: set by the caller before avcodec_open2().
2450      */
2451     int refcounted_frames;
2452 
2453     /* - encoding parameters */
2454     float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
2455     float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
2456 
2457     /**
2458      * minimum quantizer
2459      * - encoding: Set by user.
2460      * - decoding: unused
2461      */
2462     int qmin;
2463 
2464     /**
2465      * maximum quantizer
2466      * - encoding: Set by user.
2467      * - decoding: unused
2468      */
2469     int qmax;
2470 
2471     /**
2472      * maximum quantizer difference between frames
2473      * - encoding: Set by user.
2474      * - decoding: unused
2475      */
2476     int max_qdiff;
2477 
2478 static if (FF_API_MPV_OPT) {
2479     /** @deprecated use encoder private options instead */
2480     deprecated
2481         float rc_qsquish;
2482     deprecated
2483         float rc_qmod_amp;
2484     deprecated
2485         int rc_qmod_freq;
2486 }
2487 
2488     /**
2489      * decoder bitstream buffer size
2490      * - encoding: Set by user.
2491      * - decoding: unused
2492      */
2493     int rc_buffer_size;
2494 
2495     /**
2496      * ratecontrol override, see RcOverride
2497      * - encoding: Allocated/set/freed by user.
2498      * - decoding: unused
2499      */
2500     int rc_override_count;
2501     RcOverride *rc_override;
2502 
2503 static if (FF_API_MPV_OPT) {
2504     /** @deprecated use encoder private options instead */
2505     deprecated
2506         const char *rc_eq;
2507 }
2508     /**
2509      * maximum bitrate
2510      * - encoding: Set by user.
2511      * - decoding: Set by libavcodec.
2512      */
2513     int rc_max_rate;
2514 
2515     /**
2516      * minimum bitrate
2517      * - encoding: Set by user.
2518      * - decoding: unused
2519      */
2520     int rc_min_rate;
2521 
2522 static if (FF_API_MPV_OPT) {
2523     /** @deprecated use encoder private options instead */
2524     deprecated
2525         float rc_buffer_aggressivity;
2526     deprecated
2527         float rc_initial_cplx;
2528 }
2529 
2530     /**
2531      * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
2532      * - encoding: Set by user.
2533      * - decoding: unused.
2534      */
2535     float rc_max_available_vbv_use;
2536 
2537     /**
2538      * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2539      * - encoding: Set by user.
2540      * - decoding: unused.
2541      */
2542     float rc_min_vbv_overflow_use;
2543 
2544     /**
2545      * Number of bits which should be loaded into the rc buffer before decoding starts.
2546      * - encoding: Set by user.
2547      * - decoding: unused
2548      */
2549     int rc_initial_buffer_occupancy;
2550 
2551 static if (FF_API_CODER_TYPE) {
2552 //#define FF_CODER_TYPE_VLC       0
2553 //#define FF_CODER_TYPE_AC        1
2554 //#define FF_CODER_TYPE_RAW       2
2555 //#define FF_CODER_TYPE_RLE       3
2556 //#if FF_API_UNUSED_MEMBERS
2557 //#define FF_CODER_TYPE_DEFLATE   4
2558 //#endif /* FF_API_UNUSED_MEMBERS */
2559     /** @deprecated use encoder private options instead */
2560     deprecated
2561         int coder_type;
2562 }
2563 
2564 static if (FF_API_PRIVATE_OPT) {
2565     /** @deprecated use encoder private options instead */
2566     deprecated
2567         int context_model;
2568 }
2569 
2570 static if (FF_API_MPV_OPT) {
2571     /** @deprecated use encoder private options instead */
2572     deprecated
2573         int lmin;
2574 
2575     /** @deprecated use encoder private options instead */
2576     deprecated
2577         int lmax;
2578 }
2579 
2580 static if (FF_API_PRIVATE_OPT) {
2581     /** @deprecated use encoder private options instead */
2582     deprecated
2583         int frame_skip_threshold;
2584 
2585     /** @deprecated use encoder private options instead */
2586     deprecated
2587         int frame_skip_factor;
2588 
2589     /** @deprecated use encoder private options instead */
2590     deprecated
2591         int frame_skip_exp;
2592 
2593     /** @deprecated use encoder private options instead */
2594     deprecated
2595         int frame_skip_cmp;
2596 }
2597 
2598     /**
2599      * trellis RD quantization
2600      * - encoding: Set by user.
2601      * - decoding: unused
2602      */
2603     int trellis;
2604 
2605 static if (FF_API_PRIVATE_OPT) {
2606     /** @deprecated use encoder private options instead */
2607     deprecated
2608         int min_prediction_order;
2609 
2610     /** @deprecated use encoder private options instead */
2611     deprecated
2612         int max_prediction_order;
2613 
2614     /** @deprecated use encoder private options instead */
2615     deprecated
2616         int64_t timecode_frame_start;
2617 }
2618 
2619 static if (FF_API_RTP_CALLBACK) {
2620     /**
2621      * @deprecated unused
2622      */
2623     /* The RTP callback: This function is called    */
2624     /* every time the encoder has a packet to send. */
2625     /* It depends on the encoder if the data starts */
2626     /* with a Start Code (it should). H.263 does.   */
2627     /* mb_nb contains the number of macroblocks     */
2628     /* encoded in the RTP payload.                  */
2629     deprecated
2630         void function(AVCodecContext *avctx, void *data, int size, int mb_nb) rtp_callback;
2631 }
2632 
2633 static if (FF_API_PRIVATE_OPT) {
2634     /** @deprecated use encoder private options instead */
2635     deprecated
2636       int rtp_payload_size; /* The size of the RTP payload: the coder will  */
2637                             /* do its best to deliver a chunk with size     */
2638                             /* below rtp_payload_size, the chunk will start */
2639                             /* with a start code on some codecs like H.263. */
2640                             /* This doesn't take account of any particular  */
2641                             /* headers inside the transmitted RTP payload.  */
2642 }
2643 
2644 static if (FF_API_STAT_BITS) {
2645     /* statistics, used for 2-pass encoding */
2646     deprecated
2647         int mv_bits;
2648     deprecated
2649         int header_bits;
2650     deprecated
2651         int i_tex_bits;
2652     deprecated
2653         int p_tex_bits;
2654     deprecated
2655         int i_count;
2656     deprecated
2657         int p_count;
2658     deprecated
2659         int skip_count;
2660     deprecated
2661         int misc_bits;
2662 
2663     /** @deprecated this field is unused */
2664     deprecated
2665         int frame_bits;
2666 }
2667     /**
2668      * pass1 encoding statistics output buffer
2669      * - encoding: Set by libavcodec.
2670      * - decoding: unused
2671      */
2672     char *stats_out;
2673 
2674     /**
2675      * pass2 encoding statistics input buffer
2676      * Concatenated stuff from stats_out of pass1 should be placed here.
2677      * - encoding: Allocated/set/freed by user.
2678      * - decoding: unused
2679      */
2680     char *stats_in;
2681 
2682     /**
2683      * Work around bugs in encoders which sometimes cannot be detected automatically.
2684      * - encoding: Set by user
2685      * - decoding: Set by user
2686      */
2687     int workaround_bugs;
2688 //#define FF_BUG_AUTODETECT       1  ///< autodetection
2689 //#if FF_API_OLD_MSMPEG4
2690 //#define FF_BUG_OLD_MSMPEG4      2
2691 //#endif
2692 //#define FF_BUG_XVID_ILACE       4
2693 //#define FF_BUG_UMP4             8
2694 //#define FF_BUG_NO_PADDING       16
2695 //#define FF_BUG_AMV              32
2696 //#if FF_API_AC_VLC
2697 //#define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
2698 //#endif
2699 //#define FF_BUG_QPEL_CHROMA      64
2700 //#define FF_BUG_STD_QPEL         128
2701 //#define FF_BUG_QPEL_CHROMA2     256
2702 //#define FF_BUG_DIRECT_BLOCKSIZE 512
2703 //#define FF_BUG_EDGE             1024
2704 //#define FF_BUG_HPEL_CHROMA      2048
2705 //#define FF_BUG_DC_CLIP          4096
2706 //#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
2707 //#define FF_BUG_TRUNCATED       16384
2708 
2709     /**
2710      * strictly follow the standard (MPEG4, ...).
2711      * - encoding: Set by user.
2712      * - decoding: Set by user.
2713      * Setting this to STRICT or higher means the encoder and decoder will
2714      * generally do stupid things, whereas setting it to unofficial or lower
2715      * will mean the encoder might produce output that is not supported by all
2716      * spec-compliant decoders. Decoders don't differentiate between normal,
2717      * unofficial and experimental (that is, they always try to decode things
2718      * when they can) unless they are explicitly asked to behave stupidly
2719      * (=strictly conform to the specs)
2720      */
2721     int strict_std_compliance;
2722 //#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
2723 //#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
2724 //#define FF_COMPLIANCE_NORMAL        0
2725 //#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
2726 //#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
2727 
2728     /**
2729      * error concealment flags
2730      * - encoding: unused
2731      * - decoding: Set by user.
2732      */
2733     int error_concealment;
2734 //#define FF_EC_GUESS_MVS   1
2735 //#define FF_EC_DEBLOCK     2
2736 //#define FF_EC_FAVOR_INTER 256
2737     /**
2738      * debug
2739      * - encoding: Set by user.
2740      * - decoding: Set by user.
2741      */
2742     int _debug;
2743 //#define FF_DEBUG_PICT_INFO   1
2744 //#define FF_DEBUG_RC          2
2745 //#define FF_DEBUG_BITSTREAM   4
2746 //#define FF_DEBUG_MB_TYPE     8
2747 //#define FF_DEBUG_QP          16
2748 //#if FF_API_DEBUG_MV
2749 /**
2750  * @deprecated this option does nothing
2751  */
2752 //#define FF_DEBUG_MV          32
2753 //#endif
2754 //#define FF_DEBUG_DCT_COEFF   0x00000040
2755 //#define FF_DEBUG_SKIP        0x00000080
2756 //#define FF_DEBUG_STARTCODE   0x00000100
2757 //#if FF_API_UNUSED_MEMBERS
2758 //#define FF_DEBUG_PTS         0x00000200
2759 //#endif /* FF_API_UNUSED_MEMBERS */
2760 //#define FF_DEBUG_ER          0x00000400
2761 //#define FF_DEBUG_MMCO        0x00000800
2762 //#define FF_DEBUG_BUGS        0x00001000
2763 //#if FF_API_DEBUG_MV
2764 //#define FF_DEBUG_VIS_QP      0x00002000 ///< only access through AVOptions from outside libavcodec
2765 //#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec
2766 //#endif
2767 //#define FF_DEBUG_BUFFERS     0x00008000
2768 //#define FF_DEBUG_THREADS     0x00010000
2769 //#define FF_DEBUG_NOMC        0x01000000
2770 
2771 static if (FF_API_DEBUG_MV) {
2772     /**
2773      * debug
2774      * Code outside libavcodec should access this field using AVOptions
2775      * - encoding: Set by user.
2776      * - decoding: Set by user.
2777      */
2778     int debug_mv;
2779 //#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
2780 //#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
2781 //#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
2782 }
2783 
2784     /**
2785      * Error recognition; may misdetect some more or less valid parts as errors.
2786      * - encoding: unused
2787      * - decoding: Set by user.
2788      */
2789     int err_recognition;
2790 
2791 /**
2792  * Verify checksums embedded in the bitstream (could be of either encoded or
2793  * decoded data, depending on the codec) and print an error message on mismatch.
2794  * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
2795  * decoder returning an error.
2796  */
2797 //#define AV_EF_CRCCHECK  (1<<0)
2798 //#define AV_EF_BITSTREAM (1<<1)
2799 //#define AV_EF_BUFFER    (1<<2)
2800 //#define AV_EF_EXPLODE   (1<<3)
2801 
2802 //#define AV_EF_IGNORE_ERR (1<<15)        ///< ignore errors and continue
2803 //#define AV_EF_CAREFUL    (1<<16)
2804 //#define AV_EF_COMPLIANT  (1<<17)
2805 //#define AV_EF_AGGRESSIVE (1<<18)
2806 
2807 
2808     /**
2809      * opaque 64bit number (generally a PTS) that will be reordered and
2810      * output in AVFrame.reordered_opaque
2811      * - encoding: unused
2812      * - decoding: Set by user.
2813      */
2814     int64_t reordered_opaque;
2815 
2816     /**
2817      * Hardware accelerator in use
2818      * - encoding: unused.
2819      * - decoding: Set by libavcodec
2820      */
2821     AVHWAccel *hwaccel;
2822 
2823     /**
2824      * Hardware accelerator context.
2825      * For some hardware accelerators, a global context needs to be
2826      * provided by the user. In that case, this holds display-dependent
2827      * data FFmpeg cannot instantiate itself. Please refer to the
2828      * FFmpeg HW accelerator documentation to know how to fill this
2829      * is. e.g. for VA API, this is a struct vaapi_context.
2830      * - encoding: unused
2831      * - decoding: Set by user
2832      */
2833     void *hwaccel_context;
2834 
2835     /**
2836      * error
2837      * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
2838      * - decoding: unused
2839      */
2840     uint64_t [AV_NUM_DATA_POINTERS]error;
2841 
2842     /**
2843      * DCT algorithm, see FF_DCT_* below
2844      * - encoding: Set by user.
2845      * - decoding: unused
2846      */
2847     int dct_algo;
2848 //#define FF_DCT_AUTO    0
2849 //#define FF_DCT_FASTINT 1
2850 //#if FF_API_UNUSED_MEMBERS
2851 //#define FF_DCT_INT     2
2852 //#endif /* FF_API_UNUSED_MEMBERS */
2853 //#define FF_DCT_MMX     3
2854 //#define FF_DCT_ALTIVEC 5
2855 //#define FF_DCT_FAAN    6
2856 
2857     /**
2858      * IDCT algorithm, see FF_IDCT_* below.
2859      * - encoding: Set by user.
2860      * - decoding: Set by user.
2861      */
2862     int idct_algo;
2863 //#define FF_IDCT_AUTO          0
2864 //#define FF_IDCT_INT           1
2865 //#define FF_IDCT_SIMPLE        2
2866 //#define FF_IDCT_SIMPLEMMX     3
2867 //#define FF_IDCT_ARM           7
2868 //#define FF_IDCT_ALTIVEC       8
2869 //#if FF_API_ARCH_SH4
2870 //#define FF_IDCT_SH4           9
2871 //#endif
2872 //#define FF_IDCT_SIMPLEARM     10
2873 //#if FF_API_UNUSED_MEMBERS
2874 //#define FF_IDCT_IPP           13
2875 //#endif /* FF_API_UNUSED_MEMBERS */
2876 //#if FF_API_IDCT_XVIDMMX
2877 //#define FF_IDCT_XVIDMMX       14
2878 //#endif /* FF_API_IDCT_XVIDMMX */
2879 //#define FF_IDCT_SIMPLEARMV5TE 16
2880 //#define FF_IDCT_SIMPLEARMV6   17
2881 //#if FF_API_ARCH_SPARC
2882 //#define FF_IDCT_SIMPLEVIS     18
2883 //#endif
2884 //#define FF_IDCT_FAAN          20
2885 //#define FF_IDCT_SIMPLENEON    22
2886 //#if FF_API_ARCH_ALPHA
2887 //#define FF_IDCT_SIMPLEALPHA   23
2888 //#endif
2889 //#define FF_IDCT_SIMPLEAUTO    128
2890 
2891 
2892     /**
2893      * bits per sample/pixel from the demuxer (needed for huffyuv).
2894      * - encoding: Set by libavcodec.
2895      * - decoding: Set by user.
2896      */
2897      int bits_per_coded_sample;
2898 
2899     /**
2900      * Bits per sample/pixel of internal libavcodec pixel/sample format.
2901      * - encoding: set by user.
2902      * - decoding: set by libavcodec.
2903      */
2904     int bits_per_raw_sample;
2905 
2906 static if (FF_API_LOWRES) {
2907     /**
2908      * low resolution decoding, 1-> 1/2 size, 2->1/4 size
2909      * - encoding: unused
2910      * - decoding: Set by user.
2911      * Code outside libavcodec should access this field using:
2912      * av_codec_{get,set}_lowres(avctx)
2913      */
2914      int lowres;
2915 }
2916 
2917 static if (FF_API_CODED_FRAME) {
2918     /**
2919      * the picture in the bitstream
2920      * - encoding: Set by libavcodec.
2921      * - decoding: unused
2922      *
2923      * @deprecated use the quality factor packet side data instead
2924      */
2925     deprecated
2926         AVFrame *coded_frame;
2927 }
2928 
2929     /**
2930      * thread count
2931      * is used to decide how many independent tasks should be passed to execute()
2932      * - encoding: Set by user.
2933      * - decoding: Set by user.
2934      */
2935     int thread_count;
2936 
2937     /**
2938      * Which multithreading methods to use.
2939      * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2940      * so clients which cannot provide future frames should not use it.
2941      *
2942      * - encoding: Set by user, otherwise the default is used.
2943      * - decoding: Set by user, otherwise the default is used.
2944      */
2945     int thread_type;
2946 //#define FF_THREAD_FRAME   1 ///< Decode more than one frame at once
2947 //#define FF_THREAD_SLICE   2 ///< Decode more than one part of a single frame at once
2948 
2949     /**
2950      * Which multithreading methods are in use by the codec.
2951      * - encoding: Set by libavcodec.
2952      * - decoding: Set by libavcodec.
2953      */
2954     int active_thread_type;
2955 
2956     /**
2957      * Set by the client if its custom get_buffer() callback can be called
2958      * synchronously from another thread, which allows faster multithreaded decoding.
2959      * draw_horiz_band() will be called from other threads regardless of this setting.
2960      * Ignored if the default get_buffer() is used.
2961      * - encoding: Set by user.
2962      * - decoding: Set by user.
2963      */
2964     int thread_safe_callbacks;
2965 
2966     /**
2967      * The codec may call this to execute several independent things.
2968      * It will return only after finishing all tasks.
2969      * The user may replace this with some multithreaded implementation,
2970      * the default implementation will execute the parts serially.
2971      * @param count the number of things to execute
2972      * - encoding: Set by libavcodec, user can override.
2973      * - decoding: Set by libavcodec, user can override.
2974      */
2975     int function(AVCodecContext *c, int function(AVCodecContext *c2, void *arg) func, void *arg2, int *ret, int count, int size) execute;
2976 
2977     /**
2978      * The codec may call this to execute several independent things.
2979      * It will return only after finishing all tasks.
2980      * The user may replace this with some multithreaded implementation,
2981      * the default implementation will execute the parts serially.
2982      * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
2983      * @param c context passed also to func
2984      * @param count the number of things to execute
2985      * @param arg2 argument passed unchanged to func
2986      * @param ret return values of executed functions, must have space for "count" values. May be NULL.
2987      * @param func function that will be called count times, with jobnr from 0 to count-1.
2988      *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
2989      *             two instances of func executing at the same time will have the same threadnr.
2990      * @return always 0 currently, but code should handle a future improvement where when any call to func
2991      *         returns < 0 no further calls to func may be done and < 0 is returned.
2992      * - encoding: Set by libavcodec, user can override.
2993      * - decoding: Set by libavcodec, user can override.
2994      */
2995     int function(AVCodecContext *c, int function(AVCodecContext *c2, void *arg, int jobnr, int threadnr) func, void *arg2, int *ret, int count) execute2;
2996 
2997     /**
2998      * noise vs. sse weight for the nsse comparison function
2999      * - encoding: Set by user.
3000      * - decoding: unused
3001      */
3002      int nsse_weight;
3003 
3004     /**
3005      * profile
3006      * - encoding: Set by user.
3007      * - decoding: Set by libavcodec.
3008      */
3009      int profile;
3010 //#define FF_PROFILE_UNKNOWN -99
3011 //#define FF_PROFILE_RESERVED -100
3012 
3013 //#define FF_PROFILE_AAC_MAIN 0
3014 //#define FF_PROFILE_AAC_LOW  1
3015 //#define FF_PROFILE_AAC_SSR  2
3016 //#define FF_PROFILE_AAC_LTP  3
3017 //#define FF_PROFILE_AAC_HE   4
3018 //#define FF_PROFILE_AAC_HE_V2 28
3019 //#define FF_PROFILE_AAC_LD   22
3020 //#define FF_PROFILE_AAC_ELD  38
3021 //#define FF_PROFILE_MPEG2_AAC_LOW 128
3022 //#define FF_PROFILE_MPEG2_AAC_HE  131
3023 
3024 //#define FF_PROFILE_DTS         20
3025 //#define FF_PROFILE_DTS_ES      30
3026 //#define FF_PROFILE_DTS_96_24   40
3027 //#define FF_PROFILE_DTS_HD_HRA  50
3028 //#define FF_PROFILE_DTS_HD_MA   60
3029 
3030 //#define FF_PROFILE_MPEG2_422    0
3031 //#define FF_PROFILE_MPEG2_HIGH   1
3032 //#define FF_PROFILE_MPEG2_SS     2
3033 //#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
3034 //#define FF_PROFILE_MPEG2_MAIN   4
3035 //#define FF_PROFILE_MPEG2_SIMPLE 5
3036 
3037 //#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
3038 //#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
3039 
3040 //#define FF_PROFILE_H264_BASELINE             66
3041 //#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3042 //#define FF_PROFILE_H264_MAIN                 77
3043 //#define FF_PROFILE_H264_EXTENDED             88
3044 //#define FF_PROFILE_H264_HIGH                 100
3045 //#define FF_PROFILE_H264_HIGH_10              110
3046 //#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
3047 //#define FF_PROFILE_H264_HIGH_422             122
3048 //#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
3049 //#define FF_PROFILE_H264_HIGH_444             144
3050 //#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
3051 //#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
3052 //#define FF_PROFILE_H264_CAVLC_444            44
3053 
3054 //#define FF_PROFILE_VC1_SIMPLE   0
3055 //#define FF_PROFILE_VC1_MAIN     1
3056 //#define FF_PROFILE_VC1_COMPLEX  2
3057 //#define FF_PROFILE_VC1_ADVANCED 3
3058 
3059 //#define FF_PROFILE_MPEG4_SIMPLE                     0
3060 //#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
3061 //#define FF_PROFILE_MPEG4_CORE                       2
3062 //#define FF_PROFILE_MPEG4_MAIN                       3
3063 //#define FF_PROFILE_MPEG4_N_BIT                      4
3064 //#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
3065 //#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
3066 //#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
3067 //#define FF_PROFILE_MPEG4_HYBRID                     8
3068 //#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
3069 //#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
3070 //#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
3071 //#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
3072 //#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3073 //#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
3074 //#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
3075 
3076 //#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0   0
3077 //#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1   1
3078 //#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION  2
3079 //#define FF_PROFILE_JPEG2000_DCINEMA_2K              3
3080 //#define FF_PROFILE_JPEG2000_DCINEMA_4K              4
3081 //
3082 //
3083 //#define FF_PROFILE_HEVC_MAIN                        1
3084 //#define FF_PROFILE_HEVC_MAIN_10                     2
3085 //#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
3086 //#define FF_PROFILE_HEVC_REXT                        4
3087 
3088     /**
3089      * level
3090      * - encoding: Set by user.
3091      * - decoding: Set by libavcodec.
3092      */
3093      int level;
3094 //#define FF_LEVEL_UNKNOWN -99
3095 
3096     /**
3097      * Skip loop filtering for selected frames.
3098      * - encoding: unused
3099      * - decoding: Set by user.
3100      */
3101     AVDiscard skip_loop_filter;
3102 
3103     /**
3104      * Skip IDCT/dequantization for selected frames.
3105      * - encoding: unused
3106      * - decoding: Set by user.
3107      */
3108     AVDiscard skip_idct;
3109 
3110     /**
3111      * Skip decoding for selected frames.
3112      * - encoding: unused
3113      * - decoding: Set by user.
3114      */
3115     AVDiscard skip_frame;
3116 
3117     /**
3118      * Header containing style information for text subtitles.
3119      * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3120      * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3121      * the Format line following. It shouldn't include any Dialogue line.
3122      * - encoding: Set/allocated/freed by user (before avcodec_open2())
3123      * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3124      */
3125     uint8_t *subtitle_header;
3126     int subtitle_header_size;
3127 
3128 static if (FF_API_ERROR_RATE) {
3129     /**
3130      * @deprecated use the 'error_rate' private AVOption of the mpegvideo
3131      * encoders
3132      */
3133     deprecated
3134     int error_rate;
3135 }
3136 
3137 static if (FF_API_VBV_DELAY) {
3138     /**
3139      * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3140      * Used for compliant TS muxing.
3141      * - encoding: Set by libavcodec.
3142      * - decoding: unused.
3143      *
3144      * @deprecated this value is now exported as a part of
3145      * AV_PKT_DATA_CPB_PROPERTIES packet side data
3146      */
3147     deprecated
3148         uint64_t vbv_delay;
3149 }
3150 
3151 static if (FF_API_SIDEDATA_ONLY_PKT) {
3152     /**
3153      * Encoding only. Allow encoders to output packets that do not contain any
3154      * encoded data, only side data.
3155      *
3156      * Some encoders need to output such packets, e.g. to update some stream
3157      * parameters at the end of encoding.
3158      *
3159      * @deprecated this field disables the default behaviour and
3160             *             it is kept only for compatibility.
3161      */
3162     deprecated
3163         int side_data_only_packets;
3164 }
3165 
3166     /**
3167      * Audio only. The number of "priming" samples (padding) inserted by the
3168      * encoder at the beginning of the audio. I.e. this number of leading
3169      * decoded samples must be discarded by the caller to get the original audio
3170      * without leading padding.
3171      *
3172      * - decoding: unused
3173      * - encoding: Set by libavcodec. The timestamps on the output packets are
3174      *             adjusted by the encoder so that they always refer to the
3175      *             first sample of the data actually contained in the packet,
3176      *             including any added padding.  E.g. if the timebase is
3177      *             1/samplerate and the timestamp of the first input sample is
3178      *             0, the timestamp of the first output packet will be
3179      *             -initial_padding.
3180      */
3181     int initial_padding;
3182 
3183     /**
3184      * - decoding: For codecs that store a framerate value in the compressed
3185      *             bitstream, the decoder may export it here. { 0, 1} when
3186      *             unknown.
3187      * - encoding: May be used to signal the framerate of CFR content to an
3188      *             encoder.
3189      */
3190     AVRational framerate;
3191 
3192     /**
3193      * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3194      * - encoding: unused.
3195      * - decoding: Set by libavcodec before calling get_format()
3196      */
3197     AVPixelFormat sw_pix_fmt;
3198 
3199     /**
3200      * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3201      * Code outside libavcodec should access this field using:
3202      * av_codec_{get,set}_pkt_timebase(avctx)
3203      * - encoding unused.
3204      * - decoding set by user.
3205      */
3206     AVRational pkt_timebase;
3207 
3208     /**
3209      * AVCodecDescriptor
3210      * Code outside libavcodec should access this field using:
3211      * av_codec_{get,set}_codec_descriptor(avctx)
3212      * - encoding: unused.
3213      * - decoding: set by libavcodec.
3214      */
3215     const AVCodecDescriptor *codec_descriptor;
3216 
3217 static if (!FF_API_LOWRES) {
3218     /**
3219      * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3220      * - encoding: unused
3221      * - decoding: Set by user.
3222      * Code outside libavcodec should access this field using:
3223      * av_codec_{get,set}_lowres(avctx)
3224      */
3225      int lowres;
3226 }
3227 
3228     /**
3229      * Current statistics for PTS correction.
3230      * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3231      * - encoding: unused
3232      */
3233     int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3234     int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3235     int64_t pts_correction_last_pts;       /// PTS of the last frame
3236     int64_t pts_correction_last_dts;       /// DTS of the last frame
3237 
3238     /**
3239      * Character encoding of the input subtitles file.
3240      * - decoding: set by user
3241      * - encoding: unused
3242      */
3243     char *sub_charenc;
3244 
3245     /**
3246      * Subtitles character encoding mode. Formats or codecs might be adjusting
3247      * this setting (if they are doing the conversion themselves for instance).
3248      * - decoding: set by libavcodec
3249      * - encoding: unused
3250      */
3251     int sub_charenc_mode;
3252 //#define FF_SUB_CHARENC_MODE_DO_NOTHING  -1  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
3253 //#define FF_SUB_CHARENC_MODE_AUTOMATIC    0  ///< libavcodec will select the mode itself
3254 //#define FF_SUB_CHARENC_MODE_PRE_DECODER  1  ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
3255 
3256     /**
3257      * Skip processing alpha if supported by codec.
3258      * Note that if the format uses pre-multiplied alpha (common with VP6,
3259      * and recommended due to better video quality/compression)
3260      * the image will look as if alpha-blended onto a black background.
3261      * However for formats that do not use pre-multiplied alpha
3262      * there might be serious artefacts (though e.g. libswscale currently
3263      * assumes pre-multiplied alpha anyway).
3264      * Code outside libavcodec should access this field using AVOptions
3265      *
3266      * - decoding: set by user
3267      * - encoding: unused
3268      */
3269     int skip_alpha;
3270 
3271     /**
3272      * Number of samples to skip after a discontinuity
3273      * - decoding: unused
3274      * - encoding: set by libavcodec
3275      */
3276     int seek_preroll;
3277 
3278 static if (!FF_API_DEBUG_MV) {
3279     /**
3280      * debug motion vectors
3281      * Code outside libavcodec should access this field using AVOptions
3282      * - encoding: Set by user.
3283      * - decoding: Set by user.
3284      */
3285     int debug_mv;
3286 //#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
3287 //#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
3288 //#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3289 }
3290 
3291     /**
3292      * custom intra quantization matrix
3293      * Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix()
3294      * - encoding: Set by user, can be NULL.
3295      * - decoding: unused.
3296      */
3297     uint16_t *chroma_intra_matrix;
3298 
3299 
3300     /**
3301      * dump format separator.
3302      * can be ", " or "\n      " or anything else
3303      * Code outside libavcodec should access this field using AVOptions
3304      * (NO direct access).
3305      * - encoding: Set by user.
3306      * - decoding: Set by user.
3307      */
3308     uint8_t *dump_separator;
3309 
3310     /**
3311      * ',' separated list of allowed decoders.
3312      * If NULL then all are allowed
3313      * - encoding: unused
3314      * - decoding: set by user through AVOPtions (NO direct access)
3315      */
3316     char *codec_whitelist;
3317 
3318     /*
3319      * Properties of the stream that gets decoded
3320      * To be accessed through av_codec_get_properties() (NO direct access)
3321      * - encoding: unused
3322      * - decoding: set by libavcodec
3323      */
3324     uint properties;
3325 //#define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
3326 //#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3327 
3328     /**
3329      * Additional data associated with the entire coded stream.
3330      *
3331      * - decoding: unused
3332      * - encoding: may be set by libavcodec after avcodec_open2().
3333      */
3334     AVPacketSideData *coded_side_data;
3335     int            nb_coded_side_data;
3336 
3337 }
3338 
3339 AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
3340 void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
3341 
3342 AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
3343 void                     av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
3344 
3345 uint av_codec_get_codec_properties(const AVCodecContext *avctx);
3346 
3347 int  av_codec_get_lowres(const AVCodecContext *avctx);
3348 void av_codec_set_lowres(AVCodecContext *avctx, int val);
3349 
3350 int  av_codec_get_seek_preroll(const AVCodecContext *avctx);
3351 void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
3352 
3353 uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
3354 void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
3355 
3356 /**
3357  * AVProfile.
3358  */
3359 struct AVProfile {
3360     int profile;
3361     const char *name; ///< short name for the profile
3362 }
3363 
3364 struct AVCodecDefault;
3365 
3366 //struct AVSubtitle;
3367 
3368 /**
3369  * AVCodec.
3370  */
3371 struct AVCodec {
3372     /**
3373      * Name of the codec implementation.
3374      * The name is globally unique among encoders and among decoders (but an
3375      * encoder and a decoder can share the same name).
3376      * This is the primary way to find a codec from the user perspective.
3377      */
3378     const char *name;
3379     /**
3380      * Descriptive name for the codec, meant to be more human readable than name.
3381      * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
3382      */
3383     const char *long_name;
3384     AVMediaType type;
3385     AVCodecID id;
3386     /**
3387      * Codec capabilities.
3388      * see CODEC_CAP_*
3389      */
3390     int capabilities;
3391     const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
3392     const AVPixelFormat *pix_fmts;       ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
3393     const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
3394     const AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
3395     const uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
3396     uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres()
3397     const AVClass *priv_class;              ///< AVClass for the private context
3398     const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
3399 
3400     /*****************************************************************
3401      * No fields below this line are part of the public API. They
3402      * may not be used outside of libavcodec and can be changed and
3403      * removed at will.
3404      * New public fields should be added right above.
3405      *****************************************************************
3406      */
3407     int priv_data_size;
3408     AVCodec *next;
3409     /**
3410      * @name Frame-level threading support functions
3411      * @{
3412      */
3413     /**
3414      * If defined, called on thread contexts when they are created.
3415      * If the codec allocates writable tables in init(), re-allocate them here.
3416      * priv_data will be set to a copy of the original.
3417      */
3418     int function (AVCodecContext *) init_thread_copy;
3419     /**
3420      * Copy necessary context variables from a previous thread context to the current one.
3421      * If not defined, the next thread will start automatically; otherwise, the codec
3422      * must call ff_thread_finish_setup().
3423      *
3424      * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
3425      */
3426     int function(AVCodecContext *dst, const AVCodecContext *src) update_thread_context;
3427     /** @} */
3428 
3429     /**
3430      * Private codec-specific defaults.
3431      */
3432     const AVCodecDefault *defaults;
3433 
3434     /**
3435      * Initialize codec static data, called from avcodec_register().
3436      */
3437     void function(AVCodec *codec) init_static_data;
3438 
3439     int function(AVCodecContext *) init;
3440     int function(AVCodecContext *, uint8_t *buf, int buf_size,
3441                       const AVSubtitle *sub) encode_sub;
3442     /**
3443      * Encode data to an AVPacket.
3444      *
3445      * @param      avctx          codec context
3446      * @param      avpkt          output AVPacket (may contain a user-provided buffer)
3447      * @param[in]  frame          AVFrame containing the raw data to be encoded
3448      * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
3449      *                            non-empty packet was returned in avpkt.
3450      * @return 0 on success, negative error code on failure
3451      */
3452     int function(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, 
3453                    int *got_packet_ptr) encode2;
3454     int function(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt) decode;
3455     int function(AVCodecContext *) close;
3456     /**
3457      * Flush buffers.
3458      * Will be called when seeking
3459      */
3460     void function(AVCodecContext *) flush;
3461     /**
3462      * Internal codec capabilities.
3463      * See FF_CODEC_CAP_* in internal.h
3464      */
3465     int caps_internal;
3466 }
3467 
3468 int av_codec_get_max_lowres(const AVCodec *codec);
3469 
3470 struct MpegEncContext;
3471 
3472 /**
3473  * AVHWAccel.
3474  */
3475 struct AVHWAccel {
3476     /**
3477      * Name of the hardware accelerated codec.
3478      * The name is globally unique among encoders and among decoders (but an
3479      * encoder and a decoder can share the same name).
3480      */
3481     const char *name;
3482 
3483     /**
3484      * Type of codec implemented by the hardware accelerator.
3485      *
3486      * See AVMEDIA_TYPE_xxx
3487      */
3488     AVMediaType type;
3489 
3490     /**
3491      * Codec implemented by the hardware accelerator.
3492      *
3493      * See AV_CODEC_ID_xxx
3494      */
3495     AVCodecID id;
3496 
3497     /**
3498      * Supported pixel format.
3499      *
3500      * Only hardware accelerated formats are supported here.
3501      */
3502     AVPixelFormat pix_fmt;
3503 
3504     /**
3505      * Hardware accelerated codec capabilities.
3506      * see FF_HWACCEL_CODEC_CAP_*
3507      */
3508     int capabilities;
3509 
3510     /*****************************************************************
3511      * No fields below this line are part of the public API. They
3512      * may not be used outside of libavcodec and can be changed and
3513      * removed at will.
3514      * New public fields should be added right above.
3515      *****************************************************************
3516      */
3517     AVHWAccel *next;
3518 
3519     /**
3520      * Allocate a custom buffer
3521      */
3522     int function(AVCodecContext *avctx, AVFrame *frame) alloc_frame;
3523 
3524     /**
3525      * Called at the beginning of each frame or field picture.
3526      *
3527      * Meaningful frame information (codec specific) is guaranteed to
3528      * be parsed at this point. This function is mandatory.
3529      *
3530      * Note that buf can be NULL along with buf_size set to 0.
3531      * Otherwise, this means the whole frame is available at this point.
3532      *
3533      * @param avctx the codec context
3534      * @param buf the frame data buffer base
3535      * @param buf_size the size of the frame in bytes
3536      * @return zero if successful, a negative value otherwise
3537      */
3538     int function(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size) start_frame;
3539 
3540     /**
3541      * Callback for each slice.
3542      *
3543      * Meaningful slice information (codec specific) is guaranteed to
3544      * be parsed at this point. This function is mandatory.
3545      * The only exception is XvMC, that works on MB level.
3546      *
3547      * @param avctx the codec context
3548      * @param buf the slice data buffer base
3549      * @param buf_size the size of the slice in bytes
3550      * @return zero if successful, a negative value otherwise
3551      */
3552     int function(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size) decode_slice;
3553 
3554     /**
3555      * Called at the end of each frame or field picture.
3556      *
3557      * The whole picture is parsed at this point and can now be sent
3558      * to the hardware accelerator. This function is mandatory.
3559      *
3560      * @param avctx the codec context
3561      * @return zero if successful, a negative value otherwise
3562      */
3563     int function(AVCodecContext *avctx) end_frame;
3564 
3565     /**
3566      * Size of per-frame hardware accelerator private data.
3567      *
3568      * Private data is allocated with av_mallocz() before
3569      * AVCodecContext.get_buffer() and deallocated after
3570      * AVCodecContext.release_buffer().
3571      */
3572     int frame_priv_data_size;
3573 
3574     /**
3575      * Called for every Macroblock in a slice.
3576      *
3577      * XvMC uses it to replace the ff_mpv_decode_mb().
3578      * Instead of decoding to raw picture, MB parameters are
3579      * stored in an array provided by the video driver.
3580      *
3581      * @param s the mpeg context
3582      */
3583     void function(MpegEncContext *s) decode_mb;
3584 
3585     /**
3586      * Initialize the hwaccel private data.
3587      *
3588      * This will be called from ff_get_format(), after hwaccel and
3589      * hwaccel_context are set and the hwaccel private data in AVCodecInternal
3590      * is allocated.
3591      */
3592     int function (AVCodecContext *avctx) init;
3593 
3594     /**
3595      * Uninitialize the hwaccel private data.
3596      *
3597      * This will be called from get_format() or avcodec_close(), after hwaccel
3598      * and hwaccel_context are already uninitialized.
3599      */
3600         int function(AVCodecContext *avctx) uninit;
3601 
3602     /**
3603      * Size of the private data to allocate in
3604      * AVCodecInternal.hwaccel_priv_data.
3605      */
3606     int priv_data_size;
3607 }
3608 
3609 /**
3610  * Hardware acceleration should be used for decoding even if the codec level
3611  * used is unknown or higher than the maximum supported level reported by the
3612  * hardware driver.
3613  *
3614  * It's generally a good idea to pass this flag unless you have a specific
3615  * reason not to, as hardware tends to under-report supported levels.
3616  */
3617 enum AV_HWACCEL_FLAG_IGNORE_LEVEL = (1 << 0);
3618 
3619 /**
3620  * Hardware acceleration can output YUV pixel formats with a different chroma
3621  * sampling than 4:2:0 and/or other than 8 bits per component.
3622  */
3623 enum AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH = (1 << 1);
3624 
3625 /**
3626  * @}
3627  */
3628 
3629 static if(FF_API_AVPICTURE){
3630     /**
3631      * @defgroup lavc_picture AVPicture
3632      *
3633      * Functions for working with AVPicture
3634      * @{
3635      */
3636 
3637     /**
3638      * Picture data structure.
3639      *
3640      * Up to four components can be stored into it, the last component is
3641      * alpha.
3642      * @deprecated use AVFrame or imgutils functions instead
3643      */
3644     struct AVPicture {
3645         deprecated
3646             uint8_t *[AV_NUM_DATA_POINTERS]data;    ///< pointers to the image data planes
3647         deprecated
3648             int [AV_NUM_DATA_POINTERS]linesize;     ///< number of bytes per line
3649     }
3650 
3651     /**
3652      * @}
3653      */
3654 }
3655 enum AVSubtitleType {
3656     SUBTITLE_NONE,
3657 
3658     SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
3659 
3660     /**
3661      * Plain text, the text field must be set by the decoder and is
3662      * authoritative. ass and pict fields may contain approximations.
3663      */
3664     SUBTITLE_TEXT,
3665 
3666     /**
3667      * Formatted text, the ass field must be set by the decoder and is
3668      * authoritative. pict and text fields may contain approximations.
3669      */
3670     SUBTITLE_ASS,
3671 }
3672 
3673 enum AV_SUBTITLE_FLAG_FORCED=0x00000001;
3674 
3675 struct AVSubtitleRect {
3676     int x;         ///< top left corner  of pict, undefined when pict is not set
3677     int y;         ///< top left corner  of pict, undefined when pict is not set
3678     int w;         ///< width            of pict, undefined when pict is not set
3679     int h;         ///< height           of pict, undefined when pict is not set
3680     int nb_colors; ///< number of colors in pict, undefined when pict is not set
3681 
3682 static if(FF_API_AVPICTURE){
3683     /** @deprecated unused */
3684     deprecated
3685         AVPicture pict;
3686 }
3687     /**
3688      * data+linesize for the bitmap of this subtitle.
3689      * Can be set for text/ass as well once they are rendered.
3690      */
3691     uint8_t [4]*data;
3692     int [4]linesize;
3693 
3694     AVSubtitleType type;
3695 
3696     char *text;                     ///< 0 terminated plain UTF-8 text
3697 
3698     /**
3699      * 0 terminated ASS/SSA compatible event line.
3700      * The presentation of this is unaffected by the other values in this
3701      * struct.
3702      */
3703     char *ass;
3704 
3705     int flags;
3706 }
3707 
3708 struct AVSubtitle {
3709     uint16_t format; /* 0 = graphics */
3710     uint32_t start_display_time; /* relative to packet pts, in ms */
3711     uint32_t end_display_time; /* relative to packet pts, in ms */
3712     uint num_rects;
3713     AVSubtitleRect **rects;
3714     int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
3715 }
3716 
3717 /**
3718  * If c is NULL, returns the first registered codec,
3719  * if c is non-NULL, returns the next registered codec after c,
3720  * or NULL if c is the last one.
3721  */
3722 AVCodec *av_codec_next(AVCodec *c);
3723 
3724 /**
3725  * Return the LIBAVCODEC_VERSION_INT constant.
3726  */
3727 uint avcodec_version();
3728 
3729 /**
3730  * Return the libavcodec build-time configuration.
3731  */
3732 const (char) *avcodec_configuration();
3733 
3734 /**
3735  * Return the libavcodec license.
3736  */
3737 char *avcodec_license();
3738 
3739 /**
3740  * Register the codec codec and initialize libavcodec.
3741  *
3742  * @warning either this function or avcodec_register_all() must be called
3743  * before any other libavcodec functions.
3744  *
3745  * @see avcodec_register_all()
3746  */
3747 void avcodec_register(AVCodec *codec);
3748 
3749 /**
3750  * Register all the codecs, parsers and bitstream filters which were enabled at
3751  * configuration time. If you do not call this function you can select exactly
3752  * which formats you want to support, by using the individual registration
3753  * functions.
3754  *
3755  * @see avcodec_register
3756  * @see av_register_codec_parser
3757  * @see av_register_bitstream_filter
3758  */
3759 void avcodec_register_all();
3760 
3761 /**
3762  * Allocate an AVCodecContext and set its fields to default values. The
3763  * resulting struct should be freed with avcodec_free_context().
3764  *
3765  * @param codec if non-NULL, allocate private data and initialize defaults
3766  *              for the given codec. It is illegal to then call avcodec_open2()
3767  *              with a different codec.
3768  *              If NULL, then the codec-specific defaults won't be initialized,
3769  *              which may result in suboptimal default settings (this is
3770  *              important mainly for encoders, e.g. libx264).
3771  *
3772  * @return An AVCodecContext filled with default values or NULL on failure.
3773  * @see avcodec_get_context_defaults
3774  */
3775 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
3776 
3777 /**
3778  * Free the codec context and everything associated with it and write NULL to
3779  * the provided pointer.
3780  */
3781 void avcodec_free_context(AVCodecContext **avctx);
3782 
3783 /**
3784  * Set the fields of the given AVCodecContext to default values corresponding
3785  * to the given codec (defaults may be codec-dependent).
3786  *
3787  * Do not call this function if a non-NULL codec has been passed
3788  * to avcodec_alloc_context3() that allocated this AVCodecContext.
3789  * If codec is non-NULL, it is illegal to call avcodec_open2() with a
3790  * different codec on this AVCodecContext.
3791  */
3792 int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
3793 
3794 /**
3795  * Get the AVClass for AVCodecContext. It can be used in combination with
3796  * AV_OPT_SEARCH_FAKE_OBJ for examining options.
3797  *
3798  * @see av_opt_find().
3799  */
3800 AVClass *avcodec_get_class();
3801 
3802 /**
3803  * Get the AVClass for AVFrame. It can be used in combination with
3804  * AV_OPT_SEARCH_FAKE_OBJ for examining options.
3805  *
3806  * @see av_opt_find().
3807  */
3808 AVClass *avcodec_get_frame_class();
3809 
3810 /**
3811  * Get the AVClass for AVSubtitleRect. It can be used in combination with
3812  * AV_OPT_SEARCH_FAKE_OBJ for examining options.
3813  *
3814  * @see av_opt_find().
3815  */
3816 AVClass *avcodec_get_subtitle_rect_class();
3817 
3818 /**
3819  * Copy the settings of the source AVCodecContext into the destination
3820  * AVCodecContext. The resulting destination codec context will be
3821  * unopened, i.e. you are required to call avcodec_open2() before you
3822  * can use this AVCodecContext to decode/encode video/audio data.
3823  *
3824  * @param dest target codec context, should be initialized with
3825  *             avcodec_alloc_context3(NULL), but otherwise uninitialized
3826  * @param src source codec context
3827  * @return AVERROR() on error (e.g. memory allocation error), 0 on success
3828  *
3829  * @deprecated The semantics of this function are ill-defined and it should not
3830  * be used. If you need to transfer the stream parameters from one codec context
3831  * to another, use an intermediate AVCodecParameters instance and the
3832  * avcodec_parameters_from_context() / avcodec_parameters_to_context()
3833  * functions.
3834  */
3835 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3836 
3837 /**
3838  * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3839  * function the context has to be allocated with avcodec_alloc_context3().
3840  *
3841  * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3842  * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3843  * retrieving a codec.
3844  *
3845  * @warning This function is not thread safe!
3846  *
3847  * @note Always call this function before using decoding routines (such as
3848  * @ref avcodec_decode_video2()).
3849  *
3850  * @code
3851  * avcodec_register_all();
3852  * av_dict_set(&opts, "b", "2.5M", 0);
3853  * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
3854  * if (!codec)
3855  *     exit(1);
3856  *
3857  * context = avcodec_alloc_context3(codec);
3858  *
3859  * if (avcodec_open2(context, codec, opts) < 0)
3860  *     exit(1);
3861  * @endcode
3862  *
3863  * @param avctx The context to initialize.
3864  * @param codec The codec to open this context for. If a non-NULL codec has been
3865  *              previously passed to avcodec_alloc_context3() or
3866  *              avcodec_get_context_defaults3() for this context, then this
3867  *              parameter MUST be either NULL or equal to the previously passed
3868  *              codec.
3869  * @param options A dictionary filled with AVCodecContext and codec-private options.
3870  *                On return this object will be filled with options that were not found.
3871  *
3872  * @return zero on success, a negative value on error
3873  * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
3874  *      av_dict_set(), av_opt_find().
3875  */
3876 int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
3877 
3878 /**
3879  * Close a given AVCodecContext and free all the data associated with it
3880  * (but not the AVCodecContext itself).
3881  *
3882  * Calling this function on an AVCodecContext that hasn't been opened will free
3883  * the codec-specific data allocated in avcodec_alloc_context3() /
3884  * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
3885  * do nothing.
3886  */
3887 int avcodec_close(AVCodecContext *avctx);
3888 
3889 /**
3890  * Free all allocated data in the given subtitle struct.
3891  *
3892  * @param sub AVSubtitle to free.
3893  */
3894 void avsubtitle_free(AVSubtitle *sub);
3895 
3896 /**
3897  * @}
3898  */
3899 
3900 /**
3901  * @addtogroup lavc_packet
3902  * @{
3903  */
3904 
3905 /**
3906  * Allocate an AVPacket and set its fields to default values.  The resulting
3907  * struct must be freed using av_packet_free().
3908  *
3909  * @return An AVPacket filled with default values or NULL on failure.
3910  *
3911  * @note this only allocates the AVPacket itself, not the data buffers. Those
3912  * must be allocated through other means such as av_new_packet.
3913  *
3914  * @see av_new_packet
3915  */
3916 AVPacket *av_packet_alloc();
3917 
3918 /**
3919  * Create a new packet that references the same data as src.
3920  *
3921  * This is a shortcut for av_packet_alloc()+av_packet_ref().
3922  *
3923  * @return newly created AVPacket on success, NULL on error.
3924  *
3925  * @see av_packet_alloc
3926  * @see av_packet_ref
3927  */
3928 AVPacket *av_packet_clone(AVPacket *src);
3929 
3930 /**
3931  * Free the packet, if the packet is reference counted, it will be
3932  * unreferenced first.
3933  *
3934  * @param packet packet to be freed. The pointer will be set to NULL.
3935  * @note passing NULL is a no-op.
3936  */
3937 void av_packet_free(AVPacket **pkt);
3938 
3939 /**
3940  * Initialize optional fields of a packet with default values.
3941  *
3942  * Note, this does not touch the data and size members, which have to be
3943  * initialized separately.
3944  *
3945  * @param pkt packet
3946  */
3947 void av_init_packet(AVPacket *pkt);
3948 
3949 /**
3950  * Allocate the payload of a packet and initialize its fields with
3951  * default values.
3952  *
3953  * @param pkt packet
3954  * @param size wanted payload size
3955  * @return 0 if OK, AVERROR_xxx otherwise
3956  */
3957 int av_new_packet(AVPacket *pkt, int size);
3958 
3959 /**
3960  * Reduce packet size, correctly zeroing padding
3961  *
3962  * @param pkt packet
3963  * @param size new size
3964  */
3965 void av_shrink_packet(AVPacket *pkt, int size);
3966 
3967 /**
3968  * Increase packet size, correctly zeroing padding
3969  *
3970  * @param pkt packet
3971  * @param grow_by number of bytes by which to increase the size of the packet
3972  */
3973 int av_grow_packet(AVPacket *pkt, int grow_by);
3974 
3975 /**
3976  * Initialize a reference-counted packet from av_malloc()ed data.
3977  *
3978  * @param pkt packet to be initialized. This function will set the data, size,
3979  *        buf and destruct fields, all others are left untouched.
3980  * @param data Data allocated by av_malloc() to be used as packet data. If this
3981  *        function returns successfully, the data is owned by the underlying AVBuffer.
3982  *        The caller may not access the data through other means.
3983  * @param size size of data in bytes, without the padding. I.e. the full buffer
3984  *        size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE.
3985  *
3986  * @return 0 on success, a negative AVERROR on error
3987  */
3988 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
3989 
3990 static if(FF_API_AVPACKET_OLD_API){
3991     /**
3992      * @warning This is a hack - the packet memory allocation stuff is broken. The
3993      * packet is allocated if it was not really allocated.
3994      *
3995      * @deprecated Use av_packet_ref
3996      */
3997     deprecated
3998         int av_dup_packet(AVPacket *pkt);
3999 
4000     /**
4001      * Copy packet, including contents
4002      *
4003      * @return 0 on success, negative AVERROR on fail
4004      */
4005     deprecated
4006         int av_copy_packet(AVPacket *dst, AVPacket *src);
4007 
4008     /**
4009      * Copy packet side data
4010      *
4011      * @return 0 on success, negative AVERROR on fail
4012      */
4013     deprecated
4014         int av_copy_packet_side_data(AVPacket *dst, AVPacket *src);
4015 
4016     /**
4017      * Free a packet.
4018      *
4019      * @deprecated Use av_packet_unref
4020      *
4021      * @param pkt packet to free
4022      */
4023     deprecated
4024         void av_free_packet(AVPacket *pkt);
4025 }
4026 
4027 /**
4028  * Allocate new information of a packet.
4029  *
4030  * @param pkt packet
4031  * @param type side information type
4032  * @param size side information size
4033  * @return pointer to fresh allocated data or NULL otherwise
4034  */
4035 uint8_t* av_packet_new_side_data(AVPacket *pkt, AVPacketSideDataType type,
4036                                  int size);
4037 
4038 /**
4039  * Wrap an existing array as a packet side data.
4040  *
4041  * @param pkt packet
4042  * @param type side information type
4043  * @param data the side data array. It must be allocated with the av_malloc()
4044  *             family of functions. The ownership of the data is transferred to
4045  *             pkt.
4046  * @param size side information size
4047  * @return a non-negative number on success, a negative AVERROR code on
4048  *         failure. On failure, the packet is unchanged and the data remains
4049  *         owned by the caller.
4050  */
4051 int av_packet_add_side_data(AVPacket *pkt, AVPacketSideDataType type,
4052                             uint8_t *data, size_t size);
4053 
4054 /**
4055  * Shrink the already allocated side data buffer
4056  *
4057  * @param pkt packet
4058  * @param type side information type
4059  * @param size new side information size
4060  * @return 0 on success, < 0 on failure
4061  */
4062 int av_packet_shrink_side_data(AVPacket *pkt, AVPacketSideDataType type,
4063                                int size);
4064 
4065 /**
4066  * Get side information from packet.
4067  *
4068  * @param pkt packet
4069  * @param type desired side information type
4070  * @param size pointer for side information size to store (optional)
4071  * @return pointer to data if present or NULL otherwise
4072  */
4073 uint8_t* av_packet_get_side_data(AVPacket *pkt, AVPacketSideDataType type,
4074                                  int *size);
4075 
4076 int av_packet_merge_side_data(AVPacket *pkt);
4077 
4078 int av_packet_split_side_data(AVPacket *pkt);
4079 
4080 char *av_packet_side_data_name(AVPacketSideDataType type);
4081 
4082 /**
4083  * Pack a dictionary for use in side_data.
4084  *
4085  * @param dict The dictionary to pack.
4086  * @param size pointer to store the size of the returned data
4087  * @return pointer to data if successful, NULL otherwise
4088  */
4089 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
4090 /**
4091  * Unpack a dictionary from side_data.
4092  *
4093  * @param data data from side_data
4094  * @param size size of the data
4095  * @param dict the metadata storage dictionary
4096  * @return 0 on success, < 0 on failure
4097  */
4098 int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
4099 
4100 
4101 /**
4102  * Convenience function to free all the side data stored.
4103  * All the other fields stay untouched.
4104  *
4105  * @param pkt packet
4106  */
4107 void av_packet_free_side_data(AVPacket *pkt);
4108 
4109 /**
4110  * Setup a new reference to the data described by a given packet
4111  *
4112  * If src is reference-counted, setup dst as a new reference to the
4113  * buffer in src. Otherwise allocate a new buffer in dst and copy the
4114  * data from src into it.
4115  *
4116  * All the other fields are copied from src.
4117  *
4118  * @see av_packet_unref
4119  *
4120  * @param dst Destination packet
4121  * @param src Source packet
4122  *
4123  * @return 0 on success, a negative AVERROR on error.
4124  */
4125 int av_packet_ref(AVPacket *dst, const AVPacket *src);
4126 
4127 /**
4128  * Wipe the packet.
4129  *
4130  * Unreference the buffer referenced by the packet and reset the
4131  * remaining packet fields to their default values.
4132  *
4133  * @param pkt The packet to be unreferenced.
4134  */
4135 void av_packet_unref(AVPacket *pkt);
4136 
4137 /**
4138  * Move every field in src to dst and reset src.
4139  *
4140  * @see av_packet_unref
4141  *
4142  * @param src Source packet, will be reset
4143  * @param dst Destination packet
4144  */
4145 void av_packet_move_ref(AVPacket *dst, AVPacket *src);
4146 
4147 /**
4148  * Copy only "properties" fields from src to dst.
4149  *
4150  * Properties for the purpose of this function are all the fields
4151  * beside those related to the packet data (buf, data, size)
4152  *
4153  * @param dst Destination packet
4154  * @param src Source packet
4155  *
4156  * @return 0 on success AVERROR on failure.
4157  *
4158  */
4159 int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
4160 
4161 /**
4162  * Convert valid timing fields (timestamps / durations) in a packet from one
4163  * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
4164  * ignored.
4165  *
4166  * @param pkt packet on which the conversion will be performed
4167  * @param tb_src source timebase, in which the timing fields in pkt are
4168  *               expressed
4169  * @param tb_dst destination timebase, to which the timing fields will be
4170  *               converted
4171  */
4172 void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
4173 
4174 /**
4175  * @}
4176  */
4177 
4178 /**
4179  * @addtogroup lavc_decoding
4180  * @{
4181  */
4182 
4183 /**
4184  * Find a registered decoder with a matching codec ID.
4185  *
4186  * @param id AVCodecID of the requested decoder
4187  * @return A decoder if one was found, NULL otherwise.
4188  */
4189 AVCodec *avcodec_find_decoder(AVCodecID id);
4190 
4191 /**
4192  * Find a registered decoder with the specified name.
4193  *
4194  * @param name name of the requested decoder
4195  * @return A decoder if one was found, NULL otherwise.
4196  */
4197 AVCodec *avcodec_find_decoder_by_name(const char *name);
4198 
4199 /**
4200  * The default callback for AVCodecContext.get_buffer2(). It is made public so
4201  * it can be called by custom get_buffer2() implementations for decoders without
4202  * CODEC_CAP_DR1 set.
4203  */
4204 int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
4205 
4206 static if (FF_API_EMU_EDGE) {
4207 /**
4208  * Return the amount of padding in pixels which the get_buffer callback must
4209  * provide around the edge of the image for codecs which do not have the
4210  * CODEC_FLAG_EMU_EDGE flag.
4211  *
4212  * @return Required padding in pixels.
4213  *
4214  * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer
4215  * needed
4216  */
4217 deprecated
4218 uint avcodec_get_edge_width();
4219 }
4220 
4221 /**
4222  * Modify width and height values so that they will result in a memory
4223  * buffer that is acceptable for the codec if you do not use any horizontal
4224  * padding.
4225  *
4226  * May only be used if a codec with CODEC_CAP_DR1 has been opened.
4227  */
4228 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
4229 
4230 /**
4231  * Modify width and height values so that they will result in a memory
4232  * buffer that is acceptable for the codec if you also ensure that all
4233  * line sizes are a multiple of the respective linesize_align[i].
4234  *
4235  * May only be used if a codec with CODEC_CAP_DR1 has been opened.
4236  */
4237 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
4238                                int [AV_NUM_DATA_POINTERS]linesize_align);
4239 
4240 /**
4241  * Converts AVChromaLocation to swscale x/y chroma position.
4242  *
4243  * The positions represent the chroma (0,0) position in a coordinates system
4244  * with luma (0,0) representing the origin and luma(1,1) representing 256,256
4245  *
4246  * @param xpos  horizontal chroma sample position
4247  * @param ypos  vertical   chroma sample position
4248  */
4249 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, AVChromaLocation pos);
4250 
4251 /**
4252  * Converts swscale x/y chroma position to AVChromaLocation.
4253  *
4254  * The positions represent the chroma (0,0) position in a coordinates system
4255  * with luma (0,0) representing the origin and luma(1,1) representing 256,256
4256  *
4257  * @param xpos  horizontal chroma sample position
4258  * @param ypos  vertical   chroma sample position
4259  */
4260 AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
4261 
4262 /**
4263  * Decode the audio frame of size avpkt->size from avpkt->data into frame.
4264  *
4265  * Some decoders may support multiple frames in a single AVPacket. Such
4266  * decoders would then just decode the first frame and the return value would be
4267  * less than the packet size. In this case, avcodec_decode_audio4 has to be
4268  * called again with an AVPacket containing the remaining data in order to
4269  * decode the second frame, etc...  Even if no frames are returned, the packet
4270  * needs to be fed to the decoder with remaining data until it is completely
4271  * consumed or an error occurs.
4272  *
4273  * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
4274  * and output. This means that for some packets they will not immediately
4275  * produce decoded output and need to be flushed at the end of decoding to get
4276  * all the decoded data. Flushing is done by calling this function with packets
4277  * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
4278  * returning samples. It is safe to flush even those decoders that are not
4279  * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
4280  *
4281  * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
4282  *          larger than the actual read bytes because some optimized bitstream
4283  *          readers read 32 or 64 bits at once and could read over the end.
4284  *
4285  * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
4286  * before packets may be fed to the decoder.
4287  *
4288  * @param      avctx the codec context
4289  * @param[out] frame The AVFrame in which to store decoded audio samples.
4290  *                   The decoder will allocate a buffer for the decoded frame by
4291  *                   calling the AVCodecContext.get_buffer2() callback.
4292  *                   When AVCodecContext.refcounted_frames is set to 1, the frame is
4293  *                   reference counted and the returned reference belongs to the
4294  *                   caller. The caller must release the frame using av_frame_unref()
4295  *                   when the frame is no longer needed. The caller may safely write
4296  *                   to the frame if av_frame_is_writable() returns 1.
4297  *                   When AVCodecContext.refcounted_frames is set to 0, the returned
4298  *                   reference belongs to the decoder and is valid only until the
4299  *                   next call to this function or until closing or flushing the
4300  *                   decoder. The caller may not write to it.
4301  * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
4302  *                           non-zero. Note that this field being set to zero
4303  *                           does not mean that an error has occurred. For
4304  *                           decoders with AV_CODEC_CAP_DELAY set, no given decode
4305  *                           call is guaranteed to produce a frame.
4306  * @param[in]  avpkt The input AVPacket containing the input buffer.
4307  *                   At least avpkt->data and avpkt->size should be set. Some
4308  *                   decoders might also require additional fields to be set.
4309  * @return A negative error code is returned if an error occurred during
4310  *         decoding, otherwise the number of bytes consumed from the input
4311  *         AVPacket is returned.
4312  */
4313 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
4314                           int *got_frame_ptr, const AVPacket *avpkt);
4315 
4316 /**
4317  * Decode the video frame of size avpkt->size from avpkt->data into picture.
4318  * Some decoders may support multiple frames in a single AVPacket, such
4319  * decoders would then just decode the first frame.
4320  *
4321  * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
4322  * the actual read bytes because some optimized bitstream readers read 32 or 64
4323  * bits at once and could read over the end.
4324  *
4325  * @warning The end of the input buffer buf should be set to 0 to ensure that
4326  * no overreading happens for damaged MPEG streams.
4327  *
4328  * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
4329  * between input and output, these need to be fed with avpkt->data=NULL,
4330  * avpkt->size=0 at the end to return the remaining frames.
4331  *
4332  * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
4333  * before packets may be fed to the decoder.
4334  *
4335  * @param avctx the codec context
4336  * @param[out] picture The AVFrame in which the decoded video frame will be stored.
4337  *             Use av_frame_alloc() to get an AVFrame. The codec will
4338  *             allocate memory for the actual bitmap by calling the
4339  *             AVCodecContext.get_buffer2() callback.
4340  *             When AVCodecContext.refcounted_frames is set to 1, the frame is
4341  *             reference counted and the returned reference belongs to the
4342  *             caller. The caller must release the frame using av_frame_unref()
4343  *             when the frame is no longer needed. The caller may safely write
4344  *             to the frame if av_frame_is_writable() returns 1.
4345  *             When AVCodecContext.refcounted_frames is set to 0, the returned
4346  *             reference belongs to the decoder and is valid only until the
4347  *             next call to this function or until closing or flushing the
4348  *             decoder. The caller may not write to it.
4349  *
4350  * @param[in] avpkt The input AVPacket containing the input buffer.
4351  *            You can create such packet with av_init_packet() and by then setting
4352  *            data and size, some decoders might in addition need other fields like
4353  *            flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
4354  *            fields possible.
4355  * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
4356  * @return On error a negative value is returned, otherwise the number of bytes
4357  * used or zero if no frame could be decompressed.
4358  */
4359 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
4360                          int *got_picture_ptr,
4361                          const AVPacket *avpkt);
4362 
4363 /**
4364  * Decode a subtitle message.
4365  * Return a negative value on error, otherwise return the number of bytes used.
4366  * If no subtitle could be decompressed, got_sub_ptr is zero.
4367  * Otherwise, the subtitle is stored in *sub.
4368  * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
4369  * simplicity, because the performance difference is expect to be negligible
4370  * and reusing a get_buffer written for video codecs would probably perform badly
4371  * due to a potentially very different allocation pattern.
4372  *
4373  * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input
4374  * and output. This means that for some packets they will not immediately
4375  * produce decoded output and need to be flushed at the end of decoding to get
4376  * all the decoded data. Flushing is done by calling this function with packets
4377  * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
4378  * returning subtitles. It is safe to flush even those decoders that are not
4379  * marked with CODEC_CAP_DELAY, then no subtitles will be returned.
4380  *
4381  * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
4382  * before packets may be fed to the decoder.
4383  *
4384  * @param avctx the codec context
4385  * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
4386  *                 must be freed with avsubtitle_free if *got_sub_ptr is set.
4387  * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
4388  * @param[in] avpkt The input AVPacket containing the input buffer.
4389  */
4390 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
4391                             int *got_sub_ptr,
4392                             AVPacket *avpkt);
4393 
4394 /**
4395  * @defgroup lavc_parsing Frame parsing
4396  * @{
4397  */
4398 
4399 enum AVPictureStructure {
4400     AV_PICTURE_STRUCTURE_UNKNOWN,      //< unknown
4401     AV_PICTURE_STRUCTURE_TOP_FIELD,    //< coded as top field
4402     AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
4403     AV_PICTURE_STRUCTURE_FRAME,        //< coded as frame
4404 }
4405 
4406 struct AVCodecParserContext {
4407     void *priv_data;
4408     AVCodecParser *parser;
4409     int64_t frame_offset; /* offset of the current frame */
4410     int64_t cur_offset; /* current offset
4411                            (incremented by each av_parser_parse()) */
4412     int64_t next_frame_offset; /* offset of the next frame */
4413     /* video info */
4414     int pict_type; /* XXX: Put it back in AVCodecContext. */
4415     /**
4416      * This field is used for proper frame duration computation in lavf.
4417      * It signals, how much longer the frame duration of the current frame
4418      * is compared to normal frame duration.
4419      *
4420      * frame_duration = (1 + repeat_pict) * time_base
4421      *
4422      * It is used by codecs like H.264 to display telecined material.
4423      */
4424     int repeat_pict; /* XXX: Put it back in AVCodecContext. */
4425     int64_t pts;     /* pts of the current frame */
4426     int64_t dts;     /* dts of the current frame */
4427 
4428     /* private data */
4429     int64_t last_pts;
4430     int64_t last_dts;
4431     int fetch_timestamp;
4432 
4433 //#define AV_PARSER_PTS_NB 4
4434     int cur_frame_start_index;
4435     int64_t [AV_PARSER_PTS_NB]cur_frame_offset;
4436     int64_t [AV_PARSER_PTS_NB]cur_frame_pts;
4437     int64_t [AV_PARSER_PTS_NB]cur_frame_dts;
4438 
4439     int flags;
4440 //#define PARSER_FLAG_COMPLETE_FRAMES           0x0001
4441 //#define PARSER_FLAG_ONCE                      0x0002
4442 /// Set if the parser has a valid file offset
4443 //#define PARSER_FLAG_FETCHED_OFFSET            0x0004
4444 //#define PARSER_FLAG_USE_CODEC_TS              0x1000
4445 
4446     int64_t offset;      ///< byte offset from starting packet start
4447     int64_t [AV_PARSER_PTS_NB]cur_frame_end;
4448 
4449     /**
4450      * Set by parser to 1 for key frames and 0 for non-key frames.
4451      * It is initialized to -1, so if the parser doesn't set this flag,
4452      * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
4453      * will be used.
4454      */
4455     int key_frame;
4456 
4457 static if(FF_API_CONVERGENCE_DURATION){
4458     /** @deprecated unused */
4459     deprecated
4460         int64_t convergence_duration;
4461 }
4462     // Timestamp generation support:
4463     /**
4464      * Synchronization point for start of timestamp generation.
4465      *
4466      * Set to >0 for sync point, 0 for no sync point and <0 for undefined
4467      * (default).
4468      *
4469      * For example, this corresponds to presence of H.264 buffering period
4470      * SEI message.
4471      */
4472     int dts_sync_point;
4473 
4474     /**
4475      * Offset of the current timestamp against last timestamp sync point in
4476      * units of AVCodecContext.time_base.
4477      *
4478      * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
4479      * contain a valid timestamp offset.
4480      *
4481      * Note that the timestamp of sync point has usually a nonzero
4482      * dts_ref_dts_delta, which refers to the previous sync point. Offset of
4483      * the next frame after timestamp sync point will be usually 1.
4484      *
4485      * For example, this corresponds to H.264 cpb_removal_delay.
4486      */
4487     int dts_ref_dts_delta;
4488 
4489     /**
4490      * Presentation delay of current frame in units of AVCodecContext.time_base.
4491      *
4492      * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
4493      * contain valid non-negative timestamp delta (presentation time of a frame
4494      * must not lie in the past).
4495      *
4496      * This delay represents the difference between decoding and presentation
4497      * time of the frame.
4498      *
4499      * For example, this corresponds to H.264 dpb_output_delay.
4500      */
4501     int pts_dts_delta;
4502 
4503     /**
4504      * Position of the packet in file.
4505      *
4506      * Analogous to cur_frame_pts/dts
4507      */
4508     int64_t [AV_PARSER_PTS_NB]cur_frame_pos;
4509 
4510     /**
4511      * Byte position of currently parsed frame in stream.
4512      */
4513     int64_t pos;
4514 
4515     /**
4516      * Previous frame byte position.
4517      */
4518     int64_t last_pos;
4519 
4520     /**
4521      * Duration of the current frame.
4522      * For audio, this is in units of 1 / AVCodecContext.sample_rate.
4523      * For all other types, this is in units of AVCodecContext.time_base.
4524      */
4525     int duration;
4526 
4527     AVFieldOrder field_order;
4528 
4529     /**
4530      * Indicate whether a picture is coded as a frame, top field or bottom field.
4531      *
4532      * For example, H.264 field_pic_flag equal to 0 corresponds to
4533      * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
4534      * equal to 1 and bottom_field_flag equal to 0 corresponds to
4535      * AV_PICTURE_STRUCTURE_TOP_FIELD.
4536      */
4537     AVPictureStructure picture_structure;
4538 
4539     /**
4540      * Picture number incremented in presentation or output order.
4541      * This field may be reinitialized at the first picture of a new sequence.
4542      *
4543      * For example, this corresponds to H.264 PicOrderCnt.
4544      */
4545     int output_picture_number;
4546 
4547     /**
4548      * Dimensions of the decoded video intended for presentation.
4549      */
4550     int width;
4551     int height;
4552 
4553     /**
4554      * Dimensions of the coded video.
4555      */
4556     int coded_width;
4557     int coded_height;
4558 
4559     /**
4560      * The format of the coded data, corresponds to enum AVPixelFormat for video
4561      * and for enum AVSampleFormat for audio.
4562      *
4563      * Note that a decoder can have considerable freedom in how exactly it
4564      * decodes the data, so the format reported here might be different from the
4565      * one returned by a decoder.
4566      */
4567     int format;
4568 }
4569 
4570 struct AVCodecParser {
4571     int [5]codec_ids; /* several codec IDs are permitted */
4572     int priv_data_size;
4573     int function(AVCodecParserContext *s) parser_init;
4574     /* This callback never returns an error, a negative value means that
4575          * the frame start was in a previous packet. */
4576     int function(AVCodecParserContext *s, 
4577                         AVCodecContext *avctx, 
4578                         const uint8_t **poutbuf, int *poutbuf_size,
4579                         const uint8_t *buf, int buf_size) parser_parse;
4580     void function(AVCodecParserContext *s) parser_close;
4581     int function(AVCodecContext *avctx, const uint8_t *buf, int buf_size) split;
4582     AVCodecParser *next;
4583 }
4584 
4585 AVCodecParser *av_parser_next(AVCodecParser *c);
4586 
4587 void av_register_codec_parser(AVCodecParser *parser);
4588 AVCodecParserContext *av_parser_init(int codec_id);
4589 
4590 /**
4591  * Parse a packet.
4592  *
4593  * @param s             parser context.
4594  * @param avctx         codec context.
4595  * @param poutbuf       set to pointer to parsed buffer or NULL if not yet finished.
4596  * @param poutbuf_size  set to size of parsed buffer or zero if not yet finished.
4597  * @param buf           input buffer.
4598  * @param buf_size      input length, to signal EOF, this should be 0 (so that the last frame can be output).
4599  * @param pts           input presentation timestamp.
4600  * @param dts           input decoding timestamp.
4601  * @param pos           input byte position in stream.
4602  * @return the number of bytes of the input bitstream used.
4603  *
4604  * Example:
4605  * @code
4606  *   while(in_len){
4607  *       len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
4608  *                                        in_data, in_len,
4609  *                                        pts, dts, pos);
4610  *       in_data += len;
4611  *       in_len  -= len;
4612  *
4613  *       if(size)
4614  *          decode_frame(data, size);
4615  *   }
4616  * @endcode
4617  */
4618 int av_parser_parse2(AVCodecParserContext *s,
4619                      AVCodecContext *avctx,
4620                      uint8_t **poutbuf, int *poutbuf_size,
4621                      const uint8_t *buf, int buf_size,
4622                      int64_t pts, int64_t dts,
4623                      int64_t pos);
4624 
4625 /**
4626  * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
4627  * @deprecated use AVBitStreamFilter
4628  */
4629 int av_parser_change(AVCodecParserContext *s,
4630                      AVCodecContext *avctx,
4631                      uint8_t **poutbuf, int *poutbuf_size,
4632                      const uint8_t *buf, int buf_size, int keyframe);
4633 void av_parser_close(AVCodecParserContext *s);
4634 
4635 /**
4636  * @}
4637  * @}
4638  */
4639 
4640 /**
4641  * @addtogroup lavc_encoding
4642  * @{
4643  */
4644 
4645 /**
4646  * Find a registered encoder with a matching codec ID.
4647  *
4648  * @param id AVCodecID of the requested encoder
4649  * @return An encoder if one was found, NULL otherwise.
4650  */
4651 AVCodec *avcodec_find_encoder(AVCodecID id);
4652 
4653 /**
4654  * Find a registered encoder with the specified name.
4655  *
4656  * @param name name of the requested encoder
4657  * @return An encoder if one was found, NULL otherwise.
4658  */
4659 AVCodec *avcodec_find_encoder_by_name(const char *name);
4660 
4661 /**
4662  * Encode a frame of audio.
4663  *
4664  * Takes input samples from frame and writes the next output packet, if
4665  * available, to avpkt. The output packet does not necessarily contain data for
4666  * the most recent frame, as encoders can delay, split, and combine input frames
4667  * internally as needed.
4668  *
4669  * @param avctx     codec context
4670  * @param avpkt     output AVPacket.
4671  *                  The user can supply an output buffer by setting
4672  *                  avpkt->data and avpkt->size prior to calling the
4673  *                  function, but if the size of the user-provided data is not
4674  *                  large enough, encoding will fail. If avpkt->data and
4675  *                  avpkt->size are set, avpkt->destruct must also be set. All
4676  *                  other AVPacket fields will be reset by the encoder using
4677  *                  av_init_packet(). If avpkt->data is NULL, the encoder will
4678  *                  allocate it. The encoder will set avpkt->size to the size
4679  *                  of the output packet.
4680  *
4681  *                  If this function fails or produces no output, avpkt will be
4682  *                  freed using av_free_packet() (i.e. avpkt->destruct will be
4683  *                  called to free the user supplied buffer).
4684  * @param[in] frame AVFrame containing the raw audio data to be encoded.
4685  *                  May be NULL when flushing an encoder that has the
4686  *                  CODEC_CAP_DELAY capability set.
4687  *                  If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
4688  *                  can have any number of samples.
4689  *                  If it is not set, frame->nb_samples must be equal to
4690  *                  avctx->frame_size for all frames except the last.
4691  *                  The final frame may be smaller than avctx->frame_size.
4692  * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
4693  *                            output packet is non-empty, and to 0 if it is
4694  *                            empty. If the function returns an error, the
4695  *                            packet can be assumed to be invalid, and the
4696  *                            value of got_packet_ptr is undefined and should
4697  *                            not be used.
4698  * @return          0 on success, negative error code on failure
4699  */
4700 int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
4701                           const AVFrame *frame, int *got_packet_ptr);
4702 
4703 /**
4704  * Encode a frame of video.
4705  *
4706  * Takes input raw video data from frame and writes the next output packet, if
4707  * available, to avpkt. The output packet does not necessarily contain data for
4708  * the most recent frame, as encoders can delay and reorder input frames
4709  * internally as needed.
4710  *
4711  * @param avctx     codec context
4712  * @param avpkt     output AVPacket.
4713  *                  The user can supply an output buffer by setting
4714  *                  avpkt->data and avpkt->size prior to calling the
4715  *                  function, but if the size of the user-provided data is not
4716  *                  large enough, encoding will fail. All other AVPacket fields
4717  *                  will be reset by the encoder using av_init_packet(). If
4718  *                  avpkt->data is NULL, the encoder will allocate it.
4719  *                  The encoder will set avpkt->size to the size of the
4720  *                  output packet. The returned data (if any) belongs to the
4721  *                  caller, he is responsible for freeing it.
4722  *
4723  *                  If this function fails or produces no output, avpkt will be
4724  *                  freed using av_free_packet() (i.e. avpkt->destruct will be
4725  *                  called to free the user supplied buffer).
4726  * @param[in] frame AVFrame containing the raw video data to be encoded.
4727  *                  May be NULL when flushing an encoder that has the
4728  *                  CODEC_CAP_DELAY capability set.
4729  * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
4730  *                            output packet is non-empty, and to 0 if it is
4731  *                            empty. If the function returns an error, the
4732  *                            packet can be assumed to be invalid, and the
4733  *                            value of got_packet_ptr is undefined and should
4734  *                            not be used.
4735  * @return          0 on success, negative error code on failure
4736  */
4737 int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
4738                           const AVFrame *frame, int *got_packet_ptr);
4739 
4740 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
4741                             const AVSubtitle *sub);
4742 
4743 
4744 /**
4745  * @}
4746  */
4747 
4748 static if (FF_API_AVCODEC_RESAMPLE) {
4749 /**
4750  * @defgroup lavc_resample Audio resampling
4751  * @ingroup libavc
4752  * @deprecated use libswresample instead
4753  *
4754  * @{
4755  */
4756 struct ReSampleContext;
4757 struct AVResampleContext;
4758 
4759 //typedef struct ReSampleContext ReSampleContext;
4760 
4761 /**
4762  *  Initialize audio resampling context.
4763  *
4764  * @param output_channels  number of output channels
4765  * @param input_channels   number of input channels
4766  * @param output_rate      output sample rate
4767  * @param input_rate       input sample rate
4768  * @param sample_fmt_out   requested output sample format
4769  * @param sample_fmt_in    input sample format
4770  * @param filter_length    length of each FIR filter in the filterbank relative to the cutoff frequency
4771  * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
4772  * @param linear           if 1 then the used FIR filter will be linearly interpolated
4773                            between the 2 closest, if 0 the closest will be used
4774  * @param cutoff           cutoff frequency, 1.0 corresponds to half the output sampling rate
4775  * @return allocated ReSampleContext, NULL if error occurred
4776  */
4777 deprecated
4778 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
4779                                         int output_rate, int input_rate,
4780                                         AVSampleFormat sample_fmt_out,
4781                                         AVSampleFormat sample_fmt_in,
4782                                         int filter_length, int log2_phase_count,
4783                                         int linear, double cutoff);
4784 
4785 deprecated
4786 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
4787 
4788 /**
4789  * Free resample context.
4790  *
4791  * @param s a non-NULL pointer to a resample context previously
4792  *          created with av_audio_resample_init()
4793  */
4794 deprecated
4795 void audio_resample_close(ReSampleContext *s);
4796 
4797 
4798 /**
4799  * Initialize an audio resampler.
4800  * Note, if either rate is not an integer then simply scale both rates up so they are.
4801  * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
4802  * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
4803  * @param linear If 1 then the used FIR filter will be linearly interpolated
4804                  between the 2 closest, if 0 the closest will be used
4805  * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
4806  */
4807 deprecated
4808 AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
4809 
4810 /**
4811  * Resample an array of samples using a previously configured context.
4812  * @param src an array of unconsumed samples
4813  * @param consumed the number of samples of src which have been consumed are returned here
4814  * @param src_size the number of unconsumed samples available
4815  * @param dst_size the amount of space in samples available in dst
4816  * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
4817  * @return the number of samples written in dst or -1 if an error occurred
4818  */
4819 deprecated
4820 int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
4821 
4822 
4823 /**
4824  * Compensate samplerate/timestamp drift. The compensation is done by changing
4825  * the resampler parameters, so no audible clicks or similar distortions occur
4826  * @param compensation_distance distance in output samples over which the compensation should be performed
4827  * @param sample_delta number of output samples which should be output less
4828  *
4829  * example: av_resample_compensate(c, 10, 500)
4830  * here instead of 510 samples only 500 samples would be output
4831  *
4832  * note, due to rounding the actual compensation might be slightly different,
4833  * especially if the compensation_distance is large and the in_rate used during init is small
4834  */
4835 deprecated
4836 void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance);
4837 deprecated
4838 void av_resample_close(AVResampleContext *c);
4839 
4840 /**
4841  * @}
4842  */
4843 }
4844 
4845 static if(FF_API_AVPICTURE){
4846 
4847     /**
4848      * @addtogroup lavc_picture
4849      * @{
4850      */
4851 
4852     /**
4853      * @deprecated unused
4854      */
4855     deprecated
4856         int avpicture_alloc(AVPicture *picture, AVPixelFormat pix_fmt, int width, int height);
4857 
4858     /**
4859      * @deprecated unused
4860      */
4861     deprecated
4862         void avpicture_free(AVPicture *picture);
4863 
4864     /**
4865      * @deprecated use av_image_fill_arrays() instead.
4866      */
4867     deprecated
4868         int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
4869                        AVPixelFormat pix_fmt, int width, int height);
4870 
4871     /**
4872      * @deprecated use av_image_copy_to_buffer() instead.
4873      */
4874     deprecated
4875         int avpicture_layout(const AVPicture *src, AVPixelFormat pix_fmt,
4876                          int width, int height,
4877                          ubyte *dest, int dest_size);
4878 
4879     /**
4880      * @deprecated use av_image_get_buffer_size() instead.
4881      */
4882     deprecated
4883         int avpicture_get_size(AVPixelFormat pix_fmt, int width, int height);
4884 
4885     /**
4886      * @deprecated av_image_copy() instead.
4887      */
4888     deprecated
4889         void av_picture_copy(AVPicture *dst, const AVPicture *src,
4890                          AVPixelFormat pix_fmt, int width, int height);
4891 
4892     /**
4893      * @deprecated unused
4894      */
4895     deprecated
4896         int av_picture_crop(AVPicture *dst, const AVPicture *src,
4897                         AVPixelFormat pix_fmt, int top_band, int left_band);
4898 
4899     /**
4900      * @deprecated unused
4901      */
4902     deprecated
4903         int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, AVPixelFormat pix_fmt,
4904                 int padtop, int padbottom, int padleft, int padright, int *color);
4905 
4906     /**
4907      * @}
4908      */
4909 }
4910 
4911 /**
4912  * @defgroup lavc_misc Utility functions
4913  * @ingroup libavc
4914  *
4915  * Miscellaneous utility functions related to both encoding and decoding
4916  * (or neither).
4917  * @{
4918  */
4919 
4920 /**
4921  * @defgroup lavc_misc_pixfmt Pixel formats
4922  *
4923  * Functions for working with pixel formats.
4924  * @{
4925  */
4926 
4927 /**
4928  * Utility function to access log2_chroma_w log2_chroma_h from
4929  * the pixel format AVPixFmtDescriptor.
4930  *
4931  * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample
4932  * for one that returns a failure code and continues in case of invalid
4933  * pix_fmts.
4934  *
4935  * @param[in]  pix_fmt the pixel format
4936  * @param[out] h_shift store log2_chroma_h
4937  * @param[out] v_shift store log2_chroma_w
4938  *
4939  * @see av_pix_fmt_get_chroma_sub_sample
4940  */
4941 
4942 void avcodec_get_chroma_sub_sample(AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
4943 
4944 /**
4945  * Return a value representing the fourCC code associated to the
4946  * pixel format pix_fmt, or 0 if no associated fourCC code can be
4947  * found.
4948  */
4949 uint avcodec_pix_fmt_to_codec_tag(AVPixelFormat pix_fmt);
4950 
4951 /**
4952  * @deprecated see av_get_pix_fmt_loss()
4953  */
4954 int avcodec_get_pix_fmt_loss(AVPixelFormat dst_pix_fmt, AVPixelFormat src_pix_fmt,
4955                              int has_alpha);
4956 
4957 /**
4958  * Find the best pixel format to convert to given a certain source pixel
4959  * format.  When converting from one pixel format to another, information loss
4960  * may occur.  For example, when converting from RGB24 to GRAY, the color
4961  * information will be lost. Similarly, other losses occur when converting from
4962  * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
4963  * the given pixel formats should be used to suffer the least amount of loss.
4964  * The pixel formats from which it chooses one, are determined by the
4965  * pix_fmt_list parameter.
4966  *
4967  *
4968  * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
4969  * @param[in] src_pix_fmt source pixel format
4970  * @param[in] has_alpha Whether the source pixel format alpha channel is used.
4971  * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
4972  * @return The best pixel format to convert to or -1 if none was found.
4973  */
4974 AVPixelFormat avcodec_find_best_pix_fmt_of_list(AVPixelFormat *pix_fmt_list,
4975                                             AVPixelFormat src_pix_fmt,
4976                                             int has_alpha, int *loss_ptr);
4977 
4978 /**
4979  * @deprecated see av_find_best_pix_fmt_of_2()
4980  */
4981 AVPixelFormat avcodec_find_best_pix_fmt_of_2(AVPixelFormat dst_pix_fmt1, AVPixelFormat dst_pix_fmt2,
4982                                              AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
4983 
4984 
4985 static if (AV_HAVE_INCOMPATIBLE_LIBAV_ABI) {
4986 deprecated AVPixelFormat avcodec_find_best_pix_fmt2(AVPixelFormat *pix_fmt_list,
4987                                               AVPixelFormat src_pix_fmt,
4988                                               int has_alpha, int *loss_ptr);
4989 } else {
4990 AVPixelFormat avcodec_find_best_pix_fmt2(AVPixelFormat dst_pix_fmt1, AVPixelFormat dst_pix_fmt2,
4991                                             AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
4992 }
4993 
4994 
4995 AVPixelFormat avcodec_default_get_format(AVCodecContext *s, const AVPixelFormat * fmt);
4996 
4997 /**
4998  * @}
4999  */
5000 
5001 static if (FF_API_SET_DIMENSIONS) {
5002 /**
5003  * @deprecated this function is not supposed to be used from outside of lavc
5004  */
5005 deprecated
5006 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
5007 }
5008 
5009 /**
5010  * Put a string representing the codec tag codec_tag in buf.
5011  *
5012  * @param buf       buffer to place codec tag in
5013  * @param buf_size size in bytes of buf
5014  * @param codec_tag codec tag to assign
5015  * @return the length of the string that would have been generated if
5016  * enough space had been available, excluding the trailing null
5017  */
5018 size_t av_get_codec_tag_string(char *buf, size_t buf_size, uint codec_tag);
5019 
5020 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
5021 
5022 /**
5023  * Return a name for the specified profile, if available.
5024  *
5025  * @param codec the codec that is searched for the given profile
5026  * @param profile the profile value for which a name is requested
5027  * @return A name for the profile if found, NULL otherwise.
5028  */
5029 char *av_get_profile_name(const AVCodec *codec, int profile);
5030 
5031 /**
5032  * Return a name for the specified profile, if available.
5033  *
5034  * @param codec_id the ID of the codec to which the requested profile belongs
5035  * @param profile the profile value for which a name is requested
5036  * @return A name for the profile if found, NULL otherwise.
5037  *
5038  * @note unlike av_get_profile_name(), which searches a list of profiles
5039  *       supported by a specific decoder or encoder implementation, this
5040  *       function searches the list of profiles from the AVCodecDescriptor
5041  */
5042 char *avcodec_profile_name(AVCodecID codec_id, int profile);
5043 
5044 int avcodec_default_execute(AVCodecContext *c, int function(AVCodecContext *c2, void *arg2) func,void *arg, int *ret, int count, int size);
5045 int avcodec_default_execute2(AVCodecContext *c, int function(AVCodecContext *c2, void *arg2, int, int) func,void *arg, int *ret, int count);
5046 //FIXME func typedef
5047 
5048 /**
5049  * Fill AVFrame audio data and linesize pointers.
5050  *
5051  * The buffer buf must be a preallocated buffer with a size big enough
5052  * to contain the specified samples amount. The filled AVFrame data
5053  * pointers will point to this buffer.
5054  *
5055  * AVFrame extended_data channel pointers are allocated if necessary for
5056  * planar audio.
5057  *
5058  * @param frame       the AVFrame
5059  *                    frame->nb_samples must be set prior to calling the
5060  *                    function. This function fills in frame->data,
5061  *                    frame->extended_data, frame->linesize[0].
5062  * @param nb_channels channel count
5063  * @param sample_fmt  sample format
5064  * @param buf         buffer to use for frame data
5065  * @param buf_size    size of buffer
5066  * @param align       plane size sample alignment (0 = default)
5067  * @return            >=0 on success, negative error code on failure
5068  * @todo return the size in bytes required to store the samples in
5069  * case of success, at the next libavutil bump
5070  */
5071 int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
5072                              AVSampleFormat sample_fmt, const uint8_t *buf,
5073                              int buf_size, int _align);
5074 
5075 /**
5076  * Reset the internal decoder state / flush internal buffers. Should be called
5077  * e.g. when seeking or when switching to a different stream.
5078  *
5079  * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
5080  * this invalidates the frames previously returned from the decoder. When
5081  * refcounted frames are used, the decoder just releases any references it might
5082  * keep internally, but the caller's reference remains valid.
5083  */
5084 void avcodec_flush_buffers(AVCodecContext *avctx);
5085 
5086 /**
5087  * Return codec bits per sample.
5088  *
5089  * @param[in] codec_id the codec
5090  * @return Number of bits per sample or zero if unknown for the given codec.
5091  */
5092 int av_get_bits_per_sample(AVCodecID codec_id);
5093 
5094 /**
5095  * Return the PCM codec associated with a sample format.
5096  * @param be  endianness, 0 for little, 1 for big,
5097  *            -1 (or anything else) for native
5098  * @return  AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
5099  */
5100 AVCodecID av_get_pcm_codec(AVSampleFormat fmt, int be);
5101 
5102 /**
5103  * Return codec bits per sample.
5104  * Only return non-zero if the bits per sample is exactly correct, not an
5105  * approximation.
5106  *
5107  * @param[in] codec_id the codec
5108  * @return Number of bits per sample or zero if unknown for the given codec.
5109  */
5110 int av_get_exact_bits_per_sample(AVCodecID codec_id);
5111 
5112 /**
5113  * Return audio frame duration.
5114  *
5115  * @param avctx        codec context
5116  * @param frame_bytes  size of the frame, or 0 if unknown
5117  * @return             frame duration, in samples, if known. 0 if not able to
5118  *                     determine.
5119  */
5120 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
5121 
5122 struct AVBitStreamFilterContext {
5123     void *priv_data;
5124     AVBitStreamFilter *filter;
5125     AVCodecParserContext *parser;
5126     AVBitStreamFilterContext *next;
5127     /**
5128      * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
5129      * Not for access by library users.
5130      */
5131     char *args;
5132 }
5133 
5134 struct AVBitStreamFilter {
5135     const char *name;
5136     int priv_data_size;
5137     int function(AVBitStreamFilterContext *bsfc,
5138                   AVCodecContext *avctx, const char *args,
5139                   uint8_t **poutbuf, int *poutbuf_size,
5140                   const uint8_t *buf, int buf_size, int keyframe) filter;
5141     void function(AVBitStreamFilterContext *bsfc) close;
5142     AVBitStreamFilter *next;
5143 }
5144 
5145 /**
5146  * Register a bitstream filter.
5147  *
5148  * The filter will be accessible to the application code through
5149  * av_bitstream_filter_next() or can be directly initialized with
5150  * av_bitstream_filter_init().
5151  *
5152  * @see avcodec_register_all()
5153  */
5154 void av_register_bitstream_filter(AVBitStreamFilter *bsf);
5155 
5156 /**
5157  * Create and initialize a bitstream filter context given a bitstream
5158  * filter name.
5159  *
5160  * The returned context must be freed with av_bitstream_filter_close().
5161  *
5162  * @param name    the name of the bitstream filter
5163  * @return a bitstream filter context if a matching filter was found
5164  * and successfully initialized, NULL otherwise
5165  */
5166 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
5167 
5168 /**
5169  * Filter bitstream.
5170  *
5171  * This function filters the buffer buf with size buf_size, and places the
5172  * filtered buffer in the buffer pointed to by poutbuf.
5173  *
5174  * The output buffer must be freed by the caller.
5175  *
5176  * @param bsfc            bitstream filter context created by av_bitstream_filter_init()
5177  * @param avctx           AVCodecContext accessed by the filter, may be NULL.
5178  *                        If specified, this must point to the encoder context of the
5179  *                        output stream the packet is sent to.
5180  * @param args            arguments which specify the filter configuration, may be NULL
5181  * @param poutbuf         pointer which is updated to point to the filtered buffer
5182  * @param poutbuf_size    pointer which is updated to the filtered buffer size in bytes
5183  * @param buf             buffer containing the data to filter
5184  * @param buf_size        size in bytes of buf
5185  * @param keyframe        set to non-zero if the buffer to filter corresponds to a key-frame packet data
5186  * @return >= 0 in case of success, or a negative error code in case of failure
5187  *
5188  * If the return value is positive, an output buffer is allocated and
5189  * is available in *poutbuf, and is distinct from the input buffer.
5190  *
5191  * If the return value is 0, the output buffer is not allocated and
5192  * should be considered identical to the input buffer, or in case
5193  * *poutbuf was set it points to the input buffer (not necessarily to
5194  * its starting address).
5195  */
5196 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
5197                            AVCodecContext *avctx, const char *args,
5198                            uint8_t **poutbuf, int *poutbuf_size,
5199                            const uint8_t *buf, int buf_size, int keyframe);
5200 
5201 /**
5202  * Release bitstream filter context.
5203  *
5204  * @param bsf the bitstream filter context created with
5205  * av_bitstream_filter_init(), can be NULL
5206  */
5207 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
5208 
5209 /**
5210  * If f is NULL, return the first registered bitstream filter,
5211  * if f is non-NULL, return the next registered bitstream filter
5212  * after f, or NULL if f is the last one.
5213  *
5214  * This function can be used to iterate over all registered bitstream
5215  * filters.
5216  */
5217 AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
5218 
5219 /* memory */
5220 
5221 /**
5222  * Same behaviour av_fast_malloc but the buffer has additional
5223  * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
5224  *
5225  * In addition the whole buffer will initially and after resizes
5226  * be 0-initialized so that no uninitialized data will ever appear.
5227  */
5228 void av_fast_padded_malloc(void *ptr, uint *size, size_t min_size);
5229 
5230 /**
5231  * Same behaviour av_fast_padded_malloc except that buffer will always
5232  * be 0-initialized after call.
5233  */
5234 void av_fast_padded_mallocz(void *ptr, uint *size, size_t min_size);
5235 
5236 /**
5237  * Encode extradata length to a buffer. Used by xiph codecs.
5238  *
5239  * @param s buffer to write to; must be at least (v/255+1) bytes long
5240  * @param v size of extradata in bytes
5241  * @return number of bytes written to the buffer.
5242  */
5243 uint av_xiphlacing(ubyte *s, uint v);
5244 
5245 static if (FF_API_MISSING_SAMPLE) {
5246 /**
5247  * Log a generic warning message about a missing feature. This function is
5248  * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
5249  * only, and would normally not be used by applications.
5250  * @param[in] avc a pointer to an arbitrary struct of which the first field is
5251  * a pointer to an AVClass struct
5252  * @param[in] feature string containing the name of the missing feature
5253  * @param[in] want_sample indicates if samples are wanted which exhibit this feature.
5254  * If want_sample is non-zero, additional verbage will be added to the log
5255  * message which tells the user how to report samples to the development
5256  * mailing list.
5257  * @deprecated Use avpriv_report_missing_feature() instead.
5258  */
5259 deprecated
5260 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
5261 
5262 /**
5263  * Log a generic warning message asking for a sample. This function is
5264  * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
5265  * only, and would normally not be used by applications.
5266  * @param[in] avc a pointer to an arbitrary struct of which the first field is
5267  * a pointer to an AVClass struct
5268  * @param[in] msg string containing an optional message, or NULL if no message
5269  * @deprecated Use avpriv_request_sample() instead.
5270  */
5271 deprecated
5272 void av_log_ask_for_sample(void* avc, const(char)* msg, ...);
5273 }
5274 
5275 /**
5276  * Register the hardware accelerator hwaccel.
5277  */
5278 void av_register_hwaccel(AVHWAccel *hwaccel);
5279 
5280 /**
5281  * If hwaccel is NULL, returns the first registered hardware accelerator,
5282  * if hwaccel is non-NULL, returns the next registered hardware accelerator
5283  * after hwaccel, or NULL if hwaccel is the last one.
5284  */
5285 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
5286 
5287 
5288 /**
5289  * Lock operation used by lockmgr
5290  */
5291 enum AVLockOp {
5292   AV_LOCK_CREATE,  ///< Create a mutex
5293   AV_LOCK_OBTAIN,  ///< Lock the mutex
5294   AV_LOCK_RELEASE, ///< Unlock the mutex
5295   AV_LOCK_DESTROY, ///< Free mutex resources
5296 }
5297 
5298 /**
5299  * Register a user provided lock manager supporting the operations
5300  * specified by AVLockOp. The "mutex" argument to the function points
5301  * to a (void *) where the lockmgr should store/get a pointer to a user
5302  * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
5303  * value left by the last call for all other ops. If the lock manager is
5304  * unable to perform the op then it should leave the mutex in the same
5305  * state as when it was called and return a non-zero value. However,
5306  * when called with AV_LOCK_DESTROY the mutex will always be assumed to
5307  * have been successfully destroyed. If av_lockmgr_register succeeds
5308  * it will return a non-negative value, if it fails it will return a
5309  * negative value and destroy all mutex and unregister all callbacks.
5310  * av_lockmgr_register is not thread-safe, it must be called from a
5311  * single thread before any calls which make use of locking are used.
5312  *
5313  * @param cb User defined callback. av_lockmgr_register invokes calls
5314  *           to this callback and the previously registered callback.
5315  *           The callback will be used to create more than one mutex
5316  *           each of which must be backed by its own underlying locking
5317  *           mechanism (i.e. do not use a single static object to
5318  *           implement your lock manager). If cb is set to NULL the
5319  *           lockmgr will be unregistered.
5320  */
5321 int av_lockmgr_register(int function(void **mutex, AVLockOp op) cb);
5322 
5323 /**
5324  * Get the type of the given codec.
5325  */
5326 AVMediaType avcodec_get_type(AVCodecID codec_id);
5327 
5328 /**
5329  * Get the name of a codec.
5330  * @return  a static string identifying the codec; never NULL
5331  */
5332 char *avcodec_get_name(AVCodecID id);
5333 
5334 /**
5335  * @return a positive value if s is open (i.e. avcodec_open2() was called on it
5336  * with no corresponding avcodec_close()), 0 otherwise.
5337  */
5338 int avcodec_is_open(AVCodecContext *s);
5339 
5340 /**
5341  * @return a non-zero number if codec is an encoder, zero otherwise
5342  */
5343 int av_codec_is_encoder(const AVCodec *codec);
5344 
5345 /**
5346  * @return a non-zero number if codec is a decoder, zero otherwise
5347  */
5348 int av_codec_is_decoder(const AVCodec *codec);
5349 
5350 /**
5351  * @return descriptor for given codec ID or NULL if no descriptor exists.
5352  */
5353 AVCodecDescriptor *avcodec_descriptor_get(AVCodecID id);
5354 
5355 /**
5356  * Iterate over all codec descriptors known to libavcodec.
5357  *
5358  * @param prev previous descriptor. NULL to get the first descriptor.
5359  *
5360  * @return next descriptor or NULL after the last descriptor
5361  */
5362 AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
5363 
5364 /**
5365  * @return codec descriptor with the given name or NULL if no such descriptor
5366  *         exists.
5367  */
5368 AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
5369 
5370 /**
5371  * Allocate a CPB properties structure and initialize its fields to default
5372  * values.
5373  *
5374  * @param size if non-NULL, the size of the allocated struct will be written
5375  *             here. This is useful for embedding it in side data.
5376  *
5377  * @return the newly allocated struct or NULL on failure
5378  */
5379 AVCPBProperties *av_cpb_properties_alloc(size_t *size);
5380 
5381 /**
5382  * @}
5383  */
5384 
5385 
5386 ///Constant definitions that were embedded inside structs
5387 
5388 enum FF_ASPECT_EXTENDED = 15;
5389 enum FF_RC_STRATEGY_XVID = 1;
5390 enum FF_PRED_LEFT = 0;
5391 enum FF_PRED_PLANE = 1;
5392 enum FF_PRED_MEDIAN = 2;
5393 
5394 enum FF_CMP_SAD =  0;
5395 enum FF_CMP_SSE =  1;
5396 enum FF_CMP_SATD = 2;
5397 enum FF_CMP_DCT =  3;
5398 enum FF_CMP_PSNR = 4;
5399 enum FF_CMP_BIT =  5;
5400 enum FF_CMP_RD =   6;
5401 enum FF_CMP_ZERO = 7;
5402 enum FF_CMP_VSAD = 8;
5403 enum FF_CMP_VSSE = 9;
5404 enum FF_CMP_NSSE = 10;
5405 enum FF_CMP_W53 =  11;
5406 enum FF_CMP_W97 =  12;
5407 enum FF_CMP_DCTMAX = 13;
5408 enum FF_CMP_DCT264 = 14;
5409 enum FF_CMP_CHROMA = 256;
5410 
5411 enum FF_DTG_AFD_SAME =       8;
5412 enum FF_DTG_AFD_4_3 =        9;
5413 enum FF_DTG_AFD_16_9 =       10;
5414 enum FF_DTG_AFD_14_9 =       11;
5415 enum FF_DTG_AFD_4_3_SP_14_9 = 13;
5416 enum FF_DTG_AFD_16_9_SP_14_9 = 14;
5417 enum FF_DTG_AFD_SP_4_3 =     15;
5418 
5419 enum FF_DEFAULT_QUANT_BIAS = 999999;
5420 
5421 enum SLICE_FLAG_CODED_ORDER =  0x0001; ///< draw_horiz_band() is called in coded order instead of display
5422 enum SLICE_FLAG_ALLOW_FIELD =  0x0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
5423 enum SLICE_FLAG_ALLOW_PLANE =  0x0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
5424 
5425 enum FF_MB_DECISION_SIMPLE = 0;        ///< uses mb_cmp
5426 enum FF_MB_DECISION_BITS = 1;        ///< chooses the one which needs the fewest bits
5427 enum FF_MB_DECISION_RD =   2;       ///< rate distortion
5428 
5429 enum FF_CODER_TYPE_VLC =   0;
5430 enum FF_CODER_TYPE_AC =      1;
5431 enum FF_CODER_TYPE_RAW =     2;
5432 enum FF_CODER_TYPE_RLE =     3;
5433 static if (FF_API_UNUSED_MEMBERS) {
5434     enum FF_CODER_TYPE_DEFLATE = 4;
5435 }
5436 
5437 //AVCodecContext.workaround_bugs
5438 enum FF_BUG_AUTODETECT =     1;  ///< autodetection
5439 static if (FF_API_OLD_MSMPEG4) {
5440     enum FF_BUG_OLD_MSMPEG4 =    2;
5441 }
5442 enum FF_BUG_XVID_ILACE  =    4;
5443 enum FF_BUG_UMP4 =           8;
5444 enum FF_BUG_NO_PADDING =     16;
5445 enum FF_BUG_AMV  =           32;
5446 enum FF_BUG_AC_VLC =         0;  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
5447 enum FF_BUG_QPEL_CHROMA =    64;
5448 enum FF_BUG_STD_QPEL =       128;
5449 enum FF_BUG_QPEL_CHROMA2 =   256;
5450 enum FF_BUG_DIRECT_BLOCKSIZE = 512;
5451 enum FF_BUG_EDGE =           1024;
5452 enum FF_BUG_HPEL_CHROMA =    2048;
5453 enum FF_BUG_DC_CLIP   =      4096;
5454 enum FF_BUG_MS    =          8192; ///< Work around various bugs in Microsoft's broken decoders.
5455 enum FF_BUG_TRUNCATED =     16384;
5456 
5457 // AVCodecContext.strict_std_compliance;
5458 enum FF_COMPLIANCE_VERY_STRICT = 2; ///< Strictly conform to an older more strict version of the spec or reference software.
5459 enum FF_COMPLIANCE_STRICT =      1; ///< Strictly conform to all the things in the spec no matter what consequences.
5460 enum FF_COMPLIANCE_NORMAL =      0;
5461 enum FF_COMPLIANCE_UNOFFICIAL = -1; ///< Allow unofficial extensions
5462 enum FF_COMPLIANCE_EXPERIMENTAL = -2; ///< Allow nonstandardized experimental things.
5463 
5464 // AVCodecContext.error_concealment
5465 enum FF_EC_GUESS_MVS =  1;
5466 enum FF_EC_DEBLOCK =    2;
5467 enum FF_EC_FAVOR_INTER = 256;
5468 
5469 // AVCodecContext.ddebug
5470 enum FF_DEBUG_PICT_INFO = 1;
5471 enum FF_DEBUG_RC =        2;
5472 enum FF_DEBUG_BITSTREAM = 4;
5473 enum FF_DEBUG_MB_TYPE =   8;
5474 enum FF_DEBUG_QP =        16;
5475 enum FF_DEBUG_MV =        32;
5476 enum FF_DEBUG_DCT_COEFF = 0x00000040;
5477 enum FF_DEBUG_SKIP =      0x00000080;
5478 enum FF_DEBUG_STARTCODE = 0x00000100;
5479 static if (FF_API_UNUSED_MEMBERS) {
5480     enum FF_DEBUG_PTS =       0x00000200;
5481 }
5482 enum FF_DEBUG_ER =        0x00000400;
5483 enum FF_DEBUG_MMCO =      0x00000800;
5484 enum FF_DEBUG_BUGS =      0x00001000;
5485 static if (FF_API_DEBUG_MV) {
5486     enum FF_DEBUG_VIS_QP =    0x00002000;
5487     enum FF_DEBUG_VIS_MB_TYPE =  0x00004000;
5488 }
5489 enum FF_DEBUG_BUFFERS =   0x00008000;
5490 enum FF_DEBUG_THREADS =   0x00010000;
5491 enum FF_DEBUG_NOMC    =   0x01000000;
5492 // AVCodecContext.debug_mv
5493 enum FF_DEBUG_VIS_MV_P_FOR =0x00000001; //visualize forward predicted MVs of P frames
5494 enum FF_DEBUG_VIS_MV_B_FOR =0x00000002; //visualize forward predicted MVs of B frames
5495 enum FF_DEBUG_VIS_MV_B_BACK =0x00000004; //visualize backward predicted MVs of B frames
5496 
5497 // AVCodecContext.err_recognition
5498 enum AV_EF_CRCCHECK  = 1<<0;
5499 enum AV_EF_BITSTREAM = 1<<1;
5500 enum AV_EF_BUFFER    = 1<<2;
5501 enum AV_EF_EXPLODE   = 1<<3;
5502 enum AV_EF_IGNORE_ERR = (1<<15);        ///< ignore errors and continue
5503 enum AV_EF_CAREFUL   = 1<<16;
5504 enum AV_EF_COMPLIANT = 1<<17;
5505 enum AV_EF_AGGRESSIVE = 1<<18;
5506 
5507 //AVCodecContext.dct_algo
5508 enum FF_DCT_AUTO =   0;
5509 enum FF_DCT_FASTINT =1;
5510 static if (FF_API_UNUSED_MEMBERS) {
5511     enum FF_DCT_INT =    2;
5512 }
5513 enum FF_DCT_MMX =    3;
5514 enum FF_DCT_ALTIVEC =5;
5515 enum FF_DCT_FAAN =   6;
5516 
5517 //AVCodecContext.idct_algo
5518 enum FF_IDCT_AUTO =         0;
5519 enum FF_IDCT_INT =          1;
5520 enum FF_IDCT_SIMPLE =       2;
5521 enum FF_IDCT_SIMPLEMMX =    3;
5522 enum FF_IDCT_LIBMPEG2MMX =  4;
5523 enum FF_IDCT_ARM =          7;
5524 enum FF_IDCT_ALTIVEC =      8;
5525 static if (FF_API_ARCH_SH4) {
5526     enum FF_IDCT_SH4       =   9;
5527 }
5528 enum FF_IDCT_SIMPLEARM =    10;
5529 static if (FF_API_UNUSED_MEMBERS) {
5530     enum FF_IDCT_IPP     =      13;
5531 }
5532 static if (FF_API_IDCT_XVIDMMX) {
5533     enum FF_IDCT_XVIDMMX =      14;
5534 }
5535 enum FF_IDCT_SIMPLEARMV5TE =16;
5536 enum FF_IDCT_SIMPLEARMV6 =  17;
5537 static if (FF_API_ARCH_SPARC) {
5538     enum FF_IDCT_SIMPLEVIS =    18;
5539 }
5540 enum FF_IDCT_FAAN   =       20;
5541 enum FF_IDCT_SIMPLENEON =   22;
5542 static if (FF_API_ARCH_ALPHA) {
5543     enum FF_IDCT_SIMPLEALPHA =  23;
5544 }
5545 enum FF_IDCT_SIMPLEAUTO =  128;
5546 
5547 //AVCodecContext.thread_type
5548 enum FF_THREAD_FRAME =  1; ///< Decode more than one frame at once
5549 enum FF_THREAD_SLICE =  2; ///< Decode more than one part of a single frame at once
5550 
5551 //AVCodecContext.profile;
5552 enum FF_PROFILE_UNKNOWN = -99;
5553 enum FF_PROFILE_RESERVED = -100;
5554 
5555 enum FF_PROFILE_AAC_MAIN =0;
5556 enum FF_PROFILE_AAC_LOW = 1;
5557 enum FF_PROFILE_AAC_SSR = 2;
5558 enum FF_PROFILE_AAC_LTP = 3;
5559 
5560 enum FF_PROFILE_AAC_HE  =4;
5561 enum FF_PROFILE_AAC_HE_V2=28;
5562 enum FF_PROFILE_AAC_LD  =22;
5563 enum FF_PROFILE_AAC_ELD =38;
5564 enum FF_PROFILE_MPEG2_AAC_LOW = 128;
5565 enum FF_PROFILE_MPEG2_AAC_HE = 131;
5566 
5567 enum FF_PROFILE_DTS    =    20;
5568 enum FF_PROFILE_DTS_ES =    30;
5569 enum FF_PROFILE_DTS_96_24 = 40;
5570 enum FF_PROFILE_DTS_HD_HRA= 50;
5571 enum FF_PROFILE_DTS_HD_MA = 60;
5572 
5573 enum FF_PROFILE_MPEG2_422 =  0;
5574 enum FF_PROFILE_MPEG2_HIGH = 1;
5575 enum FF_PROFILE_MPEG2_SS =   2;
5576 enum FF_PROFILE_MPEG2_SNR_SCALABLE =3;
5577 enum FF_PROFILE_MPEG2_MAIN = 4;
5578 enum FF_PROFILE_MPEG2_SIMPLE=5;
5579 
5580 enum FF_PROFILE_H264_CONSTRAINED= (1<<9);  // 8+1; constraint_set1_flag
5581 enum FF_PROFILE_H264_INTRA   =    (1<<11); // 8+3; constraint_set3_flag
5582 
5583 enum FF_PROFILE_H264_BASELINE =           66;
5584 enum FF_PROFILE_H264_CONSTRAINED_BASELINE=(66|FF_PROFILE_H264_CONSTRAINED);
5585 enum FF_PROFILE_H264_MAIN  =              77;
5586 enum FF_PROFILE_H264_EXTENDED =           88;
5587 enum FF_PROFILE_H264_HIGH    =            100;
5588 enum FF_PROFILE_H264_HIGH_10  =           110;
5589 enum FF_PROFILE_H264_HIGH_10_INTRA =      (110|FF_PROFILE_H264_INTRA);
5590 enum FF_PROFILE_H264_HIGH_422   =         122;
5591 enum FF_PROFILE_H264_HIGH_422_INTRA =     (122|FF_PROFILE_H264_INTRA);
5592 enum FF_PROFILE_H264_HIGH_444 =           144;
5593 enum FF_PROFILE_H264_HIGH_444_PREDICTIVE =244;
5594 enum FF_PROFILE_H264_HIGH_444_INTRA  =    (244|FF_PROFILE_H264_INTRA);
5595 enum FF_PROFILE_H264_CAVLC_444 =          44;
5596 
5597 enum FF_PROFILE_VC1_SIMPLE = 0;
5598 enum FF_PROFILE_VC1_MAIN =   1;
5599 enum FF_PROFILE_VC1_COMPLEX =2;
5600 enum FF_PROFILE_VC1_ADVANCED=3;
5601 
5602 enum FF_PROFILE_MPEG4_SIMPLE =                   0;
5603 enum FF_PROFILE_MPEG4_SIMPLE_SCALABLE =          1;
5604 enum FF_PROFILE_MPEG4_CORE =                     2;
5605 enum FF_PROFILE_MPEG4_MAIN =                     3;
5606 enum FF_PROFILE_MPEG4_N_BIT =                    4;
5607 enum FF_PROFILE_MPEG4_SCALABLE_TEXTURE =         5;
5608 enum FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION =    6;
5609 enum FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE =   7;
5610 enum FF_PROFILE_MPEG4_HYBRID =                   8;
5611 enum FF_PROFILE_MPEG4_ADVANCED_REAL_TIME =       9;
5612 enum FF_PROFILE_MPEG4_CORE_SCALABLE =           10;
5613 enum FF_PROFILE_MPEG4_ADVANCED_CODING =         11;
5614 enum FF_PROFILE_MPEG4_ADVANCED_CORE =           12;
5615 enum FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE=13;
5616 enum FF_PROFILE_MPEG4_SIMPLE_STUDIO =           14;
5617 enum FF_PROFILE_MPEG4_ADVANCED_SIMPLE =         15;
5618 enum FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 = 0;
5619 enum FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 = 1;
5620 enum FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION =2;
5621 enum FF_PROFILE_JPEG2000_DCINEMA_2K           =  3;
5622 enum FF_PROFILE_JPEG2000_DCINEMA_4K           =  4;
5623 
5624 
5625 enum FF_PROFILE_HEVC_MAIN                     =  1;
5626 enum FF_PROFILE_HEVC_MAIN_10                  =  2;
5627 enum FF_PROFILE_HEVC_MAIN_STILL_PICTURE       =  3;
5628 enum FF_PROFILE_HEVC_REXT                     =  4;
5629 
5630 enum FF_COMPRESSION_DEFAULT =                   -1;
5631 
5632 //AVCodecContext.level;
5633 enum FF_LEVEL_UNKNOWN = -99;
5634 
5635 enum FF_SUB_CHARENC_MODE_DO_NOTHING =-1;  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
5636 enum FF_SUB_CHARENC_MODE_AUTOMATIC  = 0;  ///< libavcodec will select the mode itself
5637 enum FF_SUB_CHARENC_MODE_PRE_DECODER= 1;  ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
5638 
5639 static if (!FF_API_DEBUG_MV) {
5640     enum FF_DEBUG_VIS_MV_P_FOR =0x00000001;//visualize forward predicted MVs of P frames
5641     enum FF_DEBUG_VIS_MV_B_FOR =0x00000002;//visualize forward predicted MVs of B frames
5642     enum FF_DEBUG_VIS_MV_B_BACK=0x00000004;//visualize backward predicted MVs of B frames
5643 }
5644 
5645 enum AV_PARSER_PTS_NB = 4;
5646 enum PARSER_FLAG_COMPLETE_FRAMES   =       0x0001;
5647 enum PARSER_FLAG_ONCE              =        0x0002;
5648 /// Set if the parser has a valid file offset
5649 enum PARSER_FLAG_FETCHED_OFFSET     =       0x0004;
5650 enum PARSER_FLAG_USE_CODEC_TS       =       0x1000;
5651 
5652 alias AV_CODEC_ID_H265 = AVCodecID.AV_CODEC_ID_HEVC;
5653 alias AV_CODEC_ID_IFF_BYTERUN1 = AVCodecID.AV_CODEC_ID_IFF_ILBM;