1 // This header was generated from the FFMPEG headers
2 #pragma once
3 
4 #include <math.h>
5 #include <stdarg.h>
6 #include <errno.h>
7 #include <stdint.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <inttypes.h>
11 #include <time.h>
12 #include <limits.h>
13 #include <stdio.h>
14 #include <stddef.h>
15 
16 #define AVCODEC_AVCODEC_H
17 
18 #define AVUTIL_SAMPLEFMT_H
19 
20 #define AVUTIL_AVUTIL_H
21 
22 unsigned avutil_version(void);
23 
24 const char *av_version_info(void);
25 
26 const char *avutil_configuration(void);
27 
28 const char *avutil_license(void);
29 
30 enum AVMediaType {
31     AVMEDIA_TYPE_UNKNOWN = -1,
32     AVMEDIA_TYPE_VIDEO,
33     AVMEDIA_TYPE_AUDIO,
34     AVMEDIA_TYPE_DATA,
35     AVMEDIA_TYPE_SUBTITLE,
36     AVMEDIA_TYPE_ATTACHMENT,
37     AVMEDIA_TYPE_NB
38 };
39 
40 const char *av_get_media_type_string(enum AVMediaType media_type);
41 
42 #define FF_LAMBDA_SHIFT 7
43 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
44 #define FF_QP2LAMBDA 118
45 #define FF_LAMBDA_MAX (256*128-1)
46 
47 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE
48 
49 #define AV_NOPTS_VALUE          ((int64_t)UINT64_C(0x8000000000000000))
50 
51 #define AV_TIME_BASE            1000000
52 
53 #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
54 
55 enum AVPictureType {
56     AV_PICTURE_TYPE_NONE = 0,
57     AV_PICTURE_TYPE_I,
58     AV_PICTURE_TYPE_P,
59     AV_PICTURE_TYPE_B,
60     AV_PICTURE_TYPE_S,
61     AV_PICTURE_TYPE_SI,
62     AV_PICTURE_TYPE_SP,
63     AV_PICTURE_TYPE_BI,
64 };
65 
66 char av_get_picture_type_char(enum AVPictureType pict_type);
67 
68 #define AVUTIL_COMMON_H
69 
70 #define AVUTIL_ATTRIBUTES_H
71 
72 #    define AV_GCC_VERSION_AT_LEAST(x,y) 0
73 #    define AV_GCC_VERSION_AT_MOST(x,y)  0
74 
75 #    define av_always_inline inline
76 
77 #    define av_extern_inline inline
78 
79 #    define av_warn_unused_result
80 
81 #    define av_noinline
82 
83 #    define av_pure
84 
85 #    define av_const
86 
87 #    define av_cold
88 
89 #    define av_flatten
90 
91 #    define attribute_deprecated
92 
93 #    define AV_NOWARN_DEPRECATED(code) code
94 
95 #    define av_unused
96 
97 #    define av_used
98 
99 #   define av_alias
100 
101 #    define av_uninit(x) x
102 
103 #    define av_builtin_constant_p(x) 0
104 #    define av_printf_format(fmtpos, attrpos)
105 
106 #    define av_noreturn
107 
108 #define AVUTIL_MACROS_H
109 
110 #define AV_STRINGIFY(s)         AV_TOSTRING(s)
111 #define AV_TOSTRING(s) #s
112 
113 #define AV_GLUE(a, b) a ## b
114 #define AV_JOIN(a, b) AV_GLUE(a, b)
115 
116 #define AV_PRAGMA(s) _Pragma(#s)
117 
118 #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
119 
120 #define AVUTIL_VERSION_H
121 
122 #define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
123 #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
124 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
125 
126 #define AV_VERSION_MAJOR(a) ((a) >> 16)
127 #define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
128 #define AV_VERSION_MICRO(a) ((a) & 0xFF)
129 
130 #define LIBAVUTIL_VERSION_MAJOR  55
131 #define LIBAVUTIL_VERSION_MINOR  78
132 #define LIBAVUTIL_VERSION_MICRO 100
133 
134 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
135                                                LIBAVUTIL_VERSION_MINOR, \
136                                                LIBAVUTIL_VERSION_MICRO)
137 #define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_MAJOR,     \
138                                            LIBAVUTIL_VERSION_MINOR,     \
139                                            LIBAVUTIL_VERSION_MICRO)
140 #define LIBAVUTIL_BUILD         LIBAVUTIL_VERSION_INT
141 
142 #define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
143 
144 #define FF_API_VDPAU                    (LIBAVUTIL_VERSION_MAJOR < 56)
145 #define FF_API_XVMC                     (LIBAVUTIL_VERSION_MAJOR < 56)
146 #define FF_API_OPT_TYPE_METADATA        (LIBAVUTIL_VERSION_MAJOR < 56)
147 #define FF_API_DLOG                     (LIBAVUTIL_VERSION_MAJOR < 56)
148 #define FF_API_VAAPI                    (LIBAVUTIL_VERSION_MAJOR < 56)
149 #define FF_API_FRAME_QP                 (LIBAVUTIL_VERSION_MAJOR < 56)
150 #define FF_API_PLUS1_MINUS1             (LIBAVUTIL_VERSION_MAJOR < 56)
151 #define FF_API_ERROR_FRAME              (LIBAVUTIL_VERSION_MAJOR < 56)
152 #define FF_API_CRC_BIG_TABLE            (LIBAVUTIL_VERSION_MAJOR < 56)
153 #define FF_API_PKT_PTS                  (LIBAVUTIL_VERSION_MAJOR < 56)
154 #define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 56)
155 
156 #   define AV_NE(be, le) (le)
157 
158 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
159 
160 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
161 
162 #define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
163                                                        : ((a) + (1<<(b)) - 1) >> (b))
164 
165 #define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
166 
167 #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
168 #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
169 
170 #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
171 #define FFSIGN(a) ((a) > 0 ? 1 : -1)
172 
173 #define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
174 
175 #define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
176 
177 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
178 #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
179 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
180 #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
181 
182 #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
183 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
184 
185 #   define av_ceil_log2     av_ceil_log2_c
186 #   define av_clip          av_clip_c
187 #   define av_clip64        av_clip64_c
188 #   define av_clip_uint8    av_clip_uint8_c
189 #   define av_clip_int8     av_clip_int8_c
190 #   define av_clip_uint16   av_clip_uint16_c
191 #   define av_clip_int16    av_clip_int16_c
192 #   define av_clipl_int32   av_clipl_int32_c
193 #   define av_clip_intp2    av_clip_intp2_c
194 #   define av_clip_uintp2   av_clip_uintp2_c
195 #   define av_mod_uintp2    av_mod_uintp2_c
196 #   define av_sat_add32     av_sat_add32_c
197 #   define av_sat_dadd32    av_sat_dadd32_c
198 #   define av_clipf         av_clipf_c
199 #   define av_clipd         av_clipd_c
200 #   define av_popcount      av_popcount_c
201 #   define av_popcount64    av_popcount64_c
202 #   define av_parity        av_parity_c
203 
204 av_const int av_log2(unsigned v);
205 
206 av_const int av_log2_16bit(unsigned v);
207 
av_clip_c(int a,int amin,int amax)208 static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
209 {
210     if      (a < amin) return amin;
211     else if (a > amax) return amax;
212     else               return a;
213 }
214 
av_clip64_c(int64_t a,int64_t amin,int64_t amax)215 static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
216 {
217     if      (a < amin) return amin;
218     else if (a > amax) return amax;
219     else               return a;
220 }
221 
av_clip_uint8_c(int a)222 static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
223 {
224     if (a&(~0xFF)) return (~a)>>31;
225     else           return a;
226 }
227 
av_clip_int8_c(int a)228 static av_always_inline av_const int8_t av_clip_int8_c(int a)
229 {
230     if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
231     else                  return a;
232 }
233 
av_clip_uint16_c(int a)234 static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
235 {
236     if (a&(~0xFFFF)) return (~a)>>31;
237     else             return a;
238 }
239 
av_clip_int16_c(int a)240 static av_always_inline av_const int16_t av_clip_int16_c(int a)
241 {
242     if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
243     else                      return a;
244 }
245 
av_clipl_int32_c(int64_t a)246 static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
247 {
248     if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
249     else                                         return (int32_t)a;
250 }
251 
av_clip_intp2_c(int a,int p)252 static av_always_inline av_const int av_clip_intp2_c(int a, int p)
253 {
254     if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
255         return (a >> 31) ^ ((1 << p) - 1);
256     else
257         return a;
258 }
259 
av_clip_uintp2_c(int a,int p)260 static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
261 {
262     if (a & ~((1<<p) - 1)) return (~a) >> 31 & ((1<<p) - 1);
263     else                   return  a;
264 }
265 
av_mod_uintp2_c(unsigned a,unsigned p)266 static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
267 {
268     return a & ((1 << p) - 1);
269 }
270 
av_sat_add32_c(int a,int b)271 static av_always_inline int av_sat_add32_c(int a, int b)
272 {
273     return av_clipl_int32((int64_t)a + b);
274 }
275 
av_sat_dadd32_c(int a,int b)276 static av_always_inline int av_sat_dadd32_c(int a, int b)
277 {
278     return av_sat_add32(a, av_sat_add32(b, b));
279 }
280 
av_clipf_c(float a,float amin,float amax)281 static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
282 {
283     if      (a < amin) return amin;
284     else if (a > amax) return amax;
285     else               return a;
286 }
287 
av_clipd_c(double a,double amin,double amax)288 static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
289 {
290     if      (a < amin) return amin;
291     else if (a > amax) return amax;
292     else               return a;
293 }
294 
av_ceil_log2_c(int x)295 static av_always_inline av_const int av_ceil_log2_c(int x)
296 {
297     return av_log2((x - 1U) << 1);
298 }
299 
av_popcount_c(uint32_t x)300 static av_always_inline av_const int av_popcount_c(uint32_t x)
301 {
302     x -= (x >> 1) & 0x55555555;
303     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
304     x = (x + (x >> 4)) & 0x0F0F0F0F;
305     x += x >> 8;
306     return (x + (x >> 16)) & 0x3F;
307 }
308 
av_popcount64_c(uint64_t x)309 static av_always_inline av_const int av_popcount64_c(uint64_t x)
310 {
311     return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
312 }
313 
av_parity_c(uint32_t v)314 static av_always_inline av_const int av_parity_c(uint32_t v)
315 {
316     return av_popcount(v) & 1;
317 }
318 
319 #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
320 #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
321 
322 #define GET_UTF8(val, GET_BYTE, ERROR)\
323     val= (GET_BYTE);\
324     {\
325         uint32_t top = (val & 128) >> 1;\
326         if ((val & 0xc0) == 0x80 || val >= 0xFE)\
327             ERROR\
328         while (val & top) {\
329             int tmp= (GET_BYTE) - 128;\
330             if(tmp>>6)\
331                 ERROR\
332             val= (val<<6) + tmp;\
333             top <<= 5;\
334         }\
335         val &= (top << 1) - 1;\
336     }
337 
338 #define GET_UTF16(val, GET_16BIT, ERROR)\
339     val = GET_16BIT;\
340     {\
341         unsigned int hi = val - 0xD800;\
342         if (hi < 0x800) {\
343             val = GET_16BIT - 0xDC00;\
344             if (val > 0x3FFU || hi > 0x3FFU)\
345                 ERROR\
346             val += (hi<<10) + 0x10000;\
347         }\
348     }\
349 
350 #define PUT_UTF8(val, tmp, PUT_BYTE)\
351     {\
352         int bytes, shift;\
353         uint32_t in = val;\
354         if (in < 0x80) {\
355             tmp = in;\
356             PUT_BYTE\
357         } else {\
358             bytes = (av_log2(in) + 4) / 5;\
359             shift = (bytes - 1) * 6;\
360             tmp = (256 - (256 >> bytes)) | (in >> shift);\
361             PUT_BYTE\
362             while (shift >= 6) {\
363                 shift -= 6;\
364                 tmp = 0x80 | ((in >> shift) & 0x3f);\
365                 PUT_BYTE\
366             }\
367         }\
368     }
369 
370 #define PUT_UTF16(val, tmp, PUT_16BIT)\
371     {\
372         uint32_t in = val;\
373         if (in < 0x10000) {\
374             tmp = in;\
375             PUT_16BIT\
376         } else {\
377             tmp = 0xD800 | ((in - 0x10000) >> 10);\
378             PUT_16BIT\
379             tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
380             PUT_16BIT\
381         }\
382     }\
383 
384 #define AVUTIL_MEM_H
385 
386 #define AVUTIL_ERROR_H
387 
388 #define AVERROR(e) (e)
389 #define AVUNERROR(e) (e)
390 
391 #define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
392 
393 #define AVERROR_BSF_NOT_FOUND      FFERRTAG(0xF8,'B','S','F')
394 #define AVERROR_BUG                FFERRTAG( 'B','U','G','!')
395 #define AVERROR_BUFFER_TOO_SMALL   FFERRTAG( 'B','U','F','S')
396 #define AVERROR_DECODER_NOT_FOUND  FFERRTAG(0xF8,'D','E','C')
397 #define AVERROR_DEMUXER_NOT_FOUND  FFERRTAG(0xF8,'D','E','M')
398 #define AVERROR_ENCODER_NOT_FOUND  FFERRTAG(0xF8,'E','N','C')
399 #define AVERROR_EOF                FFERRTAG( 'E','O','F',' ')
400 #define AVERROR_EXIT               FFERRTAG( 'E','X','I','T')
401 #define AVERROR_EXTERNAL           FFERRTAG( 'E','X','T',' ')
402 #define AVERROR_FILTER_NOT_FOUND   FFERRTAG(0xF8,'F','I','L')
403 #define AVERROR_INVALIDDATA        FFERRTAG( 'I','N','D','A')
404 #define AVERROR_MUXER_NOT_FOUND    FFERRTAG(0xF8,'M','U','X')
405 #define AVERROR_OPTION_NOT_FOUND   FFERRTAG(0xF8,'O','P','T')
406 #define AVERROR_PATCHWELCOME       FFERRTAG( 'P','A','W','E')
407 #define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O')
408 
409 #define AVERROR_STREAM_NOT_FOUND   FFERRTAG(0xF8,'S','T','R')
410 
411 #define AVERROR_BUG2               FFERRTAG( 'B','U','G',' ')
412 #define AVERROR_UNKNOWN            FFERRTAG( 'U','N','K','N')
413 #define AVERROR_EXPERIMENTAL       (-0x2bb2afa8)
414 #define AVERROR_INPUT_CHANGED      (-0x636e6701)
415 #define AVERROR_OUTPUT_CHANGED     (-0x636e6702)
416 
417 #define AVERROR_HTTP_BAD_REQUEST   FFERRTAG(0xF8,'4','0','0')
418 #define AVERROR_HTTP_UNAUTHORIZED  FFERRTAG(0xF8,'4','0','1')
419 #define AVERROR_HTTP_FORBIDDEN     FFERRTAG(0xF8,'4','0','3')
420 #define AVERROR_HTTP_NOT_FOUND     FFERRTAG(0xF8,'4','0','4')
421 #define AVERROR_HTTP_OTHER_4XX     FFERRTAG(0xF8,'4','X','X')
422 #define AVERROR_HTTP_SERVER_ERROR  FFERRTAG(0xF8,'5','X','X')
423 
424 #define AV_ERROR_MAX_STRING_SIZE 64
425 
426 int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
427 
av_make_error_string(char * errbuf,size_t errbuf_size,int errnum)428 static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
429 {
430     av_strerror(errnum, errbuf, errbuf_size);
431     return errbuf;
432 }
433 
434 #define av_err2str(errnum) \
435     av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
436 
437     #define DECLARE_ALIGNED(n,t,v)      t v
438     #define DECLARE_ASM_CONST(n,t,v)    static const t v
439 
440     #define av_malloc_attrib
441 
442     #define av_alloc_size(...)
443 
444 void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
445 
446 void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
447 
av_malloc_array(size_t nmemb,size_t size)448 av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
449 {
450     if (!size || nmemb >= INT_MAX / size)
451         return NULL;
452     return av_malloc(nmemb * size);
453 }
454 
av_mallocz_array(size_t nmemb,size_t size)455 av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
456 {
457     if (!size || nmemb >= INT_MAX / size)
458         return NULL;
459     return av_mallocz(nmemb * size);
460 }
461 
462 void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
463 
464 void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
465 
466 av_warn_unused_result
467 int av_reallocp(void *ptr, size_t size);
468 
469 void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
470 
471 av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
472 
473 int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
474 
475 void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
476 
477 void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
478 
479 void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
480 
481 void av_free(void *ptr);
482 
483 void av_freep(void *ptr);
484 
485 char *av_strdup(const char *s) av_malloc_attrib;
486 
487 char *av_strndup(const char *s, size_t len) av_malloc_attrib;
488 
489 void *av_memdup(const void *p, size_t size);
490 
491 void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
492 
493 void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
494 
495 av_warn_unused_result
496 int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
497 
498 void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
499                        const uint8_t *elem_data);
500 
av_size_mult(size_t a,size_t b,size_t * r)501 static inline int av_size_mult(size_t a, size_t b, size_t *r)
502 {
503     size_t t = a * b;
504 
505     if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
506         return AVERROR(EINVAL);
507     *r = t;
508     return 0;
509 }
510 
511 void av_max_alloc(size_t max);
512 
513 #define AVUTIL_RATIONAL_H
514 
515 typedef struct AVRational{
516     int num;
517     int den;
518 } AVRational;
519 
av_make_q(int num,int den)520 static inline AVRational av_make_q(int num, int den)
521 {
522     AVRational r = { num, den };
523     return r;
524 }
525 
av_cmp_q(AVRational a,AVRational b)526 static inline int av_cmp_q(AVRational a, AVRational b){
527     const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
528 
529     if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
530     else if(b.den && a.den) return 0;
531     else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
532     else                    return INT_MIN;
533 }
534 
av_q2d(AVRational a)535 static inline double av_q2d(AVRational a){
536     return a.num / (double) a.den;
537 }
538 
539 int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
540 
541 AVRational av_mul_q(AVRational b, AVRational c) av_const;
542 
543 AVRational av_div_q(AVRational b, AVRational c) av_const;
544 
545 AVRational av_add_q(AVRational b, AVRational c) av_const;
546 
547 AVRational av_sub_q(AVRational b, AVRational c) av_const;
548 
av_inv_q(AVRational q)549 static av_always_inline AVRational av_inv_q(AVRational q)
550 {
551     AVRational r = { q.den, q.num };
552     return r;
553 }
554 
555 AVRational av_d2q(double d, int max) av_const;
556 
557 int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
558 
559 int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
560 
561 uint32_t av_q2intfloat(AVRational q);
562 
563 #define AVUTIL_MATHEMATICS_H
564 
565 #define AVUTIL_INTFLOAT_H
566 
567 union av_intfloat32 {
568     uint32_t i;
569     float    f;
570 };
571 
572 union av_intfloat64 {
573     uint64_t i;
574     double   f;
575 };
576 
av_int2float(uint32_t i)577 static av_always_inline float av_int2float(uint32_t i)
578 {
579     union av_intfloat32 v;
580     v.i = i;
581     return v.f;
582 }
583 
av_float2int(float f)584 static av_always_inline uint32_t av_float2int(float f)
585 {
586     union av_intfloat32 v;
587     v.f = f;
588     return v.i;
589 }
590 
av_int2double(uint64_t i)591 static av_always_inline double av_int2double(uint64_t i)
592 {
593     union av_intfloat64 v;
594     v.i = i;
595     return v.f;
596 }
597 
av_double2int(double f)598 static av_always_inline uint64_t av_double2int(double f)
599 {
600     union av_intfloat64 v;
601     v.f = f;
602     return v.i;
603 }
604 
605 #define M_E            2.7182818284590452354
606 #define M_LN2          0.69314718055994530942
607 #define M_LN10         2.30258509299404568402
608 #define M_LOG2_10      3.32192809488736234787
609 #define M_PHI          1.61803398874989484820
610 #define M_PI           3.14159265358979323846
611 #define M_PI_2         1.57079632679489661923
612 #define M_SQRT1_2      0.70710678118654752440
613 #define M_SQRT2        1.41421356237309504880
614 #define NAN            av_int2float(0x7fc00000)
615 #define INFINITY       av_int2float(0x7f800000)
616 
617 enum AVRounding {
618     AV_ROUND_ZERO     = 0,
619     AV_ROUND_INF      = 1,
620     AV_ROUND_DOWN     = 2,
621     AV_ROUND_UP       = 3,
622     AV_ROUND_NEAR_INF = 5,
623 
624     AV_ROUND_PASS_MINMAX = 8192,
625 };
626 
627 int64_t av_const av_gcd(int64_t a, int64_t b);
628 
629 int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
630 
631 int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
632 
633 int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
634 
635 int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
636                          enum AVRounding rnd) av_const;
637 
638 int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
639 
640 int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
641 
642 int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts,  AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
643 
644 int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
645 
646 #define AVUTIL_LOG_H
647 
648 typedef enum {
649     AV_CLASS_CATEGORY_NA = 0,
650     AV_CLASS_CATEGORY_INPUT,
651     AV_CLASS_CATEGORY_OUTPUT,
652     AV_CLASS_CATEGORY_MUXER,
653     AV_CLASS_CATEGORY_DEMUXER,
654     AV_CLASS_CATEGORY_ENCODER,
655     AV_CLASS_CATEGORY_DECODER,
656     AV_CLASS_CATEGORY_FILTER,
657     AV_CLASS_CATEGORY_BITSTREAM_FILTER,
658     AV_CLASS_CATEGORY_SWSCALER,
659     AV_CLASS_CATEGORY_SWRESAMPLER,
660     AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
661     AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
662     AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
663     AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
664     AV_CLASS_CATEGORY_DEVICE_OUTPUT,
665     AV_CLASS_CATEGORY_DEVICE_INPUT,
666     AV_CLASS_CATEGORY_NB
667 }AVClassCategory;
668 
669 #define AV_IS_INPUT_DEVICE(category) \
670     (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
671      ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
672      ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
673 
674 #define AV_IS_OUTPUT_DEVICE(category) \
675     (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
676      ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
677      ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
678 
679 struct AVOptionRanges;
680 
681 typedef struct AVClass {
682 
683     const char* class_name;
684 
685     const char* (*item_name)(void* ctx);
686 
687     const struct AVOption *option;
688 
689     int version;
690 
691     int log_level_offset_offset;
692 
693     int parent_log_context_offset;
694 
695     void* (*child_next)(void *obj, void *prev);
696 
697     const struct AVClass* (*child_class_next)(const struct AVClass *prev);
698 
699     AVClassCategory category;
700 
701     AVClassCategory (*get_category)(void* ctx);
702 
703     int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
704 } AVClass;
705 
706 #define AV_LOG_QUIET    -8
707 
708 #define AV_LOG_PANIC     0
709 
710 #define AV_LOG_FATAL     8
711 
712 #define AV_LOG_ERROR    16
713 
714 #define AV_LOG_WARNING  24
715 
716 #define AV_LOG_INFO     32
717 
718 #define AV_LOG_VERBOSE  40
719 
720 #define AV_LOG_DEBUG    48
721 
722 #define AV_LOG_TRACE    56
723 
724 #define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
725 
726 #define AV_LOG_C(x) ((x) << 8)
727 
728 void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
729 
730 void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
731 
732 int av_log_get_level(void);
733 
734 void av_log_set_level(int level);
735 
736 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
737 
738 void av_log_default_callback(void *avcl, int level, const char *fmt,
739                              va_list vl);
740 
741 const char* av_default_item_name(void* ctx);
742 AVClassCategory av_default_get_category(void *ptr);
743 
744 void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
745                         char *line, int line_size, int *print_prefix);
746 
747 int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
748                         char *line, int line_size, int *print_prefix);
749 
750 #    define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
751 
752 #define AV_LOG_SKIP_REPEATED 1
753 
754 #define AV_LOG_PRINT_LEVEL 2
755 
756 void av_log_set_flags(int arg);
757 int av_log_get_flags(void);
758 
759 #define AVUTIL_PIXFMT_H
760 
761 #define AVPALETTE_SIZE 1024
762 #define AVPALETTE_COUNT 256
763 
764 enum AVPixelFormat {
765     AV_PIX_FMT_NONE = -1,
766     AV_PIX_FMT_YUV420P,
767     AV_PIX_FMT_YUYV422,
768     AV_PIX_FMT_RGB24,
769     AV_PIX_FMT_BGR24,
770     AV_PIX_FMT_YUV422P,
771     AV_PIX_FMT_YUV444P,
772     AV_PIX_FMT_YUV410P,
773     AV_PIX_FMT_YUV411P,
774     AV_PIX_FMT_GRAY8,
775     AV_PIX_FMT_MONOWHITE,
776     AV_PIX_FMT_MONOBLACK,
777     AV_PIX_FMT_PAL8,
778     AV_PIX_FMT_YUVJ420P,
779     AV_PIX_FMT_YUVJ422P,
780     AV_PIX_FMT_YUVJ444P,
781     AV_PIX_FMT_XVMC_MPEG2_MC,
782     AV_PIX_FMT_XVMC_MPEG2_IDCT,
783     AV_PIX_FMT_XVMC = AV_PIX_FMT_XVMC_MPEG2_IDCT,
784     AV_PIX_FMT_UYVY422,
785     AV_PIX_FMT_UYYVYY411,
786     AV_PIX_FMT_BGR8,
787     AV_PIX_FMT_BGR4,
788     AV_PIX_FMT_BGR4_BYTE,
789     AV_PIX_FMT_RGB8,
790     AV_PIX_FMT_RGB4,
791     AV_PIX_FMT_RGB4_BYTE,
792     AV_PIX_FMT_NV12,
793     AV_PIX_FMT_NV21,
794 
795     AV_PIX_FMT_ARGB,
796     AV_PIX_FMT_RGBA,
797     AV_PIX_FMT_ABGR,
798     AV_PIX_FMT_BGRA,
799 
800     AV_PIX_FMT_GRAY16BE,
801     AV_PIX_FMT_GRAY16LE,
802     AV_PIX_FMT_YUV440P,
803     AV_PIX_FMT_YUVJ440P,
804     AV_PIX_FMT_YUVA420P,
805     AV_PIX_FMT_VDPAU_H264,
806     AV_PIX_FMT_VDPAU_MPEG1,
807     AV_PIX_FMT_VDPAU_MPEG2,
808     AV_PIX_FMT_VDPAU_WMV3,
809     AV_PIX_FMT_VDPAU_VC1,
810     AV_PIX_FMT_RGB48BE,
811     AV_PIX_FMT_RGB48LE,
812 
813     AV_PIX_FMT_RGB565BE,
814     AV_PIX_FMT_RGB565LE,
815     AV_PIX_FMT_RGB555BE,
816     AV_PIX_FMT_RGB555LE,
817 
818     AV_PIX_FMT_BGR565BE,
819     AV_PIX_FMT_BGR565LE,
820     AV_PIX_FMT_BGR555BE,
821     AV_PIX_FMT_BGR555LE,
822 
823     AV_PIX_FMT_VAAPI_MOCO,
824     AV_PIX_FMT_VAAPI_IDCT,
825     AV_PIX_FMT_VAAPI_VLD,
826 
827     AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
828 
829     AV_PIX_FMT_YUV420P16LE,
830     AV_PIX_FMT_YUV420P16BE,
831     AV_PIX_FMT_YUV422P16LE,
832     AV_PIX_FMT_YUV422P16BE,
833     AV_PIX_FMT_YUV444P16LE,
834     AV_PIX_FMT_YUV444P16BE,
835     AV_PIX_FMT_VDPAU_MPEG4,
836     AV_PIX_FMT_DXVA2_VLD,
837 
838     AV_PIX_FMT_RGB444LE,
839     AV_PIX_FMT_RGB444BE,
840     AV_PIX_FMT_BGR444LE,
841     AV_PIX_FMT_BGR444BE,
842     AV_PIX_FMT_YA8,
843 
844     AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8,
845     AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8,
846 
847     AV_PIX_FMT_BGR48BE,
848     AV_PIX_FMT_BGR48LE,
849 
850     AV_PIX_FMT_YUV420P9BE,
851     AV_PIX_FMT_YUV420P9LE,
852     AV_PIX_FMT_YUV420P10BE,
853     AV_PIX_FMT_YUV420P10LE,
854     AV_PIX_FMT_YUV422P10BE,
855     AV_PIX_FMT_YUV422P10LE,
856     AV_PIX_FMT_YUV444P9BE,
857     AV_PIX_FMT_YUV444P9LE,
858     AV_PIX_FMT_YUV444P10BE,
859     AV_PIX_FMT_YUV444P10LE,
860     AV_PIX_FMT_YUV422P9BE,
861     AV_PIX_FMT_YUV422P9LE,
862     AV_PIX_FMT_VDA_VLD,
863     AV_PIX_FMT_GBRP,
864     AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP,
865     AV_PIX_FMT_GBRP9BE,
866     AV_PIX_FMT_GBRP9LE,
867     AV_PIX_FMT_GBRP10BE,
868     AV_PIX_FMT_GBRP10LE,
869     AV_PIX_FMT_GBRP16BE,
870     AV_PIX_FMT_GBRP16LE,
871     AV_PIX_FMT_YUVA422P,
872     AV_PIX_FMT_YUVA444P,
873     AV_PIX_FMT_YUVA420P9BE,
874     AV_PIX_FMT_YUVA420P9LE,
875     AV_PIX_FMT_YUVA422P9BE,
876     AV_PIX_FMT_YUVA422P9LE,
877     AV_PIX_FMT_YUVA444P9BE,
878     AV_PIX_FMT_YUVA444P9LE,
879     AV_PIX_FMT_YUVA420P10BE,
880     AV_PIX_FMT_YUVA420P10LE,
881     AV_PIX_FMT_YUVA422P10BE,
882     AV_PIX_FMT_YUVA422P10LE,
883     AV_PIX_FMT_YUVA444P10BE,
884     AV_PIX_FMT_YUVA444P10LE,
885     AV_PIX_FMT_YUVA420P16BE,
886     AV_PIX_FMT_YUVA420P16LE,
887     AV_PIX_FMT_YUVA422P16BE,
888     AV_PIX_FMT_YUVA422P16LE,
889     AV_PIX_FMT_YUVA444P16BE,
890     AV_PIX_FMT_YUVA444P16LE,
891 
892     AV_PIX_FMT_VDPAU,
893 
894     AV_PIX_FMT_XYZ12LE,
895     AV_PIX_FMT_XYZ12BE,
896     AV_PIX_FMT_NV16,
897     AV_PIX_FMT_NV20LE,
898     AV_PIX_FMT_NV20BE,
899 
900     AV_PIX_FMT_RGBA64BE,
901     AV_PIX_FMT_RGBA64LE,
902     AV_PIX_FMT_BGRA64BE,
903     AV_PIX_FMT_BGRA64LE,
904 
905     AV_PIX_FMT_YVYU422,
906 
907     AV_PIX_FMT_VDA,
908 
909     AV_PIX_FMT_YA16BE,
910     AV_PIX_FMT_YA16LE,
911 
912     AV_PIX_FMT_GBRAP,
913     AV_PIX_FMT_GBRAP16BE,
914     AV_PIX_FMT_GBRAP16LE,
915 
916     AV_PIX_FMT_QSV,
917 
918     AV_PIX_FMT_MMAL,
919 
920     AV_PIX_FMT_D3D11VA_VLD,
921 
922     AV_PIX_FMT_CUDA,
923 
924     AV_PIX_FMT_0RGB=0x123+4,
925     AV_PIX_FMT_RGB0,
926     AV_PIX_FMT_0BGR,
927     AV_PIX_FMT_BGR0,
928 
929     AV_PIX_FMT_YUV420P12BE,
930     AV_PIX_FMT_YUV420P12LE,
931     AV_PIX_FMT_YUV420P14BE,
932     AV_PIX_FMT_YUV420P14LE,
933     AV_PIX_FMT_YUV422P12BE,
934     AV_PIX_FMT_YUV422P12LE,
935     AV_PIX_FMT_YUV422P14BE,
936     AV_PIX_FMT_YUV422P14LE,
937     AV_PIX_FMT_YUV444P12BE,
938     AV_PIX_FMT_YUV444P12LE,
939     AV_PIX_FMT_YUV444P14BE,
940     AV_PIX_FMT_YUV444P14LE,
941     AV_PIX_FMT_GBRP12BE,
942     AV_PIX_FMT_GBRP12LE,
943     AV_PIX_FMT_GBRP14BE,
944     AV_PIX_FMT_GBRP14LE,
945     AV_PIX_FMT_YUVJ411P,
946 
947     AV_PIX_FMT_BAYER_BGGR8,
948     AV_PIX_FMT_BAYER_RGGB8,
949     AV_PIX_FMT_BAYER_GBRG8,
950     AV_PIX_FMT_BAYER_GRBG8,
951     AV_PIX_FMT_BAYER_BGGR16LE,
952     AV_PIX_FMT_BAYER_BGGR16BE,
953     AV_PIX_FMT_BAYER_RGGB16LE,
954     AV_PIX_FMT_BAYER_RGGB16BE,
955     AV_PIX_FMT_BAYER_GBRG16LE,
956     AV_PIX_FMT_BAYER_GBRG16BE,
957     AV_PIX_FMT_BAYER_GRBG16LE,
958     AV_PIX_FMT_BAYER_GRBG16BE,
959     AV_PIX_FMT_YUV440P10LE,
960     AV_PIX_FMT_YUV440P10BE,
961     AV_PIX_FMT_YUV440P12LE,
962     AV_PIX_FMT_YUV440P12BE,
963     AV_PIX_FMT_AYUV64LE,
964     AV_PIX_FMT_AYUV64BE,
965 
966     AV_PIX_FMT_VIDEOTOOLBOX,
967 
968     AV_PIX_FMT_P010LE,
969     AV_PIX_FMT_P010BE,
970 
971     AV_PIX_FMT_GBRAP12BE,
972     AV_PIX_FMT_GBRAP12LE,
973 
974     AV_PIX_FMT_GBRAP10BE,
975     AV_PIX_FMT_GBRAP10LE,
976 
977     AV_PIX_FMT_MEDIACODEC,
978 
979     AV_PIX_FMT_GRAY12BE,
980     AV_PIX_FMT_GRAY12LE,
981     AV_PIX_FMT_GRAY10BE,
982     AV_PIX_FMT_GRAY10LE,
983 
984     AV_PIX_FMT_P016LE,
985     AV_PIX_FMT_P016BE,
986 
987     AV_PIX_FMT_D3D11,
988 
989     AV_PIX_FMT_GRAY9BE,
990     AV_PIX_FMT_GRAY9LE,
991 
992     AV_PIX_FMT_GBRPF32BE,
993     AV_PIX_FMT_GBRPF32LE,
994     AV_PIX_FMT_GBRAPF32BE,
995     AV_PIX_FMT_GBRAPF32LE,
996 
997     AV_PIX_FMT_DRM_PRIME,
998 
999     AV_PIX_FMT_NB
1000 };
1001 
1002 #   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
1003 
1004 #define AV_PIX_FMT_RGB32   AV_PIX_FMT_NE(ARGB, BGRA)
1005 #define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
1006 #define AV_PIX_FMT_BGR32   AV_PIX_FMT_NE(ABGR, RGBA)
1007 #define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
1008 #define AV_PIX_FMT_0RGB32  AV_PIX_FMT_NE(0RGB, BGR0)
1009 #define AV_PIX_FMT_0BGR32  AV_PIX_FMT_NE(0BGR, RGB0)
1010 
1011 #define AV_PIX_FMT_GRAY9  AV_PIX_FMT_NE(GRAY9BE,  GRAY9LE)
1012 #define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
1013 #define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
1014 #define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
1015 #define AV_PIX_FMT_YA16   AV_PIX_FMT_NE(YA16BE,   YA16LE)
1016 #define AV_PIX_FMT_RGB48  AV_PIX_FMT_NE(RGB48BE,  RGB48LE)
1017 #define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
1018 #define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
1019 #define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
1020 #define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
1021 #define AV_PIX_FMT_BGR48  AV_PIX_FMT_NE(BGR48BE,  BGR48LE)
1022 #define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
1023 #define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
1024 #define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
1025 #define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
1026 
1027 #define AV_PIX_FMT_YUV420P9  AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
1028 #define AV_PIX_FMT_YUV422P9  AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
1029 #define AV_PIX_FMT_YUV444P9  AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
1030 #define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
1031 #define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
1032 #define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
1033 #define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
1034 #define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
1035 #define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
1036 #define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
1037 #define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
1038 #define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
1039 #define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
1040 #define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
1041 #define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
1042 #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
1043 #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
1044 
1045 #define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
1046 #define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
1047 #define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
1048 #define AV_PIX_FMT_GBRP14    AV_PIX_FMT_NE(GBRP14BE,    GBRP14LE)
1049 #define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
1050 #define AV_PIX_FMT_GBRAP10   AV_PIX_FMT_NE(GBRAP10BE,   GBRAP10LE)
1051 #define AV_PIX_FMT_GBRAP12   AV_PIX_FMT_NE(GBRAP12BE,   GBRAP12LE)
1052 #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
1053 
1054 #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    BAYER_BGGR16LE)
1055 #define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE,    BAYER_RGGB16LE)
1056 #define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE,    BAYER_GBRG16LE)
1057 #define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE,    BAYER_GRBG16LE)
1058 
1059 #define AV_PIX_FMT_GBRPF32    AV_PIX_FMT_NE(GBRPF32BE,  GBRPF32LE)
1060 #define AV_PIX_FMT_GBRAPF32   AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
1061 
1062 #define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
1063 #define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
1064 #define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
1065 #define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
1066 #define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
1067 #define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
1068 #define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
1069 #define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
1070 #define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
1071 
1072 #define AV_PIX_FMT_XYZ12      AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
1073 #define AV_PIX_FMT_NV20       AV_PIX_FMT_NE(NV20BE,  NV20LE)
1074 #define AV_PIX_FMT_AYUV64     AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
1075 #define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
1076 #define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
1077 
1078 enum AVColorPrimaries {
1079     AVCOL_PRI_RESERVED0   = 0,
1080     AVCOL_PRI_BT709       = 1,
1081     AVCOL_PRI_UNSPECIFIED = 2,
1082     AVCOL_PRI_RESERVED    = 3,
1083     AVCOL_PRI_BT470M      = 4,
1084 
1085     AVCOL_PRI_BT470BG     = 5,
1086     AVCOL_PRI_SMPTE170M   = 6,
1087     AVCOL_PRI_SMPTE240M   = 7,
1088     AVCOL_PRI_FILM        = 8,
1089     AVCOL_PRI_BT2020      = 9,
1090     AVCOL_PRI_SMPTE428    = 10,
1091     AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
1092     AVCOL_PRI_SMPTE431    = 11,
1093     AVCOL_PRI_SMPTE432    = 12,
1094     AVCOL_PRI_JEDEC_P22   = 22,
1095     AVCOL_PRI_NB
1096 };
1097 
1098 enum AVColorTransferCharacteristic {
1099     AVCOL_TRC_RESERVED0    = 0,
1100     AVCOL_TRC_BT709        = 1,
1101     AVCOL_TRC_UNSPECIFIED  = 2,
1102     AVCOL_TRC_RESERVED     = 3,
1103     AVCOL_TRC_GAMMA22      = 4,
1104     AVCOL_TRC_GAMMA28      = 5,
1105     AVCOL_TRC_SMPTE170M    = 6,
1106     AVCOL_TRC_SMPTE240M    = 7,
1107     AVCOL_TRC_LINEAR       = 8,
1108     AVCOL_TRC_LOG          = 9,
1109     AVCOL_TRC_LOG_SQRT     = 10,
1110     AVCOL_TRC_IEC61966_2_4 = 11,
1111     AVCOL_TRC_BT1361_ECG   = 12,
1112     AVCOL_TRC_IEC61966_2_1 = 13,
1113     AVCOL_TRC_BT2020_10    = 14,
1114     AVCOL_TRC_BT2020_12    = 15,
1115     AVCOL_TRC_SMPTE2084    = 16,
1116     AVCOL_TRC_SMPTEST2084  = AVCOL_TRC_SMPTE2084,
1117     AVCOL_TRC_SMPTE428     = 17,
1118     AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
1119     AVCOL_TRC_ARIB_STD_B67 = 18,
1120     AVCOL_TRC_NB
1121 };
1122 
1123 enum AVColorSpace {
1124     AVCOL_SPC_RGB         = 0,
1125     AVCOL_SPC_BT709       = 1,
1126     AVCOL_SPC_UNSPECIFIED = 2,
1127     AVCOL_SPC_RESERVED    = 3,
1128     AVCOL_SPC_FCC         = 4,
1129     AVCOL_SPC_BT470BG     = 5,
1130     AVCOL_SPC_SMPTE170M   = 6,
1131     AVCOL_SPC_SMPTE240M   = 7,
1132     AVCOL_SPC_YCGCO       = 8,
1133     AVCOL_SPC_YCOCG       = AVCOL_SPC_YCGCO,
1134     AVCOL_SPC_BT2020_NCL  = 9,
1135     AVCOL_SPC_BT2020_CL   = 10,
1136     AVCOL_SPC_SMPTE2085   = 11,
1137     AVCOL_SPC_CHROMA_DERIVED_NCL = 12,
1138     AVCOL_SPC_CHROMA_DERIVED_CL = 13,
1139     AVCOL_SPC_ICTCP       = 14,
1140     AVCOL_SPC_NB
1141 };
1142 
1143 enum AVColorRange {
1144     AVCOL_RANGE_UNSPECIFIED = 0,
1145     AVCOL_RANGE_MPEG        = 1,
1146     AVCOL_RANGE_JPEG        = 2,
1147     AVCOL_RANGE_NB
1148 };
1149 
1150 enum AVChromaLocation {
1151     AVCHROMA_LOC_UNSPECIFIED = 0,
1152     AVCHROMA_LOC_LEFT        = 1,
1153     AVCHROMA_LOC_CENTER      = 2,
1154     AVCHROMA_LOC_TOPLEFT     = 3,
1155     AVCHROMA_LOC_TOP         = 4,
1156     AVCHROMA_LOC_BOTTOMLEFT  = 5,
1157     AVCHROMA_LOC_BOTTOM      = 6,
1158     AVCHROMA_LOC_NB
1159 };
1160 
av_x_if_null(const void * p,const void * x)1161 static inline void *av_x_if_null(const void *p, const void *x)
1162 {
1163     return (void *)(intptr_t)(p ? p : x);
1164 }
1165 
1166 unsigned av_int_list_length_for_size(unsigned elsize,
1167                                      const void *list, uint64_t term) av_pure;
1168 
1169 #define av_int_list_length(list, term) \
1170     av_int_list_length_for_size(sizeof(*(list)), list, term)
1171 
1172 FILE *av_fopen_utf8(const char *path, const char *mode);
1173 
1174 AVRational av_get_time_base_q(void);
1175 
1176 #define AV_FOURCC_MAX_STRING_SIZE 32
1177 
1178 #define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
1179 
1180 char *av_fourcc_make_string(char *buf, uint32_t fourcc);
1181 
1182 enum AVSampleFormat {
1183     AV_SAMPLE_FMT_NONE = -1,
1184     AV_SAMPLE_FMT_U8,
1185     AV_SAMPLE_FMT_S16,
1186     AV_SAMPLE_FMT_S32,
1187     AV_SAMPLE_FMT_FLT,
1188     AV_SAMPLE_FMT_DBL,
1189 
1190     AV_SAMPLE_FMT_U8P,
1191     AV_SAMPLE_FMT_S16P,
1192     AV_SAMPLE_FMT_S32P,
1193     AV_SAMPLE_FMT_FLTP,
1194     AV_SAMPLE_FMT_DBLP,
1195     AV_SAMPLE_FMT_S64,
1196     AV_SAMPLE_FMT_S64P,
1197 
1198     AV_SAMPLE_FMT_NB
1199 };
1200 
1201 const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
1202 
1203 enum AVSampleFormat av_get_sample_fmt(const char *name);
1204 
1205 enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
1206 
1207 enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
1208 
1209 enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
1210 
1211 char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
1212 
1213 int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
1214 
1215 int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
1216 
1217 int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
1218                                enum AVSampleFormat sample_fmt, int align);
1219 
1220 int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
1221                            const uint8_t *buf,
1222                            int nb_channels, int nb_samples,
1223                            enum AVSampleFormat sample_fmt, int align);
1224 
1225 int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
1226                      int nb_samples, enum AVSampleFormat sample_fmt, int align);
1227 
1228 int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
1229                                        int nb_samples, enum AVSampleFormat sample_fmt, int align);
1230 
1231 int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
1232                     int src_offset, int nb_samples, int nb_channels,
1233                     enum AVSampleFormat sample_fmt);
1234 
1235 int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
1236                            int nb_channels, enum AVSampleFormat sample_fmt);
1237 
1238 #define AVUTIL_BUFFER_H
1239 
1240 typedef struct AVBuffer AVBuffer;
1241 
1242 typedef struct AVBufferRef {
1243     AVBuffer *buffer;
1244 
1245     uint8_t *data;
1246 
1247     int      size;
1248 } AVBufferRef;
1249 
1250 AVBufferRef *av_buffer_alloc(int size);
1251 
1252 AVBufferRef *av_buffer_allocz(int size);
1253 
1254 #define AV_BUFFER_FLAG_READONLY (1 << 0)
1255 
1256 AVBufferRef *av_buffer_create(uint8_t *data, int size,
1257                               void (*free)(void *opaque, uint8_t *data),
1258                               void *opaque, int flags);
1259 
1260 void av_buffer_default_free(void *opaque, uint8_t *data);
1261 
1262 AVBufferRef *av_buffer_ref(AVBufferRef *buf);
1263 
1264 void av_buffer_unref(AVBufferRef **buf);
1265 
1266 int av_buffer_is_writable(const AVBufferRef *buf);
1267 
1268 void *av_buffer_get_opaque(const AVBufferRef *buf);
1269 
1270 int av_buffer_get_ref_count(const AVBufferRef *buf);
1271 
1272 int av_buffer_make_writable(AVBufferRef **buf);
1273 
1274 int av_buffer_realloc(AVBufferRef **buf, int size);
1275 
1276 typedef struct AVBufferPool AVBufferPool;
1277 
1278 AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
1279 
1280 AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
1281                                    AVBufferRef* (*alloc)(void *opaque, int size),
1282                                    void (*pool_free)(void *opaque));
1283 
1284 void av_buffer_pool_uninit(AVBufferPool **pool);
1285 
1286 AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
1287 
1288 #define AVUTIL_CPU_H
1289 
1290 #define AV_CPU_FLAG_FORCE    0x80000000
1291 
1292 #define AV_CPU_FLAG_MMX          0x0001
1293 #define AV_CPU_FLAG_MMXEXT       0x0002
1294 #define AV_CPU_FLAG_MMX2         0x0002
1295 #define AV_CPU_FLAG_3DNOW        0x0004
1296 #define AV_CPU_FLAG_SSE          0x0008
1297 #define AV_CPU_FLAG_SSE2         0x0010
1298 #define AV_CPU_FLAG_SSE2SLOW 0x40000000
1299 
1300 #define AV_CPU_FLAG_3DNOWEXT     0x0020
1301 #define AV_CPU_FLAG_SSE3         0x0040
1302 #define AV_CPU_FLAG_SSE3SLOW 0x20000000
1303 
1304 #define AV_CPU_FLAG_SSSE3        0x0080
1305 #define AV_CPU_FLAG_SSSE3SLOW 0x4000000
1306 #define AV_CPU_FLAG_ATOM     0x10000000
1307 #define AV_CPU_FLAG_SSE4         0x0100
1308 #define AV_CPU_FLAG_SSE42        0x0200
1309 #define AV_CPU_FLAG_AESNI       0x80000
1310 #define AV_CPU_FLAG_AVX          0x4000
1311 #define AV_CPU_FLAG_AVXSLOW   0x8000000
1312 #define AV_CPU_FLAG_XOP          0x0400
1313 #define AV_CPU_FLAG_FMA4         0x0800
1314 #define AV_CPU_FLAG_CMOV         0x1000
1315 #define AV_CPU_FLAG_AVX2         0x8000
1316 #define AV_CPU_FLAG_FMA3        0x10000
1317 #define AV_CPU_FLAG_BMI1        0x20000
1318 #define AV_CPU_FLAG_BMI2        0x40000
1319 
1320 #define AV_CPU_FLAG_ALTIVEC      0x0001
1321 #define AV_CPU_FLAG_VSX          0x0002
1322 #define AV_CPU_FLAG_POWER8       0x0004
1323 
1324 #define AV_CPU_FLAG_ARMV5TE      (1 << 0)
1325 #define AV_CPU_FLAG_ARMV6        (1 << 1)
1326 #define AV_CPU_FLAG_ARMV6T2      (1 << 2)
1327 #define AV_CPU_FLAG_VFP          (1 << 3)
1328 #define AV_CPU_FLAG_VFPV3        (1 << 4)
1329 #define AV_CPU_FLAG_NEON         (1 << 5)
1330 #define AV_CPU_FLAG_ARMV8        (1 << 6)
1331 #define AV_CPU_FLAG_VFP_VM       (1 << 7)
1332 #define AV_CPU_FLAG_SETEND       (1 <<16)
1333 
1334 int av_get_cpu_flags(void);
1335 
1336 void av_force_cpu_flags(int flags);
1337 
1338 attribute_deprecated void av_set_cpu_flags_mask(int mask);
1339 
1340 attribute_deprecated
1341 int av_parse_cpu_flags(const char *s);
1342 
1343 int av_parse_cpu_caps(unsigned *flags, const char *s);
1344 
1345 int av_cpu_count(void);
1346 
1347 size_t av_cpu_max_align(void);
1348 
1349 #define AVUTIL_CHANNEL_LAYOUT_H
1350 
1351 #define AV_CH_FRONT_LEFT             0x00000001
1352 #define AV_CH_FRONT_RIGHT            0x00000002
1353 #define AV_CH_FRONT_CENTER           0x00000004
1354 #define AV_CH_LOW_FREQUENCY          0x00000008
1355 #define AV_CH_BACK_LEFT              0x00000010
1356 #define AV_CH_BACK_RIGHT             0x00000020
1357 #define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
1358 #define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
1359 #define AV_CH_BACK_CENTER            0x00000100
1360 #define AV_CH_SIDE_LEFT              0x00000200
1361 #define AV_CH_SIDE_RIGHT             0x00000400
1362 #define AV_CH_TOP_CENTER             0x00000800
1363 #define AV_CH_TOP_FRONT_LEFT         0x00001000
1364 #define AV_CH_TOP_FRONT_CENTER       0x00002000
1365 #define AV_CH_TOP_FRONT_RIGHT        0x00004000
1366 #define AV_CH_TOP_BACK_LEFT          0x00008000
1367 #define AV_CH_TOP_BACK_CENTER        0x00010000
1368 #define AV_CH_TOP_BACK_RIGHT         0x00020000
1369 #define AV_CH_STEREO_LEFT            0x20000000
1370 #define AV_CH_STEREO_RIGHT           0x40000000
1371 #define AV_CH_WIDE_LEFT              0x0000000080000000ULL
1372 #define AV_CH_WIDE_RIGHT             0x0000000100000000ULL
1373 #define AV_CH_SURROUND_DIRECT_LEFT   0x0000000200000000ULL
1374 #define AV_CH_SURROUND_DIRECT_RIGHT  0x0000000400000000ULL
1375 #define AV_CH_LOW_FREQUENCY_2        0x0000000800000000ULL
1376 
1377 #define AV_CH_LAYOUT_NATIVE          0x8000000000000000ULL
1378 
1379 #define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
1380 #define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
1381 #define AV_CH_LAYOUT_2POINT1           (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
1382 #define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
1383 #define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
1384 #define AV_CH_LAYOUT_3POINT1           (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
1385 #define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
1386 #define AV_CH_LAYOUT_4POINT1           (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
1387 #define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
1388 #define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
1389 #define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
1390 #define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
1391 #define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
1392 #define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
1393 #define AV_CH_LAYOUT_6POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
1394 #define AV_CH_LAYOUT_6POINT0_FRONT     (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
1395 #define AV_CH_LAYOUT_HEXAGONAL         (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
1396 #define AV_CH_LAYOUT_6POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
1397 #define AV_CH_LAYOUT_6POINT1_BACK      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
1398 #define AV_CH_LAYOUT_6POINT1_FRONT     (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
1399 #define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
1400 #define AV_CH_LAYOUT_7POINT0_FRONT     (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
1401 #define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
1402 #define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
1403 #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
1404 #define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
1405 #define AV_CH_LAYOUT_HEXADECAGONAL     (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
1406 #define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
1407 
1408 enum AVMatrixEncoding {
1409     AV_MATRIX_ENCODING_NONE,
1410     AV_MATRIX_ENCODING_DOLBY,
1411     AV_MATRIX_ENCODING_DPLII,
1412     AV_MATRIX_ENCODING_DPLIIX,
1413     AV_MATRIX_ENCODING_DPLIIZ,
1414     AV_MATRIX_ENCODING_DOLBYEX,
1415     AV_MATRIX_ENCODING_DOLBYHEADPHONE,
1416     AV_MATRIX_ENCODING_NB
1417 };
1418 
1419 uint64_t av_get_channel_layout(const char *name);
1420 
1421 int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
1422 
1423 void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
1424 
1425 struct AVBPrint;
1426 
1427 void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
1428 
1429 int av_get_channel_layout_nb_channels(uint64_t channel_layout);
1430 
1431 int64_t av_get_default_channel_layout(int nb_channels);
1432 
1433 int av_get_channel_layout_channel_index(uint64_t channel_layout,
1434                                         uint64_t channel);
1435 
1436 uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
1437 
1438 const char *av_get_channel_name(uint64_t channel);
1439 
1440 const char *av_get_channel_description(uint64_t channel);
1441 
1442 int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
1443                                    const char **name);
1444 
1445 #define AVUTIL_DICT_H
1446 
1447 #define AV_DICT_MATCH_CASE      1
1448 #define AV_DICT_IGNORE_SUFFIX   2
1449 
1450 #define AV_DICT_DONT_STRDUP_KEY 4
1451 
1452 #define AV_DICT_DONT_STRDUP_VAL 8
1453 
1454 #define AV_DICT_DONT_OVERWRITE 16
1455 #define AV_DICT_APPEND         32
1456 
1457 #define AV_DICT_MULTIKEY       64
1458 
1459 typedef struct AVDictionaryEntry {
1460     char *key;
1461     char *value;
1462 } AVDictionaryEntry;
1463 
1464 typedef struct AVDictionary AVDictionary;
1465 
1466 AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
1467                                const AVDictionaryEntry *prev, int flags);
1468 
1469 int av_dict_count(const AVDictionary *m);
1470 
1471 int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
1472 
1473 int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
1474 
1475 int av_dict_parse_string(AVDictionary **pm, const char *str,
1476                          const char *key_val_sep, const char *pairs_sep,
1477                          int flags);
1478 
1479 int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
1480 
1481 void av_dict_free(AVDictionary **m);
1482 
1483 int av_dict_get_string(const AVDictionary *m, char **buffer,
1484                        const char key_val_sep, const char pairs_sep);
1485 
1486 #define AVUTIL_FRAME_H
1487 
1488 enum AVFrameSideDataType {
1489 
1490     AV_FRAME_DATA_PANSCAN,
1491 
1492     AV_FRAME_DATA_A53_CC,
1493 
1494     AV_FRAME_DATA_STEREO3D,
1495 
1496     AV_FRAME_DATA_MATRIXENCODING,
1497 
1498     AV_FRAME_DATA_DOWNMIX_INFO,
1499 
1500     AV_FRAME_DATA_REPLAYGAIN,
1501 
1502     AV_FRAME_DATA_DISPLAYMATRIX,
1503 
1504     AV_FRAME_DATA_AFD,
1505 
1506     AV_FRAME_DATA_MOTION_VECTORS,
1507 
1508     AV_FRAME_DATA_SKIP_SAMPLES,
1509 
1510     AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
1511 
1512     AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
1513 
1514     AV_FRAME_DATA_GOP_TIMECODE,
1515 
1516     AV_FRAME_DATA_SPHERICAL,
1517 
1518     AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
1519 
1520     AV_FRAME_DATA_ICC_PROFILE,
1521 };
1522 
1523 enum AVActiveFormatDescription {
1524     AV_AFD_SAME         = 8,
1525     AV_AFD_4_3          = 9,
1526     AV_AFD_16_9         = 10,
1527     AV_AFD_14_9         = 11,
1528     AV_AFD_4_3_SP_14_9  = 13,
1529     AV_AFD_16_9_SP_14_9 = 14,
1530     AV_AFD_SP_4_3       = 15,
1531 };
1532 
1533 typedef struct AVFrameSideData {
1534     enum AVFrameSideDataType type;
1535     uint8_t *data;
1536     int      size;
1537     AVDictionary *metadata;
1538     AVBufferRef *buf;
1539 } AVFrameSideData;
1540 
1541 typedef struct AVFrame {
1542 #define AV_NUM_DATA_POINTERS 8
1543 
1544     uint8_t *data[AV_NUM_DATA_POINTERS];
1545 
1546     int linesize[AV_NUM_DATA_POINTERS];
1547 
1548     uint8_t **extended_data;
1549 
1550     int width, height;
1551 
1552     int nb_samples;
1553 
1554     int format;
1555 
1556     int key_frame;
1557 
1558     enum AVPictureType pict_type;
1559 
1560     AVRational sample_aspect_ratio;
1561 
1562     int64_t pts;
1563 
1564     attribute_deprecated
1565     int64_t pkt_pts;
1566 
1567     int64_t pkt_dts;
1568 
1569     int coded_picture_number;
1570 
1571     int display_picture_number;
1572 
1573     int quality;
1574 
1575     void *opaque;
1576 
1577     attribute_deprecated
1578     uint64_t error[AV_NUM_DATA_POINTERS];
1579 
1580     int repeat_pict;
1581 
1582     int interlaced_frame;
1583 
1584     int top_field_first;
1585 
1586     int palette_has_changed;
1587 
1588     int64_t reordered_opaque;
1589 
1590     int sample_rate;
1591 
1592     uint64_t channel_layout;
1593 
1594     AVBufferRef *buf[AV_NUM_DATA_POINTERS];
1595 
1596     AVBufferRef **extended_buf;
1597 
1598     int        nb_extended_buf;
1599 
1600     AVFrameSideData **side_data;
1601     int            nb_side_data;
1602 
1603 #define AV_FRAME_FLAG_CORRUPT       (1 << 0)
1604 
1605 #define AV_FRAME_FLAG_DISCARD   (1 << 2)
1606 
1607     int flags;
1608 
1609     enum AVColorRange color_range;
1610 
1611     enum AVColorPrimaries color_primaries;
1612 
1613     enum AVColorTransferCharacteristic color_trc;
1614 
1615     enum AVColorSpace colorspace;
1616 
1617     enum AVChromaLocation chroma_location;
1618 
1619     int64_t best_effort_timestamp;
1620 
1621     int64_t pkt_pos;
1622 
1623     int64_t pkt_duration;
1624 
1625     AVDictionary *metadata;
1626 
1627     int decode_error_flags;
1628 #define FF_DECODE_ERROR_INVALID_BITSTREAM   1
1629 #define FF_DECODE_ERROR_MISSING_REFERENCE   2
1630 
1631     int channels;
1632 
1633     int pkt_size;
1634 
1635     attribute_deprecated
1636     int8_t *qscale_table;
1637 
1638     attribute_deprecated
1639     int qstride;
1640 
1641     attribute_deprecated
1642     int qscale_type;
1643 
1644     AVBufferRef *qp_table_buf;
1645 
1646     AVBufferRef *hw_frames_ctx;
1647 
1648     AVBufferRef *opaque_ref;
1649 
1650     size_t crop_top;
1651     size_t crop_bottom;
1652     size_t crop_left;
1653     size_t crop_right;
1654 
1655 } AVFrame;
1656 
1657 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
1658 void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
1659 int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
1660 void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
1661 int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
1662 void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
1663 int64_t av_frame_get_channel_layout       (const AVFrame *frame);
1664 void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
1665 int     av_frame_get_channels             (const AVFrame *frame);
1666 void    av_frame_set_channels             (AVFrame *frame, int     val);
1667 int     av_frame_get_sample_rate          (const AVFrame *frame);
1668 void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
1669 AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
1670 void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
1671 int     av_frame_get_decode_error_flags   (const AVFrame *frame);
1672 void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
1673 int     av_frame_get_pkt_size(const AVFrame *frame);
1674 void    av_frame_set_pkt_size(AVFrame *frame, int val);
1675 AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
1676 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
1677 int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
1678 enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
1679 void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
1680 enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
1681 void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
1682 
1683 const char *av_get_colorspace_name(enum AVColorSpace val);
1684 
1685 AVFrame *av_frame_alloc(void);
1686 
1687 void av_frame_free(AVFrame **frame);
1688 
1689 int av_frame_ref(AVFrame *dst, const AVFrame *src);
1690 
1691 AVFrame *av_frame_clone(const AVFrame *src);
1692 
1693 void av_frame_unref(AVFrame *frame);
1694 
1695 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
1696 
1697 int av_frame_get_buffer(AVFrame *frame, int align);
1698 
1699 int av_frame_is_writable(AVFrame *frame);
1700 
1701 int av_frame_make_writable(AVFrame *frame);
1702 
1703 int av_frame_copy(AVFrame *dst, const AVFrame *src);
1704 
1705 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
1706 
1707 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
1708 
1709 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
1710                                         enum AVFrameSideDataType type,
1711                                         int size);
1712 
1713 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
1714                                         enum AVFrameSideDataType type);
1715 
1716 void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
1717 
1718 enum {
1719 
1720     AV_FRAME_CROP_UNALIGNED     = 1 << 0,
1721 };
1722 
1723 int av_frame_apply_cropping(AVFrame *frame, int flags);
1724 
1725 const char *av_frame_side_data_name(enum AVFrameSideDataType type);
1726 
1727 #define AVCODEC_VERSION_H
1728 
1729 #define LIBAVCODEC_VERSION_MAJOR  57
1730 #define LIBAVCODEC_VERSION_MINOR 107
1731 #define LIBAVCODEC_VERSION_MICRO 100
1732 
1733 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
1734                                                LIBAVCODEC_VERSION_MINOR, \
1735                                                LIBAVCODEC_VERSION_MICRO)
1736 #define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
1737                                            LIBAVCODEC_VERSION_MINOR,    \
1738                                            LIBAVCODEC_VERSION_MICRO)
1739 #define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
1740 
1741 #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
1742 
1743 #define FF_API_VIMA_DECODER     (LIBAVCODEC_VERSION_MAJOR < 58)
1744 #define FF_API_AUDIO_CONVERT     (LIBAVCODEC_VERSION_MAJOR < 58)
1745 #define FF_API_AVCODEC_RESAMPLE  FF_API_AUDIO_CONVERT
1746 #define FF_API_MISSING_SAMPLE    (LIBAVCODEC_VERSION_MAJOR < 58)
1747 #define FF_API_LOWRES            (LIBAVCODEC_VERSION_MAJOR < 58)
1748 #define FF_API_CAP_VDPAU         (LIBAVCODEC_VERSION_MAJOR < 58)
1749 #define FF_API_BUFS_VDPAU        (LIBAVCODEC_VERSION_MAJOR < 58)
1750 #define FF_API_VOXWARE           (LIBAVCODEC_VERSION_MAJOR < 58)
1751 #define FF_API_SET_DIMENSIONS    (LIBAVCODEC_VERSION_MAJOR < 58)
1752 #define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 58)
1753 #define FF_API_AC_VLC            (LIBAVCODEC_VERSION_MAJOR < 58)
1754 #define FF_API_OLD_MSMPEG4       (LIBAVCODEC_VERSION_MAJOR < 58)
1755 #define FF_API_ASPECT_EXTENDED   (LIBAVCODEC_VERSION_MAJOR < 58)
1756 #define FF_API_ARCH_ALPHA        (LIBAVCODEC_VERSION_MAJOR < 58)
1757 #define FF_API_ERROR_RATE        (LIBAVCODEC_VERSION_MAJOR < 58)
1758 #define FF_API_QSCALE_TYPE       (LIBAVCODEC_VERSION_MAJOR < 58)
1759 #define FF_API_MB_TYPE           (LIBAVCODEC_VERSION_MAJOR < 58)
1760 #define FF_API_MAX_BFRAMES       (LIBAVCODEC_VERSION_MAJOR < 58)
1761 #define FF_API_NEG_LINESIZES     (LIBAVCODEC_VERSION_MAJOR < 58)
1762 #define FF_API_EMU_EDGE          (LIBAVCODEC_VERSION_MAJOR < 58)
1763 #define FF_API_ARCH_SH4          (LIBAVCODEC_VERSION_MAJOR < 58)
1764 #define FF_API_ARCH_SPARC        (LIBAVCODEC_VERSION_MAJOR < 58)
1765 #define FF_API_UNUSED_MEMBERS    (LIBAVCODEC_VERSION_MAJOR < 58)
1766 #define FF_API_IDCT_XVIDMMX      (LIBAVCODEC_VERSION_MAJOR < 58)
1767 #define FF_API_INPUT_PRESERVED   (LIBAVCODEC_VERSION_MAJOR < 58)
1768 #define FF_API_NORMALIZE_AQP     (LIBAVCODEC_VERSION_MAJOR < 58)
1769 #define FF_API_GMC               (LIBAVCODEC_VERSION_MAJOR < 58)
1770 #define FF_API_MV0               (LIBAVCODEC_VERSION_MAJOR < 58)
1771 #define FF_API_CODEC_NAME        (LIBAVCODEC_VERSION_MAJOR < 58)
1772 #define FF_API_AFD               (LIBAVCODEC_VERSION_MAJOR < 58)
1773 
1774 #define FF_API_VISMV             (LIBAVCODEC_VERSION_MAJOR < 58)
1775 #define FF_API_AUDIOENC_DELAY    (LIBAVCODEC_VERSION_MAJOR < 58)
1776 #define FF_API_VAAPI_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 58)
1777 #define FF_API_MERGE_SD          (LIBAVCODEC_VERSION_MAJOR < 58)
1778 #define FF_API_AVCTX_TIMEBASE    (LIBAVCODEC_VERSION_MAJOR < 59)
1779 #define FF_API_MPV_OPT           (LIBAVCODEC_VERSION_MAJOR < 59)
1780 #define FF_API_STREAM_CODEC_TAG  (LIBAVCODEC_VERSION_MAJOR < 59)
1781 #define FF_API_QUANT_BIAS        (LIBAVCODEC_VERSION_MAJOR < 59)
1782 #define FF_API_RC_STRATEGY       (LIBAVCODEC_VERSION_MAJOR < 59)
1783 #define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
1784 #define FF_API_MOTION_EST        (LIBAVCODEC_VERSION_MAJOR < 59)
1785 #define FF_API_WITHOUT_PREFIX    (LIBAVCODEC_VERSION_MAJOR < 59)
1786 #define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
1787 #define FF_API_VDPAU_PROFILE     (LIBAVCODEC_VERSION_MAJOR < 59)
1788 #define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
1789 #define FF_API_AVPICTURE         (LIBAVCODEC_VERSION_MAJOR < 59)
1790 #define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
1791 #define FF_API_RTP_CALLBACK      (LIBAVCODEC_VERSION_MAJOR < 59)
1792 #define FF_API_VBV_DELAY         (LIBAVCODEC_VERSION_MAJOR < 59)
1793 #define FF_API_CODER_TYPE        (LIBAVCODEC_VERSION_MAJOR < 59)
1794 #define FF_API_STAT_BITS         (LIBAVCODEC_VERSION_MAJOR < 59)
1795 #define FF_API_PRIVATE_OPT      (LIBAVCODEC_VERSION_MAJOR < 59)
1796 #define FF_API_ASS_TIMING       (LIBAVCODEC_VERSION_MAJOR < 59)
1797 #define FF_API_OLD_BSF          (LIBAVCODEC_VERSION_MAJOR < 59)
1798 #define FF_API_COPY_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 59)
1799 #define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
1800 #define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
1801 #define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
1802 #define FF_API_MERGE_SD_API      (LIBAVCODEC_VERSION_MAJOR < 59)
1803 #define FF_API_TAG_STRING        (LIBAVCODEC_VERSION_MAJOR < 59)
1804 #define FF_API_GETCHROMA         (LIBAVCODEC_VERSION_MAJOR < 59)
1805 
1806 enum AVCodecID {
1807     AV_CODEC_ID_NONE,
1808 
1809     AV_CODEC_ID_MPEG1VIDEO,
1810     AV_CODEC_ID_MPEG2VIDEO,
1811     AV_CODEC_ID_MPEG2VIDEO_XVMC,
1812     AV_CODEC_ID_H261,
1813     AV_CODEC_ID_H263,
1814     AV_CODEC_ID_RV10,
1815     AV_CODEC_ID_RV20,
1816     AV_CODEC_ID_MJPEG,
1817     AV_CODEC_ID_MJPEGB,
1818     AV_CODEC_ID_LJPEG,
1819     AV_CODEC_ID_SP5X,
1820     AV_CODEC_ID_JPEGLS,
1821     AV_CODEC_ID_MPEG4,
1822     AV_CODEC_ID_RAWVIDEO,
1823     AV_CODEC_ID_MSMPEG4V1,
1824     AV_CODEC_ID_MSMPEG4V2,
1825     AV_CODEC_ID_MSMPEG4V3,
1826     AV_CODEC_ID_WMV1,
1827     AV_CODEC_ID_WMV2,
1828     AV_CODEC_ID_H263P,
1829     AV_CODEC_ID_H263I,
1830     AV_CODEC_ID_FLV1,
1831     AV_CODEC_ID_SVQ1,
1832     AV_CODEC_ID_SVQ3,
1833     AV_CODEC_ID_DVVIDEO,
1834     AV_CODEC_ID_HUFFYUV,
1835     AV_CODEC_ID_CYUV,
1836     AV_CODEC_ID_H264,
1837     AV_CODEC_ID_INDEO3,
1838     AV_CODEC_ID_VP3,
1839     AV_CODEC_ID_THEORA,
1840     AV_CODEC_ID_ASV1,
1841     AV_CODEC_ID_ASV2,
1842     AV_CODEC_ID_FFV1,
1843     AV_CODEC_ID_4XM,
1844     AV_CODEC_ID_VCR1,
1845     AV_CODEC_ID_CLJR,
1846     AV_CODEC_ID_MDEC,
1847     AV_CODEC_ID_ROQ,
1848     AV_CODEC_ID_INTERPLAY_VIDEO,
1849     AV_CODEC_ID_XAN_WC3,
1850     AV_CODEC_ID_XAN_WC4,
1851     AV_CODEC_ID_RPZA,
1852     AV_CODEC_ID_CINEPAK,
1853     AV_CODEC_ID_WS_VQA,
1854     AV_CODEC_ID_MSRLE,
1855     AV_CODEC_ID_MSVIDEO1,
1856     AV_CODEC_ID_IDCIN,
1857     AV_CODEC_ID_8BPS,
1858     AV_CODEC_ID_SMC,
1859     AV_CODEC_ID_FLIC,
1860     AV_CODEC_ID_TRUEMOTION1,
1861     AV_CODEC_ID_VMDVIDEO,
1862     AV_CODEC_ID_MSZH,
1863     AV_CODEC_ID_ZLIB,
1864     AV_CODEC_ID_QTRLE,
1865     AV_CODEC_ID_TSCC,
1866     AV_CODEC_ID_ULTI,
1867     AV_CODEC_ID_QDRAW,
1868     AV_CODEC_ID_VIXL,
1869     AV_CODEC_ID_QPEG,
1870     AV_CODEC_ID_PNG,
1871     AV_CODEC_ID_PPM,
1872     AV_CODEC_ID_PBM,
1873     AV_CODEC_ID_PGM,
1874     AV_CODEC_ID_PGMYUV,
1875     AV_CODEC_ID_PAM,
1876     AV_CODEC_ID_FFVHUFF,
1877     AV_CODEC_ID_RV30,
1878     AV_CODEC_ID_RV40,
1879     AV_CODEC_ID_VC1,
1880     AV_CODEC_ID_WMV3,
1881     AV_CODEC_ID_LOCO,
1882     AV_CODEC_ID_WNV1,
1883     AV_CODEC_ID_AASC,
1884     AV_CODEC_ID_INDEO2,
1885     AV_CODEC_ID_FRAPS,
1886     AV_CODEC_ID_TRUEMOTION2,
1887     AV_CODEC_ID_BMP,
1888     AV_CODEC_ID_CSCD,
1889     AV_CODEC_ID_MMVIDEO,
1890     AV_CODEC_ID_ZMBV,
1891     AV_CODEC_ID_AVS,
1892     AV_CODEC_ID_SMACKVIDEO,
1893     AV_CODEC_ID_NUV,
1894     AV_CODEC_ID_KMVC,
1895     AV_CODEC_ID_FLASHSV,
1896     AV_CODEC_ID_CAVS,
1897     AV_CODEC_ID_JPEG2000,
1898     AV_CODEC_ID_VMNC,
1899     AV_CODEC_ID_VP5,
1900     AV_CODEC_ID_VP6,
1901     AV_CODEC_ID_VP6F,
1902     AV_CODEC_ID_TARGA,
1903     AV_CODEC_ID_DSICINVIDEO,
1904     AV_CODEC_ID_TIERTEXSEQVIDEO,
1905     AV_CODEC_ID_TIFF,
1906     AV_CODEC_ID_GIF,
1907     AV_CODEC_ID_DXA,
1908     AV_CODEC_ID_DNXHD,
1909     AV_CODEC_ID_THP,
1910     AV_CODEC_ID_SGI,
1911     AV_CODEC_ID_C93,
1912     AV_CODEC_ID_BETHSOFTVID,
1913     AV_CODEC_ID_PTX,
1914     AV_CODEC_ID_TXD,
1915     AV_CODEC_ID_VP6A,
1916     AV_CODEC_ID_AMV,
1917     AV_CODEC_ID_VB,
1918     AV_CODEC_ID_PCX,
1919     AV_CODEC_ID_SUNRAST,
1920     AV_CODEC_ID_INDEO4,
1921     AV_CODEC_ID_INDEO5,
1922     AV_CODEC_ID_MIMIC,
1923     AV_CODEC_ID_RL2,
1924     AV_CODEC_ID_ESCAPE124,
1925     AV_CODEC_ID_DIRAC,
1926     AV_CODEC_ID_BFI,
1927     AV_CODEC_ID_CMV,
1928     AV_CODEC_ID_MOTIONPIXELS,
1929     AV_CODEC_ID_TGV,
1930     AV_CODEC_ID_TGQ,
1931     AV_CODEC_ID_TQI,
1932     AV_CODEC_ID_AURA,
1933     AV_CODEC_ID_AURA2,
1934     AV_CODEC_ID_V210X,
1935     AV_CODEC_ID_TMV,
1936     AV_CODEC_ID_V210,
1937     AV_CODEC_ID_DPX,
1938     AV_CODEC_ID_MAD,
1939     AV_CODEC_ID_FRWU,
1940     AV_CODEC_ID_FLASHSV2,
1941     AV_CODEC_ID_CDGRAPHICS,
1942     AV_CODEC_ID_R210,
1943     AV_CODEC_ID_ANM,
1944     AV_CODEC_ID_BINKVIDEO,
1945     AV_CODEC_ID_IFF_ILBM,
1946 #define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1947     AV_CODEC_ID_KGV1,
1948     AV_CODEC_ID_YOP,
1949     AV_CODEC_ID_VP8,
1950     AV_CODEC_ID_PICTOR,
1951     AV_CODEC_ID_ANSI,
1952     AV_CODEC_ID_A64_MULTI,
1953     AV_CODEC_ID_A64_MULTI5,
1954     AV_CODEC_ID_R10K,
1955     AV_CODEC_ID_MXPEG,
1956     AV_CODEC_ID_LAGARITH,
1957     AV_CODEC_ID_PRORES,
1958     AV_CODEC_ID_JV,
1959     AV_CODEC_ID_DFA,
1960     AV_CODEC_ID_WMV3IMAGE,
1961     AV_CODEC_ID_VC1IMAGE,
1962     AV_CODEC_ID_UTVIDEO,
1963     AV_CODEC_ID_BMV_VIDEO,
1964     AV_CODEC_ID_VBLE,
1965     AV_CODEC_ID_DXTORY,
1966     AV_CODEC_ID_V410,
1967     AV_CODEC_ID_XWD,
1968     AV_CODEC_ID_CDXL,
1969     AV_CODEC_ID_XBM,
1970     AV_CODEC_ID_ZEROCODEC,
1971     AV_CODEC_ID_MSS1,
1972     AV_CODEC_ID_MSA1,
1973     AV_CODEC_ID_TSCC2,
1974     AV_CODEC_ID_MTS2,
1975     AV_CODEC_ID_CLLC,
1976     AV_CODEC_ID_MSS2,
1977     AV_CODEC_ID_VP9,
1978     AV_CODEC_ID_AIC,
1979     AV_CODEC_ID_ESCAPE130,
1980     AV_CODEC_ID_G2M,
1981     AV_CODEC_ID_WEBP,
1982     AV_CODEC_ID_HNM4_VIDEO,
1983     AV_CODEC_ID_HEVC,
1984 #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1985     AV_CODEC_ID_FIC,
1986     AV_CODEC_ID_ALIAS_PIX,
1987     AV_CODEC_ID_BRENDER_PIX,
1988     AV_CODEC_ID_PAF_VIDEO,
1989     AV_CODEC_ID_EXR,
1990     AV_CODEC_ID_VP7,
1991     AV_CODEC_ID_SANM,
1992     AV_CODEC_ID_SGIRLE,
1993     AV_CODEC_ID_MVC1,
1994     AV_CODEC_ID_MVC2,
1995     AV_CODEC_ID_HQX,
1996     AV_CODEC_ID_TDSC,
1997     AV_CODEC_ID_HQ_HQA,
1998     AV_CODEC_ID_HAP,
1999     AV_CODEC_ID_DDS,
2000     AV_CODEC_ID_DXV,
2001     AV_CODEC_ID_SCREENPRESSO,
2002     AV_CODEC_ID_RSCC,
2003 
2004     AV_CODEC_ID_Y41P = 0x8000,
2005     AV_CODEC_ID_AVRP,
2006     AV_CODEC_ID_012V,
2007     AV_CODEC_ID_AVUI,
2008     AV_CODEC_ID_AYUV,
2009     AV_CODEC_ID_TARGA_Y216,
2010     AV_CODEC_ID_V308,
2011     AV_CODEC_ID_V408,
2012     AV_CODEC_ID_YUV4,
2013     AV_CODEC_ID_AVRN,
2014     AV_CODEC_ID_CPIA,
2015     AV_CODEC_ID_XFACE,
2016     AV_CODEC_ID_SNOW,
2017     AV_CODEC_ID_SMVJPEG,
2018     AV_CODEC_ID_APNG,
2019     AV_CODEC_ID_DAALA,
2020     AV_CODEC_ID_CFHD,
2021     AV_CODEC_ID_TRUEMOTION2RT,
2022     AV_CODEC_ID_M101,
2023     AV_CODEC_ID_MAGICYUV,
2024     AV_CODEC_ID_SHEERVIDEO,
2025     AV_CODEC_ID_YLC,
2026     AV_CODEC_ID_PSD,
2027     AV_CODEC_ID_PIXLET,
2028     AV_CODEC_ID_SPEEDHQ,
2029     AV_CODEC_ID_FMVC,
2030     AV_CODEC_ID_SCPR,
2031     AV_CODEC_ID_CLEARVIDEO,
2032     AV_CODEC_ID_XPM,
2033     AV_CODEC_ID_AV1,
2034     AV_CODEC_ID_BITPACKED,
2035     AV_CODEC_ID_MSCC,
2036     AV_CODEC_ID_SRGC,
2037     AV_CODEC_ID_SVG,
2038     AV_CODEC_ID_GDV,
2039     AV_CODEC_ID_FITS,
2040 
2041     AV_CODEC_ID_FIRST_AUDIO = 0x10000,
2042     AV_CODEC_ID_PCM_S16LE = 0x10000,
2043     AV_CODEC_ID_PCM_S16BE,
2044     AV_CODEC_ID_PCM_U16LE,
2045     AV_CODEC_ID_PCM_U16BE,
2046     AV_CODEC_ID_PCM_S8,
2047     AV_CODEC_ID_PCM_U8,
2048     AV_CODEC_ID_PCM_MULAW,
2049     AV_CODEC_ID_PCM_ALAW,
2050     AV_CODEC_ID_PCM_S32LE,
2051     AV_CODEC_ID_PCM_S32BE,
2052     AV_CODEC_ID_PCM_U32LE,
2053     AV_CODEC_ID_PCM_U32BE,
2054     AV_CODEC_ID_PCM_S24LE,
2055     AV_CODEC_ID_PCM_S24BE,
2056     AV_CODEC_ID_PCM_U24LE,
2057     AV_CODEC_ID_PCM_U24BE,
2058     AV_CODEC_ID_PCM_S24DAUD,
2059     AV_CODEC_ID_PCM_ZORK,
2060     AV_CODEC_ID_PCM_S16LE_PLANAR,
2061     AV_CODEC_ID_PCM_DVD,
2062     AV_CODEC_ID_PCM_F32BE,
2063     AV_CODEC_ID_PCM_F32LE,
2064     AV_CODEC_ID_PCM_F64BE,
2065     AV_CODEC_ID_PCM_F64LE,
2066     AV_CODEC_ID_PCM_BLURAY,
2067     AV_CODEC_ID_PCM_LXF,
2068     AV_CODEC_ID_S302M,
2069     AV_CODEC_ID_PCM_S8_PLANAR,
2070     AV_CODEC_ID_PCM_S24LE_PLANAR,
2071     AV_CODEC_ID_PCM_S32LE_PLANAR,
2072     AV_CODEC_ID_PCM_S16BE_PLANAR,
2073 
2074     AV_CODEC_ID_PCM_S64LE = 0x10800,
2075     AV_CODEC_ID_PCM_S64BE,
2076     AV_CODEC_ID_PCM_F16LE,
2077     AV_CODEC_ID_PCM_F24LE,
2078 
2079     AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
2080     AV_CODEC_ID_ADPCM_IMA_WAV,
2081     AV_CODEC_ID_ADPCM_IMA_DK3,
2082     AV_CODEC_ID_ADPCM_IMA_DK4,
2083     AV_CODEC_ID_ADPCM_IMA_WS,
2084     AV_CODEC_ID_ADPCM_IMA_SMJPEG,
2085     AV_CODEC_ID_ADPCM_MS,
2086     AV_CODEC_ID_ADPCM_4XM,
2087     AV_CODEC_ID_ADPCM_XA,
2088     AV_CODEC_ID_ADPCM_ADX,
2089     AV_CODEC_ID_ADPCM_EA,
2090     AV_CODEC_ID_ADPCM_G726,
2091     AV_CODEC_ID_ADPCM_CT,
2092     AV_CODEC_ID_ADPCM_SWF,
2093     AV_CODEC_ID_ADPCM_YAMAHA,
2094     AV_CODEC_ID_ADPCM_SBPRO_4,
2095     AV_CODEC_ID_ADPCM_SBPRO_3,
2096     AV_CODEC_ID_ADPCM_SBPRO_2,
2097     AV_CODEC_ID_ADPCM_THP,
2098     AV_CODEC_ID_ADPCM_IMA_AMV,
2099     AV_CODEC_ID_ADPCM_EA_R1,
2100     AV_CODEC_ID_ADPCM_EA_R3,
2101     AV_CODEC_ID_ADPCM_EA_R2,
2102     AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
2103     AV_CODEC_ID_ADPCM_IMA_EA_EACS,
2104     AV_CODEC_ID_ADPCM_EA_XAS,
2105     AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
2106     AV_CODEC_ID_ADPCM_IMA_ISS,
2107     AV_CODEC_ID_ADPCM_G722,
2108     AV_CODEC_ID_ADPCM_IMA_APC,
2109     AV_CODEC_ID_ADPCM_VIMA,
2110     AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA,
2111 
2112     AV_CODEC_ID_ADPCM_AFC = 0x11800,
2113     AV_CODEC_ID_ADPCM_IMA_OKI,
2114     AV_CODEC_ID_ADPCM_DTK,
2115     AV_CODEC_ID_ADPCM_IMA_RAD,
2116     AV_CODEC_ID_ADPCM_G726LE,
2117     AV_CODEC_ID_ADPCM_THP_LE,
2118     AV_CODEC_ID_ADPCM_PSX,
2119     AV_CODEC_ID_ADPCM_AICA,
2120     AV_CODEC_ID_ADPCM_IMA_DAT4,
2121     AV_CODEC_ID_ADPCM_MTAF,
2122 
2123     AV_CODEC_ID_AMR_NB = 0x12000,
2124     AV_CODEC_ID_AMR_WB,
2125 
2126     AV_CODEC_ID_RA_144 = 0x13000,
2127     AV_CODEC_ID_RA_288,
2128 
2129     AV_CODEC_ID_ROQ_DPCM = 0x14000,
2130     AV_CODEC_ID_INTERPLAY_DPCM,
2131     AV_CODEC_ID_XAN_DPCM,
2132     AV_CODEC_ID_SOL_DPCM,
2133 
2134     AV_CODEC_ID_SDX2_DPCM = 0x14800,
2135     AV_CODEC_ID_GREMLIN_DPCM,
2136 
2137     AV_CODEC_ID_MP2 = 0x15000,
2138     AV_CODEC_ID_MP3,
2139     AV_CODEC_ID_AAC,
2140     AV_CODEC_ID_AC3,
2141     AV_CODEC_ID_DTS,
2142     AV_CODEC_ID_VORBIS,
2143     AV_CODEC_ID_DVAUDIO,
2144     AV_CODEC_ID_WMAV1,
2145     AV_CODEC_ID_WMAV2,
2146     AV_CODEC_ID_MACE3,
2147     AV_CODEC_ID_MACE6,
2148     AV_CODEC_ID_VMDAUDIO,
2149     AV_CODEC_ID_FLAC,
2150     AV_CODEC_ID_MP3ADU,
2151     AV_CODEC_ID_MP3ON4,
2152     AV_CODEC_ID_SHORTEN,
2153     AV_CODEC_ID_ALAC,
2154     AV_CODEC_ID_WESTWOOD_SND1,
2155     AV_CODEC_ID_GSM,
2156     AV_CODEC_ID_QDM2,
2157     AV_CODEC_ID_COOK,
2158     AV_CODEC_ID_TRUESPEECH,
2159     AV_CODEC_ID_TTA,
2160     AV_CODEC_ID_SMACKAUDIO,
2161     AV_CODEC_ID_QCELP,
2162     AV_CODEC_ID_WAVPACK,
2163     AV_CODEC_ID_DSICINAUDIO,
2164     AV_CODEC_ID_IMC,
2165     AV_CODEC_ID_MUSEPACK7,
2166     AV_CODEC_ID_MLP,
2167     AV_CODEC_ID_GSM_MS,
2168     AV_CODEC_ID_ATRAC3,
2169     AV_CODEC_ID_VOXWARE,
2170     AV_CODEC_ID_APE,
2171     AV_CODEC_ID_NELLYMOSER,
2172     AV_CODEC_ID_MUSEPACK8,
2173     AV_CODEC_ID_SPEEX,
2174     AV_CODEC_ID_WMAVOICE,
2175     AV_CODEC_ID_WMAPRO,
2176     AV_CODEC_ID_WMALOSSLESS,
2177     AV_CODEC_ID_ATRAC3P,
2178     AV_CODEC_ID_EAC3,
2179     AV_CODEC_ID_SIPR,
2180     AV_CODEC_ID_MP1,
2181     AV_CODEC_ID_TWINVQ,
2182     AV_CODEC_ID_TRUEHD,
2183     AV_CODEC_ID_MP4ALS,
2184     AV_CODEC_ID_ATRAC1,
2185     AV_CODEC_ID_BINKAUDIO_RDFT,
2186     AV_CODEC_ID_BINKAUDIO_DCT,
2187     AV_CODEC_ID_AAC_LATM,
2188     AV_CODEC_ID_QDMC,
2189     AV_CODEC_ID_CELT,
2190     AV_CODEC_ID_G723_1,
2191     AV_CODEC_ID_G729,
2192     AV_CODEC_ID_8SVX_EXP,
2193     AV_CODEC_ID_8SVX_FIB,
2194     AV_CODEC_ID_BMV_AUDIO,
2195     AV_CODEC_ID_RALF,
2196     AV_CODEC_ID_IAC,
2197     AV_CODEC_ID_ILBC,
2198     AV_CODEC_ID_OPUS,
2199     AV_CODEC_ID_COMFORT_NOISE,
2200     AV_CODEC_ID_TAK,
2201     AV_CODEC_ID_METASOUND,
2202     AV_CODEC_ID_PAF_AUDIO,
2203     AV_CODEC_ID_ON2AVC,
2204     AV_CODEC_ID_DSS_SP,
2205 
2206     AV_CODEC_ID_FFWAVESYNTH = 0x15800,
2207     AV_CODEC_ID_SONIC,
2208     AV_CODEC_ID_SONIC_LS,
2209     AV_CODEC_ID_EVRC,
2210     AV_CODEC_ID_SMV,
2211     AV_CODEC_ID_DSD_LSBF,
2212     AV_CODEC_ID_DSD_MSBF,
2213     AV_CODEC_ID_DSD_LSBF_PLANAR,
2214     AV_CODEC_ID_DSD_MSBF_PLANAR,
2215     AV_CODEC_ID_4GV,
2216     AV_CODEC_ID_INTERPLAY_ACM,
2217     AV_CODEC_ID_XMA1,
2218     AV_CODEC_ID_XMA2,
2219     AV_CODEC_ID_DST,
2220     AV_CODEC_ID_ATRAC3AL,
2221     AV_CODEC_ID_ATRAC3PAL,
2222     AV_CODEC_ID_DOLBY_E,
2223 
2224     AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,
2225     AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
2226     AV_CODEC_ID_DVB_SUBTITLE,
2227     AV_CODEC_ID_TEXT,
2228     AV_CODEC_ID_XSUB,
2229     AV_CODEC_ID_SSA,
2230     AV_CODEC_ID_MOV_TEXT,
2231     AV_CODEC_ID_HDMV_PGS_SUBTITLE,
2232     AV_CODEC_ID_DVB_TELETEXT,
2233     AV_CODEC_ID_SRT,
2234 
2235     AV_CODEC_ID_MICRODVD   = 0x17800,
2236     AV_CODEC_ID_EIA_608,
2237     AV_CODEC_ID_JACOSUB,
2238     AV_CODEC_ID_SAMI,
2239     AV_CODEC_ID_REALTEXT,
2240     AV_CODEC_ID_STL,
2241     AV_CODEC_ID_SUBVIEWER1,
2242     AV_CODEC_ID_SUBVIEWER,
2243     AV_CODEC_ID_SUBRIP,
2244     AV_CODEC_ID_WEBVTT,
2245     AV_CODEC_ID_MPL2,
2246     AV_CODEC_ID_VPLAYER,
2247     AV_CODEC_ID_PJS,
2248     AV_CODEC_ID_ASS,
2249     AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
2250 
2251     AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,
2252     AV_CODEC_ID_TTF = 0x18000,
2253 
2254     AV_CODEC_ID_SCTE_35,
2255     AV_CODEC_ID_BINTEXT    = 0x18800,
2256     AV_CODEC_ID_XBIN,
2257     AV_CODEC_ID_IDF,
2258     AV_CODEC_ID_OTF,
2259     AV_CODEC_ID_SMPTE_KLV,
2260     AV_CODEC_ID_DVD_NAV,
2261     AV_CODEC_ID_TIMED_ID3,
2262     AV_CODEC_ID_BIN_DATA,
2263 
2264     AV_CODEC_ID_PROBE = 0x19000,
2265 
2266     AV_CODEC_ID_MPEG2TS = 0x20000,
2267 
2268     AV_CODEC_ID_MPEG4SYSTEMS = 0x20001,
2269 
2270     AV_CODEC_ID_FFMETADATA = 0x21000,
2271     AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001,
2272 };
2273 
2274 typedef struct AVCodecDescriptor {
2275     enum AVCodecID     id;
2276     enum AVMediaType type;
2277 
2278     const char      *name;
2279 
2280     const char *long_name;
2281 
2282     int             props;
2283 
2284     const char *const *mime_types;
2285 
2286     const struct AVProfile *profiles;
2287 } AVCodecDescriptor;
2288 
2289 #define AV_CODEC_PROP_INTRA_ONLY    (1 << 0)
2290 
2291 #define AV_CODEC_PROP_LOSSY         (1 << 1)
2292 
2293 #define AV_CODEC_PROP_LOSSLESS      (1 << 2)
2294 
2295 #define AV_CODEC_PROP_REORDER       (1 << 3)
2296 
2297 #define AV_CODEC_PROP_BITMAP_SUB    (1 << 16)
2298 
2299 #define AV_CODEC_PROP_TEXT_SUB      (1 << 17)
2300 
2301 #define AV_INPUT_BUFFER_PADDING_SIZE 32
2302 
2303 #define AV_INPUT_BUFFER_MIN_SIZE 16384
2304 
2305 #define FF_INPUT_BUFFER_PADDING_SIZE 32
2306 
2307 #define FF_MIN_BUFFER_SIZE 16384
2308 
2309 enum Motion_Est_ID {
2310     ME_ZERO = 1,
2311     ME_FULL,
2312     ME_LOG,
2313     ME_PHODS,
2314     ME_EPZS,
2315     ME_X1,
2316     ME_HEX,
2317     ME_UMH,
2318     ME_TESA,
2319     ME_ITER=50,
2320 };
2321 
2322 enum AVDiscard{
2323 
2324     AVDISCARD_NONE    =-16,
2325     AVDISCARD_DEFAULT =  0,
2326     AVDISCARD_NONREF  =  8,
2327     AVDISCARD_BIDIR   = 16,
2328     AVDISCARD_NONINTRA= 24,
2329     AVDISCARD_NONKEY  = 32,
2330     AVDISCARD_ALL     = 48,
2331 };
2332 
2333 enum AVAudioServiceType {
2334     AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
2335     AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
2336     AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
2337     AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
2338     AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
2339     AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
2340     AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
2341     AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
2342     AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
2343     AV_AUDIO_SERVICE_TYPE_NB                   ,
2344 };
2345 
2346 typedef struct RcOverride{
2347     int start_frame;
2348     int end_frame;
2349     int qscale;
2350     float quality_factor;
2351 } RcOverride;
2352 
2353 #define FF_MAX_B_FRAMES 16
2354 
2355 #define AV_CODEC_FLAG_UNALIGNED       (1 <<  0)
2356 
2357 #define AV_CODEC_FLAG_QSCALE          (1 <<  1)
2358 
2359 #define AV_CODEC_FLAG_4MV             (1 <<  2)
2360 
2361 #define AV_CODEC_FLAG_OUTPUT_CORRUPT  (1 <<  3)
2362 
2363 #define AV_CODEC_FLAG_QPEL            (1 <<  4)
2364 
2365 #define AV_CODEC_FLAG_PASS1           (1 <<  9)
2366 
2367 #define AV_CODEC_FLAG_PASS2           (1 << 10)
2368 
2369 #define AV_CODEC_FLAG_LOOP_FILTER     (1 << 11)
2370 
2371 #define AV_CODEC_FLAG_GRAY            (1 << 13)
2372 
2373 #define AV_CODEC_FLAG_PSNR            (1 << 15)
2374 
2375 #define AV_CODEC_FLAG_TRUNCATED       (1 << 16)
2376 
2377 #define AV_CODEC_FLAG_INTERLACED_DCT  (1 << 18)
2378 
2379 #define AV_CODEC_FLAG_LOW_DELAY       (1 << 19)
2380 
2381 #define AV_CODEC_FLAG_GLOBAL_HEADER   (1 << 22)
2382 
2383 #define AV_CODEC_FLAG_BITEXACT        (1 << 23)
2384 
2385 #define AV_CODEC_FLAG_AC_PRED         (1 << 24)
2386 
2387 #define AV_CODEC_FLAG_INTERLACED_ME   (1 << 29)
2388 #define AV_CODEC_FLAG_CLOSED_GOP      (1U << 31)
2389 
2390 #define AV_CODEC_FLAG2_FAST           (1 <<  0)
2391 
2392 #define AV_CODEC_FLAG2_NO_OUTPUT      (1 <<  2)
2393 
2394 #define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
2395 
2396 #define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
2397 
2398 #define AV_CODEC_FLAG2_CHUNKS         (1 << 15)
2399 
2400 #define AV_CODEC_FLAG2_IGNORE_CROP    (1 << 16)
2401 
2402 #define AV_CODEC_FLAG2_SHOW_ALL       (1 << 22)
2403 
2404 #define AV_CODEC_FLAG2_EXPORT_MVS     (1 << 28)
2405 
2406 #define AV_CODEC_FLAG2_SKIP_MANUAL    (1 << 29)
2407 
2408 #define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
2409 
2410 #define AV_CODEC_CAP_DRAW_HORIZ_BAND     (1 <<  0)
2411 
2412 #define AV_CODEC_CAP_DR1                 (1 <<  1)
2413 #define AV_CODEC_CAP_TRUNCATED           (1 <<  3)
2414 
2415 #define AV_CODEC_CAP_DELAY               (1 <<  5)
2416 
2417 #define AV_CODEC_CAP_SMALL_LAST_FRAME    (1 <<  6)
2418 
2419 #define AV_CODEC_CAP_HWACCEL_VDPAU       (1 <<  7)
2420 
2421 #define AV_CODEC_CAP_SUBFRAMES           (1 <<  8)
2422 
2423 #define AV_CODEC_CAP_EXPERIMENTAL        (1 <<  9)
2424 
2425 #define AV_CODEC_CAP_CHANNEL_CONF        (1 << 10)
2426 
2427 #define AV_CODEC_CAP_FRAME_THREADS       (1 << 12)
2428 
2429 #define AV_CODEC_CAP_SLICE_THREADS       (1 << 13)
2430 
2431 #define AV_CODEC_CAP_PARAM_CHANGE        (1 << 14)
2432 
2433 #define AV_CODEC_CAP_AUTO_THREADS        (1 << 15)
2434 
2435 #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
2436 
2437 #define AV_CODEC_CAP_AVOID_PROBING       (1 << 17)
2438 
2439 #define AV_CODEC_CAP_INTRA_ONLY       0x40000000
2440 
2441 #define AV_CODEC_CAP_LOSSLESS         0x80000000
2442 
2443 #define CODEC_FLAG_UNALIGNED AV_CODEC_FLAG_UNALIGNED
2444 #define CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE
2445 #define CODEC_FLAG_4MV    AV_CODEC_FLAG_4MV
2446 #define CODEC_FLAG_OUTPUT_CORRUPT AV_CODEC_FLAG_OUTPUT_CORRUPT
2447 #define CODEC_FLAG_QPEL   AV_CODEC_FLAG_QPEL
2448 
2449 #define CODEC_FLAG_GMC    0x0020
2450 
2451 #define CODEC_FLAG_MV0    0x0040
2452 
2453 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
2454 #define CODEC_FLAG_PASS1           AV_CODEC_FLAG_PASS1
2455 #define CODEC_FLAG_PASS2           AV_CODEC_FLAG_PASS2
2456 #define CODEC_FLAG_GRAY            AV_CODEC_FLAG_GRAY
2457 
2458 #define CODEC_FLAG_EMU_EDGE        0x4000
2459 #define CODEC_FLAG_PSNR            AV_CODEC_FLAG_PSNR
2460 #define CODEC_FLAG_TRUNCATED       AV_CODEC_FLAG_TRUNCATED
2461 
2462 #define CODEC_FLAG_NORMALIZE_AQP  0x00020000
2463 #define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT
2464 #define CODEC_FLAG_LOW_DELAY      AV_CODEC_FLAG_LOW_DELAY
2465 #define CODEC_FLAG_GLOBAL_HEADER  AV_CODEC_FLAG_GLOBAL_HEADER
2466 #define CODEC_FLAG_BITEXACT       AV_CODEC_FLAG_BITEXACT
2467 #define CODEC_FLAG_AC_PRED        AV_CODEC_FLAG_AC_PRED
2468 #define CODEC_FLAG_LOOP_FILTER    AV_CODEC_FLAG_LOOP_FILTER
2469 #define CODEC_FLAG_INTERLACED_ME  AV_CODEC_FLAG_INTERLACED_ME
2470 #define CODEC_FLAG_CLOSED_GOP     AV_CODEC_FLAG_CLOSED_GOP
2471 #define CODEC_FLAG2_FAST          AV_CODEC_FLAG2_FAST
2472 #define CODEC_FLAG2_NO_OUTPUT     AV_CODEC_FLAG2_NO_OUTPUT
2473 #define CODEC_FLAG2_LOCAL_HEADER  AV_CODEC_FLAG2_LOCAL_HEADER
2474 #define CODEC_FLAG2_DROP_FRAME_TIMECODE AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
2475 #define CODEC_FLAG2_IGNORE_CROP   AV_CODEC_FLAG2_IGNORE_CROP
2476 
2477 #define CODEC_FLAG2_CHUNKS        AV_CODEC_FLAG2_CHUNKS
2478 #define CODEC_FLAG2_SHOW_ALL      AV_CODEC_FLAG2_SHOW_ALL
2479 #define CODEC_FLAG2_EXPORT_MVS    AV_CODEC_FLAG2_EXPORT_MVS
2480 #define CODEC_FLAG2_SKIP_MANUAL   AV_CODEC_FLAG2_SKIP_MANUAL
2481 
2482 #define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND
2483 
2484 #define CODEC_CAP_DR1             AV_CODEC_CAP_DR1
2485 #define CODEC_CAP_TRUNCATED       AV_CODEC_CAP_TRUNCATED
2486 
2487 #define CODEC_CAP_HWACCEL         0x0010
2488 
2489 #define CODEC_CAP_DELAY           AV_CODEC_CAP_DELAY
2490 
2491 #define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME
2492 
2493 #define CODEC_CAP_HWACCEL_VDPAU    AV_CODEC_CAP_HWACCEL_VDPAU
2494 
2495 #define CODEC_CAP_SUBFRAMES        AV_CODEC_CAP_SUBFRAMES
2496 
2497 #define CODEC_CAP_EXPERIMENTAL     AV_CODEC_CAP_EXPERIMENTAL
2498 
2499 #define CODEC_CAP_CHANNEL_CONF     AV_CODEC_CAP_CHANNEL_CONF
2500 
2501 #define CODEC_CAP_NEG_LINESIZES    0x0800
2502 
2503 #define CODEC_CAP_FRAME_THREADS    AV_CODEC_CAP_FRAME_THREADS
2504 
2505 #define CODEC_CAP_SLICE_THREADS    AV_CODEC_CAP_SLICE_THREADS
2506 
2507 #define CODEC_CAP_PARAM_CHANGE     AV_CODEC_CAP_PARAM_CHANGE
2508 
2509 #define CODEC_CAP_AUTO_THREADS     AV_CODEC_CAP_AUTO_THREADS
2510 
2511 #define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE
2512 
2513 #define CODEC_CAP_INTRA_ONLY       AV_CODEC_CAP_INTRA_ONLY
2514 
2515 #define CODEC_CAP_LOSSLESS         AV_CODEC_CAP_LOSSLESS
2516 
2517 #define HWACCEL_CODEC_CAP_EXPERIMENTAL     0x0200
2518 
2519 #define MB_TYPE_INTRA4x4   0x0001
2520 #define MB_TYPE_INTRA16x16 0x0002
2521 #define MB_TYPE_INTRA_PCM  0x0004
2522 #define MB_TYPE_16x16      0x0008
2523 #define MB_TYPE_16x8       0x0010
2524 #define MB_TYPE_8x16       0x0020
2525 #define MB_TYPE_8x8        0x0040
2526 #define MB_TYPE_INTERLACED 0x0080
2527 #define MB_TYPE_DIRECT2    0x0100
2528 #define MB_TYPE_ACPRED     0x0200
2529 #define MB_TYPE_GMC        0x0400
2530 #define MB_TYPE_SKIP       0x0800
2531 #define MB_TYPE_P0L0       0x1000
2532 #define MB_TYPE_P1L0       0x2000
2533 #define MB_TYPE_P0L1       0x4000
2534 #define MB_TYPE_P1L1       0x8000
2535 #define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
2536 #define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
2537 #define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
2538 #define MB_TYPE_QUANT      0x00010000
2539 #define MB_TYPE_CBP        0x00020000
2540 
2541 typedef struct AVPanScan{
2542 
2543     int id;
2544 
2545     int width;
2546     int height;
2547 
2548     int16_t position[3][2];
2549 }AVPanScan;
2550 
2551 typedef struct AVCPBProperties {
2552 
2553     int max_bitrate;
2554 
2555     int min_bitrate;
2556 
2557     int avg_bitrate;
2558 
2559     int buffer_size;
2560 
2561     uint64_t vbv_delay;
2562 } AVCPBProperties;
2563 
2564 #define FF_QSCALE_TYPE_MPEG1 0
2565 #define FF_QSCALE_TYPE_MPEG2 1
2566 #define FF_QSCALE_TYPE_H264  2
2567 #define FF_QSCALE_TYPE_VP56  3
2568 
2569 #define AV_GET_BUFFER_FLAG_REF (1 << 0)
2570 
2571 enum AVPacketSideDataType {
2572 
2573     AV_PKT_DATA_PALETTE,
2574 
2575     AV_PKT_DATA_NEW_EXTRADATA,
2576 
2577     AV_PKT_DATA_PARAM_CHANGE,
2578 
2579     AV_PKT_DATA_H263_MB_INFO,
2580 
2581     AV_PKT_DATA_REPLAYGAIN,
2582 
2583     AV_PKT_DATA_DISPLAYMATRIX,
2584 
2585     AV_PKT_DATA_STEREO3D,
2586 
2587     AV_PKT_DATA_AUDIO_SERVICE_TYPE,
2588 
2589     AV_PKT_DATA_QUALITY_STATS,
2590 
2591     AV_PKT_DATA_FALLBACK_TRACK,
2592 
2593     AV_PKT_DATA_CPB_PROPERTIES,
2594 
2595     AV_PKT_DATA_SKIP_SAMPLES=70,
2596 
2597     AV_PKT_DATA_JP_DUALMONO,
2598 
2599     AV_PKT_DATA_STRINGS_METADATA,
2600 
2601     AV_PKT_DATA_SUBTITLE_POSITION,
2602 
2603     AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
2604 
2605     AV_PKT_DATA_WEBVTT_IDENTIFIER,
2606 
2607     AV_PKT_DATA_WEBVTT_SETTINGS,
2608 
2609     AV_PKT_DATA_METADATA_UPDATE,
2610 
2611     AV_PKT_DATA_MPEGTS_STREAM_ID,
2612 
2613     AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
2614 
2615     AV_PKT_DATA_SPHERICAL,
2616 
2617     AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2618 
2619     AV_PKT_DATA_A53_CC,
2620 
2621     AV_PKT_DATA_NB
2622 };
2623 
2624 #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS
2625 
2626 typedef struct AVPacketSideData {
2627     uint8_t *data;
2628     int      size;
2629     enum AVPacketSideDataType type;
2630 } AVPacketSideData;
2631 
2632 typedef struct AVPacket {
2633 
2634     AVBufferRef *buf;
2635 
2636     int64_t pts;
2637 
2638     int64_t dts;
2639     uint8_t *data;
2640     int   size;
2641     int   stream_index;
2642 
2643     int   flags;
2644 
2645     AVPacketSideData *side_data;
2646     int side_data_elems;
2647 
2648     int64_t duration;
2649 
2650     int64_t pos;
2651 
2652     attribute_deprecated
2653     int64_t convergence_duration;
2654 } AVPacket;
2655 #define AV_PKT_FLAG_KEY     0x0001
2656 #define AV_PKT_FLAG_CORRUPT 0x0002
2657 
2658 #define AV_PKT_FLAG_DISCARD   0x0004
2659 
2660 #define AV_PKT_FLAG_TRUSTED   0x0008
2661 
2662 enum AVSideDataParamChangeFlags {
2663     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
2664     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2665     AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
2666     AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
2667 };
2668 
2669 struct AVCodecInternal;
2670 
2671 enum AVFieldOrder {
2672     AV_FIELD_UNKNOWN,
2673     AV_FIELD_PROGRESSIVE,
2674     AV_FIELD_TT,
2675     AV_FIELD_BB,
2676     AV_FIELD_TB,
2677     AV_FIELD_BT,
2678 };
2679 
2680 typedef struct AVCodecContext {
2681 
2682     const AVClass *av_class;
2683     int log_level_offset;
2684 
2685     enum AVMediaType codec_type;
2686     const struct AVCodec  *codec;
2687 
2688     attribute_deprecated
2689     char             codec_name[32];
2690     enum AVCodecID     codec_id;
2691 
2692     unsigned int codec_tag;
2693 
2694     attribute_deprecated
2695     unsigned int stream_codec_tag;
2696 
2697     void *priv_data;
2698 
2699     struct AVCodecInternal *internal;
2700 
2701     void *opaque;
2702 
2703     int64_t bit_rate;
2704 
2705     int bit_rate_tolerance;
2706 
2707     int global_quality;
2708 
2709     int compression_level;
2710 #define FF_COMPRESSION_DEFAULT -1
2711 
2712     int flags;
2713 
2714     int flags2;
2715 
2716     uint8_t *extradata;
2717     int extradata_size;
2718 
2719     AVRational time_base;
2720 
2721     int ticks_per_frame;
2722 
2723     int delay;
2724 
2725     int width, height;
2726 
2727     int coded_width, coded_height;
2728 
2729 #define FF_ASPECT_EXTENDED 15
2730 
2731     int gop_size;
2732 
2733     enum AVPixelFormat pix_fmt;
2734 
2735     attribute_deprecated int me_method;
2736 
2737     void (*draw_horiz_band)(struct AVCodecContext *s,
2738                             const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2739                             int y, int type, int height);
2740 
2741     enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2742 
2743     int max_b_frames;
2744 
2745     float b_quant_factor;
2746 
2747     attribute_deprecated int rc_strategy;
2748 #define FF_RC_STRATEGY_XVID 1
2749 
2750     attribute_deprecated
2751     int b_frame_strategy;
2752 
2753     float b_quant_offset;
2754 
2755     int has_b_frames;
2756 
2757     attribute_deprecated
2758     int mpeg_quant;
2759 
2760     float i_quant_factor;
2761 
2762     float i_quant_offset;
2763 
2764     float lumi_masking;
2765 
2766     float temporal_cplx_masking;
2767 
2768     float spatial_cplx_masking;
2769 
2770     float p_masking;
2771 
2772     float dark_masking;
2773 
2774     int slice_count;
2775 
2776     attribute_deprecated
2777      int prediction_method;
2778 #define FF_PRED_LEFT   0
2779 #define FF_PRED_PLANE  1
2780 #define FF_PRED_MEDIAN 2
2781 
2782     int *slice_offset;
2783 
2784     AVRational sample_aspect_ratio;
2785 
2786     int me_cmp;
2787 
2788     int me_sub_cmp;
2789 
2790     int mb_cmp;
2791 
2792     int ildct_cmp;
2793 #define FF_CMP_SAD          0
2794 #define FF_CMP_SSE          1
2795 #define FF_CMP_SATD         2
2796 #define FF_CMP_DCT          3
2797 #define FF_CMP_PSNR         4
2798 #define FF_CMP_BIT          5
2799 #define FF_CMP_RD           6
2800 #define FF_CMP_ZERO         7
2801 #define FF_CMP_VSAD         8
2802 #define FF_CMP_VSSE         9
2803 #define FF_CMP_NSSE         10
2804 #define FF_CMP_W53          11
2805 #define FF_CMP_W97          12
2806 #define FF_CMP_DCTMAX       13
2807 #define FF_CMP_DCT264       14
2808 #define FF_CMP_MEDIAN_SAD   15
2809 #define FF_CMP_CHROMA       256
2810 
2811     int dia_size;
2812 
2813     int last_predictor_count;
2814 
2815     attribute_deprecated
2816     int pre_me;
2817 
2818     int me_pre_cmp;
2819 
2820     int pre_dia_size;
2821 
2822     int me_subpel_quality;
2823 
2824     attribute_deprecated int dtg_active_format;
2825 #define FF_DTG_AFD_SAME         8
2826 #define FF_DTG_AFD_4_3          9
2827 #define FF_DTG_AFD_16_9         10
2828 #define FF_DTG_AFD_14_9         11
2829 #define FF_DTG_AFD_4_3_SP_14_9  13
2830 #define FF_DTG_AFD_16_9_SP_14_9 14
2831 #define FF_DTG_AFD_SP_4_3       15
2832 
2833     int me_range;
2834 
2835     attribute_deprecated int intra_quant_bias;
2836 #define FF_DEFAULT_QUANT_BIAS 999999
2837 
2838     attribute_deprecated int inter_quant_bias;
2839 
2840     int slice_flags;
2841 #define SLICE_FLAG_CODED_ORDER    0x0001
2842 #define SLICE_FLAG_ALLOW_FIELD    0x0002
2843 #define SLICE_FLAG_ALLOW_PLANE    0x0004
2844 
2845     attribute_deprecated int xvmc_acceleration;
2846 
2847     int mb_decision;
2848 #define FF_MB_DECISION_SIMPLE 0
2849 #define FF_MB_DECISION_BITS   1
2850 #define FF_MB_DECISION_RD     2
2851 
2852     uint16_t *intra_matrix;
2853 
2854     uint16_t *inter_matrix;
2855 
2856     attribute_deprecated
2857     int scenechange_threshold;
2858 
2859     attribute_deprecated
2860     int noise_reduction;
2861 
2862     attribute_deprecated
2863     int me_threshold;
2864 
2865     attribute_deprecated
2866     int mb_threshold;
2867 
2868     int intra_dc_precision;
2869 
2870     int skip_top;
2871 
2872     int skip_bottom;
2873 
2874     attribute_deprecated
2875     float border_masking;
2876 
2877     int mb_lmin;
2878 
2879     int mb_lmax;
2880 
2881     attribute_deprecated
2882     int me_penalty_compensation;
2883 
2884     int bidir_refine;
2885 
2886     attribute_deprecated
2887     int brd_scale;
2888 
2889     int keyint_min;
2890 
2891     int refs;
2892 
2893     attribute_deprecated
2894     int chromaoffset;
2895 
2896     attribute_deprecated int scenechange_factor;
2897 
2898     int mv0_threshold;
2899 
2900     attribute_deprecated
2901     int b_sensitivity;
2902 
2903     enum AVColorPrimaries color_primaries;
2904 
2905     enum AVColorTransferCharacteristic color_trc;
2906 
2907     enum AVColorSpace colorspace;
2908 
2909     enum AVColorRange color_range;
2910 
2911     enum AVChromaLocation chroma_sample_location;
2912 
2913     int slices;
2914 
2915     enum AVFieldOrder field_order;
2916 
2917     int sample_rate;
2918     int channels;
2919 
2920     enum AVSampleFormat sample_fmt;
2921 
2922     int frame_size;
2923 
2924     int frame_number;
2925 
2926     int block_align;
2927 
2928     int cutoff;
2929 
2930     uint64_t channel_layout;
2931 
2932     uint64_t request_channel_layout;
2933 
2934     enum AVAudioServiceType audio_service_type;
2935 
2936     enum AVSampleFormat request_sample_fmt;
2937 
2938     int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
2939 
2940     attribute_deprecated
2941     int refcounted_frames;
2942 
2943     float qcompress;
2944     float qblur;
2945 
2946     int qmin;
2947 
2948     int qmax;
2949 
2950     int max_qdiff;
2951 
2952     attribute_deprecated
2953     float rc_qsquish;
2954 
2955     attribute_deprecated
2956     float rc_qmod_amp;
2957     attribute_deprecated
2958     int rc_qmod_freq;
2959 
2960     int rc_buffer_size;
2961 
2962     int rc_override_count;
2963     RcOverride *rc_override;
2964 
2965     attribute_deprecated
2966     const char *rc_eq;
2967 
2968     int64_t rc_max_rate;
2969 
2970     int64_t rc_min_rate;
2971 
2972     attribute_deprecated
2973     float rc_buffer_aggressivity;
2974 
2975     attribute_deprecated
2976     float rc_initial_cplx;
2977 
2978     float rc_max_available_vbv_use;
2979 
2980     float rc_min_vbv_overflow_use;
2981 
2982     int rc_initial_buffer_occupancy;
2983 
2984 #define FF_CODER_TYPE_VLC       0
2985 #define FF_CODER_TYPE_AC        1
2986 #define FF_CODER_TYPE_RAW       2
2987 #define FF_CODER_TYPE_RLE       3
2988 #define FF_CODER_TYPE_DEFLATE   4
2989 
2990     attribute_deprecated
2991     int coder_type;
2992 
2993     attribute_deprecated
2994     int context_model;
2995 
2996     attribute_deprecated
2997     int lmin;
2998 
2999     attribute_deprecated
3000     int lmax;
3001 
3002     attribute_deprecated
3003     int frame_skip_threshold;
3004 
3005     attribute_deprecated
3006     int frame_skip_factor;
3007 
3008     attribute_deprecated
3009     int frame_skip_exp;
3010 
3011     attribute_deprecated
3012     int frame_skip_cmp;
3013 
3014     int trellis;
3015 
3016     attribute_deprecated
3017     int min_prediction_order;
3018 
3019     attribute_deprecated
3020     int max_prediction_order;
3021 
3022     attribute_deprecated
3023     int64_t timecode_frame_start;
3024 
3025     attribute_deprecated
3026     void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3027 
3028     attribute_deprecated
3029     int rtp_payload_size;
3030 
3031     attribute_deprecated
3032     int mv_bits;
3033     attribute_deprecated
3034     int header_bits;
3035     attribute_deprecated
3036     int i_tex_bits;
3037     attribute_deprecated
3038     int p_tex_bits;
3039     attribute_deprecated
3040     int i_count;
3041     attribute_deprecated
3042     int p_count;
3043     attribute_deprecated
3044     int skip_count;
3045     attribute_deprecated
3046     int misc_bits;
3047 
3048     attribute_deprecated
3049     int frame_bits;
3050 
3051     char *stats_out;
3052 
3053     char *stats_in;
3054 
3055     int workaround_bugs;
3056 #define FF_BUG_AUTODETECT       1
3057 #define FF_BUG_OLD_MSMPEG4      2
3058 #define FF_BUG_XVID_ILACE       4
3059 #define FF_BUG_UMP4             8
3060 #define FF_BUG_NO_PADDING       16
3061 #define FF_BUG_AMV              32
3062 #define FF_BUG_AC_VLC           0
3063 #define FF_BUG_QPEL_CHROMA      64
3064 #define FF_BUG_STD_QPEL         128
3065 #define FF_BUG_QPEL_CHROMA2     256
3066 #define FF_BUG_DIRECT_BLOCKSIZE 512
3067 #define FF_BUG_EDGE             1024
3068 #define FF_BUG_HPEL_CHROMA      2048
3069 #define FF_BUG_DC_CLIP          4096
3070 #define FF_BUG_MS               8192
3071 #define FF_BUG_TRUNCATED       16384
3072 #define FF_BUG_IEDGE           32768
3073 
3074     int strict_std_compliance;
3075 #define FF_COMPLIANCE_VERY_STRICT   2
3076 #define FF_COMPLIANCE_STRICT        1
3077 #define FF_COMPLIANCE_NORMAL        0
3078 #define FF_COMPLIANCE_UNOFFICIAL   -1
3079 #define FF_COMPLIANCE_EXPERIMENTAL -2
3080 
3081     int error_concealment;
3082 #define FF_EC_GUESS_MVS   1
3083 #define FF_EC_DEBLOCK     2
3084 #define FF_EC_FAVOR_INTER 256
3085 
3086     int debug;
3087 #define FF_DEBUG_PICT_INFO   1
3088 #define FF_DEBUG_RC          2
3089 #define FF_DEBUG_BITSTREAM   4
3090 #define FF_DEBUG_MB_TYPE     8
3091 #define FF_DEBUG_QP          16
3092 
3093 #define FF_DEBUG_MV          32
3094 #define FF_DEBUG_DCT_COEFF   0x00000040
3095 #define FF_DEBUG_SKIP        0x00000080
3096 #define FF_DEBUG_STARTCODE   0x00000100
3097 #define FF_DEBUG_PTS         0x00000200
3098 #define FF_DEBUG_ER          0x00000400
3099 #define FF_DEBUG_MMCO        0x00000800
3100 #define FF_DEBUG_BUGS        0x00001000
3101 #define FF_DEBUG_VIS_QP      0x00002000
3102 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
3103 #define FF_DEBUG_BUFFERS     0x00008000
3104 #define FF_DEBUG_THREADS     0x00010000
3105 #define FF_DEBUG_GREEN_MD    0x00800000
3106 #define FF_DEBUG_NOMC        0x01000000
3107 
3108     int debug_mv;
3109 #define FF_DEBUG_VIS_MV_P_FOR  0x00000001
3110 #define FF_DEBUG_VIS_MV_B_FOR  0x00000002
3111 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004
3112 
3113     int err_recognition;
3114 
3115 #define AV_EF_CRCCHECK  (1<<0)
3116 #define AV_EF_BITSTREAM (1<<1)
3117 #define AV_EF_BUFFER    (1<<2)
3118 #define AV_EF_EXPLODE   (1<<3)
3119 
3120 #define AV_EF_IGNORE_ERR (1<<15)
3121 #define AV_EF_CAREFUL    (1<<16)
3122 #define AV_EF_COMPLIANT  (1<<17)
3123 #define AV_EF_AGGRESSIVE (1<<18)
3124 
3125     int64_t reordered_opaque;
3126 
3127     struct AVHWAccel *hwaccel;
3128 
3129     void *hwaccel_context;
3130 
3131     uint64_t error[AV_NUM_DATA_POINTERS];
3132 
3133     int dct_algo;
3134 #define FF_DCT_AUTO    0
3135 #define FF_DCT_FASTINT 1
3136 #define FF_DCT_INT     2
3137 #define FF_DCT_MMX     3
3138 #define FF_DCT_ALTIVEC 5
3139 #define FF_DCT_FAAN    6
3140 
3141     int idct_algo;
3142 #define FF_IDCT_AUTO          0
3143 #define FF_IDCT_INT           1
3144 #define FF_IDCT_SIMPLE        2
3145 #define FF_IDCT_SIMPLEMMX     3
3146 #define FF_IDCT_ARM           7
3147 #define FF_IDCT_ALTIVEC       8
3148 #define FF_IDCT_SH4           9
3149 #define FF_IDCT_SIMPLEARM     10
3150 #define FF_IDCT_IPP           13
3151 #define FF_IDCT_XVID          14
3152 #define FF_IDCT_XVIDMMX       14
3153 #define FF_IDCT_SIMPLEARMV5TE 16
3154 #define FF_IDCT_SIMPLEARMV6   17
3155 #define FF_IDCT_SIMPLEVIS     18
3156 #define FF_IDCT_FAAN          20
3157 #define FF_IDCT_SIMPLENEON    22
3158 #define FF_IDCT_SIMPLEALPHA   23
3159 #define FF_IDCT_NONE          24
3160 #define FF_IDCT_SIMPLEAUTO    128
3161 
3162      int bits_per_coded_sample;
3163 
3164     int bits_per_raw_sample;
3165 
3166      int lowres;
3167 
3168     attribute_deprecated AVFrame *coded_frame;
3169 
3170     int thread_count;
3171 
3172     int thread_type;
3173 #define FF_THREAD_FRAME   1
3174 #define FF_THREAD_SLICE   2
3175 
3176     int active_thread_type;
3177 
3178     int thread_safe_callbacks;
3179 
3180     int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3181 
3182     int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3183 
3184      int nsse_weight;
3185 
3186      int profile;
3187 #define FF_PROFILE_UNKNOWN -99
3188 #define FF_PROFILE_RESERVED -100
3189 
3190 #define FF_PROFILE_AAC_MAIN 0
3191 #define FF_PROFILE_AAC_LOW  1
3192 #define FF_PROFILE_AAC_SSR  2
3193 #define FF_PROFILE_AAC_LTP  3
3194 #define FF_PROFILE_AAC_HE   4
3195 #define FF_PROFILE_AAC_HE_V2 28
3196 #define FF_PROFILE_AAC_LD   22
3197 #define FF_PROFILE_AAC_ELD  38
3198 #define FF_PROFILE_MPEG2_AAC_LOW 128
3199 #define FF_PROFILE_MPEG2_AAC_HE  131
3200 
3201 #define FF_PROFILE_DNXHD         0
3202 #define FF_PROFILE_DNXHR_LB      1
3203 #define FF_PROFILE_DNXHR_SQ      2
3204 #define FF_PROFILE_DNXHR_HQ      3
3205 #define FF_PROFILE_DNXHR_HQX     4
3206 #define FF_PROFILE_DNXHR_444     5
3207 
3208 #define FF_PROFILE_DTS         20
3209 #define FF_PROFILE_DTS_ES      30
3210 #define FF_PROFILE_DTS_96_24   40
3211 #define FF_PROFILE_DTS_HD_HRA  50
3212 #define FF_PROFILE_DTS_HD_MA   60
3213 #define FF_PROFILE_DTS_EXPRESS 70
3214 
3215 #define FF_PROFILE_MPEG2_422    0
3216 #define FF_PROFILE_MPEG2_HIGH   1
3217 #define FF_PROFILE_MPEG2_SS     2
3218 #define FF_PROFILE_MPEG2_SNR_SCALABLE  3
3219 #define FF_PROFILE_MPEG2_MAIN   4
3220 #define FF_PROFILE_MPEG2_SIMPLE 5
3221 
3222 #define FF_PROFILE_H264_CONSTRAINED  (1<<9)
3223 #define FF_PROFILE_H264_INTRA        (1<<11)
3224 
3225 #define FF_PROFILE_H264_BASELINE             66
3226 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3227 #define FF_PROFILE_H264_MAIN                 77
3228 #define FF_PROFILE_H264_EXTENDED             88
3229 #define FF_PROFILE_H264_HIGH                 100
3230 #define FF_PROFILE_H264_HIGH_10              110
3231 #define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
3232 #define FF_PROFILE_H264_MULTIVIEW_HIGH       118
3233 #define FF_PROFILE_H264_HIGH_422             122
3234 #define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
3235 #define FF_PROFILE_H264_STEREO_HIGH          128
3236 #define FF_PROFILE_H264_HIGH_444             144
3237 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
3238 #define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
3239 #define FF_PROFILE_H264_CAVLC_444            44
3240 
3241 #define FF_PROFILE_VC1_SIMPLE   0
3242 #define FF_PROFILE_VC1_MAIN     1
3243 #define FF_PROFILE_VC1_COMPLEX  2
3244 #define FF_PROFILE_VC1_ADVANCED 3
3245 
3246 #define FF_PROFILE_MPEG4_SIMPLE                     0
3247 #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
3248 #define FF_PROFILE_MPEG4_CORE                       2
3249 #define FF_PROFILE_MPEG4_MAIN                       3
3250 #define FF_PROFILE_MPEG4_N_BIT                      4
3251 #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
3252 #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
3253 #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
3254 #define FF_PROFILE_MPEG4_HYBRID                     8
3255 #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
3256 #define FF_PROFILE_MPEG4_CORE_SCALABLE             10
3257 #define FF_PROFILE_MPEG4_ADVANCED_CODING           11
3258 #define FF_PROFILE_MPEG4_ADVANCED_CORE             12
3259 #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3260 #define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
3261 #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
3262 
3263 #define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0   1
3264 #define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1   2
3265 #define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION  32768
3266 #define FF_PROFILE_JPEG2000_DCINEMA_2K              3
3267 #define FF_PROFILE_JPEG2000_DCINEMA_4K              4
3268 
3269 #define FF_PROFILE_VP9_0                            0
3270 #define FF_PROFILE_VP9_1                            1
3271 #define FF_PROFILE_VP9_2                            2
3272 #define FF_PROFILE_VP9_3                            3
3273 
3274 #define FF_PROFILE_HEVC_MAIN                        1
3275 #define FF_PROFILE_HEVC_MAIN_10                     2
3276 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
3277 #define FF_PROFILE_HEVC_REXT                        4
3278 
3279      int level;
3280 #define FF_LEVEL_UNKNOWN -99
3281 
3282     enum AVDiscard skip_loop_filter;
3283 
3284     enum AVDiscard skip_idct;
3285 
3286     enum AVDiscard skip_frame;
3287 
3288     uint8_t *subtitle_header;
3289     int subtitle_header_size;
3290 
3291     attribute_deprecated
3292     int error_rate;
3293 
3294     attribute_deprecated
3295     uint64_t vbv_delay;
3296 
3297     attribute_deprecated
3298     int side_data_only_packets;
3299 
3300     int initial_padding;
3301 
3302     AVRational framerate;
3303 
3304     enum AVPixelFormat sw_pix_fmt;
3305 
3306     AVRational pkt_timebase;
3307 
3308     const AVCodecDescriptor *codec_descriptor;
3309 
3310     int64_t pts_correction_num_faulty_pts;
3311     int64_t pts_correction_num_faulty_dts;
3312     int64_t pts_correction_last_pts;
3313     int64_t pts_correction_last_dts;
3314 
3315     char *sub_charenc;
3316 
3317     int sub_charenc_mode;
3318 #define FF_SUB_CHARENC_MODE_DO_NOTHING  -1
3319 #define FF_SUB_CHARENC_MODE_AUTOMATIC    0
3320 #define FF_SUB_CHARENC_MODE_PRE_DECODER  1
3321 
3322     int skip_alpha;
3323 
3324     int seek_preroll;
3325 
3326     uint16_t *chroma_intra_matrix;
3327 
3328     uint8_t *dump_separator;
3329 
3330     char *codec_whitelist;
3331 
3332     unsigned properties;
3333 #define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
3334 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3335 
3336     AVPacketSideData *coded_side_data;
3337     int            nb_coded_side_data;
3338 
3339     AVBufferRef *hw_frames_ctx;
3340 
3341     int sub_text_format;
3342 #define FF_SUB_TEXT_FMT_ASS              0
3343 #define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3344 
3345     int trailing_padding;
3346 
3347     int64_t max_pixels;
3348 
3349     AVBufferRef *hw_device_ctx;
3350 
3351     int hwaccel_flags;
3352 
3353     int apply_cropping;
3354 } AVCodecContext;
3355 
3356 AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
3357 void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
3358 
3359 const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
3360 void                     av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
3361 
3362 unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
3363 
3364 int  av_codec_get_lowres(const AVCodecContext *avctx);
3365 void av_codec_set_lowres(AVCodecContext *avctx, int val);
3366 
3367 int  av_codec_get_seek_preroll(const AVCodecContext *avctx);
3368 void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
3369 
3370 uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
3371 void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
3372 
3373 typedef struct AVProfile {
3374     int profile;
3375     const char *name;
3376 } AVProfile;
3377 
3378 typedef struct AVCodecDefault AVCodecDefault;
3379 
3380 struct AVSubtitle;
3381 
3382 typedef struct AVCodec {
3383 
3384     const char *name;
3385 
3386     const char *long_name;
3387     enum AVMediaType type;
3388     enum AVCodecID id;
3389 
3390     int capabilities;
3391     const AVRational *supported_framerates;
3392     const enum AVPixelFormat *pix_fmts;
3393     const int *supported_samplerates;
3394     const enum AVSampleFormat *sample_fmts;
3395     const uint64_t *channel_layouts;
3396     uint8_t max_lowres;
3397     const AVClass *priv_class;
3398     const AVProfile *profiles;
3399 
3400     int priv_data_size;
3401     struct AVCodec *next;
3402 
3403     int (*init_thread_copy)(AVCodecContext *);
3404 
3405     int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
3406 
3407     const AVCodecDefault *defaults;
3408 
3409     void (*init_static_data)(struct AVCodec *codec);
3410 
3411     int (*init)(AVCodecContext *);
3412     int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
3413                       const struct AVSubtitle *sub);
3414 
3415     int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
3416                    int *got_packet_ptr);
3417     int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
3418     int (*close)(AVCodecContext *);
3419 
3420     int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
3421     int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
3422 
3423     int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
3424 
3425     void (*flush)(AVCodecContext *);
3426 
3427     int caps_internal;
3428 
3429     const char *bsfs;
3430 } AVCodec;
3431 
3432 int av_codec_get_max_lowres(const AVCodec *codec);
3433 
3434 struct MpegEncContext;
3435 
3436 typedef struct AVHWAccel {
3437 
3438     const char *name;
3439 
3440     enum AVMediaType type;
3441 
3442     enum AVCodecID id;
3443 
3444     enum AVPixelFormat pix_fmt;
3445 
3446     int capabilities;
3447 
3448     struct AVHWAccel *next;
3449 
3450     int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
3451 
3452     int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3453 
3454     int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3455 
3456     int (*end_frame)(AVCodecContext *avctx);
3457 
3458     int frame_priv_data_size;
3459 
3460     void (*decode_mb)(struct MpegEncContext *s);
3461 
3462     int (*init)(AVCodecContext *avctx);
3463 
3464     int (*uninit)(AVCodecContext *avctx);
3465 
3466     int priv_data_size;
3467 
3468     int caps_internal;
3469 } AVHWAccel;
3470 
3471 #define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
3472 
3473 #define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
3474 
3475 #define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
3476 
3477 #define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
3478 
3479 typedef struct AVPicture {
3480     attribute_deprecated
3481     uint8_t *data[AV_NUM_DATA_POINTERS];
3482     attribute_deprecated
3483     int linesize[AV_NUM_DATA_POINTERS];
3484 } AVPicture;
3485 
3486 enum AVSubtitleType {
3487     SUBTITLE_NONE,
3488 
3489     SUBTITLE_BITMAP,
3490 
3491     SUBTITLE_TEXT,
3492 
3493     SUBTITLE_ASS,
3494 };
3495 
3496 #define AV_SUBTITLE_FLAG_FORCED 0x00000001
3497 
3498 typedef struct AVSubtitleRect {
3499     int x;
3500     int y;
3501     int w;
3502     int h;
3503     int nb_colors;
3504 
3505     attribute_deprecated
3506     AVPicture pict;
3507 
3508     uint8_t *data[4];
3509     int linesize[4];
3510 
3511     enum AVSubtitleType type;
3512 
3513     char *text;
3514 
3515     char *ass;
3516 
3517     int flags;
3518 } AVSubtitleRect;
3519 
3520 typedef struct AVSubtitle {
3521     uint16_t format;
3522     uint32_t start_display_time;
3523     uint32_t end_display_time;
3524     unsigned num_rects;
3525     AVSubtitleRect **rects;
3526     int64_t pts;
3527 } AVSubtitle;
3528 
3529 typedef struct AVCodecParameters {
3530 
3531     enum AVMediaType codec_type;
3532 
3533     enum AVCodecID   codec_id;
3534 
3535     uint32_t         codec_tag;
3536 
3537     uint8_t *extradata;
3538 
3539     int      extradata_size;
3540 
3541     int format;
3542 
3543     int64_t bit_rate;
3544 
3545     int bits_per_coded_sample;
3546 
3547     int bits_per_raw_sample;
3548 
3549     int profile;
3550     int level;
3551 
3552     int width;
3553     int height;
3554 
3555     AVRational sample_aspect_ratio;
3556 
3557     enum AVFieldOrder                  field_order;
3558 
3559     enum AVColorRange                  color_range;
3560     enum AVColorPrimaries              color_primaries;
3561     enum AVColorTransferCharacteristic color_trc;
3562     enum AVColorSpace                  color_space;
3563     enum AVChromaLocation              chroma_location;
3564 
3565     int video_delay;
3566 
3567     uint64_t channel_layout;
3568 
3569     int      channels;
3570 
3571     int      sample_rate;
3572 
3573     int      block_align;
3574 
3575     int      frame_size;
3576 
3577     int initial_padding;
3578 
3579     int trailing_padding;
3580 
3581     int seek_preroll;
3582 } AVCodecParameters;
3583 
3584 AVCodec *av_codec_next(const AVCodec *c);
3585 
3586 unsigned avcodec_version(void);
3587 
3588 const char *avcodec_configuration(void);
3589 
3590 const char *avcodec_license(void);
3591 
3592 void avcodec_register(AVCodec *codec);
3593 
3594 void avcodec_register_all(void);
3595 
3596 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
3597 
3598 void avcodec_free_context(AVCodecContext **avctx);
3599 
3600 int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
3601 
3602 const AVClass *avcodec_get_class(void);
3603 
3604 const AVClass *avcodec_get_frame_class(void);
3605 
3606 const AVClass *avcodec_get_subtitle_rect_class(void);
3607 
3608 attribute_deprecated
3609 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3610 
3611 AVCodecParameters *avcodec_parameters_alloc(void);
3612 
3613 void avcodec_parameters_free(AVCodecParameters **par);
3614 
3615 int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
3616 
3617 int avcodec_parameters_from_context(AVCodecParameters *par,
3618                                     const AVCodecContext *codec);
3619 
3620 int avcodec_parameters_to_context(AVCodecContext *codec,
3621                                   const AVCodecParameters *par);
3622 
3623 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
3624 
3625 int avcodec_close(AVCodecContext *avctx);
3626 
3627 void avsubtitle_free(AVSubtitle *sub);
3628 
3629 AVPacket *av_packet_alloc(void);
3630 
3631 AVPacket *av_packet_clone(const AVPacket *src);
3632 
3633 void av_packet_free(AVPacket **pkt);
3634 
3635 void av_init_packet(AVPacket *pkt);
3636 
3637 int av_new_packet(AVPacket *pkt, int size);
3638 
3639 void av_shrink_packet(AVPacket *pkt, int size);
3640 
3641 int av_grow_packet(AVPacket *pkt, int grow_by);
3642 
3643 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
3644 
3645 attribute_deprecated
3646 int av_dup_packet(AVPacket *pkt);
3647 
3648 attribute_deprecated
3649 int av_copy_packet(AVPacket *dst, const AVPacket *src);
3650 
3651 attribute_deprecated
3652 int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
3653 
3654 attribute_deprecated
3655 void av_free_packet(AVPacket *pkt);
3656 
3657 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3658                                  int size);
3659 
3660 int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3661                             uint8_t *data, size_t size);
3662 
3663 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3664                                int size);
3665 
3666 uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
3667                                  int *size);
3668 
3669 attribute_deprecated
3670 int av_packet_merge_side_data(AVPacket *pkt);
3671 
3672 attribute_deprecated
3673 int av_packet_split_side_data(AVPacket *pkt);
3674 
3675 const char *av_packet_side_data_name(enum AVPacketSideDataType type);
3676 
3677 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
3678 
3679 int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
3680 
3681 void av_packet_free_side_data(AVPacket *pkt);
3682 
3683 int av_packet_ref(AVPacket *dst, const AVPacket *src);
3684 
3685 void av_packet_unref(AVPacket *pkt);
3686 
3687 void av_packet_move_ref(AVPacket *dst, AVPacket *src);
3688 
3689 int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
3690 
3691 void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
3692 
3693 AVCodec *avcodec_find_decoder(enum AVCodecID id);
3694 
3695 AVCodec *avcodec_find_decoder_by_name(const char *name);
3696 
3697 int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
3698 
3699 attribute_deprecated
3700 unsigned avcodec_get_edge_width(void);
3701 
3702 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
3703 
3704 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
3705                                int linesize_align[AV_NUM_DATA_POINTERS]);
3706 
3707 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
3708 
3709 enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
3710 
3711 attribute_deprecated
3712 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
3713                           int *got_frame_ptr, const AVPacket *avpkt);
3714 
3715 attribute_deprecated
3716 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
3717                          int *got_picture_ptr,
3718                          const AVPacket *avpkt);
3719 
3720 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
3721                             int *got_sub_ptr,
3722                             AVPacket *avpkt);
3723 
3724 int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
3725 
3726 int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
3727 
3728 int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
3729 
3730 int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
3731 
3732 enum AVPictureStructure {
3733     AV_PICTURE_STRUCTURE_UNKNOWN,
3734     AV_PICTURE_STRUCTURE_TOP_FIELD,
3735     AV_PICTURE_STRUCTURE_BOTTOM_FIELD,
3736     AV_PICTURE_STRUCTURE_FRAME,
3737 };
3738 
3739 typedef struct AVCodecParserContext {
3740     void *priv_data;
3741     struct AVCodecParser *parser;
3742     int64_t frame_offset;
3743     int64_t cur_offset;
3744 
3745     int64_t next_frame_offset;
3746 
3747     int pict_type;
3748 
3749     int repeat_pict;
3750     int64_t pts;
3751     int64_t dts;
3752 
3753     int64_t last_pts;
3754     int64_t last_dts;
3755     int fetch_timestamp;
3756 
3757 #define AV_PARSER_PTS_NB 4
3758     int cur_frame_start_index;
3759     int64_t cur_frame_offset[AV_PARSER_PTS_NB];
3760     int64_t cur_frame_pts[AV_PARSER_PTS_NB];
3761     int64_t cur_frame_dts[AV_PARSER_PTS_NB];
3762 
3763     int flags;
3764 #define PARSER_FLAG_COMPLETE_FRAMES           0x0001
3765 #define PARSER_FLAG_ONCE                      0x0002
3766 
3767 #define PARSER_FLAG_FETCHED_OFFSET            0x0004
3768 #define PARSER_FLAG_USE_CODEC_TS              0x1000
3769 
3770     int64_t offset;
3771     int64_t cur_frame_end[AV_PARSER_PTS_NB];
3772 
3773     int key_frame;
3774 
3775     attribute_deprecated
3776     int64_t convergence_duration;
3777 
3778     int dts_sync_point;
3779 
3780     int dts_ref_dts_delta;
3781 
3782     int pts_dts_delta;
3783 
3784     int64_t cur_frame_pos[AV_PARSER_PTS_NB];
3785 
3786     int64_t pos;
3787 
3788     int64_t last_pos;
3789 
3790     int duration;
3791 
3792     enum AVFieldOrder field_order;
3793 
3794     enum AVPictureStructure picture_structure;
3795 
3796     int output_picture_number;
3797 
3798     int width;
3799     int height;
3800 
3801     int coded_width;
3802     int coded_height;
3803 
3804     int format;
3805 } AVCodecParserContext;
3806 
3807 typedef struct AVCodecParser {
3808     int codec_ids[5];
3809     int priv_data_size;
3810     int (*parser_init)(AVCodecParserContext *s);
3811 
3812     int (*parser_parse)(AVCodecParserContext *s,
3813                         AVCodecContext *avctx,
3814                         const uint8_t **poutbuf, int *poutbuf_size,
3815                         const uint8_t *buf, int buf_size);
3816     void (*parser_close)(AVCodecParserContext *s);
3817     int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
3818     struct AVCodecParser *next;
3819 } AVCodecParser;
3820 
3821 AVCodecParser *av_parser_next(const AVCodecParser *c);
3822 
3823 void av_register_codec_parser(AVCodecParser *parser);
3824 AVCodecParserContext *av_parser_init(int codec_id);
3825 
3826 int av_parser_parse2(AVCodecParserContext *s,
3827                      AVCodecContext *avctx,
3828                      uint8_t **poutbuf, int *poutbuf_size,
3829                      const uint8_t *buf, int buf_size,
3830                      int64_t pts, int64_t dts,
3831                      int64_t pos);
3832 
3833 int av_parser_change(AVCodecParserContext *s,
3834                      AVCodecContext *avctx,
3835                      uint8_t **poutbuf, int *poutbuf_size,
3836                      const uint8_t *buf, int buf_size, int keyframe);
3837 void av_parser_close(AVCodecParserContext *s);
3838 
3839 AVCodec *avcodec_find_encoder(enum AVCodecID id);
3840 
3841 AVCodec *avcodec_find_encoder_by_name(const char *name);
3842 
3843 attribute_deprecated
3844 int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
3845                           const AVFrame *frame, int *got_packet_ptr);
3846 
3847 attribute_deprecated
3848 int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
3849                           const AVFrame *frame, int *got_packet_ptr);
3850 
3851 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
3852                             const AVSubtitle *sub);
3853 
3854 struct ReSampleContext;
3855 struct AVResampleContext;
3856 
3857 typedef struct ReSampleContext ReSampleContext;
3858 
3859 attribute_deprecated
3860 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
3861                                         int output_rate, int input_rate,
3862                                         enum AVSampleFormat sample_fmt_out,
3863                                         enum AVSampleFormat sample_fmt_in,
3864                                         int filter_length, int log2_phase_count,
3865                                         int linear, double cutoff);
3866 
3867 attribute_deprecated
3868 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
3869 
3870 attribute_deprecated
3871 void audio_resample_close(ReSampleContext *s);
3872 
3873 attribute_deprecated
3874 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
3875 
3876 attribute_deprecated
3877 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
3878 
3879 attribute_deprecated
3880 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
3881 attribute_deprecated
3882 void av_resample_close(struct AVResampleContext *c);
3883 
3884 attribute_deprecated
3885 int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
3886 
3887 attribute_deprecated
3888 void avpicture_free(AVPicture *picture);
3889 
3890 attribute_deprecated
3891 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
3892                    enum AVPixelFormat pix_fmt, int width, int height);
3893 
3894 attribute_deprecated
3895 int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
3896                      int width, int height,
3897                      unsigned char *dest, int dest_size);
3898 
3899 attribute_deprecated
3900 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
3901 
3902 attribute_deprecated
3903 void av_picture_copy(AVPicture *dst, const AVPicture *src,
3904                      enum AVPixelFormat pix_fmt, int width, int height);
3905 
3906 attribute_deprecated
3907 int av_picture_crop(AVPicture *dst, const AVPicture *src,
3908                     enum AVPixelFormat pix_fmt, int top_band, int left_band);
3909 
3910 attribute_deprecated
3911 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
3912             int padtop, int padbottom, int padleft, int padright, int *color);
3913 
3914 attribute_deprecated
3915 void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
3916 
3917 unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
3918 
3919 int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
3920                              int has_alpha);
3921 
3922 enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
3923                                             enum AVPixelFormat src_pix_fmt,
3924                                             int has_alpha, int *loss_ptr);
3925 
3926 enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
3927                                             enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
3928 
3929 attribute_deprecated
3930 enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
3931                                             enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
3932 
3933 enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
3934 
3935 attribute_deprecated
3936 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
3937 
3938 attribute_deprecated
3939 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
3940 
3941 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
3942 
3943 const char *av_get_profile_name(const AVCodec *codec, int profile);
3944 
3945 const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
3946 
3947 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
3948 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
3949 
3950 int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
3951                              enum AVSampleFormat sample_fmt, const uint8_t *buf,
3952                              int buf_size, int align);
3953 
3954 void avcodec_flush_buffers(AVCodecContext *avctx);
3955 
3956 int av_get_bits_per_sample(enum AVCodecID codec_id);
3957 
3958 enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
3959 
3960 int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
3961 
3962 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
3963 
3964 int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
3965 
3966 typedef struct AVBitStreamFilterContext {
3967     void *priv_data;
3968     const struct AVBitStreamFilter *filter;
3969     AVCodecParserContext *parser;
3970     struct AVBitStreamFilterContext *next;
3971 
3972     char *args;
3973 } AVBitStreamFilterContext;
3974 
3975 typedef struct AVBSFInternal AVBSFInternal;
3976 
3977 typedef struct AVBSFContext {
3978 
3979     const AVClass *av_class;
3980 
3981     const struct AVBitStreamFilter *filter;
3982 
3983     AVBSFInternal *internal;
3984 
3985     void *priv_data;
3986 
3987     AVCodecParameters *par_in;
3988 
3989     AVCodecParameters *par_out;
3990 
3991     AVRational time_base_in;
3992 
3993     AVRational time_base_out;
3994 } AVBSFContext;
3995 
3996 typedef struct AVBitStreamFilter {
3997     const char *name;
3998 
3999     const enum AVCodecID *codec_ids;
4000 
4001     const AVClass *priv_class;
4002 
4003     int priv_data_size;
4004     int (*init)(AVBSFContext *ctx);
4005     int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
4006     void (*close)(AVBSFContext *ctx);
4007 } AVBitStreamFilter;
4008 
4009 attribute_deprecated
4010 void av_register_bitstream_filter(AVBitStreamFilter *bsf);
4011 
4012 attribute_deprecated
4013 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
4014 
4015 attribute_deprecated
4016 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
4017                                AVCodecContext *avctx, const char *args,
4018                                uint8_t **poutbuf, int *poutbuf_size,
4019                                const uint8_t *buf, int buf_size, int keyframe);
4020 
4021 attribute_deprecated
4022 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
4023 
4024 attribute_deprecated
4025 AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
4026 
4027 const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
4028 
4029 const AVBitStreamFilter *av_bsf_next(void **opaque);
4030 
4031 int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
4032 
4033 int av_bsf_init(AVBSFContext *ctx);
4034 
4035 int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
4036 
4037 int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
4038 
4039 void av_bsf_free(AVBSFContext **ctx);
4040 
4041 const AVClass *av_bsf_get_class(void);
4042 
4043 typedef struct AVBSFList AVBSFList;
4044 
4045 AVBSFList *av_bsf_list_alloc(void);
4046 
4047 void av_bsf_list_free(AVBSFList **lst);
4048 
4049 int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
4050 
4051 int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
4052 
4053 int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
4054 
4055 int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
4056 
4057 int av_bsf_get_null_filter(AVBSFContext **bsf);
4058 
4059 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
4060 
4061 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
4062 
4063 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
4064 
4065 attribute_deprecated
4066 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
4067 
4068 attribute_deprecated
4069 void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
4070 
4071 void av_register_hwaccel(AVHWAccel *hwaccel);
4072 
4073 AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
4074 
4075 enum AVLockOp {
4076   AV_LOCK_CREATE,
4077   AV_LOCK_OBTAIN,
4078   AV_LOCK_RELEASE,
4079   AV_LOCK_DESTROY,
4080 };
4081 
4082 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
4083 
4084 enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
4085 
4086 const char *avcodec_get_name(enum AVCodecID id);
4087 
4088 int avcodec_is_open(AVCodecContext *s);
4089 
4090 int av_codec_is_encoder(const AVCodec *codec);
4091 
4092 int av_codec_is_decoder(const AVCodec *codec);
4093 
4094 const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
4095 
4096 const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
4097 
4098 const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
4099 
4100 AVCPBProperties *av_cpb_properties_alloc(size_t *size);
4101 
4102 #define AVFORMAT_AVFORMAT_H
4103 
4104 #define AVFORMAT_AVIO_H
4105 
4106 #define AVFORMAT_VERSION_H
4107 
4108 #define LIBAVFORMAT_VERSION_MAJOR  57
4109 #define LIBAVFORMAT_VERSION_MINOR  83
4110 #define LIBAVFORMAT_VERSION_MICRO 100
4111 
4112 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
4113                                                LIBAVFORMAT_VERSION_MINOR, \
4114                                                LIBAVFORMAT_VERSION_MICRO)
4115 #define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_MAJOR,   \
4116                                            LIBAVFORMAT_VERSION_MINOR,   \
4117                                            LIBAVFORMAT_VERSION_MICRO)
4118 #define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
4119 
4120 #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
4121 
4122 #define FF_API_LAVF_BITEXACT            (LIBAVFORMAT_VERSION_MAJOR < 58)
4123 #define FF_API_LAVF_FRAC                (LIBAVFORMAT_VERSION_MAJOR < 58)
4124 #define FF_API_LAVF_CODEC_TB            (LIBAVFORMAT_VERSION_MAJOR < 58)
4125 #define FF_API_URL_FEOF                 (LIBAVFORMAT_VERSION_MAJOR < 58)
4126 #define FF_API_LAVF_FMT_RAWPICTURE      (LIBAVFORMAT_VERSION_MAJOR < 58)
4127 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 58)
4128 #define FF_API_OLD_OPEN_CALLBACKS       (LIBAVFORMAT_VERSION_MAJOR < 58)
4129 #define FF_API_LAVF_AVCTX               (LIBAVFORMAT_VERSION_MAJOR < 58)
4130 #define FF_API_NOCONST_GET_SIDE_DATA    (LIBAVFORMAT_VERSION_MAJOR < 58)
4131 #define FF_API_HTTP_USER_AGENT          (LIBAVFORMAT_VERSION_MAJOR < 58)
4132 #define FF_API_HLS_WRAP                 (LIBAVFORMAT_VERSION_MAJOR < 58)
4133 #define FF_API_LAVF_MERGE_SD            (LIBAVFORMAT_VERSION_MAJOR < 58)
4134 #define FF_API_LAVF_KEEPSIDE_FLAG       (LIBAVFORMAT_VERSION_MAJOR < 58)
4135 #define FF_API_OLD_ROTATE_API           (LIBAVFORMAT_VERSION_MAJOR < 58)
4136 
4137 #define FF_API_R_FRAME_RATE            1
4138 
4139 #define AVIO_SEEKABLE_NORMAL (1 << 0)
4140 
4141 #define AVIO_SEEKABLE_TIME   (1 << 1)
4142 
4143 typedef struct AVIOInterruptCB {
4144     int (*callback)(void*);
4145     void *opaque;
4146 } AVIOInterruptCB;
4147 
4148 enum AVIODirEntryType {
4149     AVIO_ENTRY_UNKNOWN,
4150     AVIO_ENTRY_BLOCK_DEVICE,
4151     AVIO_ENTRY_CHARACTER_DEVICE,
4152     AVIO_ENTRY_DIRECTORY,
4153     AVIO_ENTRY_NAMED_PIPE,
4154     AVIO_ENTRY_SYMBOLIC_LINK,
4155     AVIO_ENTRY_SOCKET,
4156     AVIO_ENTRY_FILE,
4157     AVIO_ENTRY_SERVER,
4158     AVIO_ENTRY_SHARE,
4159     AVIO_ENTRY_WORKGROUP,
4160 };
4161 
4162 typedef struct AVIODirEntry {
4163     char *name;
4164     int type;
4165     int utf8;
4166 
4167     int64_t size;
4168     int64_t modification_timestamp;
4169 
4170     int64_t access_timestamp;
4171 
4172     int64_t status_change_timestamp;
4173 
4174     int64_t user_id;
4175     int64_t group_id;
4176     int64_t filemode;
4177 } AVIODirEntry;
4178 
4179 typedef struct AVIODirContext {
4180     struct URLContext *url_context;
4181 } AVIODirContext;
4182 
4183 enum AVIODataMarkerType {
4184 
4185     AVIO_DATA_MARKER_HEADER,
4186 
4187     AVIO_DATA_MARKER_SYNC_POINT,
4188 
4189     AVIO_DATA_MARKER_BOUNDARY_POINT,
4190 
4191     AVIO_DATA_MARKER_UNKNOWN,
4192 
4193     AVIO_DATA_MARKER_TRAILER,
4194 
4195     AVIO_DATA_MARKER_FLUSH_POINT,
4196 };
4197 
4198 typedef struct AVIOContext {
4199 
4200     const AVClass *av_class;
4201 
4202     unsigned char *buffer;
4203     int buffer_size;
4204     unsigned char *buf_ptr;
4205     unsigned char *buf_end;
4206 
4207     void *opaque;
4208 
4209     int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
4210     int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
4211     int64_t (*seek)(void *opaque, int64_t offset, int whence);
4212     int64_t pos;
4213     int must_flush;
4214     int eof_reached;
4215     int write_flag;
4216     int max_packet_size;
4217     unsigned long checksum;
4218     unsigned char *checksum_ptr;
4219     unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
4220     int error;
4221 
4222     int (*read_pause)(void *opaque, int pause);
4223 
4224     int64_t (*read_seek)(void *opaque, int stream_index,
4225                          int64_t timestamp, int flags);
4226 
4227     int seekable;
4228 
4229     int64_t maxsize;
4230 
4231     int direct;
4232 
4233     int64_t bytes_read;
4234 
4235     int seek_count;
4236 
4237     int writeout_count;
4238 
4239     int orig_buffer_size;
4240 
4241     int short_seek_threshold;
4242 
4243     const char *protocol_whitelist;
4244 
4245     const char *protocol_blacklist;
4246 
4247     int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
4248                            enum AVIODataMarkerType type, int64_t time);
4249 
4250     int ignore_boundary_point;
4251 
4252     enum AVIODataMarkerType current_type;
4253     int64_t last_time;
4254 
4255     int (*short_seek_get)(void *opaque);
4256 
4257     int64_t written;
4258 
4259     unsigned char *buf_ptr_max;
4260 
4261     int min_packet_size;
4262 } AVIOContext;
4263 
4264 const char *avio_find_protocol_name(const char *url);
4265 
4266 int avio_check(const char *url, int flags);
4267 
4268 int avpriv_io_move(const char *url_src, const char *url_dst);
4269 
4270 int avpriv_io_delete(const char *url);
4271 
4272 int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options);
4273 
4274 int avio_read_dir(AVIODirContext *s, AVIODirEntry **next);
4275 
4276 int avio_close_dir(AVIODirContext **s);
4277 
4278 void avio_free_directory_entry(AVIODirEntry **entry);
4279 
4280 AVIOContext *avio_alloc_context(
4281                   unsigned char *buffer,
4282                   int buffer_size,
4283                   int write_flag,
4284                   void *opaque,
4285                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
4286                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
4287                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
4288 
4289 void avio_context_free(AVIOContext **s);
4290 
4291 void avio_w8(AVIOContext *s, int b);
4292 void avio_write(AVIOContext *s, const unsigned char *buf, int size);
4293 void avio_wl64(AVIOContext *s, uint64_t val);
4294 void avio_wb64(AVIOContext *s, uint64_t val);
4295 void avio_wl32(AVIOContext *s, unsigned int val);
4296 void avio_wb32(AVIOContext *s, unsigned int val);
4297 void avio_wl24(AVIOContext *s, unsigned int val);
4298 void avio_wb24(AVIOContext *s, unsigned int val);
4299 void avio_wl16(AVIOContext *s, unsigned int val);
4300 void avio_wb16(AVIOContext *s, unsigned int val);
4301 
4302 int avio_put_str(AVIOContext *s, const char *str);
4303 
4304 int avio_put_str16le(AVIOContext *s, const char *str);
4305 
4306 int avio_put_str16be(AVIOContext *s, const char *str);
4307 
4308 void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type);
4309 
4310 #define AVSEEK_SIZE 0x10000
4311 
4312 #define AVSEEK_FORCE 0x20000
4313 
4314 int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
4315 
4316 int64_t avio_skip(AVIOContext *s, int64_t offset);
4317 
avio_tell(AVIOContext * s)4318 static av_always_inline int64_t avio_tell(AVIOContext *s)
4319 {
4320     return avio_seek(s, 0, SEEK_CUR);
4321 }
4322 
4323 int64_t avio_size(AVIOContext *s);
4324 
4325 int avio_feof(AVIOContext *s);
4326 
4327 attribute_deprecated
4328 int url_feof(AVIOContext *s);
4329 
4330 int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
4331 
4332 void avio_flush(AVIOContext *s);
4333 
4334 int avio_read(AVIOContext *s, unsigned char *buf, int size);
4335 
4336 int avio_read_partial(AVIOContext *s, unsigned char *buf, int size);
4337 
4338 int          avio_r8  (AVIOContext *s);
4339 unsigned int avio_rl16(AVIOContext *s);
4340 unsigned int avio_rl24(AVIOContext *s);
4341 unsigned int avio_rl32(AVIOContext *s);
4342 uint64_t     avio_rl64(AVIOContext *s);
4343 unsigned int avio_rb16(AVIOContext *s);
4344 unsigned int avio_rb24(AVIOContext *s);
4345 unsigned int avio_rb32(AVIOContext *s);
4346 uint64_t     avio_rb64(AVIOContext *s);
4347 
4348 int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
4349 
4350 int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
4351 int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
4352 
4353 #define AVIO_FLAG_READ  1
4354 #define AVIO_FLAG_WRITE 2
4355 #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
4356 
4357 #define AVIO_FLAG_NONBLOCK 8
4358 
4359 #define AVIO_FLAG_DIRECT 0x8000
4360 
4361 int avio_open(AVIOContext **s, const char *url, int flags);
4362 
4363 int avio_open2(AVIOContext **s, const char *url, int flags,
4364                const AVIOInterruptCB *int_cb, AVDictionary **options);
4365 
4366 int avio_close(AVIOContext *s);
4367 
4368 int avio_closep(AVIOContext **s);
4369 
4370 int avio_open_dyn_buf(AVIOContext **s);
4371 
4372 int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
4373 
4374 int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
4375 
4376 const char *avio_enum_protocols(void **opaque, int output);
4377 
4378 int     avio_pause(AVIOContext *h, int pause);
4379 
4380 int64_t avio_seek_time(AVIOContext *h, int stream_index,
4381                        int64_t timestamp, int flags);
4382 
4383 struct AVBPrint;
4384 
4385 int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size);
4386 
4387 int avio_accept(AVIOContext *s, AVIOContext **c);
4388 
4389 int avio_handshake(AVIOContext *c);
4390 
4391 struct AVFormatContext;
4392 
4393 struct AVDeviceInfoList;
4394 struct AVDeviceCapabilitiesQuery;
4395 
4396 int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
4397 
4398 int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
4399 
4400 typedef struct AVFrac {
4401     int64_t val, num, den;
4402 } AVFrac;
4403 
4404 struct AVCodecTag;
4405 
4406 typedef struct AVProbeData {
4407     const char *filename;
4408     unsigned char *buf;
4409     int buf_size;
4410     const char *mime_type;
4411 } AVProbeData;
4412 
4413 #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
4414 #define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1)
4415 
4416 #define AVPROBE_SCORE_EXTENSION  50
4417 #define AVPROBE_SCORE_MIME       75
4418 #define AVPROBE_SCORE_MAX       100
4419 
4420 #define AVPROBE_PADDING_SIZE 32
4421 
4422 #define AVFMT_NOFILE        0x0001
4423 #define AVFMT_NEEDNUMBER    0x0002
4424 #define AVFMT_SHOW_IDS      0x0008
4425 #define AVFMT_RAWPICTURE    0x0020
4426 
4427 #define AVFMT_GLOBALHEADER  0x0040
4428 #define AVFMT_NOTIMESTAMPS  0x0080
4429 #define AVFMT_GENERIC_INDEX 0x0100
4430 #define AVFMT_TS_DISCONT    0x0200
4431 #define AVFMT_VARIABLE_FPS  0x0400
4432 #define AVFMT_NODIMENSIONS  0x0800
4433 #define AVFMT_NOSTREAMS     0x1000
4434 #define AVFMT_NOBINSEARCH   0x2000
4435 #define AVFMT_NOGENSEARCH   0x4000
4436 #define AVFMT_NO_BYTE_SEEK  0x8000
4437 #define AVFMT_ALLOW_FLUSH  0x10000
4438 #define AVFMT_TS_NONSTRICT 0x20000
4439 
4440 #define AVFMT_TS_NEGATIVE  0x40000
4441 
4442 #define AVFMT_SEEK_TO_PTS   0x4000000
4443 
4444 typedef struct AVOutputFormat {
4445     const char *name;
4446 
4447     const char *long_name;
4448     const char *mime_type;
4449     const char *extensions;
4450 
4451     enum AVCodecID audio_codec;
4452     enum AVCodecID video_codec;
4453     enum AVCodecID subtitle_codec;
4454 
4455     int flags;
4456 
4457     const struct AVCodecTag * const *codec_tag;
4458 
4459     const AVClass *priv_class;
4460 
4461     struct AVOutputFormat *next;
4462 
4463     int priv_data_size;
4464 
4465     int (*write_header)(struct AVFormatContext *);
4466 
4467     int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
4468     int (*write_trailer)(struct AVFormatContext *);
4469 
4470     int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
4471                              AVPacket *in, int flush);
4472 
4473     int (*query_codec)(enum AVCodecID id, int std_compliance);
4474 
4475     void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
4476                                  int64_t *dts, int64_t *wall);
4477 
4478     int (*control_message)(struct AVFormatContext *s, int type,
4479                            void *data, size_t data_size);
4480 
4481     int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index,
4482                                AVFrame **frame, unsigned flags);
4483 
4484     int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
4485 
4486     int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
4487 
4488     int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
4489     enum AVCodecID data_codec;
4490 
4491     int (*init)(struct AVFormatContext *);
4492 
4493     void (*deinit)(struct AVFormatContext *);
4494 
4495     int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt);
4496 } AVOutputFormat;
4497 
4498 typedef struct AVInputFormat {
4499 
4500     const char *name;
4501 
4502     const char *long_name;
4503 
4504     int flags;
4505 
4506     const char *extensions;
4507 
4508     const struct AVCodecTag * const *codec_tag;
4509 
4510     const AVClass *priv_class;
4511 
4512     const char *mime_type;
4513 
4514     struct AVInputFormat *next;
4515 
4516     int raw_codec_id;
4517 
4518     int priv_data_size;
4519 
4520     int (*read_probe)(AVProbeData *);
4521 
4522     int (*read_header)(struct AVFormatContext *);
4523 
4524     int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
4525 
4526     int (*read_close)(struct AVFormatContext *);
4527 
4528     int (*read_seek)(struct AVFormatContext *,
4529                      int stream_index, int64_t timestamp, int flags);
4530 
4531     int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
4532                               int64_t *pos, int64_t pos_limit);
4533 
4534     int (*read_play)(struct AVFormatContext *);
4535 
4536     int (*read_pause)(struct AVFormatContext *);
4537 
4538     int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
4539 
4540     int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
4541 
4542     int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
4543 
4544     int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
4545 } AVInputFormat;
4546 
4547 enum AVStreamParseType {
4548     AVSTREAM_PARSE_NONE,
4549     AVSTREAM_PARSE_FULL,
4550     AVSTREAM_PARSE_HEADERS,
4551     AVSTREAM_PARSE_TIMESTAMPS,
4552     AVSTREAM_PARSE_FULL_ONCE,
4553     AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),
4554 
4555 };
4556 
4557 typedef struct AVIndexEntry {
4558     int64_t pos;
4559     int64_t timestamp;
4560 
4561 #define AVINDEX_KEYFRAME 0x0001
4562 #define AVINDEX_DISCARD_FRAME  0x0002
4563 
4564     int flags:2;
4565     int size:30;
4566     int min_distance;
4567 } AVIndexEntry;
4568 
4569 #define AV_DISPOSITION_DEFAULT   0x0001
4570 #define AV_DISPOSITION_DUB       0x0002
4571 #define AV_DISPOSITION_ORIGINAL  0x0004
4572 #define AV_DISPOSITION_COMMENT   0x0008
4573 #define AV_DISPOSITION_LYRICS    0x0010
4574 #define AV_DISPOSITION_KARAOKE   0x0020
4575 
4576 #define AV_DISPOSITION_FORCED    0x0040
4577 #define AV_DISPOSITION_HEARING_IMPAIRED  0x0080
4578 #define AV_DISPOSITION_VISUAL_IMPAIRED   0x0100
4579 #define AV_DISPOSITION_CLEAN_EFFECTS     0x0200
4580 
4581 #define AV_DISPOSITION_ATTACHED_PIC      0x0400
4582 
4583 #define AV_DISPOSITION_TIMED_THUMBNAILS  0x0800
4584 
4585 typedef struct AVStreamInternal AVStreamInternal;
4586 
4587 #define AV_DISPOSITION_CAPTIONS     0x10000
4588 #define AV_DISPOSITION_DESCRIPTIONS 0x20000
4589 #define AV_DISPOSITION_METADATA     0x40000
4590 
4591 #define AV_PTS_WRAP_IGNORE      0
4592 #define AV_PTS_WRAP_ADD_OFFSET  1
4593 #define AV_PTS_WRAP_SUB_OFFSET  -1
4594 
4595 typedef struct AVStream {
4596     int index;
4597 
4598     int id;
4599 
4600     attribute_deprecated
4601     AVCodecContext *codec;
4602     void *priv_data;
4603 
4604     attribute_deprecated
4605     struct AVFrac pts;
4606 
4607     AVRational time_base;
4608 
4609     int64_t start_time;
4610 
4611     int64_t duration;
4612 
4613     int64_t nb_frames;
4614 
4615     int disposition;
4616 
4617     enum AVDiscard discard;
4618 
4619     AVRational sample_aspect_ratio;
4620 
4621     AVDictionary *metadata;
4622 
4623     AVRational avg_frame_rate;
4624 
4625     AVPacket attached_pic;
4626 
4627     AVPacketSideData *side_data;
4628 
4629     int            nb_side_data;
4630 
4631     int event_flags;
4632 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001
4633 
4634 #define MAX_STD_TIMEBASES (30*12+30+3+6)
4635     struct {
4636         int64_t last_dts;
4637         int64_t duration_gcd;
4638         int duration_count;
4639         int64_t rfps_duration_sum;
4640         double (*duration_error)[2][MAX_STD_TIMEBASES];
4641         int64_t codec_info_duration;
4642         int64_t codec_info_duration_fields;
4643 
4644         int found_decoder;
4645 
4646         int64_t last_duration;
4647 
4648         int64_t fps_first_dts;
4649         int     fps_first_dts_idx;
4650         int64_t fps_last_dts;
4651         int     fps_last_dts_idx;
4652 
4653     } *info;
4654 
4655     int pts_wrap_bits;
4656 
4657     int64_t first_dts;
4658     int64_t cur_dts;
4659     int64_t last_IP_pts;
4660     int last_IP_duration;
4661 
4662     int probe_packets;
4663 
4664     int codec_info_nb_frames;
4665 
4666     enum AVStreamParseType need_parsing;
4667     struct AVCodecParserContext *parser;
4668 
4669     struct AVPacketList *last_in_packet_buffer;
4670     AVProbeData probe_data;
4671 #define MAX_REORDER_DELAY 16
4672     int64_t pts_buffer[MAX_REORDER_DELAY+1];
4673 
4674     AVIndexEntry *index_entries;
4675 
4676     int nb_index_entries;
4677     unsigned int index_entries_allocated_size;
4678 
4679     AVRational r_frame_rate;
4680 
4681     int stream_identifier;
4682 
4683     int64_t interleaver_chunk_size;
4684     int64_t interleaver_chunk_duration;
4685 
4686     int request_probe;
4687 
4688     int skip_to_keyframe;
4689 
4690     int skip_samples;
4691 
4692     int64_t start_skip_samples;
4693 
4694     int64_t first_discard_sample;
4695 
4696     int64_t last_discard_sample;
4697 
4698     int nb_decoded_frames;
4699 
4700     int64_t mux_ts_offset;
4701 
4702     int64_t pts_wrap_reference;
4703 
4704     int pts_wrap_behavior;
4705 
4706     int update_initial_durations_done;
4707 
4708     int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
4709     uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
4710 
4711     int64_t last_dts_for_order_check;
4712     uint8_t dts_ordered;
4713     uint8_t dts_misordered;
4714 
4715     int inject_global_side_data;
4716 
4717     char *recommended_encoder_configuration;
4718 
4719     AVRational display_aspect_ratio;
4720 
4721     struct FFFrac *priv_pts;
4722 
4723     AVStreamInternal *internal;
4724 
4725     AVCodecParameters *codecpar;
4726 } AVStream;
4727 
4728 AVRational av_stream_get_r_frame_rate(const AVStream *s);
4729 void       av_stream_set_r_frame_rate(AVStream *s, AVRational r);
4730 struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
4731 char* av_stream_get_recommended_encoder_configuration(const AVStream *s);
4732 void  av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration);
4733 
4734 int64_t    av_stream_get_end_pts(const AVStream *st);
4735 
4736 #define AV_PROGRAM_RUNNING 1
4737 
4738 typedef struct AVProgram {
4739     int            id;
4740     int            flags;
4741     enum AVDiscard discard;
4742     unsigned int   *stream_index;
4743     unsigned int   nb_stream_indexes;
4744     AVDictionary *metadata;
4745 
4746     int program_num;
4747     int pmt_pid;
4748     int pcr_pid;
4749 
4750     int64_t start_time;
4751     int64_t end_time;
4752 
4753     int64_t pts_wrap_reference;
4754     int pts_wrap_behavior;
4755 } AVProgram;
4756 
4757 #define AVFMTCTX_NOHEADER      0x0001
4758 
4759 typedef struct AVChapter {
4760     int id;
4761     AVRational time_base;
4762     int64_t start, end;
4763     AVDictionary *metadata;
4764 } AVChapter;
4765 
4766 typedef int (*av_format_control_message)(struct AVFormatContext *s, int type,
4767                                          void *data, size_t data_size);
4768 
4769 typedef int (*AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags,
4770                               const AVIOInterruptCB *int_cb, AVDictionary **options);
4771 
4772 enum AVDurationEstimationMethod {
4773     AVFMT_DURATION_FROM_PTS,
4774     AVFMT_DURATION_FROM_STREAM,
4775     AVFMT_DURATION_FROM_BITRATE
4776 };
4777 
4778 typedef struct AVFormatInternal AVFormatInternal;
4779 
4780 typedef struct AVFormatContext {
4781 
4782     const AVClass *av_class;
4783 
4784     struct AVInputFormat *iformat;
4785 
4786     struct AVOutputFormat *oformat;
4787 
4788     void *priv_data;
4789 
4790     AVIOContext *pb;
4791 
4792     int ctx_flags;
4793 
4794     unsigned int nb_streams;
4795 
4796     AVStream **streams;
4797 
4798     char filename[1024];
4799 
4800     int64_t start_time;
4801 
4802     int64_t duration;
4803 
4804     int64_t bit_rate;
4805 
4806     unsigned int packet_size;
4807     int max_delay;
4808 
4809     int flags;
4810 #define AVFMT_FLAG_GENPTS       0x0001
4811 #define AVFMT_FLAG_IGNIDX       0x0002
4812 #define AVFMT_FLAG_NONBLOCK     0x0004
4813 #define AVFMT_FLAG_IGNDTS       0x0008
4814 #define AVFMT_FLAG_NOFILLIN     0x0010
4815 #define AVFMT_FLAG_NOPARSE      0x0020
4816 #define AVFMT_FLAG_NOBUFFER     0x0040
4817 #define AVFMT_FLAG_CUSTOM_IO    0x0080
4818 #define AVFMT_FLAG_DISCARD_CORRUPT  0x0100
4819 #define AVFMT_FLAG_FLUSH_PACKETS    0x0200
4820 
4821 #define AVFMT_FLAG_BITEXACT         0x0400
4822 #define AVFMT_FLAG_MP4A_LATM    0x8000
4823 #define AVFMT_FLAG_SORT_DTS    0x10000
4824 #define AVFMT_FLAG_PRIV_OPT    0x20000
4825 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000
4826 #define AVFMT_FLAG_FAST_SEEK   0x80000
4827 #define AVFMT_FLAG_SHORTEST   0x100000
4828 #define AVFMT_FLAG_AUTO_BSF   0x200000
4829 
4830     int64_t probesize;
4831 
4832     int64_t max_analyze_duration;
4833 
4834     const uint8_t *key;
4835     int keylen;
4836 
4837     unsigned int nb_programs;
4838     AVProgram **programs;
4839 
4840     enum AVCodecID video_codec_id;
4841 
4842     enum AVCodecID audio_codec_id;
4843 
4844     enum AVCodecID subtitle_codec_id;
4845 
4846     unsigned int max_index_size;
4847 
4848     unsigned int max_picture_buffer;
4849 
4850     unsigned int nb_chapters;
4851     AVChapter **chapters;
4852 
4853     AVDictionary *metadata;
4854 
4855     int64_t start_time_realtime;
4856 
4857     int fps_probe_size;
4858 
4859     int error_recognition;
4860 
4861     AVIOInterruptCB interrupt_callback;
4862 
4863     int debug;
4864 #define FF_FDEBUG_TS        0x0001
4865 
4866     int64_t max_interleave_delta;
4867 
4868     int strict_std_compliance;
4869 
4870     int event_flags;
4871 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001
4872 
4873     int max_ts_probe;
4874 
4875     int avoid_negative_ts;
4876 #define AVFMT_AVOID_NEG_TS_AUTO             -1
4877 #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1
4878 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO         2
4879 
4880     int ts_id;
4881 
4882     int audio_preload;
4883 
4884     int max_chunk_duration;
4885 
4886     int max_chunk_size;
4887 
4888     int use_wallclock_as_timestamps;
4889 
4890     int avio_flags;
4891 
4892     enum AVDurationEstimationMethod duration_estimation_method;
4893 
4894     int64_t skip_initial_bytes;
4895 
4896     unsigned int correct_ts_overflow;
4897 
4898     int seek2any;
4899 
4900     int flush_packets;
4901 
4902     int probe_score;
4903 
4904     int format_probesize;
4905 
4906     char *codec_whitelist;
4907 
4908     char *format_whitelist;
4909 
4910     AVFormatInternal *internal;
4911 
4912     int io_repositioned;
4913 
4914     AVCodec *video_codec;
4915 
4916     AVCodec *audio_codec;
4917 
4918     AVCodec *subtitle_codec;
4919 
4920     AVCodec *data_codec;
4921 
4922     int metadata_header_padding;
4923 
4924     void *opaque;
4925 
4926     av_format_control_message control_message_cb;
4927 
4928     int64_t output_ts_offset;
4929 
4930     uint8_t *dump_separator;
4931 
4932     enum AVCodecID data_codec_id;
4933 
4934     attribute_deprecated
4935     int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options);
4936 
4937     char *protocol_whitelist;
4938 
4939     int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
4940                    int flags, AVDictionary **options);
4941 
4942     void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
4943 
4944     char *protocol_blacklist;
4945 
4946     int max_streams;
4947 } AVFormatContext;
4948 
4949 int av_format_get_probe_score(const AVFormatContext *s);
4950 AVCodec * av_format_get_video_codec(const AVFormatContext *s);
4951 void      av_format_set_video_codec(AVFormatContext *s, AVCodec *c);
4952 AVCodec * av_format_get_audio_codec(const AVFormatContext *s);
4953 void      av_format_set_audio_codec(AVFormatContext *s, AVCodec *c);
4954 AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s);
4955 void      av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c);
4956 AVCodec * av_format_get_data_codec(const AVFormatContext *s);
4957 void      av_format_set_data_codec(AVFormatContext *s, AVCodec *c);
4958 int       av_format_get_metadata_header_padding(const AVFormatContext *s);
4959 void      av_format_set_metadata_header_padding(AVFormatContext *s, int c);
4960 void *    av_format_get_opaque(const AVFormatContext *s);
4961 void      av_format_set_opaque(AVFormatContext *s, void *opaque);
4962 av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s);
4963 void      av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback);
4964 attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s);
4965 attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback);
4966 
4967 void av_format_inject_global_side_data(AVFormatContext *s);
4968 
4969 enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx);
4970 
4971 typedef struct AVPacketList {
4972     AVPacket pkt;
4973     struct AVPacketList *next;
4974 } AVPacketList;
4975 
4976 unsigned avformat_version(void);
4977 
4978 const char *avformat_configuration(void);
4979 
4980 const char *avformat_license(void);
4981 
4982 void av_register_all(void);
4983 
4984 void av_register_input_format(AVInputFormat *format);
4985 void av_register_output_format(AVOutputFormat *format);
4986 
4987 int avformat_network_init(void);
4988 
4989 int avformat_network_deinit(void);
4990 
4991 AVInputFormat  *av_iformat_next(const AVInputFormat  *f);
4992 
4993 AVOutputFormat *av_oformat_next(const AVOutputFormat *f);
4994 
4995 AVFormatContext *avformat_alloc_context(void);
4996 
4997 void avformat_free_context(AVFormatContext *s);
4998 
4999 const AVClass *avformat_get_class(void);
5000 
5001 AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c);
5002 
5003 int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
5004                             uint8_t *data, size_t size);
5005 
5006 uint8_t *av_stream_new_side_data(AVStream *stream,
5007                                  enum AVPacketSideDataType type, int size);
5008 
5009 uint8_t *av_stream_get_side_data(AVStream *stream,
5010                                  enum AVPacketSideDataType type, int *size);
5011 
5012 AVProgram *av_new_program(AVFormatContext *s, int id);
5013 
5014 int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,
5015                                    const char *format_name, const char *filename);
5016 
5017 AVInputFormat *av_find_input_format(const char *short_name);
5018 
5019 AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
5020 
5021 AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
5022 
5023 AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret);
5024 
5025 int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
5026                            const char *url, void *logctx,
5027                            unsigned int offset, unsigned int max_probe_size);
5028 
5029 int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
5030                           const char *url, void *logctx,
5031                           unsigned int offset, unsigned int max_probe_size);
5032 
5033 int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
5034 
5035 attribute_deprecated
5036 int av_demuxer_open(AVFormatContext *ic);
5037 
5038 int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);
5039 
5040 AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s);
5041 
5042 void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
5043 
5044 int av_find_best_stream(AVFormatContext *ic,
5045                         enum AVMediaType type,
5046                         int wanted_stream_nb,
5047                         int related_stream,
5048                         AVCodec **decoder_ret,
5049                         int flags);
5050 
5051 int av_read_frame(AVFormatContext *s, AVPacket *pkt);
5052 
5053 int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
5054                   int flags);
5055 
5056 int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
5057 
5058 int avformat_flush(AVFormatContext *s);
5059 
5060 int av_read_play(AVFormatContext *s);
5061 
5062 int av_read_pause(AVFormatContext *s);
5063 
5064 void avformat_close_input(AVFormatContext **s);
5065 
5066 #define AVSEEK_FLAG_BACKWARD 1
5067 #define AVSEEK_FLAG_BYTE     2
5068 #define AVSEEK_FLAG_ANY      4
5069 #define AVSEEK_FLAG_FRAME    8
5070 
5071 #define AVSTREAM_INIT_IN_WRITE_HEADER 0
5072 #define AVSTREAM_INIT_IN_INIT_OUTPUT  1
5073 
5074 av_warn_unused_result
5075 int avformat_write_header(AVFormatContext *s, AVDictionary **options);
5076 
5077 av_warn_unused_result
5078 int avformat_init_output(AVFormatContext *s, AVDictionary **options);
5079 
5080 int av_write_frame(AVFormatContext *s, AVPacket *pkt);
5081 
5082 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
5083 
5084 int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
5085                            AVFrame *frame);
5086 
5087 int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index,
5088                                        AVFrame *frame);
5089 
5090 int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index);
5091 
5092 int av_write_trailer(AVFormatContext *s);
5093 
5094 AVOutputFormat *av_guess_format(const char *short_name,
5095                                 const char *filename,
5096                                 const char *mime_type);
5097 
5098 enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
5099                             const char *filename, const char *mime_type,
5100                             enum AVMediaType type);
5101 
5102 int av_get_output_timestamp(struct AVFormatContext *s, int stream,
5103                             int64_t *dts, int64_t *wall);
5104 
5105 void av_hex_dump(FILE *f, const uint8_t *buf, int size);
5106 
5107 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size);
5108 
5109 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st);
5110 
5111 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
5112                       const AVStream *st);
5113 
5114 enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
5115 
5116 unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
5117 
5118 int av_codec_get_tag2(const struct AVCodecTag * const *tags, enum AVCodecID id,
5119                       unsigned int *tag);
5120 
5121 int av_find_default_stream_index(AVFormatContext *s);
5122 
5123 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
5124 
5125 int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
5126                        int size, int distance, int flags);
5127 
5128 void av_url_split(char *proto,         int proto_size,
5129                   char *authorization, int authorization_size,
5130                   char *hostname,      int hostname_size,
5131                   int *port_ptr,
5132                   char *path,          int path_size,
5133                   const char *url);
5134 
5135 void av_dump_format(AVFormatContext *ic,
5136                     int index,
5137                     const char *url,
5138                     int is_output);
5139 
5140 #define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1
5141 
5142 int av_get_frame_filename2(char *buf, int buf_size,
5143                           const char *path, int number, int flags);
5144 
5145 int av_get_frame_filename(char *buf, int buf_size,
5146                           const char *path, int number);
5147 
5148 int av_filename_number_test(const char *filename);
5149 
5150 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
5151 
5152 int av_match_ext(const char *filename, const char *extensions);
5153 
5154 int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
5155                          int std_compliance);
5156 
5157 const struct AVCodecTag *avformat_get_riff_video_tags(void);
5158 
5159 const struct AVCodecTag *avformat_get_riff_audio_tags(void);
5160 
5161 const struct AVCodecTag *avformat_get_mov_video_tags(void);
5162 
5163 const struct AVCodecTag *avformat_get_mov_audio_tags(void);
5164 
5165 AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame);
5166 
5167 AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame);
5168 
5169 int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
5170                                     const char *spec);
5171 
5172 int avformat_queue_attached_pictures(AVFormatContext *s);
5173 
5174 attribute_deprecated
5175 int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
5176                                AVBitStreamFilterContext *bsfc);
5177 
5178 enum AVTimebaseSource {
5179     AVFMT_TBCF_AUTO = -1,
5180     AVFMT_TBCF_DECODER,
5181     AVFMT_TBCF_DEMUXER,
5182     AVFMT_TBCF_R_FRAMERATE,
5183 };
5184 
5185 int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
5186                                                   AVStream *ost, const AVStream *ist,
5187                                                   enum AVTimebaseSource copy_tb);
5188 
5189 AVRational av_stream_get_codec_timebase(const AVStream *st);
5190 
5191 #define AVUTIL_FIFO_H
5192 
5193 typedef struct AVFifoBuffer {
5194     uint8_t *buffer;
5195     uint8_t *rptr, *wptr, *end;
5196     uint32_t rndx, wndx;
5197 } AVFifoBuffer;
5198 
5199 AVFifoBuffer *av_fifo_alloc(unsigned int size);
5200 
5201 AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size);
5202 
5203 void av_fifo_free(AVFifoBuffer *f);
5204 
5205 void av_fifo_freep(AVFifoBuffer **f);
5206 
5207 void av_fifo_reset(AVFifoBuffer *f);
5208 
5209 int av_fifo_size(const AVFifoBuffer *f);
5210 
5211 int av_fifo_space(const AVFifoBuffer *f);
5212 
5213 int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int));
5214 
5215 int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
5216 
5217 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
5218 
5219 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
5220 
5221 int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
5222 
5223 int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
5224 
5225 void av_fifo_drain(AVFifoBuffer *f, int size);
5226 
av_fifo_peek2(const AVFifoBuffer * f,int offs)5227 static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
5228 {
5229     uint8_t *ptr = f->rptr + offs;
5230     if (ptr >= f->end)
5231         ptr = f->buffer + (ptr - f->end);
5232     else if (ptr < f->buffer)
5233         ptr = f->end - (f->buffer - ptr);
5234     return ptr;
5235 }
5236 
5237