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