]> git.pld-linux.org Git - packages/firefox52-esr.git/blob - ffmpeg4.patch
- readded XUL/firefox SDK (-libs,-devel packages) as it's the last package providing...
[packages/firefox52-esr.git] / ffmpeg4.patch
1
2 # HG changeset patch
3 # User Jean-Yves Avenard <jyavenard@mozilla.com>
4 # Date 1524125955 -7200
5 # Node ID 2f39b32593bd0d1d5ebd7623bdf324610027074f
6 # Parent  b2e2129293dd05a64e0d9ccaf3ff214307b2c8b7
7 Bug 1435212 - Add support for FFmpeg 4.0. r=bryce, a=jcristau
8
9 MozReview-Commit-ID: JlDFSUyGQu
10
11 diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
12 --- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
13 +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
14 @@ -72,25 +72,31 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecode
15    mCodecContext->opaque = this;
16  
17    InitCodecContext();
18  
19    if (mExtraData) {
20      mCodecContext->extradata_size = mExtraData->Length();
21      // FFmpeg may use SIMD instructions to access the data which reads the
22      // data in 32 bytes block. Must ensure we have enough data to read.
23 +#if LIBAVCODEC_VERSION_MAJOR >= 58
24 +    mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
25 +#else
26      mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
27 +#endif
28      mCodecContext->extradata = mExtraData->Elements();
29    } else {
30      mCodecContext->extradata_size = 0;
31    }
32  
33 +#if LIBAVCODEC_VERSION_MAJOR < 57
34    if (codec->capabilities & CODEC_CAP_DR1) {
35      mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
36    }
37 +#endif
38  
39    if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
40      NS_WARNING("Couldn't initialise ffmpeg decoder");
41      mLib->avcodec_close(mCodecContext);
42      mLib->av_freep(&mCodecContext);
43      return NS_ERROR_FAILURE;
44    }
45  
46 diff --git a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
47 --- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
48 +++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
49 @@ -56,22 +56,24 @@ FFmpegLibWrapper::Link()
50  
51    enum {
52      AV_FUNC_AVUTIL_MASK = 1 << 8,
53      AV_FUNC_53 = 1 << 0,
54      AV_FUNC_54 = 1 << 1,
55      AV_FUNC_55 = 1 << 2,
56      AV_FUNC_56 = 1 << 3,
57      AV_FUNC_57 = 1 << 4,
58 +    AV_FUNC_58 = 1 << 5,
59      AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
60      AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
61      AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
62      AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
63      AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
64 -    AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
65 +    AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
66 +    AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
67      AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
68    };
69  
70    switch (macro) {
71      case 53:
72        version = AV_FUNC_53;
73        break;
74      case 54:
75 @@ -81,16 +83,19 @@ FFmpegLibWrapper::Link()
76        version = AV_FUNC_55;
77        break;
78      case 56:
79        version = AV_FUNC_56;
80        break;
81      case 57:
82        version = AV_FUNC_57;
83        break;
84 +    case 58:
85 +      version = AV_FUNC_58;
86 +      break;
87      default:
88        FFMPEG_LOG("Unknown avcodec version");
89        Unlink();
90        return isFFMpeg
91               ? ((macro > 57)
92                  ? LinkResult::UnknownFutureFFMpegVersion
93                  : LinkResult::UnknownOlderFFMpegVersion)
94               // All LibAV versions<54.35.1 are blocked, therefore we must be
95 @@ -129,19 +134,19 @@ FFmpegLibWrapper::Link()
96    AV_FUNC(av_parser_close, AV_FUNC_AVCODEC_ALL)
97    AV_FUNC(av_parser_parse2, AV_FUNC_AVCODEC_ALL)
98    AV_FUNC(avcodec_alloc_frame, (AV_FUNC_53 | AV_FUNC_54))
99    AV_FUNC(avcodec_get_frame_defaults, (AV_FUNC_53 | AV_FUNC_54))
100    AV_FUNC(avcodec_free_frame, AV_FUNC_54)
101    AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
102    AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
103    AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
104 -  AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
105 -  AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
106 -  AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
107 +  AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
108 +  AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
109 +  AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
110    AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
111  #undef AV_FUNC
112  #undef AV_FUNC_OPTION
113  
114    avcodec_register_all();
115  #ifdef DEBUG
116    av_log_set_level(AV_LOG_DEBUG);
117  #endif
118 diff --git a/dom/media/platforms/ffmpeg/FFmpegLibs.h b/dom/media/platforms/ffmpeg/FFmpegLibs.h
119 --- a/dom/media/platforms/ffmpeg/FFmpegLibs.h
120 +++ b/dom/media/platforms/ffmpeg/FFmpegLibs.h
121 @@ -22,17 +22,19 @@ extern "C" {
122  #if LIBAVCODEC_VERSION_MAJOR < 55
123  #define AV_CODEC_ID_VP6F CODEC_ID_VP6F
124  #define AV_CODEC_ID_H264 CODEC_ID_H264
125  #define AV_CODEC_ID_AAC CODEC_ID_AAC
126  #define AV_CODEC_ID_MP3 CODEC_ID_MP3
127  #define AV_CODEC_ID_VP8 CODEC_ID_VP8
128  #define AV_CODEC_ID_NONE CODEC_ID_NONE
129  #define AV_CODEC_ID_FLAC CODEC_ID_FLAC
130 +typedef CodecID AVCodecID;
131 +#endif
132 +#if LIBAVCODEC_VERSION_MAJOR <= 55
133 -typedef CodecID AVCodecID;
134  #endif
135  
136  #ifdef FFVPX_VERSION
137  enum { LIBAV_VER = FFVPX_VERSION };
138  #else
139  enum { LIBAV_VER = LIBAVCODEC_VERSION_MAJOR };
140  #endif
141  
142 diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
143 --- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
144 +++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
145 @@ -21,22 +21,25 @@ template <int V> class FFmpegDecoderModu
146  public:
147    static already_AddRefed<PlatformDecoderModule> Create(FFmpegLibWrapper*);
148  };
149  
150  static FFmpegLibWrapper sLibAV;
151  
152  static const char* sLibs[] = {
153  #if defined(XP_DARWIN)
154 +  "libavcodec.58.dylib",
155    "libavcodec.57.dylib",
156    "libavcodec.56.dylib",
157    "libavcodec.55.dylib",
158    "libavcodec.54.dylib",
159    "libavcodec.53.dylib",
160  #else
161 +  "libavcodec.so.58",
162 +  "libavcodec-ffmpeg.so.58",
163    "libavcodec-ffmpeg.so.57",
164    "libavcodec-ffmpeg.so.56",
165    "libavcodec.so.57",
166    "libavcodec.so.56",
167    "libavcodec.so.55",
168    "libavcodec.so.54",
169    "libavcodec.so.53",
170  #endif
171 @@ -129,16 +132,17 @@ FFmpegRuntimeLinker::CreateDecoderModule
172    }
173    RefPtr<PlatformDecoderModule> module;
174    switch (sLibAV.mVersion) {
175      case 53: module = FFmpegDecoderModule<53>::Create(&sLibAV); break;
176      case 54: module = FFmpegDecoderModule<54>::Create(&sLibAV); break;
177      case 55:
178      case 56: module = FFmpegDecoderModule<55>::Create(&sLibAV); break;
179      case 57: module = FFmpegDecoderModule<57>::Create(&sLibAV); break;
180 +    case 58: module = FFmpegDecoderModule<58>::Create(&sLibAV); break;
181      default: module = nullptr;
182    }
183    return module.forget();
184  }
185  
186  /* static */ const char*
187  FFmpegRuntimeLinker::LinkStatusString()
188  {
189 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
190 new file mode 100644
191 --- /dev/null
192 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
193 @@ -0,0 +1,504 @@
194 +                  GNU LESSER GENERAL PUBLIC LICENSE
195 +                       Version 2.1, February 1999
196 +
197 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
198 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
199 + Everyone is permitted to copy and distribute verbatim copies
200 + of this license document, but changing it is not allowed.
201 +
202 +[This is the first released version of the Lesser GPL.  It also counts
203 + as the successor of the GNU Library Public License, version 2, hence
204 + the version number 2.1.]
205 +
206 +                            Preamble
207 +
208 +  The licenses for most software are designed to take away your
209 +freedom to share and change it.  By contrast, the GNU General Public
210 +Licenses are intended to guarantee your freedom to share and change
211 +free software--to make sure the software is free for all its users.
212 +
213 +  This license, the Lesser General Public License, applies to some
214 +specially designated software packages--typically libraries--of the
215 +Free Software Foundation and other authors who decide to use it.  You
216 +can use it too, but we suggest you first think carefully about whether
217 +this license or the ordinary General Public License is the better
218 +strategy to use in any particular case, based on the explanations below.
219 +
220 +  When we speak of free software, we are referring to freedom of use,
221 +not price.  Our General Public Licenses are designed to make sure that
222 +you have the freedom to distribute copies of free software (and charge
223 +for this service if you wish); that you receive source code or can get
224 +it if you want it; that you can change the software and use pieces of
225 +it in new free programs; and that you are informed that you can do
226 +these things.
227 +
228 +  To protect your rights, we need to make restrictions that forbid
229 +distributors to deny you these rights or to ask you to surrender these
230 +rights.  These restrictions translate to certain responsibilities for
231 +you if you distribute copies of the library or if you modify it.
232 +
233 +  For example, if you distribute copies of the library, whether gratis
234 +or for a fee, you must give the recipients all the rights that we gave
235 +you.  You must make sure that they, too, receive or can get the source
236 +code.  If you link other code with the library, you must provide
237 +complete object files to the recipients, so that they can relink them
238 +with the library after making changes to the library and recompiling
239 +it.  And you must show them these terms so they know their rights.
240 +
241 +  We protect your rights with a two-step method: (1) we copyright the
242 +library, and (2) we offer you this license, which gives you legal
243 +permission to copy, distribute and/or modify the library.
244 +
245 +  To protect each distributor, we want to make it very clear that
246 +there is no warranty for the free library.  Also, if the library is
247 +modified by someone else and passed on, the recipients should know
248 +that what they have is not the original version, so that the original
249 +author's reputation will not be affected by problems that might be
250 +introduced by others.
251 +\f
252 +  Finally, software patents pose a constant threat to the existence of
253 +any free program.  We wish to make sure that a company cannot
254 +effectively restrict the users of a free program by obtaining a
255 +restrictive license from a patent holder.  Therefore, we insist that
256 +any patent license obtained for a version of the library must be
257 +consistent with the full freedom of use specified in this license.
258 +
259 +  Most GNU software, including some libraries, is covered by the
260 +ordinary GNU General Public License.  This license, the GNU Lesser
261 +General Public License, applies to certain designated libraries, and
262 +is quite different from the ordinary General Public License.  We use
263 +this license for certain libraries in order to permit linking those
264 +libraries into non-free programs.
265 +
266 +  When a program is linked with a library, whether statically or using
267 +a shared library, the combination of the two is legally speaking a
268 +combined work, a derivative of the original library.  The ordinary
269 +General Public License therefore permits such linking only if the
270 +entire combination fits its criteria of freedom.  The Lesser General
271 +Public License permits more lax criteria for linking other code with
272 +the library.
273 +
274 +  We call this license the "Lesser" General Public License because it
275 +does Less to protect the user's freedom than the ordinary General
276 +Public License.  It also provides other free software developers Less
277 +of an advantage over competing non-free programs.  These disadvantages
278 +are the reason we use the ordinary General Public License for many
279 +libraries.  However, the Lesser license provides advantages in certain
280 +special circumstances.
281 +
282 +  For example, on rare occasions, there may be a special need to
283 +encourage the widest possible use of a certain library, so that it becomes
284 +a de-facto standard.  To achieve this, non-free programs must be
285 +allowed to use the library.  A more frequent case is that a free
286 +library does the same job as widely used non-free libraries.  In this
287 +case, there is little to gain by limiting the free library to free
288 +software only, so we use the Lesser General Public License.
289 +
290 +  In other cases, permission to use a particular library in non-free
291 +programs enables a greater number of people to use a large body of
292 +free software.  For example, permission to use the GNU C Library in
293 +non-free programs enables many more people to use the whole GNU
294 +operating system, as well as its variant, the GNU/Linux operating
295 +system.
296 +
297 +  Although the Lesser General Public License is Less protective of the
298 +users' freedom, it does ensure that the user of a program that is
299 +linked with the Library has the freedom and the wherewithal to run
300 +that program using a modified version of the Library.
301 +
302 +  The precise terms and conditions for copying, distribution and
303 +modification follow.  Pay close attention to the difference between a
304 +"work based on the library" and a "work that uses the library".  The
305 +former contains code derived from the library, whereas the latter must
306 +be combined with the library in order to run.
307 +\f
308 +                  GNU LESSER GENERAL PUBLIC LICENSE
309 +   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
310 +
311 +  0. This License Agreement applies to any software library or other
312 +program which contains a notice placed by the copyright holder or
313 +other authorized party saying it may be distributed under the terms of
314 +this Lesser General Public License (also called "this License").
315 +Each licensee is addressed as "you".
316 +
317 +  A "library" means a collection of software functions and/or data
318 +prepared so as to be conveniently linked with application programs
319 +(which use some of those functions and data) to form executables.
320 +
321 +  The "Library", below, refers to any such software library or work
322 +which has been distributed under these terms.  A "work based on the
323 +Library" means either the Library or any derivative work under
324 +copyright law: that is to say, a work containing the Library or a
325 +portion of it, either verbatim or with modifications and/or translated
326 +straightforwardly into another language.  (Hereinafter, translation is
327 +included without limitation in the term "modification".)
328 +
329 +  "Source code" for a work means the preferred form of the work for
330 +making modifications to it.  For a library, complete source code means
331 +all the source code for all modules it contains, plus any associated
332 +interface definition files, plus the scripts used to control compilation
333 +and installation of the library.
334 +
335 +  Activities other than copying, distribution and modification are not
336 +covered by this License; they are outside its scope.  The act of
337 +running a program using the Library is not restricted, and output from
338 +such a program is covered only if its contents constitute a work based
339 +on the Library (independent of the use of the Library in a tool for
340 +writing it).  Whether that is true depends on what the Library does
341 +and what the program that uses the Library does.
342 +
343 +  1. You may copy and distribute verbatim copies of the Library's
344 +complete source code as you receive it, in any medium, provided that
345 +you conspicuously and appropriately publish on each copy an
346 +appropriate copyright notice and disclaimer of warranty; keep intact
347 +all the notices that refer to this License and to the absence of any
348 +warranty; and distribute a copy of this License along with the
349 +Library.
350 +
351 +  You may charge a fee for the physical act of transferring a copy,
352 +and you may at your option offer warranty protection in exchange for a
353 +fee.
354 +\f
355 +  2. You may modify your copy or copies of the Library or any portion
356 +of it, thus forming a work based on the Library, and copy and
357 +distribute such modifications or work under the terms of Section 1
358 +above, provided that you also meet all of these conditions:
359 +
360 +    a) The modified work must itself be a software library.
361 +
362 +    b) You must cause the files modified to carry prominent notices
363 +    stating that you changed the files and the date of any change.
364 +
365 +    c) You must cause the whole of the work to be licensed at no
366 +    charge to all third parties under the terms of this License.
367 +
368 +    d) If a facility in the modified Library refers to a function or a
369 +    table of data to be supplied by an application program that uses
370 +    the facility, other than as an argument passed when the facility
371 +    is invoked, then you must make a good faith effort to ensure that,
372 +    in the event an application does not supply such function or
373 +    table, the facility still operates, and performs whatever part of
374 +    its purpose remains meaningful.
375 +
376 +    (For example, a function in a library to compute square roots has
377 +    a purpose that is entirely well-defined independent of the
378 +    application.  Therefore, Subsection 2d requires that any
379 +    application-supplied function or table used by this function must
380 +    be optional: if the application does not supply it, the square
381 +    root function must still compute square roots.)
382 +
383 +These requirements apply to the modified work as a whole.  If
384 +identifiable sections of that work are not derived from the Library,
385 +and can be reasonably considered independent and separate works in
386 +themselves, then this License, and its terms, do not apply to those
387 +sections when you distribute them as separate works.  But when you
388 +distribute the same sections as part of a whole which is a work based
389 +on the Library, the distribution of the whole must be on the terms of
390 +this License, whose permissions for other licensees extend to the
391 +entire whole, and thus to each and every part regardless of who wrote
392 +it.
393 +
394 +Thus, it is not the intent of this section to claim rights or contest
395 +your rights to work written entirely by you; rather, the intent is to
396 +exercise the right to control the distribution of derivative or
397 +collective works based on the Library.
398 +
399 +In addition, mere aggregation of another work not based on the Library
400 +with the Library (or with a work based on the Library) on a volume of
401 +a storage or distribution medium does not bring the other work under
402 +the scope of this License.
403 +
404 +  3. You may opt to apply the terms of the ordinary GNU General Public
405 +License instead of this License to a given copy of the Library.  To do
406 +this, you must alter all the notices that refer to this License, so
407 +that they refer to the ordinary GNU General Public License, version 2,
408 +instead of to this License.  (If a newer version than version 2 of the
409 +ordinary GNU General Public License has appeared, then you can specify
410 +that version instead if you wish.)  Do not make any other change in
411 +these notices.
412 +\f
413 +  Once this change is made in a given copy, it is irreversible for
414 +that copy, so the ordinary GNU General Public License applies to all
415 +subsequent copies and derivative works made from that copy.
416 +
417 +  This option is useful when you wish to copy part of the code of
418 +the Library into a program that is not a library.
419 +
420 +  4. You may copy and distribute the Library (or a portion or
421 +derivative of it, under Section 2) in object code or executable form
422 +under the terms of Sections 1 and 2 above provided that you accompany
423 +it with the complete corresponding machine-readable source code, which
424 +must be distributed under the terms of Sections 1 and 2 above on a
425 +medium customarily used for software interchange.
426 +
427 +  If distribution of object code is made by offering access to copy
428 +from a designated place, then offering equivalent access to copy the
429 +source code from the same place satisfies the requirement to
430 +distribute the source code, even though third parties are not
431 +compelled to copy the source along with the object code.
432 +
433 +  5. A program that contains no derivative of any portion of the
434 +Library, but is designed to work with the Library by being compiled or
435 +linked with it, is called a "work that uses the Library".  Such a
436 +work, in isolation, is not a derivative work of the Library, and
437 +therefore falls outside the scope of this License.
438 +
439 +  However, linking a "work that uses the Library" with the Library
440 +creates an executable that is a derivative of the Library (because it
441 +contains portions of the Library), rather than a "work that uses the
442 +library".  The executable is therefore covered by this License.
443 +Section 6 states terms for distribution of such executables.
444 +
445 +  When a "work that uses the Library" uses material from a header file
446 +that is part of the Library, the object code for the work may be a
447 +derivative work of the Library even though the source code is not.
448 +Whether this is true is especially significant if the work can be
449 +linked without the Library, or if the work is itself a library.  The
450 +threshold for this to be true is not precisely defined by law.
451 +
452 +  If such an object file uses only numerical parameters, data
453 +structure layouts and accessors, and small macros and small inline
454 +functions (ten lines or less in length), then the use of the object
455 +file is unrestricted, regardless of whether it is legally a derivative
456 +work.  (Executables containing this object code plus portions of the
457 +Library will still fall under Section 6.)
458 +
459 +  Otherwise, if the work is a derivative of the Library, you may
460 +distribute the object code for the work under the terms of Section 6.
461 +Any executables containing that work also fall under Section 6,
462 +whether or not they are linked directly with the Library itself.
463 +\f
464 +  6. As an exception to the Sections above, you may also combine or
465 +link a "work that uses the Library" with the Library to produce a
466 +work containing portions of the Library, and distribute that work
467 +under terms of your choice, provided that the terms permit
468 +modification of the work for the customer's own use and reverse
469 +engineering for debugging such modifications.
470 +
471 +  You must give prominent notice with each copy of the work that the
472 +Library is used in it and that the Library and its use are covered by
473 +this License.  You must supply a copy of this License.  If the work
474 +during execution displays copyright notices, you must include the
475 +copyright notice for the Library among them, as well as a reference
476 +directing the user to the copy of this License.  Also, you must do one
477 +of these things:
478 +
479 +    a) Accompany the work with the complete corresponding
480 +    machine-readable source code for the Library including whatever
481 +    changes were used in the work (which must be distributed under
482 +    Sections 1 and 2 above); and, if the work is an executable linked
483 +    with the Library, with the complete machine-readable "work that
484 +    uses the Library", as object code and/or source code, so that the
485 +    user can modify the Library and then relink to produce a modified
486 +    executable containing the modified Library.  (It is understood
487 +    that the user who changes the contents of definitions files in the
488 +    Library will not necessarily be able to recompile the application
489 +    to use the modified definitions.)
490 +
491 +    b) Use a suitable shared library mechanism for linking with the
492 +    Library.  A suitable mechanism is one that (1) uses at run time a
493 +    copy of the library already present on the user's computer system,
494 +    rather than copying library functions into the executable, and (2)
495 +    will operate properly with a modified version of the library, if
496 +    the user installs one, as long as the modified version is
497 +    interface-compatible with the version that the work was made with.
498 +
499 +    c) Accompany the work with a written offer, valid for at
500 +    least three years, to give the same user the materials
501 +    specified in Subsection 6a, above, for a charge no more
502 +    than the cost of performing this distribution.
503 +
504 +    d) If distribution of the work is made by offering access to copy
505 +    from a designated place, offer equivalent access to copy the above
506 +    specified materials from the same place.
507 +
508 +    e) Verify that the user has already received a copy of these
509 +    materials or that you have already sent this user a copy.
510 +
511 +  For an executable, the required form of the "work that uses the
512 +Library" must include any data and utility programs needed for
513 +reproducing the executable from it.  However, as a special exception,
514 +the materials to be distributed need not include anything that is
515 +normally distributed (in either source or binary form) with the major
516 +components (compiler, kernel, and so on) of the operating system on
517 +which the executable runs, unless that component itself accompanies
518 +the executable.
519 +
520 +  It may happen that this requirement contradicts the license
521 +restrictions of other proprietary libraries that do not normally
522 +accompany the operating system.  Such a contradiction means you cannot
523 +use both them and the Library together in an executable that you
524 +distribute.
525 +\f
526 +  7. You may place library facilities that are a work based on the
527 +Library side-by-side in a single library together with other library
528 +facilities not covered by this License, and distribute such a combined
529 +library, provided that the separate distribution of the work based on
530 +the Library and of the other library facilities is otherwise
531 +permitted, and provided that you do these two things:
532 +
533 +    a) Accompany the combined library with a copy of the same work
534 +    based on the Library, uncombined with any other library
535 +    facilities.  This must be distributed under the terms of the
536 +    Sections above.
537 +
538 +    b) Give prominent notice with the combined library of the fact
539 +    that part of it is a work based on the Library, and explaining
540 +    where to find the accompanying uncombined form of the same work.
541 +
542 +  8. You may not copy, modify, sublicense, link with, or distribute
543 +the Library except as expressly provided under this License.  Any
544 +attempt otherwise to copy, modify, sublicense, link with, or
545 +distribute the Library is void, and will automatically terminate your
546 +rights under this License.  However, parties who have received copies,
547 +or rights, from you under this License will not have their licenses
548 +terminated so long as such parties remain in full compliance.
549 +
550 +  9. You are not required to accept this License, since you have not
551 +signed it.  However, nothing else grants you permission to modify or
552 +distribute the Library or its derivative works.  These actions are
553 +prohibited by law if you do not accept this License.  Therefore, by
554 +modifying or distributing the Library (or any work based on the
555 +Library), you indicate your acceptance of this License to do so, and
556 +all its terms and conditions for copying, distributing or modifying
557 +the Library or works based on it.
558 +
559 +  10. Each time you redistribute the Library (or any work based on the
560 +Library), the recipient automatically receives a license from the
561 +original licensor to copy, distribute, link with or modify the Library
562 +subject to these terms and conditions.  You may not impose any further
563 +restrictions on the recipients' exercise of the rights granted herein.
564 +You are not responsible for enforcing compliance by third parties with
565 +this License.
566 +\f
567 +  11. If, as a consequence of a court judgment or allegation of patent
568 +infringement or for any other reason (not limited to patent issues),
569 +conditions are imposed on you (whether by court order, agreement or
570 +otherwise) that contradict the conditions of this License, they do not
571 +excuse you from the conditions of this License.  If you cannot
572 +distribute so as to satisfy simultaneously your obligations under this
573 +License and any other pertinent obligations, then as a consequence you
574 +may not distribute the Library at all.  For example, if a patent
575 +license would not permit royalty-free redistribution of the Library by
576 +all those who receive copies directly or indirectly through you, then
577 +the only way you could satisfy both it and this License would be to
578 +refrain entirely from distribution of the Library.
579 +
580 +If any portion of this section is held invalid or unenforceable under any
581 +particular circumstance, the balance of the section is intended to apply,
582 +and the section as a whole is intended to apply in other circumstances.
583 +
584 +It is not the purpose of this section to induce you to infringe any
585 +patents or other property right claims or to contest validity of any
586 +such claims; this section has the sole purpose of protecting the
587 +integrity of the free software distribution system which is
588 +implemented by public license practices.  Many people have made
589 +generous contributions to the wide range of software distributed
590 +through that system in reliance on consistent application of that
591 +system; it is up to the author/donor to decide if he or she is willing
592 +to distribute software through any other system and a licensee cannot
593 +impose that choice.
594 +
595 +This section is intended to make thoroughly clear what is believed to
596 +be a consequence of the rest of this License.
597 +
598 +  12. If the distribution and/or use of the Library is restricted in
599 +certain countries either by patents or by copyrighted interfaces, the
600 +original copyright holder who places the Library under this License may add
601 +an explicit geographical distribution limitation excluding those countries,
602 +so that distribution is permitted only in or among countries not thus
603 +excluded.  In such case, this License incorporates the limitation as if
604 +written in the body of this License.
605 +
606 +  13. The Free Software Foundation may publish revised and/or new
607 +versions of the Lesser General Public License from time to time.
608 +Such new versions will be similar in spirit to the present version,
609 +but may differ in detail to address new problems or concerns.
610 +
611 +Each version is given a distinguishing version number.  If the Library
612 +specifies a version number of this License which applies to it and
613 +"any later version", you have the option of following the terms and
614 +conditions either of that version or of any later version published by
615 +the Free Software Foundation.  If the Library does not specify a
616 +license version number, you may choose any version ever published by
617 +the Free Software Foundation.
618 +\f
619 +  14. If you wish to incorporate parts of the Library into other free
620 +programs whose distribution conditions are incompatible with these,
621 +write to the author to ask for permission.  For software which is
622 +copyrighted by the Free Software Foundation, write to the Free
623 +Software Foundation; we sometimes make exceptions for this.  Our
624 +decision will be guided by the two goals of preserving the free status
625 +of all derivatives of our free software and of promoting the sharing
626 +and reuse of software generally.
627 +
628 +                            NO WARRANTY
629 +
630 +  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
631 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
632 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
633 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
634 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
635 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
636 +PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
637 +LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
638 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
639 +
640 +  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
641 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
642 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
643 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
644 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
645 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
646 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
647 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
648 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
649 +DAMAGES.
650 +
651 +                     END OF TERMS AND CONDITIONS
652 +\f
653 +           How to Apply These Terms to Your New Libraries
654 +
655 +  If you develop a new library, and you want it to be of the greatest
656 +possible use to the public, we recommend making it free software that
657 +everyone can redistribute and change.  You can do so by permitting
658 +redistribution under these terms (or, alternatively, under the terms of the
659 +ordinary General Public License).
660 +
661 +  To apply these terms, attach the following notices to the library.  It is
662 +safest to attach them to the start of each source file to most effectively
663 +convey the exclusion of warranty; and each file should have at least the
664 +"copyright" line and a pointer to where the full notice is found.
665 +
666 +    <one line to give the library's name and a brief idea of what it does.>
667 +    Copyright (C) <year>  <name of author>
668 +
669 +    This library is free software; you can redistribute it and/or
670 +    modify it under the terms of the GNU Lesser General Public
671 +    License as published by the Free Software Foundation; either
672 +    version 2.1 of the License, or (at your option) any later version.
673 +
674 +    This library is distributed in the hope that it will be useful,
675 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
676 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
677 +    Lesser General Public License for more details.
678 +
679 +    You should have received a copy of the GNU Lesser General Public
680 +    License along with this library; if not, write to the Free Software
681 +    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
682 +
683 +Also add information on how to contact you by electronic and paper mail.
684 +
685 +You should also get your employer (if you work as a programmer) or your
686 +school, if any, to sign a "copyright disclaimer" for the library, if
687 +necessary.  Here is a sample; alter the names:
688 +
689 +  Yoyodyne, Inc., hereby disclaims all copyright interest in the
690 +  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
691 +
692 +  <signature of Ty Coon>, 1 April 1990
693 +  Ty Coon, President of Vice
694 +
695 +That's all there is to it!
696 +
697 +
698 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
699 new file mode 100644
700 --- /dev/null
701 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
702 @@ -0,0 +1,6146 @@
703 +/*
704 + * copyright (c) 2001 Fabrice Bellard
705 + *
706 + * This file is part of FFmpeg.
707 + *
708 + * FFmpeg is free software; you can redistribute it and/or
709 + * modify it under the terms of the GNU Lesser General Public
710 + * License as published by the Free Software Foundation; either
711 + * version 2.1 of the License, or (at your option) any later version.
712 + *
713 + * FFmpeg is distributed in the hope that it will be useful,
714 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
715 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
716 + * Lesser General Public License for more details.
717 + *
718 + * You should have received a copy of the GNU Lesser General Public
719 + * License along with FFmpeg; if not, write to the Free Software
720 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
721 + */
722 +
723 +#ifndef AVCODEC_AVCODEC_H
724 +#define AVCODEC_AVCODEC_H
725 +
726 +/**
727 + * @file
728 + * @ingroup libavc
729 + * Libavcodec external API header
730 + */
731 +
732 +#include <errno.h>
733 +#include "libavutil/samplefmt.h"
734 +#include "libavutil/attributes.h"
735 +#include "libavutil/avutil.h"
736 +#include "libavutil/buffer.h"
737 +#include "libavutil/cpu.h"
738 +#include "libavutil/channel_layout.h"
739 +#include "libavutil/dict.h"
740 +#include "libavutil/frame.h"
741 +#include "libavutil/hwcontext.h"
742 +#include "libavutil/log.h"
743 +#include "libavutil/pixfmt.h"
744 +#include "libavutil/rational.h"
745 +
746 +#include "version.h"
747 +
748 +/**
749 + * @defgroup libavc libavcodec
750 + * Encoding/Decoding Library
751 + *
752 + * @{
753 + *
754 + * @defgroup lavc_decoding Decoding
755 + * @{
756 + * @}
757 + *
758 + * @defgroup lavc_encoding Encoding
759 + * @{
760 + * @}
761 + *
762 + * @defgroup lavc_codec Codecs
763 + * @{
764 + * @defgroup lavc_codec_native Native Codecs
765 + * @{
766 + * @}
767 + * @defgroup lavc_codec_wrappers External library wrappers
768 + * @{
769 + * @}
770 + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
771 + * @{
772 + * @}
773 + * @}
774 + * @defgroup lavc_internal Internal
775 + * @{
776 + * @}
777 + * @}
778 + */
779 +
780 +/**
781 + * @ingroup libavc
782 + * @defgroup lavc_encdec send/receive encoding and decoding API overview
783 + * @{
784 + *
785 + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
786 + * avcodec_receive_packet() functions provide an encode/decode API, which
787 + * decouples input and output.
788 + *
789 + * The API is very similar for encoding/decoding and audio/video, and works as
790 + * follows:
791 + * - Set up and open the AVCodecContext as usual.
792 + * - Send valid input:
793 + *   - For decoding, call avcodec_send_packet() to give the decoder raw
794 + *     compressed data in an AVPacket.
795 + *   - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
796 + *     containing uncompressed audio or video.
797 + *   In both cases, it is recommended that AVPackets and AVFrames are
798 + *   refcounted, or libavcodec might have to copy the input data. (libavformat
799 + *   always returns refcounted AVPackets, and av_frame_get_buffer() allocates
800 + *   refcounted AVFrames.)
801 + * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
802 + *   functions and process their output:
803 + *   - For decoding, call avcodec_receive_frame(). On success, it will return
804 + *     an AVFrame containing uncompressed audio or video data.
805 + *   - For encoding, call avcodec_receive_packet(). On success, it will return
806 + *     an AVPacket with a compressed frame.
807 + *   Repeat this call until it returns AVERROR(EAGAIN) or an error. The
808 + *   AVERROR(EAGAIN) return value means that new input data is required to
809 + *   return new output. In this case, continue with sending input. For each
810 + *   input frame/packet, the codec will typically return 1 output frame/packet,
811 + *   but it can also be 0 or more than 1.
812 + *
813 + * At the beginning of decoding or encoding, the codec might accept multiple
814 + * input frames/packets without returning a frame, until its internal buffers
815 + * are filled. This situation is handled transparently if you follow the steps
816 + * outlined above.
817 + *
818 + * In theory, sending input can result in EAGAIN - this should happen only if
819 + * not all output was received. You can use this to structure alternative decode
820 + * or encode loops other than the one suggested above. For example, you could
821 + * try sending new input on each iteration, and try to receive output if that
822 + * returns EAGAIN.
823 + *
824 + * End of stream situations. These require "flushing" (aka draining) the codec,
825 + * as the codec might buffer multiple frames or packets internally for
826 + * performance or out of necessity (consider B-frames).
827 + * This is handled as follows:
828 + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
829 + *   or avcodec_send_frame() (encoding) functions. This will enter draining
830 + *   mode.
831 + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
832 + *   (encoding) in a loop until AVERROR_EOF is returned. The functions will
833 + *   not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
834 + * - Before decoding can be resumed again, the codec has to be reset with
835 + *   avcodec_flush_buffers().
836 + *
837 + * Using the API as outlined above is highly recommended. But it is also
838 + * possible to call functions outside of this rigid schema. For example, you can
839 + * call avcodec_send_packet() repeatedly without calling
840 + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
841 + * until the codec's internal buffer has been filled up (which is typically of
842 + * size 1 per output frame, after initial input), and then reject input with
843 + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
844 + * read at least some output.
845 + *
846 + * Not all codecs will follow a rigid and predictable dataflow; the only
847 + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
848 + * one end implies that a receive/send call on the other end will succeed, or
849 + * at least will not fail with AVERROR(EAGAIN). In general, no codec will
850 + * permit unlimited buffering of input or output.
851 + *
852 + * This API replaces the following legacy functions:
853 + * - avcodec_decode_video2() and avcodec_decode_audio4():
854 + *   Use avcodec_send_packet() to feed input to the decoder, then use
855 + *   avcodec_receive_frame() to receive decoded frames after each packet.
856 + *   Unlike with the old video decoding API, multiple frames might result from
857 + *   a packet. For audio, splitting the input packet into frames by partially
858 + *   decoding packets becomes transparent to the API user. You never need to
859 + *   feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
860 + *   no data was read from the packet).
861 + *   Additionally, sending a flush/draining packet is required only once.
862 + * - avcodec_encode_video2()/avcodec_encode_audio2():
863 + *   Use avcodec_send_frame() to feed input to the encoder, then use
864 + *   avcodec_receive_packet() to receive encoded packets.
865 + *   Providing user-allocated buffers for avcodec_receive_packet() is not
866 + *   possible.
867 + * - The new API does not handle subtitles yet.
868 + *
869 + * Mixing new and old function calls on the same AVCodecContext is not allowed,
870 + * and will result in undefined behavior.
871 + *
872 + * Some codecs might require using the new API; using the old API will return
873 + * an error when calling it. All codecs support the new API.
874 + *
875 + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
876 + * would be an invalid state, which could put the codec user into an endless
877 + * loop. The API has no concept of time either: it cannot happen that trying to
878 + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
879 + * later accepts the packet (with no other receive/flush API calls involved).
880 + * The API is a strict state machine, and the passage of time is not supposed
881 + * to influence it. Some timing-dependent behavior might still be deemed
882 + * acceptable in certain cases. But it must never result in both send/receive
883 + * returning EAGAIN at the same time at any point. It must also absolutely be
884 + * avoided that the current state is "unstable" and can "flip-flop" between
885 + * the send/receive APIs allowing progress. For example, it's not allowed that
886 + * the codec randomly decides that it actually wants to consume a packet now
887 + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
888 + * avcodec_send_packet() call.
889 + * @}
890 + */
891 +
892 +/**
893 + * @defgroup lavc_core Core functions/structures.
894 + * @ingroup libavc
895 + *
896 + * Basic definitions, functions for querying libavcodec capabilities,
897 + * allocating core structures, etc.
898 + * @{
899 + */
900 +
901 +
902 +/**
903 + * Identify the syntax and semantics of the bitstream.
904 + * The principle is roughly:
905 + * Two decoders with the same ID can decode the same streams.
906 + * Two encoders with the same ID can encode compatible streams.
907 + * There may be slight deviations from the principle due to implementation
908 + * details.
909 + *
910 + * If you add a codec ID to this list, add it so that
911 + * 1. no value of an existing codec ID changes (that would break ABI),
912 + * 2. it is as close as possible to similar codecs
913 + *
914 + * After adding new codec IDs, do not forget to add an entry to the codec
915 + * descriptor list and bump libavcodec minor version.
916 + */
917 +enum AVCodecID {
918 +    AV_CODEC_ID_NONE,
919 +
920 +    /* video codecs */
921 +    AV_CODEC_ID_MPEG1VIDEO,
922 +    AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
923 +    AV_CODEC_ID_H261,
924 +    AV_CODEC_ID_H263,
925 +    AV_CODEC_ID_RV10,
926 +    AV_CODEC_ID_RV20,
927 +    AV_CODEC_ID_MJPEG,
928 +    AV_CODEC_ID_MJPEGB,
929 +    AV_CODEC_ID_LJPEG,
930 +    AV_CODEC_ID_SP5X,
931 +    AV_CODEC_ID_JPEGLS,
932 +    AV_CODEC_ID_MPEG4,
933 +    AV_CODEC_ID_RAWVIDEO,
934 +    AV_CODEC_ID_MSMPEG4V1,
935 +    AV_CODEC_ID_MSMPEG4V2,
936 +    AV_CODEC_ID_MSMPEG4V3,
937 +    AV_CODEC_ID_WMV1,
938 +    AV_CODEC_ID_WMV2,
939 +    AV_CODEC_ID_H263P,
940 +    AV_CODEC_ID_H263I,
941 +    AV_CODEC_ID_FLV1,
942 +    AV_CODEC_ID_SVQ1,
943 +    AV_CODEC_ID_SVQ3,
944 +    AV_CODEC_ID_DVVIDEO,
945 +    AV_CODEC_ID_HUFFYUV,
946 +    AV_CODEC_ID_CYUV,
947 +    AV_CODEC_ID_H264,
948 +    AV_CODEC_ID_INDEO3,
949 +    AV_CODEC_ID_VP3,
950 +    AV_CODEC_ID_THEORA,
951 +    AV_CODEC_ID_ASV1,
952 +    AV_CODEC_ID_ASV2,
953 +    AV_CODEC_ID_FFV1,
954 +    AV_CODEC_ID_4XM,
955 +    AV_CODEC_ID_VCR1,
956 +    AV_CODEC_ID_CLJR,
957 +    AV_CODEC_ID_MDEC,
958 +    AV_CODEC_ID_ROQ,
959 +    AV_CODEC_ID_INTERPLAY_VIDEO,
960 +    AV_CODEC_ID_XAN_WC3,
961 +    AV_CODEC_ID_XAN_WC4,
962 +    AV_CODEC_ID_RPZA,
963 +    AV_CODEC_ID_CINEPAK,
964 +    AV_CODEC_ID_WS_VQA,
965 +    AV_CODEC_ID_MSRLE,
966 +    AV_CODEC_ID_MSVIDEO1,
967 +    AV_CODEC_ID_IDCIN,
968 +    AV_CODEC_ID_8BPS,
969 +    AV_CODEC_ID_SMC,
970 +    AV_CODEC_ID_FLIC,
971 +    AV_CODEC_ID_TRUEMOTION1,
972 +    AV_CODEC_ID_VMDVIDEO,
973 +    AV_CODEC_ID_MSZH,
974 +    AV_CODEC_ID_ZLIB,
975 +    AV_CODEC_ID_QTRLE,
976 +    AV_CODEC_ID_TSCC,
977 +    AV_CODEC_ID_ULTI,
978 +    AV_CODEC_ID_QDRAW,
979 +    AV_CODEC_ID_VIXL,
980 +    AV_CODEC_ID_QPEG,
981 +    AV_CODEC_ID_PNG,
982 +    AV_CODEC_ID_PPM,
983 +    AV_CODEC_ID_PBM,
984 +    AV_CODEC_ID_PGM,
985 +    AV_CODEC_ID_PGMYUV,
986 +    AV_CODEC_ID_PAM,
987 +    AV_CODEC_ID_FFVHUFF,
988 +    AV_CODEC_ID_RV30,
989 +    AV_CODEC_ID_RV40,
990 +    AV_CODEC_ID_VC1,
991 +    AV_CODEC_ID_WMV3,
992 +    AV_CODEC_ID_LOCO,
993 +    AV_CODEC_ID_WNV1,
994 +    AV_CODEC_ID_AASC,
995 +    AV_CODEC_ID_INDEO2,
996 +    AV_CODEC_ID_FRAPS,
997 +    AV_CODEC_ID_TRUEMOTION2,
998 +    AV_CODEC_ID_BMP,
999 +    AV_CODEC_ID_CSCD,
1000 +    AV_CODEC_ID_MMVIDEO,
1001 +    AV_CODEC_ID_ZMBV,
1002 +    AV_CODEC_ID_AVS,
1003 +    AV_CODEC_ID_SMACKVIDEO,
1004 +    AV_CODEC_ID_NUV,
1005 +    AV_CODEC_ID_KMVC,
1006 +    AV_CODEC_ID_FLASHSV,
1007 +    AV_CODEC_ID_CAVS,
1008 +    AV_CODEC_ID_JPEG2000,
1009 +    AV_CODEC_ID_VMNC,
1010 +    AV_CODEC_ID_VP5,
1011 +    AV_CODEC_ID_VP6,
1012 +    AV_CODEC_ID_VP6F,
1013 +    AV_CODEC_ID_TARGA,
1014 +    AV_CODEC_ID_DSICINVIDEO,
1015 +    AV_CODEC_ID_TIERTEXSEQVIDEO,
1016 +    AV_CODEC_ID_TIFF,
1017 +    AV_CODEC_ID_GIF,
1018 +    AV_CODEC_ID_DXA,
1019 +    AV_CODEC_ID_DNXHD,
1020 +    AV_CODEC_ID_THP,
1021 +    AV_CODEC_ID_SGI,
1022 +    AV_CODEC_ID_C93,
1023 +    AV_CODEC_ID_BETHSOFTVID,
1024 +    AV_CODEC_ID_PTX,
1025 +    AV_CODEC_ID_TXD,
1026 +    AV_CODEC_ID_VP6A,
1027 +    AV_CODEC_ID_AMV,
1028 +    AV_CODEC_ID_VB,
1029 +    AV_CODEC_ID_PCX,
1030 +    AV_CODEC_ID_SUNRAST,
1031 +    AV_CODEC_ID_INDEO4,
1032 +    AV_CODEC_ID_INDEO5,
1033 +    AV_CODEC_ID_MIMIC,
1034 +    AV_CODEC_ID_RL2,
1035 +    AV_CODEC_ID_ESCAPE124,
1036 +    AV_CODEC_ID_DIRAC,
1037 +    AV_CODEC_ID_BFI,
1038 +    AV_CODEC_ID_CMV,
1039 +    AV_CODEC_ID_MOTIONPIXELS,
1040 +    AV_CODEC_ID_TGV,
1041 +    AV_CODEC_ID_TGQ,
1042 +    AV_CODEC_ID_TQI,
1043 +    AV_CODEC_ID_AURA,
1044 +    AV_CODEC_ID_AURA2,
1045 +    AV_CODEC_ID_V210X,
1046 +    AV_CODEC_ID_TMV,
1047 +    AV_CODEC_ID_V210,
1048 +    AV_CODEC_ID_DPX,
1049 +    AV_CODEC_ID_MAD,
1050 +    AV_CODEC_ID_FRWU,
1051 +    AV_CODEC_ID_FLASHSV2,
1052 +    AV_CODEC_ID_CDGRAPHICS,
1053 +    AV_CODEC_ID_R210,
1054 +    AV_CODEC_ID_ANM,
1055 +    AV_CODEC_ID_BINKVIDEO,
1056 +    AV_CODEC_ID_IFF_ILBM,
1057 +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1058 +    AV_CODEC_ID_KGV1,
1059 +    AV_CODEC_ID_YOP,
1060 +    AV_CODEC_ID_VP8,
1061 +    AV_CODEC_ID_PICTOR,
1062 +    AV_CODEC_ID_ANSI,
1063 +    AV_CODEC_ID_A64_MULTI,
1064 +    AV_CODEC_ID_A64_MULTI5,
1065 +    AV_CODEC_ID_R10K,
1066 +    AV_CODEC_ID_MXPEG,
1067 +    AV_CODEC_ID_LAGARITH,
1068 +    AV_CODEC_ID_PRORES,
1069 +    AV_CODEC_ID_JV,
1070 +    AV_CODEC_ID_DFA,
1071 +    AV_CODEC_ID_WMV3IMAGE,
1072 +    AV_CODEC_ID_VC1IMAGE,
1073 +    AV_CODEC_ID_UTVIDEO,
1074 +    AV_CODEC_ID_BMV_VIDEO,
1075 +    AV_CODEC_ID_VBLE,
1076 +    AV_CODEC_ID_DXTORY,
1077 +    AV_CODEC_ID_V410,
1078 +    AV_CODEC_ID_XWD,
1079 +    AV_CODEC_ID_CDXL,
1080 +    AV_CODEC_ID_XBM,
1081 +    AV_CODEC_ID_ZEROCODEC,
1082 +    AV_CODEC_ID_MSS1,
1083 +    AV_CODEC_ID_MSA1,
1084 +    AV_CODEC_ID_TSCC2,
1085 +    AV_CODEC_ID_MTS2,
1086 +    AV_CODEC_ID_CLLC,
1087 +    AV_CODEC_ID_MSS2,
1088 +    AV_CODEC_ID_VP9,
1089 +    AV_CODEC_ID_AIC,
1090 +    AV_CODEC_ID_ESCAPE130,
1091 +    AV_CODEC_ID_G2M,
1092 +    AV_CODEC_ID_WEBP,
1093 +    AV_CODEC_ID_HNM4_VIDEO,
1094 +    AV_CODEC_ID_HEVC,
1095 +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1096 +    AV_CODEC_ID_FIC,
1097 +    AV_CODEC_ID_ALIAS_PIX,
1098 +    AV_CODEC_ID_BRENDER_PIX,
1099 +    AV_CODEC_ID_PAF_VIDEO,
1100 +    AV_CODEC_ID_EXR,
1101 +    AV_CODEC_ID_VP7,
1102 +    AV_CODEC_ID_SANM,
1103 +    AV_CODEC_ID_SGIRLE,
1104 +    AV_CODEC_ID_MVC1,
1105 +    AV_CODEC_ID_MVC2,
1106 +    AV_CODEC_ID_HQX,
1107 +    AV_CODEC_ID_TDSC,
1108 +    AV_CODEC_ID_HQ_HQA,
1109 +    AV_CODEC_ID_HAP,
1110 +    AV_CODEC_ID_DDS,
1111 +    AV_CODEC_ID_DXV,
1112 +    AV_CODEC_ID_SCREENPRESSO,
1113 +    AV_CODEC_ID_RSCC,
1114 +
1115 +    AV_CODEC_ID_Y41P = 0x8000,
1116 +    AV_CODEC_ID_AVRP,
1117 +    AV_CODEC_ID_012V,
1118 +    AV_CODEC_ID_AVUI,
1119 +    AV_CODEC_ID_AYUV,
1120 +    AV_CODEC_ID_TARGA_Y216,
1121 +    AV_CODEC_ID_V308,
1122 +    AV_CODEC_ID_V408,
1123 +    AV_CODEC_ID_YUV4,
1124 +    AV_CODEC_ID_AVRN,
1125 +    AV_CODEC_ID_CPIA,
1126 +    AV_CODEC_ID_XFACE,
1127 +    AV_CODEC_ID_SNOW,
1128 +    AV_CODEC_ID_SMVJPEG,
1129 +    AV_CODEC_ID_APNG,
1130 +    AV_CODEC_ID_DAALA,
1131 +    AV_CODEC_ID_CFHD,
1132 +    AV_CODEC_ID_TRUEMOTION2RT,
1133 +    AV_CODEC_ID_M101,
1134 +    AV_CODEC_ID_MAGICYUV,
1135 +    AV_CODEC_ID_SHEERVIDEO,
1136 +    AV_CODEC_ID_YLC,
1137 +    AV_CODEC_ID_PSD,
1138 +    AV_CODEC_ID_PIXLET,
1139 +    AV_CODEC_ID_SPEEDHQ,
1140 +    AV_CODEC_ID_FMVC,
1141 +    AV_CODEC_ID_SCPR,
1142 +    AV_CODEC_ID_CLEARVIDEO,
1143 +    AV_CODEC_ID_XPM,
1144 +    AV_CODEC_ID_AV1,
1145 +    AV_CODEC_ID_BITPACKED,
1146 +    AV_CODEC_ID_MSCC,
1147 +    AV_CODEC_ID_SRGC,
1148 +    AV_CODEC_ID_SVG,
1149 +    AV_CODEC_ID_GDV,
1150 +    AV_CODEC_ID_FITS,
1151 +
1152 +    /* various PCM "codecs" */
1153 +    AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
1154 +    AV_CODEC_ID_PCM_S16LE = 0x10000,
1155 +    AV_CODEC_ID_PCM_S16BE,
1156 +    AV_CODEC_ID_PCM_U16LE,
1157 +    AV_CODEC_ID_PCM_U16BE,
1158 +    AV_CODEC_ID_PCM_S8,
1159 +    AV_CODEC_ID_PCM_U8,
1160 +    AV_CODEC_ID_PCM_MULAW,
1161 +    AV_CODEC_ID_PCM_ALAW,
1162 +    AV_CODEC_ID_PCM_S32LE,
1163 +    AV_CODEC_ID_PCM_S32BE,
1164 +    AV_CODEC_ID_PCM_U32LE,
1165 +    AV_CODEC_ID_PCM_U32BE,
1166 +    AV_CODEC_ID_PCM_S24LE,
1167 +    AV_CODEC_ID_PCM_S24BE,
1168 +    AV_CODEC_ID_PCM_U24LE,
1169 +    AV_CODEC_ID_PCM_U24BE,
1170 +    AV_CODEC_ID_PCM_S24DAUD,
1171 +    AV_CODEC_ID_PCM_ZORK,
1172 +    AV_CODEC_ID_PCM_S16LE_PLANAR,
1173 +    AV_CODEC_ID_PCM_DVD,
1174 +    AV_CODEC_ID_PCM_F32BE,
1175 +    AV_CODEC_ID_PCM_F32LE,
1176 +    AV_CODEC_ID_PCM_F64BE,
1177 +    AV_CODEC_ID_PCM_F64LE,
1178 +    AV_CODEC_ID_PCM_BLURAY,
1179 +    AV_CODEC_ID_PCM_LXF,
1180 +    AV_CODEC_ID_S302M,
1181 +    AV_CODEC_ID_PCM_S8_PLANAR,
1182 +    AV_CODEC_ID_PCM_S24LE_PLANAR,
1183 +    AV_CODEC_ID_PCM_S32LE_PLANAR,
1184 +    AV_CODEC_ID_PCM_S16BE_PLANAR,
1185 +
1186 +    AV_CODEC_ID_PCM_S64LE = 0x10800,
1187 +    AV_CODEC_ID_PCM_S64BE,
1188 +    AV_CODEC_ID_PCM_F16LE,
1189 +    AV_CODEC_ID_PCM_F24LE,
1190 +
1191 +    /* various ADPCM codecs */
1192 +    AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
1193 +    AV_CODEC_ID_ADPCM_IMA_WAV,
1194 +    AV_CODEC_ID_ADPCM_IMA_DK3,
1195 +    AV_CODEC_ID_ADPCM_IMA_DK4,
1196 +    AV_CODEC_ID_ADPCM_IMA_WS,
1197 +    AV_CODEC_ID_ADPCM_IMA_SMJPEG,
1198 +    AV_CODEC_ID_ADPCM_MS,
1199 +    AV_CODEC_ID_ADPCM_4XM,
1200 +    AV_CODEC_ID_ADPCM_XA,
1201 +    AV_CODEC_ID_ADPCM_ADX,
1202 +    AV_CODEC_ID_ADPCM_EA,
1203 +    AV_CODEC_ID_ADPCM_G726,
1204 +    AV_CODEC_ID_ADPCM_CT,
1205 +    AV_CODEC_ID_ADPCM_SWF,
1206 +    AV_CODEC_ID_ADPCM_YAMAHA,
1207 +    AV_CODEC_ID_ADPCM_SBPRO_4,
1208 +    AV_CODEC_ID_ADPCM_SBPRO_3,
1209 +    AV_CODEC_ID_ADPCM_SBPRO_2,
1210 +    AV_CODEC_ID_ADPCM_THP,
1211 +    AV_CODEC_ID_ADPCM_IMA_AMV,
1212 +    AV_CODEC_ID_ADPCM_EA_R1,
1213 +    AV_CODEC_ID_ADPCM_EA_R3,
1214 +    AV_CODEC_ID_ADPCM_EA_R2,
1215 +    AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
1216 +    AV_CODEC_ID_ADPCM_IMA_EA_EACS,
1217 +    AV_CODEC_ID_ADPCM_EA_XAS,
1218 +    AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
1219 +    AV_CODEC_ID_ADPCM_IMA_ISS,
1220 +    AV_CODEC_ID_ADPCM_G722,
1221 +    AV_CODEC_ID_ADPCM_IMA_APC,
1222 +    AV_CODEC_ID_ADPCM_VIMA,
1223 +
1224 +    AV_CODEC_ID_ADPCM_AFC = 0x11800,
1225 +    AV_CODEC_ID_ADPCM_IMA_OKI,
1226 +    AV_CODEC_ID_ADPCM_DTK,
1227 +    AV_CODEC_ID_ADPCM_IMA_RAD,
1228 +    AV_CODEC_ID_ADPCM_G726LE,
1229 +    AV_CODEC_ID_ADPCM_THP_LE,
1230 +    AV_CODEC_ID_ADPCM_PSX,
1231 +    AV_CODEC_ID_ADPCM_AICA,
1232 +    AV_CODEC_ID_ADPCM_IMA_DAT4,
1233 +    AV_CODEC_ID_ADPCM_MTAF,
1234 +
1235 +    /* AMR */
1236 +    AV_CODEC_ID_AMR_NB = 0x12000,
1237 +    AV_CODEC_ID_AMR_WB,
1238 +
1239 +    /* RealAudio codecs*/
1240 +    AV_CODEC_ID_RA_144 = 0x13000,
1241 +    AV_CODEC_ID_RA_288,
1242 +
1243 +    /* various DPCM codecs */
1244 +    AV_CODEC_ID_ROQ_DPCM = 0x14000,
1245 +    AV_CODEC_ID_INTERPLAY_DPCM,
1246 +    AV_CODEC_ID_XAN_DPCM,
1247 +    AV_CODEC_ID_SOL_DPCM,
1248 +
1249 +    AV_CODEC_ID_SDX2_DPCM = 0x14800,
1250 +    AV_CODEC_ID_GREMLIN_DPCM,
1251 +
1252 +    /* audio codecs */
1253 +    AV_CODEC_ID_MP2 = 0x15000,
1254 +    AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
1255 +    AV_CODEC_ID_AAC,
1256 +    AV_CODEC_ID_AC3,
1257 +    AV_CODEC_ID_DTS,
1258 +    AV_CODEC_ID_VORBIS,
1259 +    AV_CODEC_ID_DVAUDIO,
1260 +    AV_CODEC_ID_WMAV1,
1261 +    AV_CODEC_ID_WMAV2,
1262 +    AV_CODEC_ID_MACE3,
1263 +    AV_CODEC_ID_MACE6,
1264 +    AV_CODEC_ID_VMDAUDIO,
1265 +    AV_CODEC_ID_FLAC,
1266 +    AV_CODEC_ID_MP3ADU,
1267 +    AV_CODEC_ID_MP3ON4,
1268 +    AV_CODEC_ID_SHORTEN,
1269 +    AV_CODEC_ID_ALAC,
1270 +    AV_CODEC_ID_WESTWOOD_SND1,
1271 +    AV_CODEC_ID_GSM, ///< as in Berlin toast format
1272 +    AV_CODEC_ID_QDM2,
1273 +    AV_CODEC_ID_COOK,
1274 +    AV_CODEC_ID_TRUESPEECH,
1275 +    AV_CODEC_ID_TTA,
1276 +    AV_CODEC_ID_SMACKAUDIO,
1277 +    AV_CODEC_ID_QCELP,
1278 +    AV_CODEC_ID_WAVPACK,
1279 +    AV_CODEC_ID_DSICINAUDIO,
1280 +    AV_CODEC_ID_IMC,
1281 +    AV_CODEC_ID_MUSEPACK7,
1282 +    AV_CODEC_ID_MLP,
1283 +    AV_CODEC_ID_GSM_MS, /* as found in WAV */
1284 +    AV_CODEC_ID_ATRAC3,
1285 +    AV_CODEC_ID_APE,
1286 +    AV_CODEC_ID_NELLYMOSER,
1287 +    AV_CODEC_ID_MUSEPACK8,
1288 +    AV_CODEC_ID_SPEEX,
1289 +    AV_CODEC_ID_WMAVOICE,
1290 +    AV_CODEC_ID_WMAPRO,
1291 +    AV_CODEC_ID_WMALOSSLESS,
1292 +    AV_CODEC_ID_ATRAC3P,
1293 +    AV_CODEC_ID_EAC3,
1294 +    AV_CODEC_ID_SIPR,
1295 +    AV_CODEC_ID_MP1,
1296 +    AV_CODEC_ID_TWINVQ,
1297 +    AV_CODEC_ID_TRUEHD,
1298 +    AV_CODEC_ID_MP4ALS,
1299 +    AV_CODEC_ID_ATRAC1,
1300 +    AV_CODEC_ID_BINKAUDIO_RDFT,
1301 +    AV_CODEC_ID_BINKAUDIO_DCT,
1302 +    AV_CODEC_ID_AAC_LATM,
1303 +    AV_CODEC_ID_QDMC,
1304 +    AV_CODEC_ID_CELT,
1305 +    AV_CODEC_ID_G723_1,
1306 +    AV_CODEC_ID_G729,
1307 +    AV_CODEC_ID_8SVX_EXP,
1308 +    AV_CODEC_ID_8SVX_FIB,
1309 +    AV_CODEC_ID_BMV_AUDIO,
1310 +    AV_CODEC_ID_RALF,
1311 +    AV_CODEC_ID_IAC,
1312 +    AV_CODEC_ID_ILBC,
1313 +    AV_CODEC_ID_OPUS,
1314 +    AV_CODEC_ID_COMFORT_NOISE,
1315 +    AV_CODEC_ID_TAK,
1316 +    AV_CODEC_ID_METASOUND,
1317 +    AV_CODEC_ID_PAF_AUDIO,
1318 +    AV_CODEC_ID_ON2AVC,
1319 +    AV_CODEC_ID_DSS_SP,
1320 +    AV_CODEC_ID_CODEC2,
1321 +
1322 +    AV_CODEC_ID_FFWAVESYNTH = 0x15800,
1323 +    AV_CODEC_ID_SONIC,
1324 +    AV_CODEC_ID_SONIC_LS,
1325 +    AV_CODEC_ID_EVRC,
1326 +    AV_CODEC_ID_SMV,
1327 +    AV_CODEC_ID_DSD_LSBF,
1328 +    AV_CODEC_ID_DSD_MSBF,
1329 +    AV_CODEC_ID_DSD_LSBF_PLANAR,
1330 +    AV_CODEC_ID_DSD_MSBF_PLANAR,
1331 +    AV_CODEC_ID_4GV,
1332 +    AV_CODEC_ID_INTERPLAY_ACM,
1333 +    AV_CODEC_ID_XMA1,
1334 +    AV_CODEC_ID_XMA2,
1335 +    AV_CODEC_ID_DST,
1336 +    AV_CODEC_ID_ATRAC3AL,
1337 +    AV_CODEC_ID_ATRAC3PAL,
1338 +    AV_CODEC_ID_DOLBY_E,
1339 +    AV_CODEC_ID_APTX,
1340 +    AV_CODEC_ID_APTX_HD,
1341 +    AV_CODEC_ID_SBC,
1342 +
1343 +    /* subtitle codecs */
1344 +    AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
1345 +    AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
1346 +    AV_CODEC_ID_DVB_SUBTITLE,
1347 +    AV_CODEC_ID_TEXT,  ///< raw UTF-8 text
1348 +    AV_CODEC_ID_XSUB,
1349 +    AV_CODEC_ID_SSA,
1350 +    AV_CODEC_ID_MOV_TEXT,
1351 +    AV_CODEC_ID_HDMV_PGS_SUBTITLE,
1352 +    AV_CODEC_ID_DVB_TELETEXT,
1353 +    AV_CODEC_ID_SRT,
1354 +
1355 +    AV_CODEC_ID_MICRODVD   = 0x17800,
1356 +    AV_CODEC_ID_EIA_608,
1357 +    AV_CODEC_ID_JACOSUB,
1358 +    AV_CODEC_ID_SAMI,
1359 +    AV_CODEC_ID_REALTEXT,
1360 +    AV_CODEC_ID_STL,
1361 +    AV_CODEC_ID_SUBVIEWER1,
1362 +    AV_CODEC_ID_SUBVIEWER,
1363 +    AV_CODEC_ID_SUBRIP,
1364 +    AV_CODEC_ID_WEBVTT,
1365 +    AV_CODEC_ID_MPL2,
1366 +    AV_CODEC_ID_VPLAYER,
1367 +    AV_CODEC_ID_PJS,
1368 +    AV_CODEC_ID_ASS,
1369 +    AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
1370 +
1371 +    /* other specific kind of codecs (generally used for attachments) */
1372 +    AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
1373 +    AV_CODEC_ID_TTF = 0x18000,
1374 +
1375 +    AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
1376 +    AV_CODEC_ID_BINTEXT    = 0x18800,
1377 +    AV_CODEC_ID_XBIN,
1378 +    AV_CODEC_ID_IDF,
1379 +    AV_CODEC_ID_OTF,
1380 +    AV_CODEC_ID_SMPTE_KLV,
1381 +    AV_CODEC_ID_DVD_NAV,
1382 +    AV_CODEC_ID_TIMED_ID3,
1383 +    AV_CODEC_ID_BIN_DATA,
1384 +
1385 +
1386 +    AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
1387 +
1388 +    AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
1389 +                                * stream (only used by libavformat) */
1390 +    AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
1391 +                                * stream (only used by libavformat) */
1392 +    AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
1393 +    AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
1394 +};
1395 +
1396 +/**
1397 + * This struct describes the properties of a single codec described by an
1398 + * AVCodecID.
1399 + * @see avcodec_descriptor_get()
1400 + */
1401 +typedef struct AVCodecDescriptor {
1402 +    enum AVCodecID     id;
1403 +    enum AVMediaType type;
1404 +    /**
1405 +     * Name of the codec described by this descriptor. It is non-empty and
1406 +     * unique for each codec descriptor. It should contain alphanumeric
1407 +     * characters and '_' only.
1408 +     */
1409 +    const char      *name;
1410 +    /**
1411 +     * A more descriptive name for this codec. May be NULL.
1412 +     */
1413 +    const char *long_name;
1414 +    /**
1415 +     * Codec properties, a combination of AV_CODEC_PROP_* flags.
1416 +     */
1417 +    int             props;
1418 +    /**
1419 +     * MIME type(s) associated with the codec.
1420 +     * May be NULL; if not, a NULL-terminated array of MIME types.
1421 +     * The first item is always non-NULL and is the preferred MIME type.
1422 +     */
1423 +    const char *const *mime_types;
1424 +    /**
1425 +     * If non-NULL, an array of profiles recognized for this codec.
1426 +     * Terminated with FF_PROFILE_UNKNOWN.
1427 +     */
1428 +    const struct AVProfile *profiles;
1429 +} AVCodecDescriptor;
1430 +
1431 +/**
1432 + * Codec uses only intra compression.
1433 + * Video and audio codecs only.
1434 + */
1435 +#define AV_CODEC_PROP_INTRA_ONLY    (1 << 0)
1436 +/**
1437 + * Codec supports lossy compression. Audio and video codecs only.
1438 + * @note a codec may support both lossy and lossless
1439 + * compression modes
1440 + */
1441 +#define AV_CODEC_PROP_LOSSY         (1 << 1)
1442 +/**
1443 + * Codec supports lossless compression. Audio and video codecs only.
1444 + */
1445 +#define AV_CODEC_PROP_LOSSLESS      (1 << 2)
1446 +/**
1447 + * Codec supports frame reordering. That is, the coded order (the order in which
1448 + * the encoded packets are output by the encoders / stored / input to the
1449 + * decoders) may be different from the presentation order of the corresponding
1450 + * frames.
1451 + *
1452 + * For codecs that do not have this property set, PTS and DTS should always be
1453 + * equal.
1454 + */
1455 +#define AV_CODEC_PROP_REORDER       (1 << 3)
1456 +/**
1457 + * Subtitle codec is bitmap based
1458 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
1459 + */
1460 +#define AV_CODEC_PROP_BITMAP_SUB    (1 << 16)
1461 +/**
1462 + * Subtitle codec is text based.
1463 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
1464 + */
1465 +#define AV_CODEC_PROP_TEXT_SUB      (1 << 17)
1466 +
1467 +/**
1468 + * @ingroup lavc_decoding
1469 + * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
1470 + * This is mainly needed because some optimized bitstream readers read
1471 + * 32 or 64 bit at once and could read over the end.<br>
1472 + * Note: If the first 23 bits of the additional bytes are not 0, then damaged
1473 + * MPEG bitstreams could cause overread and segfault.
1474 + */
1475 +#define AV_INPUT_BUFFER_PADDING_SIZE 64
1476 +
1477 +/**
1478 + * @ingroup lavc_encoding
1479 + * minimum encoding buffer size
1480 + * Used to avoid some checks during header writing.
1481 + */
1482 +#define AV_INPUT_BUFFER_MIN_SIZE 16384
1483 +
1484 +/**
1485 + * @ingroup lavc_decoding
1486 + */
1487 +enum AVDiscard{
1488 +    /* We leave some space between them for extensions (drop some
1489 +     * keyframes for intra-only or drop just some bidir frames). */
1490 +    AVDISCARD_NONE    =-16, ///< discard nothing
1491 +    AVDISCARD_DEFAULT =  0, ///< discard useless packets like 0 size packets in avi
1492 +    AVDISCARD_NONREF  =  8, ///< discard all non reference
1493 +    AVDISCARD_BIDIR   = 16, ///< discard all bidirectional frames
1494 +    AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
1495 +    AVDISCARD_NONKEY  = 32, ///< discard all frames except keyframes
1496 +    AVDISCARD_ALL     = 48, ///< discard all
1497 +};
1498 +
1499 +enum AVAudioServiceType {
1500 +    AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
1501 +    AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
1502 +    AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
1503 +    AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
1504 +    AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
1505 +    AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
1506 +    AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
1507 +    AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
1508 +    AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
1509 +    AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
1510 +};
1511 +
1512 +/**
1513 + * @ingroup lavc_encoding
1514 + */
1515 +typedef struct RcOverride{
1516 +    int start_frame;
1517 +    int end_frame;
1518 +    int qscale; // If this is 0 then quality_factor will be used instead.
1519 +    float quality_factor;
1520 +} RcOverride;
1521 +
1522 +/* encoding support
1523 +   These flags can be passed in AVCodecContext.flags before initialization.
1524 +   Note: Not everything is supported yet.
1525 +*/
1526 +
1527 +/**
1528 + * Allow decoders to produce frames with data planes that are not aligned
1529 + * to CPU requirements (e.g. due to cropping).
1530 + */
1531 +#define AV_CODEC_FLAG_UNALIGNED       (1 <<  0)
1532 +/**
1533 + * Use fixed qscale.
1534 + */
1535 +#define AV_CODEC_FLAG_QSCALE          (1 <<  1)
1536 +/**
1537 + * 4 MV per MB allowed / advanced prediction for H.263.
1538 + */
1539 +#define AV_CODEC_FLAG_4MV             (1 <<  2)
1540 +/**
1541 + * Output even those frames that might be corrupted.
1542 + */
1543 +#define AV_CODEC_FLAG_OUTPUT_CORRUPT  (1 <<  3)
1544 +/**
1545 + * Use qpel MC.
1546 + */
1547 +#define AV_CODEC_FLAG_QPEL            (1 <<  4)
1548 +/**
1549 + * Use internal 2pass ratecontrol in first pass mode.
1550 + */
1551 +#define AV_CODEC_FLAG_PASS1           (1 <<  9)
1552 +/**
1553 + * Use internal 2pass ratecontrol in second pass mode.
1554 + */
1555 +#define AV_CODEC_FLAG_PASS2           (1 << 10)
1556 +/**
1557 + * loop filter.
1558 + */
1559 +#define AV_CODEC_FLAG_LOOP_FILTER     (1 << 11)
1560 +/**
1561 + * Only decode/encode grayscale.
1562 + */
1563 +#define AV_CODEC_FLAG_GRAY            (1 << 13)
1564 +/**
1565 + * error[?] variables will be set during encoding.
1566 + */
1567 +#define AV_CODEC_FLAG_PSNR            (1 << 15)
1568 +/**
1569 + * Input bitstream might be truncated at a random location
1570 + * instead of only at frame boundaries.
1571 + */
1572 +#define AV_CODEC_FLAG_TRUNCATED       (1 << 16)
1573 +/**
1574 + * Use interlaced DCT.
1575 + */
1576 +#define AV_CODEC_FLAG_INTERLACED_DCT  (1 << 18)
1577 +/**
1578 + * Force low delay.
1579 + */
1580 +#define AV_CODEC_FLAG_LOW_DELAY       (1 << 19)
1581 +/**
1582 + * Place global headers in extradata instead of every keyframe.
1583 + */
1584 +#define AV_CODEC_FLAG_GLOBAL_HEADER   (1 << 22)
1585 +/**
1586 + * Use only bitexact stuff (except (I)DCT).
1587 + */
1588 +#define AV_CODEC_FLAG_BITEXACT        (1 << 23)
1589 +/* Fx : Flag for H.263+ extra options */
1590 +/**
1591 + * H.263 advanced intra coding / MPEG-4 AC prediction
1592 + */
1593 +#define AV_CODEC_FLAG_AC_PRED         (1 << 24)
1594 +/**
1595 + * interlaced motion estimation
1596 + */
1597 +#define AV_CODEC_FLAG_INTERLACED_ME   (1 << 29)
1598 +#define AV_CODEC_FLAG_CLOSED_GOP      (1U << 31)
1599 +
1600 +/**
1601 + * Allow non spec compliant speedup tricks.
1602 + */
1603 +#define AV_CODEC_FLAG2_FAST           (1 <<  0)
1604 +/**
1605 + * Skip bitstream encoding.
1606 + */
1607 +#define AV_CODEC_FLAG2_NO_OUTPUT      (1 <<  2)
1608 +/**
1609 + * Place global headers at every keyframe instead of in extradata.
1610 + */
1611 +#define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
1612 +
1613 +/**
1614 + * timecode is in drop frame format. DEPRECATED!!!!
1615 + */
1616 +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
1617 +
1618 +/**
1619 + * Input bitstream might be truncated at a packet boundaries
1620 + * instead of only at frame boundaries.
1621 + */
1622 +#define AV_CODEC_FLAG2_CHUNKS         (1 << 15)
1623 +/**
1624 + * Discard cropping information from SPS.
1625 + */
1626 +#define AV_CODEC_FLAG2_IGNORE_CROP    (1 << 16)
1627 +
1628 +/**
1629 + * Show all frames before the first keyframe
1630 + */
1631 +#define AV_CODEC_FLAG2_SHOW_ALL       (1 << 22)
1632 +/**
1633 + * Export motion vectors through frame side data
1634 + */
1635 +#define AV_CODEC_FLAG2_EXPORT_MVS     (1 << 28)
1636 +/**
1637 + * Do not skip samples and export skip information as frame side data
1638 + */
1639 +#define AV_CODEC_FLAG2_SKIP_MANUAL    (1 << 29)
1640 +/**
1641 + * Do not reset ASS ReadOrder field on flush (subtitles decoding)
1642 + */
1643 +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
1644 +
1645 +/* Unsupported options :
1646 + *              Syntax Arithmetic coding (SAC)
1647 + *              Reference Picture Selection
1648 + *              Independent Segment Decoding */
1649 +/* /Fx */
1650 +/* codec capabilities */
1651 +
1652 +/**
1653 + * Decoder can use draw_horiz_band callback.
1654 + */
1655 +#define AV_CODEC_CAP_DRAW_HORIZ_BAND     (1 <<  0)
1656 +/**
1657 + * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1658 + * If not set, it might not use get_buffer() at all or use operations that
1659 + * assume the buffer was allocated by avcodec_default_get_buffer.
1660 + */
1661 +#define AV_CODEC_CAP_DR1                 (1 <<  1)
1662 +#define AV_CODEC_CAP_TRUNCATED           (1 <<  3)
1663 +/**
1664 + * Encoder or decoder requires flushing with NULL input at the end in order to
1665 + * give the complete and correct output.
1666 + *
1667 + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1668 + *       with NULL data. The user can still send NULL data to the public encode
1669 + *       or decode function, but libavcodec will not pass it along to the codec
1670 + *       unless this flag is set.
1671 + *
1672 + * Decoders:
1673 + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1674 + * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1675 + * returns frames.
1676 + *
1677 + * Encoders:
1678 + * The encoder needs to be fed with NULL data at the end of encoding until the
1679 + * encoder no longer returns data.
1680 + *
1681 + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1682 + *       flag also means that the encoder must set the pts and duration for
1683 + *       each output packet. If this flag is not set, the pts and duration will
1684 + *       be determined by libavcodec from the input frame.
1685 + */
1686 +#define AV_CODEC_CAP_DELAY               (1 <<  5)
1687 +/**
1688 + * Codec can be fed a final frame with a smaller size.
1689 + * This can be used to prevent truncation of the last audio samples.
1690 + */
1691 +#define AV_CODEC_CAP_SMALL_LAST_FRAME    (1 <<  6)
1692 +
1693 +/**
1694 + * Codec can output multiple frames per AVPacket
1695 + * Normally demuxers return one frame at a time, demuxers which do not do
1696 + * are connected to a parser to split what they return into proper frames.
1697 + * This flag is reserved to the very rare category of codecs which have a
1698 + * bitstream that cannot be split into frames without timeconsuming
1699 + * operations like full decoding. Demuxers carrying such bitstreams thus
1700 + * may return multiple frames in a packet. This has many disadvantages like
1701 + * prohibiting stream copy in many cases thus it should only be considered
1702 + * as a last resort.
1703 + */
1704 +#define AV_CODEC_CAP_SUBFRAMES           (1 <<  8)
1705 +/**
1706 + * Codec is experimental and is thus avoided in favor of non experimental
1707 + * encoders
1708 + */
1709 +#define AV_CODEC_CAP_EXPERIMENTAL        (1 <<  9)
1710 +/**
1711 + * Codec should fill in channel configuration and samplerate instead of container
1712 + */
1713 +#define AV_CODEC_CAP_CHANNEL_CONF        (1 << 10)
1714 +/**
1715 + * Codec supports frame-level multithreading.
1716 + */
1717 +#define AV_CODEC_CAP_FRAME_THREADS       (1 << 12)
1718 +/**
1719 + * Codec supports slice-based (or partition-based) multithreading.
1720 + */
1721 +#define AV_CODEC_CAP_SLICE_THREADS       (1 << 13)
1722 +/**
1723 + * Codec supports changed parameters at any point.
1724 + */
1725 +#define AV_CODEC_CAP_PARAM_CHANGE        (1 << 14)
1726 +/**
1727 + * Codec supports avctx->thread_count == 0 (auto).
1728 + */
1729 +#define AV_CODEC_CAP_AUTO_THREADS        (1 << 15)
1730 +/**
1731 + * Audio encoder supports receiving a different number of samples in each call.
1732 + */
1733 +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
1734 +/**
1735 + * Decoder is not a preferred choice for probing.
1736 + * This indicates that the decoder is not a good choice for probing.
1737 + * It could for example be an expensive to spin up hardware decoder,
1738 + * or it could simply not provide a lot of useful information about
1739 + * the stream.
1740 + * A decoder marked with this flag should only be used as last resort
1741 + * choice for probing.
1742 + */
1743 +#define AV_CODEC_CAP_AVOID_PROBING       (1 << 17)
1744 +/**
1745 + * Codec is intra only.
1746 + */
1747 +#define AV_CODEC_CAP_INTRA_ONLY       0x40000000
1748 +/**
1749 + * Codec is lossless.
1750 + */
1751 +#define AV_CODEC_CAP_LOSSLESS         0x80000000
1752 +
1753 +/**
1754 + * Codec is backed by a hardware implementation. Typically used to
1755 + * identify a non-hwaccel hardware decoder. For information about hwaccels, use
1756 + * avcodec_get_hw_config() instead.
1757 + */
1758 +#define AV_CODEC_CAP_HARDWARE            (1 << 18)
1759 +
1760 +/**
1761 + * Codec is potentially backed by a hardware implementation, but not
1762 + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
1763 + * implementation provides some sort of internal fallback.
1764 + */
1765 +#define AV_CODEC_CAP_HYBRID              (1 << 19)
1766 +
1767 +/**
1768 + * Pan Scan area.
1769 + * This specifies the area which should be displayed.
1770 + * Note there may be multiple such areas for one frame.
1771 + */
1772 +typedef struct AVPanScan {
1773 +    /**
1774 +     * id
1775 +     * - encoding: Set by user.
1776 +     * - decoding: Set by libavcodec.
1777 +     */
1778 +    int id;
1779 +
1780 +    /**
1781 +     * width and height in 1/16 pel
1782 +     * - encoding: Set by user.
1783 +     * - decoding: Set by libavcodec.
1784 +     */
1785 +    int width;
1786 +    int height;
1787 +
1788 +    /**
1789 +     * position of the top left corner in 1/16 pel for up to 3 fields/frames
1790 +     * - encoding: Set by user.
1791 +     * - decoding: Set by libavcodec.
1792 +     */
1793 +    int16_t position[3][2];
1794 +} AVPanScan;
1795 +
1796 +/**
1797 + * This structure describes the bitrate properties of an encoded bitstream. It
1798 + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1799 + * parameters for H.264/HEVC.
1800 + */
1801 +typedef struct AVCPBProperties {
1802 +    /**
1803 +     * Maximum bitrate of the stream, in bits per second.
1804 +     * Zero if unknown or unspecified.
1805 +     */
1806 +    int max_bitrate;
1807 +    /**
1808 +     * Minimum bitrate of the stream, in bits per second.
1809 +     * Zero if unknown or unspecified.
1810 +     */
1811 +    int min_bitrate;
1812 +    /**
1813 +     * Average bitrate of the stream, in bits per second.
1814 +     * Zero if unknown or unspecified.
1815 +     */
1816 +    int avg_bitrate;
1817 +
1818 +    /**
1819 +     * The size of the buffer to which the ratecontrol is applied, in bits.
1820 +     * Zero if unknown or unspecified.
1821 +     */
1822 +    int buffer_size;
1823 +
1824 +    /**
1825 +     * The delay between the time the packet this structure is associated with
1826 +     * is received and the time when it should be decoded, in periods of a 27MHz
1827 +     * clock.
1828 +     *
1829 +     * UINT64_MAX when unknown or unspecified.
1830 +     */
1831 +    uint64_t vbv_delay;
1832 +} AVCPBProperties;
1833 +
1834 +/**
1835 + * The decoder will keep a reference to the frame and may reuse it later.
1836 + */
1837 +#define AV_GET_BUFFER_FLAG_REF (1 << 0)
1838 +
1839 +/**
1840 + * @defgroup lavc_packet AVPacket
1841 + *
1842 + * Types and functions for working with AVPacket.
1843 + * @{
1844 + */
1845 +enum AVPacketSideDataType {
1846 +    /**
1847 +     * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1848 +     * bytes worth of palette. This side data signals that a new palette is
1849 +     * present.
1850 +     */
1851 +    AV_PKT_DATA_PALETTE,
1852 +
1853 +    /**
1854 +     * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1855 +     * that the extradata buffer was changed and the receiving side should
1856 +     * act upon it appropriately. The new extradata is embedded in the side
1857 +     * data buffer and should be immediately used for processing the current
1858 +     * frame or packet.
1859 +     */
1860 +    AV_PKT_DATA_NEW_EXTRADATA,
1861 +
1862 +    /**
1863 +     * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1864 +     * @code
1865 +     * u32le param_flags
1866 +     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1867 +     *     s32le channel_count
1868 +     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1869 +     *     u64le channel_layout
1870 +     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1871 +     *     s32le sample_rate
1872 +     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1873 +     *     s32le width
1874 +     *     s32le height
1875 +     * @endcode
1876 +     */
1877 +    AV_PKT_DATA_PARAM_CHANGE,
1878 +
1879 +    /**
1880 +     * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1881 +     * structures with info about macroblocks relevant to splitting the
1882 +     * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1883 +     * That is, it does not necessarily contain info about all macroblocks,
1884 +     * as long as the distance between macroblocks in the info is smaller
1885 +     * than the target payload size.
1886 +     * Each MB info structure is 12 bytes, and is laid out as follows:
1887 +     * @code
1888 +     * u32le bit offset from the start of the packet
1889 +     * u8    current quantizer at the start of the macroblock
1890 +     * u8    GOB number
1891 +     * u16le macroblock address within the GOB
1892 +     * u8    horizontal MV predictor
1893 +     * u8    vertical MV predictor
1894 +     * u8    horizontal MV predictor for block number 3
1895 +     * u8    vertical MV predictor for block number 3
1896 +     * @endcode
1897 +     */
1898 +    AV_PKT_DATA_H263_MB_INFO,
1899 +
1900 +    /**
1901 +     * This side data should be associated with an audio stream and contains
1902 +     * ReplayGain information in form of the AVReplayGain struct.
1903 +     */
1904 +    AV_PKT_DATA_REPLAYGAIN,
1905 +
1906 +    /**
1907 +     * This side data contains a 3x3 transformation matrix describing an affine
1908 +     * transformation that needs to be applied to the decoded video frames for
1909 +     * correct presentation.
1910 +     *
1911 +     * See libavutil/display.h for a detailed description of the data.
1912 +     */
1913 +    AV_PKT_DATA_DISPLAYMATRIX,
1914 +
1915 +    /**
1916 +     * This side data should be associated with a video stream and contains
1917 +     * Stereoscopic 3D information in form of the AVStereo3D struct.
1918 +     */
1919 +    AV_PKT_DATA_STEREO3D,
1920 +
1921 +    /**
1922 +     * This side data should be associated with an audio stream and corresponds
1923 +     * to enum AVAudioServiceType.
1924 +     */
1925 +    AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1926 +
1927 +    /**
1928 +     * This side data contains quality related information from the encoder.
1929 +     * @code
1930 +     * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1931 +     * u8    picture type
1932 +     * u8    error count
1933 +     * u16   reserved
1934 +     * u64le[error count] sum of squared differences between encoder in and output
1935 +     * @endcode
1936 +     */
1937 +    AV_PKT_DATA_QUALITY_STATS,
1938 +
1939 +    /**
1940 +     * This side data contains an integer value representing the stream index
1941 +     * of a "fallback" track.  A fallback track indicates an alternate
1942 +     * track to use when the current track can not be decoded for some reason.
1943 +     * e.g. no decoder available for codec.
1944 +     */
1945 +    AV_PKT_DATA_FALLBACK_TRACK,
1946 +
1947 +    /**
1948 +     * This side data corresponds to the AVCPBProperties struct.
1949 +     */
1950 +    AV_PKT_DATA_CPB_PROPERTIES,
1951 +
1952 +    /**
1953 +     * Recommmends skipping the specified number of samples
1954 +     * @code
1955 +     * u32le number of samples to skip from start of this packet
1956 +     * u32le number of samples to skip from end of this packet
1957 +     * u8    reason for start skip
1958 +     * u8    reason for end   skip (0=padding silence, 1=convergence)
1959 +     * @endcode
1960 +     */
1961 +    AV_PKT_DATA_SKIP_SAMPLES,
1962 +
1963 +    /**
1964 +     * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1965 +     * the packet may contain "dual mono" audio specific to Japanese DTV
1966 +     * and if it is true, recommends only the selected channel to be used.
1967 +     * @code
1968 +     * u8    selected channels (0=mail/left, 1=sub/right, 2=both)
1969 +     * @endcode
1970 +     */
1971 +    AV_PKT_DATA_JP_DUALMONO,
1972 +
1973 +    /**
1974 +     * A list of zero terminated key/value strings. There is no end marker for
1975 +     * the list, so it is required to rely on the side data size to stop.
1976 +     */
1977 +    AV_PKT_DATA_STRINGS_METADATA,
1978 +
1979 +    /**
1980 +     * Subtitle event position
1981 +     * @code
1982 +     * u32le x1
1983 +     * u32le y1
1984 +     * u32le x2
1985 +     * u32le y2
1986 +     * @endcode
1987 +     */
1988 +    AV_PKT_DATA_SUBTITLE_POSITION,
1989 +
1990 +    /**
1991 +     * Data found in BlockAdditional element of matroska container. There is
1992 +     * no end marker for the data, so it is required to rely on the side data
1993 +     * size to recognize the end. 8 byte id (as found in BlockAddId) followed
1994 +     * by data.
1995 +     */
1996 +    AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
1997 +
1998 +    /**
1999 +     * The optional first identifier line of a WebVTT cue.
2000 +     */
2001 +    AV_PKT_DATA_WEBVTT_IDENTIFIER,
2002 +
2003 +    /**
2004 +     * The optional settings (rendering instructions) that immediately
2005 +     * follow the timestamp specifier of a WebVTT cue.
2006 +     */
2007 +    AV_PKT_DATA_WEBVTT_SETTINGS,
2008 +
2009 +    /**
2010 +     * A list of zero terminated key/value strings. There is no end marker for
2011 +     * the list, so it is required to rely on the side data size to stop. This
2012 +     * side data includes updated metadata which appeared in the stream.
2013 +     */
2014 +    AV_PKT_DATA_METADATA_UPDATE,
2015 +
2016 +    /**
2017 +     * MPEGTS stream ID, this is required to pass the stream ID
2018 +     * information from the demuxer to the corresponding muxer.
2019 +     */
2020 +    AV_PKT_DATA_MPEGTS_STREAM_ID,
2021 +
2022 +    /**
2023 +     * Mastering display metadata (based on SMPTE-2086:2014). This metadata
2024 +     * should be associated with a video stream and contains data in the form
2025 +     * of the AVMasteringDisplayMetadata struct.
2026 +     */
2027 +    AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
2028 +
2029 +    /**
2030 +     * This side data should be associated with a video stream and corresponds
2031 +     * to the AVSphericalMapping structure.
2032 +     */
2033 +    AV_PKT_DATA_SPHERICAL,
2034 +
2035 +    /**
2036 +     * Content light level (based on CTA-861.3). This metadata should be
2037 +     * associated with a video stream and contains data in the form of the
2038 +     * AVContentLightMetadata struct.
2039 +     */
2040 +    AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2041 +
2042 +    /**
2043 +     * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
2044 +     * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
2045 +     * The number of bytes of CC data is AVPacketSideData.size.
2046 +     */
2047 +    AV_PKT_DATA_A53_CC,
2048 +
2049 +    /**
2050 +     * This side data is encryption initialization data.
2051 +     * The format is not part of ABI, use av_encryption_init_info_* methods to
2052 +     * access.
2053 +     */
2054 +    AV_PKT_DATA_ENCRYPTION_INIT_INFO,
2055 +
2056 +    /**
2057 +     * This side data contains encryption info for how to decrypt the packet.
2058 +     * The format is not part of ABI, use av_encryption_info_* methods to access.
2059 +     */
2060 +    AV_PKT_DATA_ENCRYPTION_INFO,
2061 +
2062 +    /**
2063 +     * The number of side data types.
2064 +     * This is not part of the public API/ABI in the sense that it may
2065 +     * change when new side data types are added.
2066 +     * This must stay the last enum value.
2067 +     * If its value becomes huge, some code using it
2068 +     * needs to be updated as it assumes it to be smaller than other limits.
2069 +     */
2070 +    AV_PKT_DATA_NB
2071 +};
2072 +
2073 +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
2074 +
2075 +typedef struct AVPacketSideData {
2076 +    uint8_t *data;
2077 +    int      size;
2078 +    enum AVPacketSideDataType type;
2079 +} AVPacketSideData;
2080 +
2081 +/**
2082 + * This structure stores compressed data. It is typically exported by demuxers
2083 + * and then passed as input to decoders, or received as output from encoders and
2084 + * then passed to muxers.
2085 + *
2086 + * For video, it should typically contain one compressed frame. For audio it may
2087 + * contain several compressed frames. Encoders are allowed to output empty
2088 + * packets, with no compressed data, containing only side data
2089 + * (e.g. to update some stream parameters at the end of encoding).
2090 + *
2091 + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
2092 + * ABI. Thus it may be allocated on stack and no new fields can be added to it
2093 + * without libavcodec and libavformat major bump.
2094 + *
2095 + * The semantics of data ownership depends on the buf field.
2096 + * If it is set, the packet data is dynamically allocated and is
2097 + * valid indefinitely until a call to av_packet_unref() reduces the
2098 + * reference count to 0.
2099 + *
2100 + * If the buf field is not set av_packet_ref() would make a copy instead
2101 + * of increasing the reference count.
2102 + *
2103 + * The side data is always allocated with av_malloc(), copied by
2104 + * av_packet_ref() and freed by av_packet_unref().
2105 + *
2106 + * @see av_packet_ref
2107 + * @see av_packet_unref
2108 + */
2109 +typedef struct AVPacket {
2110 +    /**
2111 +     * A reference to the reference-counted buffer where the packet data is
2112 +     * stored.
2113 +     * May be NULL, then the packet data is not reference-counted.
2114 +     */
2115 +    AVBufferRef *buf;
2116 +    /**
2117 +     * Presentation timestamp in AVStream->time_base units; the time at which
2118 +     * the decompressed packet will be presented to the user.
2119 +     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2120 +     * pts MUST be larger or equal to dts as presentation cannot happen before
2121 +     * decompression, unless one wants to view hex dumps. Some formats misuse
2122 +     * the terms dts and pts/cts to mean something different. Such timestamps
2123 +     * must be converted to true pts/dts before they are stored in AVPacket.
2124 +     */
2125 +    int64_t pts;
2126 +    /**
2127 +     * Decompression timestamp in AVStream->time_base units; the time at which
2128 +     * the packet is decompressed.
2129 +     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2130 +     */
2131 +    int64_t dts;
2132 +    uint8_t *data;
2133 +    int   size;
2134 +    int   stream_index;
2135 +    /**
2136 +     * A combination of AV_PKT_FLAG values
2137 +     */
2138 +    int   flags;
2139 +    /**
2140 +     * Additional packet data that can be provided by the container.
2141 +     * Packet can contain several types of side information.
2142 +     */
2143 +    AVPacketSideData *side_data;
2144 +    int side_data_elems;
2145 +
2146 +    /**
2147 +     * Duration of this packet in AVStream->time_base units, 0 if unknown.
2148 +     * Equals next_pts - this_pts in presentation order.
2149 +     */
2150 +    int64_t duration;
2151 +
2152 +    int64_t pos;                            ///< byte position in stream, -1 if unknown
2153 +
2154 +#if FF_API_CONVERGENCE_DURATION
2155 +    /**
2156 +     * @deprecated Same as the duration field, but as int64_t. This was required
2157 +     * for Matroska subtitles, whose duration values could overflow when the
2158 +     * duration field was still an int.
2159 +     */
2160 +    attribute_deprecated
2161 +    int64_t convergence_duration;
2162 +#endif
2163 +} AVPacket;
2164 +#define AV_PKT_FLAG_KEY     0x0001 ///< The packet contains a keyframe
2165 +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
2166 +/**
2167 + * Flag is used to discard packets which are required to maintain valid
2168 + * decoder state but are not required for output and should be dropped
2169 + * after decoding.
2170 + **/
2171 +#define AV_PKT_FLAG_DISCARD   0x0004
2172 +/**
2173 + * The packet comes from a trusted source.
2174 + *
2175 + * Otherwise-unsafe constructs such as arbitrary pointers to data
2176 + * outside the packet may be followed.
2177 + */
2178 +#define AV_PKT_FLAG_TRUSTED   0x0008
2179 +/**
2180 + * Flag is used to indicate packets that contain frames that can
2181 + * be discarded by the decoder.  I.e. Non-reference frames.
2182 + */
2183 +#define AV_PKT_FLAG_DISPOSABLE 0x0010
2184 +
2185 +
2186 +enum AVSideDataParamChangeFlags {
2187 +    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
2188 +    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2189 +    AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
2190 +    AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
2191 +};
2192 +/**
2193 + * @}
2194 + */
2195 +
2196 +struct AVCodecInternal;
2197 +
2198 +enum AVFieldOrder {
2199 +    AV_FIELD_UNKNOWN,
2200 +    AV_FIELD_PROGRESSIVE,
2201 +    AV_FIELD_TT,          //< Top coded_first, top displayed first
2202 +    AV_FIELD_BB,          //< Bottom coded first, bottom displayed first
2203 +    AV_FIELD_TB,          //< Top coded first, bottom displayed first
2204 +    AV_FIELD_BT,          //< Bottom coded first, top displayed first
2205 +};
2206 +
2207 +/**
2208 + * main external API structure.
2209 + * New fields can be added to the end with minor version bumps.
2210 + * Removal, reordering and changes to existing fields require a major
2211 + * version bump.
2212 + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
2213 + * applications.
2214 + * The name string for AVOptions options matches the associated command line
2215 + * parameter name and can be found in libavcodec/options_table.h
2216 + * The AVOption/command line parameter names differ in some cases from the C
2217 + * structure field names for historic reasons or brevity.
2218 + * sizeof(AVCodecContext) must not be used outside libav*.
2219 + */
2220 +typedef struct AVCodecContext {
2221 +    /**
2222 +     * information on struct for av_log
2223 +     * - set by avcodec_alloc_context3
2224 +     */
2225 +    const AVClass *av_class;
2226 +    int log_level_offset;
2227 +
2228 +    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
2229 +    const struct AVCodec  *codec;
2230 +    enum AVCodecID     codec_id; /* see AV_CODEC_ID_xxx */
2231 +
2232 +    /**
2233 +     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2234 +     * This is used to work around some encoder bugs.
2235 +     * A demuxer should set this to what is stored in the field used to identify the codec.
2236 +     * If there are multiple such fields in a container then the demuxer should choose the one
2237 +     * which maximizes the information about the used codec.
2238 +     * If the codec tag field in a container is larger than 32 bits then the demuxer should
2239 +     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
2240 +     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
2241 +     * first.
2242 +     * - encoding: Set by user, if not then the default based on codec_id will be used.
2243 +     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2244 +     */
2245 +    unsigned int codec_tag;
2246 +
2247 +    void *priv_data;
2248 +
2249 +    /**
2250 +     * Private context used for internal data.
2251 +     *
2252 +     * Unlike priv_data, this is not codec-specific. It is used in general
2253 +     * libavcodec functions.
2254 +     */
2255 +    struct AVCodecInternal *internal;
2256 +
2257 +    /**
2258 +     * Private data of the user, can be used to carry app specific stuff.
2259 +     * - encoding: Set by user.
2260 +     * - decoding: Set by user.
2261 +     */
2262 +    void *opaque;
2263 +
2264 +    /**
2265 +     * the average bitrate
2266 +     * - encoding: Set by user; unused for constant quantizer encoding.
2267 +     * - decoding: Set by user, may be overwritten by libavcodec
2268 +     *             if this info is available in the stream
2269 +     */
2270 +    int64_t bit_rate;
2271 +
2272 +    /**
2273 +     * number of bits the bitstream is allowed to diverge from the reference.
2274 +     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
2275 +     * - encoding: Set by user; unused for constant quantizer encoding.
2276 +     * - decoding: unused
2277 +     */
2278 +    int bit_rate_tolerance;
2279 +
2280 +    /**
2281 +     * Global quality for codecs which cannot change it per frame.
2282 +     * This should be proportional to MPEG-1/2/4 qscale.
2283 +     * - encoding: Set by user.
2284 +     * - decoding: unused
2285 +     */
2286 +    int global_quality;
2287 +
2288 +    /**
2289 +     * - encoding: Set by user.
2290 +     * - decoding: unused
2291 +     */
2292 +    int compression_level;
2293 +#define FF_COMPRESSION_DEFAULT -1
2294 +
2295 +    /**
2296 +     * AV_CODEC_FLAG_*.
2297 +     * - encoding: Set by user.
2298 +     * - decoding: Set by user.
2299 +     */
2300 +    int flags;
2301 +
2302 +    /**
2303 +     * AV_CODEC_FLAG2_*
2304 +     * - encoding: Set by user.
2305 +     * - decoding: Set by user.
2306 +     */
2307 +    int flags2;
2308 +
2309 +    /**
2310 +     * some codecs need / can use extradata like Huffman tables.
2311 +     * MJPEG: Huffman tables
2312 +     * rv10: additional flags
2313 +     * MPEG-4: global headers (they can be in the bitstream or here)
2314 +     * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
2315 +     * than extradata_size to avoid problems if it is read with the bitstream reader.
2316 +     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
2317 +     * - encoding: Set/allocated/freed by libavcodec.
2318 +     * - decoding: Set/allocated/freed by user.
2319 +     */
2320 +    uint8_t *extradata;
2321 +    int extradata_size;
2322 +
2323 +    /**
2324 +     * This is the fundamental unit of time (in seconds) in terms
2325 +     * of which frame timestamps are represented. For fixed-fps content,
2326 +     * timebase should be 1/framerate and timestamp increments should be
2327 +     * identically 1.
2328 +     * This often, but not always is the inverse of the frame rate or field rate
2329 +     * for video. 1/time_base is not the average frame rate if the frame rate is not
2330 +     * constant.
2331 +     *
2332 +     * Like containers, elementary streams also can store timestamps, 1/time_base
2333 +     * is the unit in which these timestamps are specified.
2334 +     * As example of such codec time base see ISO/IEC 14496-2:2001(E)
2335 +     * vop_time_increment_resolution and fixed_vop_rate
2336 +     * (fixed_vop_rate == 0 implies that it is different from the framerate)
2337 +     *
2338 +     * - encoding: MUST be set by user.
2339 +     * - decoding: the use of this field for decoding is deprecated.
2340 +     *             Use framerate instead.
2341 +     */
2342 +    AVRational time_base;
2343 +
2344 +    /**
2345 +     * For some codecs, the time base is closer to the field rate than the frame rate.
2346 +     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2347 +     * if no telecine is used ...
2348 +     *
2349 +     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2350 +     */
2351 +    int ticks_per_frame;
2352 +
2353 +    /**
2354 +     * Codec delay.
2355 +     *
2356 +     * Encoding: Number of frames delay there will be from the encoder input to
2357 +     *           the decoder output. (we assume the decoder matches the spec)
2358 +     * Decoding: Number of frames delay in addition to what a standard decoder
2359 +     *           as specified in the spec would produce.
2360 +     *
2361 +     * Video:
2362 +     *   Number of frames the decoded output will be delayed relative to the
2363 +     *   encoded input.
2364 +     *
2365 +     * Audio:
2366 +     *   For encoding, this field is unused (see initial_padding).
2367 +     *
2368 +     *   For decoding, this is the number of samples the decoder needs to
2369 +     *   output before the decoder's output is valid. When seeking, you should
2370 +     *   start decoding this many samples prior to your desired seek point.
2371 +     *
2372 +     * - encoding: Set by libavcodec.
2373 +     * - decoding: Set by libavcodec.
2374 +     */
2375 +    int delay;
2376 +
2377 +
2378 +    /* video only */
2379 +    /**
2380 +     * picture width / height.
2381 +     *
2382 +     * @note Those fields may not match the values of the last
2383 +     * AVFrame output by avcodec_decode_video2 due frame
2384 +     * reordering.
2385 +     *
2386 +     * - encoding: MUST be set by user.
2387 +     * - decoding: May be set by the user before opening the decoder if known e.g.
2388 +     *             from the container. Some decoders will require the dimensions
2389 +     *             to be set by the caller. During decoding, the decoder may
2390 +     *             overwrite those values as required while parsing the data.
2391 +     */
2392 +    int width, height;
2393 +
2394 +    /**
2395 +     * Bitstream width / height, may be different from width/height e.g. when
2396 +     * the decoded frame is cropped before being output or lowres is enabled.
2397 +     *
2398 +     * @note Those field may not match the value of the last
2399 +     * AVFrame output by avcodec_receive_frame() due frame
2400 +     * reordering.
2401 +     *
2402 +     * - encoding: unused
2403 +     * - decoding: May be set by the user before opening the decoder if known
2404 +     *             e.g. from the container. During decoding, the decoder may
2405 +     *             overwrite those values as required while parsing the data.
2406 +     */
2407 +    int coded_width, coded_height;
2408 +
2409 +    /**
2410 +     * the number of pictures in a group of pictures, or 0 for intra_only
2411 +     * - encoding: Set by user.
2412 +     * - decoding: unused
2413 +     */
2414 +    int gop_size;
2415 +
2416 +    /**
2417 +     * Pixel format, see AV_PIX_FMT_xxx.
2418 +     * May be set by the demuxer if known from headers.
2419 +     * May be overridden by the decoder if it knows better.
2420 +     *
2421 +     * @note This field may not match the value of the last
2422 +     * AVFrame output by avcodec_receive_frame() due frame
2423 +     * reordering.
2424 +     *
2425 +     * - encoding: Set by user.
2426 +     * - decoding: Set by user if known, overridden by libavcodec while
2427 +     *             parsing the data.
2428 +     */
2429 +    enum AVPixelFormat pix_fmt;
2430 +
2431 +    /**
2432 +     * If non NULL, 'draw_horiz_band' is called by the libavcodec
2433 +     * decoder to draw a horizontal band. It improves cache usage. Not
2434 +     * all codecs can do that. You must check the codec capabilities
2435 +     * beforehand.
2436 +     * When multithreading is used, it may be called from multiple threads
2437 +     * at the same time; threads might draw different parts of the same AVFrame,
2438 +     * or multiple AVFrames, and there is no guarantee that slices will be drawn
2439 +     * in order.
2440 +     * The function is also used by hardware acceleration APIs.
2441 +     * It is called at least once during frame decoding to pass
2442 +     * the data needed for hardware render.
2443 +     * In that mode instead of pixel data, AVFrame points to
2444 +     * a structure specific to the acceleration API. The application
2445 +     * reads the structure and can change some fields to indicate progress
2446 +     * or mark state.
2447 +     * - encoding: unused
2448 +     * - decoding: Set by user.
2449 +     * @param height the height of the slice
2450 +     * @param y the y position of the slice
2451 +     * @param type 1->top field, 2->bottom field, 3->frame
2452 +     * @param offset offset into the AVFrame.data from which the slice should be read
2453 +     */
2454 +    void (*draw_horiz_band)(struct AVCodecContext *s,
2455 +                            const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2456 +                            int y, int type, int height);
2457 +
2458 +    /**
2459 +     * callback to negotiate the pixelFormat
2460 +     * @param fmt is the list of formats which are supported by the codec,
2461 +     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2462 +     * The first is always the native one.
2463 +     * @note The callback may be called again immediately if initialization for
2464 +     * the selected (hardware-accelerated) pixel format failed.
2465 +     * @warning Behavior is undefined if the callback returns a value not
2466 +     * in the fmt list of formats.
2467 +     * @return the chosen format
2468 +     * - encoding: unused
2469 +     * - decoding: Set by user, if not set the native format will be chosen.
2470 +     */
2471 +    enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2472 +
2473 +    /**
2474 +     * maximum number of B-frames between non-B-frames
2475 +     * Note: The output will be delayed by max_b_frames+1 relative to the input.
2476 +     * - encoding: Set by user.
2477 +     * - decoding: unused
2478 +     */
2479 +    int max_b_frames;
2480 +
2481 +    /**
2482 +     * qscale factor between IP and B-frames
2483 +     * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
2484 +     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2485 +     * - encoding: Set by user.
2486 +     * - decoding: unused
2487 +     */
2488 +    float b_quant_factor;
2489 +
2490 +#if FF_API_PRIVATE_OPT
2491 +    /** @deprecated use encoder private options instead */
2492 +    attribute_deprecated
2493 +    int b_frame_strategy;
2494 +#endif
2495 +
2496 +    /**
2497 +     * qscale offset between IP and B-frames
2498 +     * - encoding: Set by user.
2499 +     * - decoding: unused
2500 +     */
2501 +    float b_quant_offset;
2502 +
2503 +    /**
2504 +     * Size of the frame reordering buffer in the decoder.
2505 +     * For MPEG-2 it is 1 IPB or 0 low delay IP.
2506 +     * - encoding: Set by libavcodec.
2507 +     * - decoding: Set by libavcodec.
2508 +     */
2509 +    int has_b_frames;
2510 +
2511 +#if FF_API_PRIVATE_OPT
2512 +    /** @deprecated use encoder private options instead */
2513 +    attribute_deprecated
2514 +    int mpeg_quant;
2515 +#endif
2516 +
2517 +    /**
2518 +     * qscale factor between P- and I-frames
2519 +     * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
2520 +     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2521 +     * - encoding: Set by user.
2522 +     * - decoding: unused
2523 +     */
2524 +    float i_quant_factor;
2525 +
2526 +    /**
2527 +     * qscale offset between P and I-frames
2528 +     * - encoding: Set by user.
2529 +     * - decoding: unused
2530 +     */
2531 +    float i_quant_offset;
2532 +
2533 +    /**
2534 +     * luminance masking (0-> disabled)
2535 +     * - encoding: Set by user.
2536 +     * - decoding: unused
2537 +     */
2538 +    float lumi_masking;
2539 +
2540 +    /**
2541 +     * temporary complexity masking (0-> disabled)
2542 +     * - encoding: Set by user.
2543 +     * - decoding: unused
2544 +     */
2545 +    float temporal_cplx_masking;
2546 +
2547 +    /**
2548 +     * spatial complexity masking (0-> disabled)
2549 +     * - encoding: Set by user.
2550 +     * - decoding: unused
2551 +     */
2552 +    float spatial_cplx_masking;
2553 +
2554 +    /**
2555 +     * p block masking (0-> disabled)
2556 +     * - encoding: Set by user.
2557 +     * - decoding: unused
2558 +     */
2559 +    float p_masking;
2560 +
2561 +    /**
2562 +     * darkness masking (0-> disabled)
2563 +     * - encoding: Set by user.
2564 +     * - decoding: unused
2565 +     */
2566 +    float dark_masking;
2567 +
2568 +    /**
2569 +     * slice count
2570 +     * - encoding: Set by libavcodec.
2571 +     * - decoding: Set by user (or 0).
2572 +     */
2573 +    int slice_count;
2574 +
2575 +#if FF_API_PRIVATE_OPT
2576 +    /** @deprecated use encoder private options instead */
2577 +    attribute_deprecated
2578 +     int prediction_method;
2579 +#define FF_PRED_LEFT   0
2580 +#define FF_PRED_PLANE  1
2581 +#define FF_PRED_MEDIAN 2
2582 +#endif
2583 +
2584 +    /**
2585 +     * slice offsets in the frame in bytes
2586 +     * - encoding: Set/allocated by libavcodec.
2587 +     * - decoding: Set/allocated by user (or NULL).
2588 +     */
2589 +    int *slice_offset;
2590 +
2591 +    /**
2592 +     * sample aspect ratio (0 if unknown)
2593 +     * That is the width of a pixel divided by the height of the pixel.
2594 +     * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
2595 +     * - encoding: Set by user.
2596 +     * - decoding: Set by libavcodec.
2597 +     */
2598 +    AVRational sample_aspect_ratio;
2599 +
2600 +    /**
2601 +     * motion estimation comparison function
2602 +     * - encoding: Set by user.
2603 +     * - decoding: unused
2604 +     */
2605 +    int me_cmp;
2606 +    /**
2607 +     * subpixel motion estimation comparison function
2608 +     * - encoding: Set by user.
2609 +     * - decoding: unused
2610 +     */
2611 +    int me_sub_cmp;
2612 +    /**
2613 +     * macroblock comparison function (not supported yet)
2614 +     * - encoding: Set by user.
2615 +     * - decoding: unused
2616 +     */
2617 +    int mb_cmp;
2618 +    /**
2619 +     * interlaced DCT comparison function
2620 +     * - encoding: Set by user.
2621 +     * - decoding: unused
2622 +     */
2623 +    int ildct_cmp;
2624 +#define FF_CMP_SAD          0
2625 +#define FF_CMP_SSE          1
2626 +#define FF_CMP_SATD         2
2627 +#define FF_CMP_DCT          3
2628 +#define FF_CMP_PSNR         4
2629 +#define FF_CMP_BIT          5
2630 +#define FF_CMP_RD           6
2631 +#define FF_CMP_ZERO         7
2632 +#define FF_CMP_VSAD         8
2633 +#define FF_CMP_VSSE         9
2634 +#define FF_CMP_NSSE         10
2635 +#define FF_CMP_W53          11
2636 +#define FF_CMP_W97          12
2637 +#define FF_CMP_DCTMAX       13
2638 +#define FF_CMP_DCT264       14
2639 +#define FF_CMP_MEDIAN_SAD   15
2640 +#define FF_CMP_CHROMA       256
2641 +
2642 +    /**
2643 +     * ME diamond size & shape
2644 +     * - encoding: Set by user.
2645 +     * - decoding: unused
2646 +     */
2647 +    int dia_size;
2648 +
2649 +    /**
2650 +     * amount of previous MV predictors (2a+1 x 2a+1 square)
2651 +     * - encoding: Set by user.
2652 +     * - decoding: unused
2653 +     */
2654 +    int last_predictor_count;
2655 +
2656 +#if FF_API_PRIVATE_OPT
2657 +    /** @deprecated use encoder private options instead */
2658 +    attribute_deprecated
2659 +    int pre_me;
2660 +#endif
2661 +
2662 +    /**
2663 +     * motion estimation prepass comparison function
2664 +     * - encoding: Set by user.
2665 +     * - decoding: unused
2666 +     */
2667 +    int me_pre_cmp;
2668 +
2669 +    /**
2670 +     * ME prepass diamond size & shape
2671 +     * - encoding: Set by user.
2672 +     * - decoding: unused
2673 +     */
2674 +    int pre_dia_size;
2675 +
2676 +    /**
2677 +     * subpel ME quality
2678 +     * - encoding: Set by user.
2679 +     * - decoding: unused
2680 +     */
2681 +    int me_subpel_quality;
2682 +
2683 +    /**
2684 +     * maximum motion estimation search range in subpel units
2685 +     * If 0 then no limit.
2686 +     *
2687 +     * - encoding: Set by user.
2688 +     * - decoding: unused
2689 +     */
2690 +    int me_range;
2691 +
2692 +    /**
2693 +     * slice flags
2694 +     * - encoding: unused
2695 +     * - decoding: Set by user.
2696 +     */
2697 +    int slice_flags;
2698 +#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
2699 +#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
2700 +#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2701 +
2702 +    /**
2703 +     * macroblock decision mode
2704 +     * - encoding: Set by user.
2705 +     * - decoding: unused
2706 +     */
2707 +    int mb_decision;
2708 +#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
2709 +#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
2710 +#define FF_MB_DECISION_RD     2        ///< rate distortion
2711 +
2712 +    /**
2713 +     * custom intra quantization matrix
2714 +     * - encoding: Set by user, can be NULL.
2715 +     * - decoding: Set by libavcodec.
2716 +     */
2717 +    uint16_t *intra_matrix;
2718 +
2719 +    /**
2720 +     * custom inter quantization matrix
2721 +     * - encoding: Set by user, can be NULL.
2722 +     * - decoding: Set by libavcodec.
2723 +     */
2724 +    uint16_t *inter_matrix;
2725 +
2726 +#if FF_API_PRIVATE_OPT
2727 +    /** @deprecated use encoder private options instead */
2728 +    attribute_deprecated
2729 +    int scenechange_threshold;
2730 +
2731 +    /** @deprecated use encoder private options instead */
2732 +    attribute_deprecated
2733 +    int noise_reduction;
2734 +#endif
2735 +
2736 +    /**
2737 +     * precision of the intra DC coefficient - 8
2738 +     * - encoding: Set by user.
2739 +     * - decoding: Set by libavcodec
2740 +     */
2741 +    int intra_dc_precision;
2742 +
2743 +    /**
2744 +     * Number of macroblock rows at the top which are skipped.
2745 +     * - encoding: unused
2746 +     * - decoding: Set by user.
2747 +     */
2748 +    int skip_top;
2749 +
2750 +    /**
2751 +     * Number of macroblock rows at the bottom which are skipped.
2752 +     * - encoding: unused
2753 +     * - decoding: Set by user.
2754 +     */
2755 +    int skip_bottom;
2756 +
2757 +    /**
2758 +     * minimum MB Lagrange multiplier
2759 +     * - encoding: Set by user.
2760 +     * - decoding: unused
2761 +     */
2762 +    int mb_lmin;
2763 +
2764 +    /**
2765 +     * maximum MB Lagrange multiplier
2766 +     * - encoding: Set by user.
2767 +     * - decoding: unused
2768 +     */
2769 +    int mb_lmax;
2770 +
2771 +#if FF_API_PRIVATE_OPT
2772 +    /**
2773 +     * @deprecated use encoder private options instead
2774 +     */
2775 +    attribute_deprecated
2776 +    int me_penalty_compensation;
2777 +#endif
2778 +
2779 +    /**
2780 +     * - encoding: Set by user.
2781 +     * - decoding: unused
2782 +     */
2783 +    int bidir_refine;
2784 +
2785 +#if FF_API_PRIVATE_OPT
2786 +    /** @deprecated use encoder private options instead */
2787 +    attribute_deprecated
2788 +    int brd_scale;
2789 +#endif
2790 +
2791 +    /**
2792 +     * minimum GOP size
2793 +     * - encoding: Set by user.
2794 +     * - decoding: unused
2795 +     */
2796 +    int keyint_min;
2797 +
2798 +    /**
2799 +     * number of reference frames
2800 +     * - encoding: Set by user.
2801 +     * - decoding: Set by lavc.
2802 +     */
2803 +    int refs;
2804 +
2805 +#if FF_API_PRIVATE_OPT
2806 +    /** @deprecated use encoder private options instead */
2807 +    attribute_deprecated
2808 +    int chromaoffset;
2809 +#endif
2810 +
2811 +    /**
2812 +     * Note: Value depends upon the compare function used for fullpel ME.
2813 +     * - encoding: Set by user.
2814 +     * - decoding: unused
2815 +     */
2816 +    int mv0_threshold;
2817 +
2818 +#if FF_API_PRIVATE_OPT
2819 +    /** @deprecated use encoder private options instead */
2820 +    attribute_deprecated
2821 +    int b_sensitivity;
2822 +#endif
2823 +
2824 +    /**
2825 +     * Chromaticity coordinates of the source primaries.
2826 +     * - encoding: Set by user
2827 +     * - decoding: Set by libavcodec
2828 +     */
2829 +    enum AVColorPrimaries color_primaries;
2830 +
2831 +    /**
2832 +     * Color Transfer Characteristic.
2833 +     * - encoding: Set by user
2834 +     * - decoding: Set by libavcodec
2835 +     */
2836 +    enum AVColorTransferCharacteristic color_trc;
2837 +
2838 +    /**
2839 +     * YUV colorspace type.
2840 +     * - encoding: Set by user
2841 +     * - decoding: Set by libavcodec
2842 +     */
2843 +    enum AVColorSpace colorspace;
2844 +
2845 +    /**
2846 +     * MPEG vs JPEG YUV range.
2847 +     * - encoding: Set by user
2848 +     * - decoding: Set by libavcodec
2849 +     */
2850 +    enum AVColorRange color_range;
2851 +
2852 +    /**
2853 +     * This defines the location of chroma samples.
2854 +     * - encoding: Set by user
2855 +     * - decoding: Set by libavcodec
2856 +     */
2857 +    enum AVChromaLocation chroma_sample_location;
2858 +
2859 +    /**
2860 +     * Number of slices.
2861 +     * Indicates number of picture subdivisions. Used for parallelized
2862 +     * decoding.
2863 +     * - encoding: Set by user
2864 +     * - decoding: unused
2865 +     */
2866 +    int slices;
2867 +
2868 +    /** Field order
2869 +     * - encoding: set by libavcodec
2870 +     * - decoding: Set by user.
2871 +     */
2872 +    enum AVFieldOrder field_order;
2873 +
2874 +    /* audio only */
2875 +    int sample_rate; ///< samples per second
2876 +    int channels;    ///< number of audio channels
2877 +
2878 +    /**
2879 +     * audio sample format
2880 +     * - encoding: Set by user.
2881 +     * - decoding: Set by libavcodec.
2882 +     */
2883 +    enum AVSampleFormat sample_fmt;  ///< sample format
2884 +
2885 +    /* The following data should not be initialized. */
2886 +    /**
2887 +     * Number of samples per channel in an audio frame.
2888 +     *
2889 +     * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2890 +     *   except the last must contain exactly frame_size samples per channel.
2891 +     *   May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2892 +     *   frame size is not restricted.
2893 +     * - decoding: may be set by some decoders to indicate constant frame size
2894 +     */
2895 +    int frame_size;
2896 +
2897 +    /**
2898 +     * Frame counter, set by libavcodec.
2899 +     *
2900 +     * - decoding: total number of frames returned from the decoder so far.
2901 +     * - encoding: total number of frames passed to the encoder so far.
2902 +     *
2903 +     *   @note the counter is not incremented if encoding/decoding resulted in
2904 +     *   an error.
2905 +     */
2906 +    int frame_number;
2907 +
2908 +    /**
2909 +     * number of bytes per packet if constant and known or 0
2910 +     * Used by some WAV based audio codecs.
2911 +     */
2912 +    int block_align;
2913 +
2914 +    /**
2915 +     * Audio cutoff bandwidth (0 means "automatic")
2916 +     * - encoding: Set by user.
2917 +     * - decoding: unused
2918 +     */
2919 +    int cutoff;
2920 +
2921 +    /**
2922 +     * Audio channel layout.
2923 +     * - encoding: set by user.
2924 +     * - decoding: set by user, may be overwritten by libavcodec.
2925 +     */
2926 +    uint64_t channel_layout;
2927 +
2928 +    /**
2929 +     * Request decoder to use this channel layout if it can (0 for default)
2930 +     * - encoding: unused
2931 +     * - decoding: Set by user.
2932 +     */
2933 +    uint64_t request_channel_layout;
2934 +
2935 +    /**
2936 +     * Type of service that the audio stream conveys.
2937 +     * - encoding: Set by user.
2938 +     * - decoding: Set by libavcodec.
2939 +     */
2940 +    enum AVAudioServiceType audio_service_type;
2941 +
2942 +    /**
2943 +     * desired sample format
2944 +     * - encoding: Not used.
2945 +     * - decoding: Set by user.
2946 +     * Decoder will decode to this format if it can.
2947 +     */
2948 +    enum AVSampleFormat request_sample_fmt;
2949 +
2950 +    /**
2951 +     * This callback is called at the beginning of each frame to get data
2952 +     * buffer(s) for it. There may be one contiguous buffer for all the data or
2953 +     * there may be a buffer per each data plane or anything in between. What
2954 +     * this means is, you may set however many entries in buf[] you feel necessary.
2955 +     * Each buffer must be reference-counted using the AVBuffer API (see description
2956 +     * of buf[] below).
2957 +     *
2958 +     * The following fields will be set in the frame before this callback is
2959 +     * called:
2960 +     * - format
2961 +     * - width, height (video only)
2962 +     * - sample_rate, channel_layout, nb_samples (audio only)
2963 +     * Their values may differ from the corresponding values in
2964 +     * AVCodecContext. This callback must use the frame values, not the codec
2965 +     * context values, to calculate the required buffer size.
2966 +     *
2967 +     * This callback must fill the following fields in the frame:
2968 +     * - data[]
2969 +     * - linesize[]
2970 +     * - extended_data:
2971 +     *   * if the data is planar audio with more than 8 channels, then this
2972 +     *     callback must allocate and fill extended_data to contain all pointers
2973 +     *     to all data planes. data[] must hold as many pointers as it can.
2974 +     *     extended_data must be allocated with av_malloc() and will be freed in
2975 +     *     av_frame_unref().
2976 +     *   * otherwise extended_data must point to data
2977 +     * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2978 +     *   the frame's data and extended_data pointers must be contained in these. That
2979 +     *   is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2980 +     *   AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2981 +     *   and av_buffer_ref().
2982 +     * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2983 +     *   this callback and filled with the extra buffers if there are more
2984 +     *   buffers than buf[] can hold. extended_buf will be freed in
2985 +     *   av_frame_unref().
2986 +     *
2987 +     * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
2988 +     * avcodec_default_get_buffer2() instead of providing buffers allocated by
2989 +     * some other means.
2990 +     *
2991 +     * Each data plane must be aligned to the maximum required by the target
2992 +     * CPU.
2993 +     *
2994 +     * @see avcodec_default_get_buffer2()
2995 +     *
2996 +     * Video:
2997 +     *
2998 +     * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2999 +     * (read and/or written to if it is writable) later by libavcodec.
3000 +     *
3001 +     * avcodec_align_dimensions2() should be used to find the required width and
3002 +     * height, as they normally need to be rounded up to the next multiple of 16.
3003 +     *
3004 +     * Some decoders do not support linesizes changing between frames.
3005 +     *
3006 +     * If frame multithreading is used and thread_safe_callbacks is set,
3007 +     * this callback may be called from a different thread, but not from more
3008 +     * than one at once. Does not need to be reentrant.
3009 +     *
3010 +     * @see avcodec_align_dimensions2()
3011 +     *
3012 +     * Audio:
3013 +     *
3014 +     * Decoders request a buffer of a particular size by setting
3015 +     * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
3016 +     * however, utilize only part of the buffer by setting AVFrame.nb_samples
3017 +     * to a smaller value in the output frame.
3018 +     *
3019 +     * As a convenience, av_samples_get_buffer_size() and
3020 +     * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
3021 +     * functions to find the required data size and to fill data pointers and
3022 +     * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
3023 +     * since all planes must be the same size.
3024 +     *
3025 +     * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
3026 +     *
3027 +     * - encoding: unused
3028 +     * - decoding: Set by libavcodec, user can override.
3029 +     */
3030 +    int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
3031 +
3032 +    /**
3033 +     * If non-zero, the decoded audio and video frames returned from
3034 +     * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
3035 +     * and are valid indefinitely. The caller must free them with
3036 +     * av_frame_unref() when they are not needed anymore.
3037 +     * Otherwise, the decoded frames must not be freed by the caller and are
3038 +     * only valid until the next decode call.
3039 +     *
3040 +     * This is always automatically enabled if avcodec_receive_frame() is used.
3041 +     *
3042 +     * - encoding: unused
3043 +     * - decoding: set by the caller before avcodec_open2().
3044 +     */
3045 +    attribute_deprecated
3046 +    int refcounted_frames;
3047 +
3048 +    /* - encoding parameters */
3049 +    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
3050 +    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
3051 +
3052 +    /**
3053 +     * minimum quantizer
3054 +     * - encoding: Set by user.
3055 +     * - decoding: unused
3056 +     */
3057 +    int qmin;
3058 +
3059 +    /**
3060 +     * maximum quantizer
3061 +     * - encoding: Set by user.
3062 +     * - decoding: unused
3063 +     */
3064 +    int qmax;
3065 +
3066 +    /**
3067 +     * maximum quantizer difference between frames
3068 +     * - encoding: Set by user.
3069 +     * - decoding: unused
3070 +     */
3071 +    int max_qdiff;
3072 +
3073 +    /**
3074 +     * decoder bitstream buffer size
3075 +     * - encoding: Set by user.
3076 +     * - decoding: unused
3077 +     */
3078 +    int rc_buffer_size;
3079 +
3080 +    /**
3081 +     * ratecontrol override, see RcOverride
3082 +     * - encoding: Allocated/set/freed by user.
3083 +     * - decoding: unused
3084 +     */
3085 +    int rc_override_count;
3086 +    RcOverride *rc_override;
3087 +
3088 +    /**
3089 +     * maximum bitrate
3090 +     * - encoding: Set by user.
3091 +     * - decoding: Set by user, may be overwritten by libavcodec.
3092 +     */
3093 +    int64_t rc_max_rate;
3094 +
3095 +    /**
3096 +     * minimum bitrate
3097 +     * - encoding: Set by user.
3098 +     * - decoding: unused
3099 +     */
3100 +    int64_t rc_min_rate;
3101 +
3102 +    /**
3103 +     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
3104 +     * - encoding: Set by user.
3105 +     * - decoding: unused.
3106 +     */
3107 +    float rc_max_available_vbv_use;
3108 +
3109 +    /**
3110 +     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
3111 +     * - encoding: Set by user.
3112 +     * - decoding: unused.
3113 +     */
3114 +    float rc_min_vbv_overflow_use;
3115 +
3116 +    /**
3117 +     * Number of bits which should be loaded into the rc buffer before decoding starts.
3118 +     * - encoding: Set by user.
3119 +     * - decoding: unused
3120 +     */
3121 +    int rc_initial_buffer_occupancy;
3122 +
3123 +#if FF_API_CODER_TYPE
3124 +#define FF_CODER_TYPE_VLC       0
3125 +#define FF_CODER_TYPE_AC        1
3126 +#define FF_CODER_TYPE_RAW       2
3127 +#define FF_CODER_TYPE_RLE       3
3128 +    /**
3129 +     * @deprecated use encoder private options instead
3130 +     */
3131 +    attribute_deprecated
3132 +    int coder_type;
3133 +#endif /* FF_API_CODER_TYPE */
3134 +
3135 +#if FF_API_PRIVATE_OPT
3136 +    /** @deprecated use encoder private options instead */
3137 +    attribute_deprecated
3138 +    int context_model;
3139 +#endif
3140 +
3141 +#if FF_API_PRIVATE_OPT
3142 +    /** @deprecated use encoder private options instead */
3143 +    attribute_deprecated
3144 +    int frame_skip_threshold;
3145 +
3146 +    /** @deprecated use encoder private options instead */
3147 +    attribute_deprecated
3148 +    int frame_skip_factor;
3149 +
3150 +    /** @deprecated use encoder private options instead */
3151 +    attribute_deprecated
3152 +    int frame_skip_exp;
3153 +
3154 +    /** @deprecated use encoder private options instead */
3155 +    attribute_deprecated
3156 +    int frame_skip_cmp;
3157 +#endif /* FF_API_PRIVATE_OPT */
3158 +
3159 +    /**
3160 +     * trellis RD quantization
3161 +     * - encoding: Set by user.
3162 +     * - decoding: unused
3163 +     */
3164 +    int trellis;
3165 +
3166 +#if FF_API_PRIVATE_OPT
3167 +    /** @deprecated use encoder private options instead */
3168 +    attribute_deprecated
3169 +    int min_prediction_order;
3170 +
3171 +    /** @deprecated use encoder private options instead */
3172 +    attribute_deprecated
3173 +    int max_prediction_order;
3174 +
3175 +    /** @deprecated use encoder private options instead */
3176 +    attribute_deprecated
3177 +    int64_t timecode_frame_start;
3178 +#endif
3179 +
3180 +#if FF_API_RTP_CALLBACK
3181 +    /**
3182 +     * @deprecated unused
3183 +     */
3184 +    /* The RTP callback: This function is called    */
3185 +    /* every time the encoder has a packet to send. */
3186 +    /* It depends on the encoder if the data starts */
3187 +    /* with a Start Code (it should). H.263 does.   */
3188 +    /* mb_nb contains the number of macroblocks     */
3189 +    /* encoded in the RTP payload.                  */
3190 +    attribute_deprecated
3191 +    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3192 +#endif
3193 +
3194 +#if FF_API_PRIVATE_OPT
3195 +    /** @deprecated use encoder private options instead */
3196 +    attribute_deprecated
3197 +    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
3198 +                            /* do its best to deliver a chunk with size     */
3199 +                            /* below rtp_payload_size, the chunk will start */
3200 +                            /* with a start code on some codecs like H.263. */
3201 +                            /* This doesn't take account of any particular  */
3202 +                            /* headers inside the transmitted RTP payload.  */
3203 +#endif
3204 +
3205 +#if FF_API_STAT_BITS
3206 +    /* statistics, used for 2-pass encoding */
3207 +    attribute_deprecated
3208 +    int mv_bits;
3209 +    attribute_deprecated
3210 +    int header_bits;
3211 +    attribute_deprecated
3212 +    int i_tex_bits;
3213 +    attribute_deprecated
3214 +    int p_tex_bits;
3215 +    attribute_deprecated
3216 +    int i_count;
3217 +    attribute_deprecated
3218 +    int p_count;
3219 +    attribute_deprecated
3220 +    int skip_count;
3221 +    attribute_deprecated
3222 +    int misc_bits;
3223 +
3224 +    /** @deprecated this field is unused */
3225 +    attribute_deprecated
3226 +    int frame_bits;
3227 +#endif
3228 +
3229 +    /**
3230 +     * pass1 encoding statistics output buffer
3231 +     * - encoding: Set by libavcodec.
3232 +     * - decoding: unused
3233 +     */
3234 +    char *stats_out;
3235 +
3236 +    /**
3237 +     * pass2 encoding statistics input buffer
3238 +     * Concatenated stuff from stats_out of pass1 should be placed here.
3239 +     * - encoding: Allocated/set/freed by user.
3240 +     * - decoding: unused
3241 +     */
3242 +    char *stats_in;
3243 +
3244 +    /**
3245 +     * Work around bugs in encoders which sometimes cannot be detected automatically.
3246 +     * - encoding: Set by user
3247 +     * - decoding: Set by user
3248 +     */
3249 +    int workaround_bugs;
3250 +#define FF_BUG_AUTODETECT       1  ///< autodetection
3251 +#define FF_BUG_XVID_ILACE       4
3252 +#define FF_BUG_UMP4             8
3253 +#define FF_BUG_NO_PADDING       16
3254 +#define FF_BUG_AMV              32
3255 +#define FF_BUG_QPEL_CHROMA      64
3256 +#define FF_BUG_STD_QPEL         128
3257 +#define FF_BUG_QPEL_CHROMA2     256
3258 +#define FF_BUG_DIRECT_BLOCKSIZE 512
3259 +#define FF_BUG_EDGE             1024
3260 +#define FF_BUG_HPEL_CHROMA      2048
3261 +#define FF_BUG_DC_CLIP          4096
3262 +#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
3263 +#define FF_BUG_TRUNCATED       16384
3264 +#define FF_BUG_IEDGE           32768
3265 +
3266 +    /**
3267 +     * strictly follow the standard (MPEG-4, ...).
3268 +     * - encoding: Set by user.
3269 +     * - decoding: Set by user.
3270 +     * Setting this to STRICT or higher means the encoder and decoder will
3271 +     * generally do stupid things, whereas setting it to unofficial or lower
3272 +     * will mean the encoder might produce output that is not supported by all
3273 +     * spec-compliant decoders. Decoders don't differentiate between normal,
3274 +     * unofficial and experimental (that is, they always try to decode things
3275 +     * when they can) unless they are explicitly asked to behave stupidly
3276 +     * (=strictly conform to the specs)
3277 +     */
3278 +    int strict_std_compliance;
3279 +#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
3280 +#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
3281 +#define FF_COMPLIANCE_NORMAL        0
3282 +#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
3283 +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
3284 +
3285 +    /**
3286 +     * error concealment flags
3287 +     * - encoding: unused
3288 +     * - decoding: Set by user.
3289 +     */
3290 +    int error_concealment;
3291 +#define FF_EC_GUESS_MVS   1
3292 +#define FF_EC_DEBLOCK     2
3293 +#define FF_EC_FAVOR_INTER 256
3294 +
3295 +    /**
3296 +     * debug
3297 +     * - encoding: Set by user.
3298 +     * - decoding: Set by user.
3299 +     */
3300 +    int debug;
3301 +#define FF_DEBUG_PICT_INFO   1
3302 +#define FF_DEBUG_RC          2
3303 +#define FF_DEBUG_BITSTREAM   4
3304 +#define FF_DEBUG_MB_TYPE     8
3305 +#define FF_DEBUG_QP          16
3306 +#if FF_API_DEBUG_MV
3307 +/**
3308 + * @deprecated this option does nothing
3309 + */
3310 +#define FF_DEBUG_MV          32
3311 +#endif
3312 +#define FF_DEBUG_DCT_COEFF   0x00000040
3313 +#define FF_DEBUG_SKIP        0x00000080
3314 +#define FF_DEBUG_STARTCODE   0x00000100
3315 +#define FF_DEBUG_ER          0x00000400
3316 +#define FF_DEBUG_MMCO        0x00000800
3317 +#define FF_DEBUG_BUGS        0x00001000
3318 +#if FF_API_DEBUG_MV
3319 +#define FF_DEBUG_VIS_QP      0x00002000
3320 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000
3321 +#endif
3322 +#define FF_DEBUG_BUFFERS     0x00008000
3323 +#define FF_DEBUG_THREADS     0x00010000
3324 +#define FF_DEBUG_GREEN_MD    0x00800000
3325 +#define FF_DEBUG_NOMC        0x01000000
3326 +
3327 +#if FF_API_DEBUG_MV
3328 +    /**
3329 +     * debug
3330 +     * - encoding: Set by user.
3331 +     * - decoding: Set by user.
3332 +     */
3333 +    int debug_mv;
3334 +#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 // visualize forward predicted MVs of P-frames
3335 +#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 // visualize forward predicted MVs of B-frames
3336 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
3337 +#endif
3338 +
3339 +    /**
3340 +     * Error recognition; may misdetect some more or less valid parts as errors.
3341 +     * - encoding: unused
3342 +     * - decoding: Set by user.
3343 +     */
3344 +    int err_recognition;
3345 +
3346 +/**
3347 + * Verify checksums embedded in the bitstream (could be of either encoded or
3348 + * decoded data, depending on the codec) and print an error message on mismatch.
3349 + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
3350 + * decoder returning an error.
3351 + */
3352 +#define AV_EF_CRCCHECK  (1<<0)
3353 +#define AV_EF_BITSTREAM (1<<1)          ///< detect bitstream specification deviations
3354 +#define AV_EF_BUFFER    (1<<2)          ///< detect improper bitstream length
3355 +#define AV_EF_EXPLODE   (1<<3)          ///< abort decoding on minor error detection
3356 +
3357 +#define AV_EF_IGNORE_ERR (1<<15)        ///< ignore errors and continue
3358 +#define AV_EF_CAREFUL    (1<<16)        ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
3359 +#define AV_EF_COMPLIANT  (1<<17)        ///< consider all spec non compliances as errors
3360 +#define AV_EF_AGGRESSIVE (1<<18)        ///< consider things that a sane encoder should not do as an error
3361 +
3362 +
3363 +    /**
3364 +     * opaque 64-bit number (generally a PTS) that will be reordered and
3365 +     * output in AVFrame.reordered_opaque
3366 +     * - encoding: unused
3367 +     * - decoding: Set by user.
3368 +     */
3369 +    int64_t reordered_opaque;
3370 +
3371 +    /**
3372 +     * Hardware accelerator in use
3373 +     * - encoding: unused.
3374 +     * - decoding: Set by libavcodec
3375 +     */
3376 +    const struct AVHWAccel *hwaccel;
3377 +
3378 +    /**
3379 +     * Hardware accelerator context.
3380 +     * For some hardware accelerators, a global context needs to be
3381 +     * provided by the user. In that case, this holds display-dependent
3382 +     * data FFmpeg cannot instantiate itself. Please refer to the
3383 +     * FFmpeg HW accelerator documentation to know how to fill this
3384 +     * is. e.g. for VA API, this is a struct vaapi_context.
3385 +     * - encoding: unused
3386 +     * - decoding: Set by user
3387 +     */
3388 +    void *hwaccel_context;
3389 +
3390 +    /**
3391 +     * error
3392 +     * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
3393 +     * - decoding: unused
3394 +     */
3395 +    uint64_t error[AV_NUM_DATA_POINTERS];
3396 +
3397 +    /**
3398 +     * DCT algorithm, see FF_DCT_* below
3399 +     * - encoding: Set by user.
3400 +     * - decoding: unused
3401 +     */
3402 +    int dct_algo;
3403 +#define FF_DCT_AUTO    0
3404 +#define FF_DCT_FASTINT 1
3405 +#define FF_DCT_INT     2
3406 +#define FF_DCT_MMX     3
3407 +#define FF_DCT_ALTIVEC 5
3408 +#define FF_DCT_FAAN    6
3409 +
3410 +    /**
3411 +     * IDCT algorithm, see FF_IDCT_* below.
3412 +     * - encoding: Set by user.
3413 +     * - decoding: Set by user.
3414 +     */
3415 +    int idct_algo;
3416 +#define FF_IDCT_AUTO          0
3417 +#define FF_IDCT_INT           1
3418 +#define FF_IDCT_SIMPLE        2
3419 +#define FF_IDCT_SIMPLEMMX     3
3420 +#define FF_IDCT_ARM           7
3421 +#define FF_IDCT_ALTIVEC       8
3422 +#define FF_IDCT_SIMPLEARM     10
3423 +#define FF_IDCT_XVID          14
3424 +#define FF_IDCT_SIMPLEARMV5TE 16
3425 +#define FF_IDCT_SIMPLEARMV6   17
3426 +#define FF_IDCT_FAAN          20
3427 +#define FF_IDCT_SIMPLENEON    22
3428 +#define FF_IDCT_NONE          24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
3429 +#define FF_IDCT_SIMPLEAUTO    128
3430 +
3431 +    /**
3432 +     * bits per sample/pixel from the demuxer (needed for huffyuv).
3433 +     * - encoding: Set by libavcodec.
3434 +     * - decoding: Set by user.
3435 +     */
3436 +     int bits_per_coded_sample;
3437 +
3438 +    /**
3439 +     * Bits per sample/pixel of internal libavcodec pixel/sample format.
3440 +     * - encoding: set by user.
3441 +     * - decoding: set by libavcodec.
3442 +     */
3443 +    int bits_per_raw_sample;
3444 +
3445 +#if FF_API_LOWRES
3446 +    /**
3447 +     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3448 +     * - encoding: unused
3449 +     * - decoding: Set by user.
3450 +     */
3451 +     int lowres;
3452 +#endif
3453 +
3454 +#if FF_API_CODED_FRAME
3455 +    /**
3456 +     * the picture in the bitstream
3457 +     * - encoding: Set by libavcodec.
3458 +     * - decoding: unused
3459 +     *
3460 +     * @deprecated use the quality factor packet side data instead
3461 +     */
3462 +    attribute_deprecated AVFrame *coded_frame;
3463 +#endif
3464 +
3465 +    /**
3466 +     * thread count
3467 +     * is used to decide how many independent tasks should be passed to execute()
3468 +     * - encoding: Set by user.
3469 +     * - decoding: Set by user.
3470 +     */
3471 +    int thread_count;
3472 +
3473 +    /**
3474 +     * Which multithreading methods to use.
3475 +     * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
3476 +     * so clients which cannot provide future frames should not use it.
3477 +     *
3478 +     * - encoding: Set by user, otherwise the default is used.
3479 +     * - decoding: Set by user, otherwise the default is used.
3480 +     */
3481 +    int thread_type;
3482 +#define FF_THREAD_FRAME   1 ///< Decode more than one frame at once
3483 +#define FF_THREAD_SLICE   2 ///< Decode more than one part of a single frame at once
3484 +
3485 +    /**
3486 +     * Which multithreading methods are in use by the codec.
3487 +     * - encoding: Set by libavcodec.
3488 +     * - decoding: Set by libavcodec.
3489 +     */
3490 +    int active_thread_type;
3491 +
3492 +    /**
3493 +     * Set by the client if its custom get_buffer() callback can be called
3494 +     * synchronously from another thread, which allows faster multithreaded decoding.
3495 +     * draw_horiz_band() will be called from other threads regardless of this setting.
3496 +     * Ignored if the default get_buffer() is used.
3497 +     * - encoding: Set by user.
3498 +     * - decoding: Set by user.
3499 +     */
3500 +    int thread_safe_callbacks;
3501 +
3502 +    /**
3503 +     * The codec may call this to execute several independent things.
3504 +     * It will return only after finishing all tasks.
3505 +     * The user may replace this with some multithreaded implementation,
3506 +     * the default implementation will execute the parts serially.
3507 +     * @param count the number of things to execute
3508 +     * - encoding: Set by libavcodec, user can override.
3509 +     * - decoding: Set by libavcodec, user can override.
3510 +     */
3511 +    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3512 +
3513 +    /**
3514 +     * The codec may call this to execute several independent things.
3515 +     * It will return only after finishing all tasks.
3516 +     * The user may replace this with some multithreaded implementation,
3517 +     * the default implementation will execute the parts serially.
3518 +     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
3519 +     * @param c context passed also to func
3520 +     * @param count the number of things to execute
3521 +     * @param arg2 argument passed unchanged to func
3522 +     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
3523 +     * @param func function that will be called count times, with jobnr from 0 to count-1.
3524 +     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
3525 +     *             two instances of func executing at the same time will have the same threadnr.
3526 +     * @return always 0 currently, but code should handle a future improvement where when any call to func
3527 +     *         returns < 0 no further calls to func may be done and < 0 is returned.
3528 +     * - encoding: Set by libavcodec, user can override.
3529 +     * - decoding: Set by libavcodec, user can override.
3530 +     */
3531 +    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3532 +
3533 +    /**
3534 +     * noise vs. sse weight for the nsse comparison function
3535 +     * - encoding: Set by user.
3536 +     * - decoding: unused
3537 +     */
3538 +     int nsse_weight;
3539 +
3540 +    /**
3541 +     * profile
3542 +     * - encoding: Set by user.
3543 +     * - decoding: Set by libavcodec.
3544 +     */
3545 +     int profile;
3546 +#define FF_PROFILE_UNKNOWN -99
3547 +#define FF_PROFILE_RESERVED -100
3548 +
3549 +#define FF_PROFILE_AAC_MAIN 0
3550 +#define FF_PROFILE_AAC_LOW  1
3551 +#define FF_PROFILE_AAC_SSR  2
3552 +#define FF_PROFILE_AAC_LTP  3
3553 +#define FF_PROFILE_AAC_HE   4
3554 +#define FF_PROFILE_AAC_HE_V2 28
3555 +#define FF_PROFILE_AAC_LD   22
3556 +#define FF_PROFILE_AAC_ELD  38
3557 +#define FF_PROFILE_MPEG2_AAC_LOW 128
3558 +#define FF_PROFILE_MPEG2_AAC_HE  131
3559 +
3560 +#define FF_PROFILE_DNXHD         0
3561 +#define FF_PROFILE_DNXHR_LB      1
3562 +#define FF_PROFILE_DNXHR_SQ      2
3563 +#define FF_PROFILE_DNXHR_HQ      3
3564 +#define FF_PROFILE_DNXHR_HQX     4
3565 +#define FF_PROFILE_DNXHR_444     5
3566 +
3567 +#define FF_PROFILE_DTS         20
3568 +#define FF_PROFILE_DTS_ES      30
3569 +#define FF_PROFILE_DTS_96_24   40
3570 +#define FF_PROFILE_DTS_HD_HRA  50
3571 +#define FF_PROFILE_DTS_HD_MA   60
3572 +#define FF_PROFILE_DTS_EXPRESS 70
3573 +
3574 +#define FF_PROFILE_MPEG2_422    0
3575 +#define FF_PROFILE_MPEG2_HIGH   1
3576 +#define FF_PROFILE_MPEG2_SS     2
3577 +#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
3578 +#define FF_PROFILE_MPEG2_MAIN   4
3579 +#define FF_PROFILE_MPEG2_SIMPLE 5
3580 +
3581 +#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
3582 +#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
3583 +
3584 +#define FF_PROFILE_H264_BASELINE             66
3585 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3586 +#define FF_PROFILE_H264_MAIN                 77
3587 +#define FF_PROFILE_H264_EXTENDED             88
3588 +#define FF_PROFILE_H264_HIGH                 100
3589 +#define FF_PROFILE_H264_HIGH_10              110
3590 +#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
3591 +#define FF_PROFILE_H264_MULTIVIEW_HIGH       118
3592 +#define FF_PROFILE_H264_HIGH_422             122
3593 +#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
3594 +#define FF_PROFILE_H264_STEREO_HIGH          128
3595 +#define FF_PROFILE_H264_HIGH_444             144
3596 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
3597 +#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
3598 +#define FF_PROFILE_H264_CAVLC_444            44
3599 +
3600 +#define FF_PROFILE_VC1_SIMPLE   0
3601 +#define FF_PROFILE_VC1_MAIN     1
3602 +#define FF_PROFILE_VC1_COMPLEX  2
3603 +#define FF_PROFILE_VC1_ADVANCED 3
3604 +
3605 +#define FF_PROFILE_MPEG4_SIMPLE                     0
3606 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
3607 +#define FF_PROFILE_MPEG4_CORE                       2
3608 +#define FF_PROFILE_MPEG4_MAIN                       3
3609 +#define FF_PROFILE_MPEG4_N_BIT                      4
3610 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
3611 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
3612 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
3613 +#define FF_PROFILE_MPEG4_HYBRID                     8
3614 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
3615 +#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
3616 +#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
3617 +#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
3618 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3619 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
3620 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
3621 +
3622 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0   1
3623 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1   2
3624 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION  32768
3625 +#define FF_PROFILE_JPEG2000_DCINEMA_2K              3
3626 +#define FF_PROFILE_JPEG2000_DCINEMA_4K              4
3627 +
3628 +#define FF_PROFILE_VP9_0                            0
3629 +#define FF_PROFILE_VP9_1                            1
3630 +#define FF_PROFILE_VP9_2                            2
3631 +#define FF_PROFILE_VP9_3                            3
3632 +
3633 +#define FF_PROFILE_HEVC_MAIN                        1
3634 +#define FF_PROFILE_HEVC_MAIN_10                     2
3635 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
3636 +#define FF_PROFILE_HEVC_REXT                        4
3637 +
3638 +#define FF_PROFILE_AV1_MAIN                         0
3639 +#define FF_PROFILE_AV1_HIGH                         1
3640 +#define FF_PROFILE_AV1_PROFESSIONAL                 2
3641 +
3642 +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT            0xc0
3643 +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
3644 +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT         0xc2
3645 +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS                0xc3
3646 +#define FF_PROFILE_MJPEG_JPEG_LS                         0xf7
3647 +
3648 +#define FF_PROFILE_SBC_MSBC                         1
3649 +
3650 +    /**
3651 +     * level
3652 +     * - encoding: Set by user.
3653 +     * - decoding: Set by libavcodec.
3654 +     */
3655 +     int level;
3656 +#define FF_LEVEL_UNKNOWN -99
3657 +
3658 +    /**
3659 +     * Skip loop filtering for selected frames.
3660 +     * - encoding: unused
3661 +     * - decoding: Set by user.
3662 +     */
3663 +    enum AVDiscard skip_loop_filter;
3664 +
3665 +    /**
3666 +     * Skip IDCT/dequantization for selected frames.
3667 +     * - encoding: unused
3668 +     * - decoding: Set by user.
3669 +     */
3670 +    enum AVDiscard skip_idct;
3671 +
3672 +    /**
3673 +     * Skip decoding for selected frames.
3674 +     * - encoding: unused
3675 +     * - decoding: Set by user.
3676 +     */
3677 +    enum AVDiscard skip_frame;
3678 +
3679 +    /**
3680 +     * Header containing style information for text subtitles.
3681 +     * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3682 +     * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3683 +     * the Format line following. It shouldn't include any Dialogue line.
3684 +     * - encoding: Set/allocated/freed by user (before avcodec_open2())
3685 +     * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3686 +     */
3687 +    uint8_t *subtitle_header;
3688 +    int subtitle_header_size;
3689 +
3690 +#if FF_API_VBV_DELAY
3691 +    /**
3692 +     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3693 +     * Used for compliant TS muxing.
3694 +     * - encoding: Set by libavcodec.
3695 +     * - decoding: unused.
3696 +     * @deprecated this value is now exported as a part of
3697 +     * AV_PKT_DATA_CPB_PROPERTIES packet side data
3698 +     */
3699 +    attribute_deprecated
3700 +    uint64_t vbv_delay;
3701 +#endif
3702 +
3703 +#if FF_API_SIDEDATA_ONLY_PKT
3704 +    /**
3705 +     * Encoding only and set by default. Allow encoders to output packets
3706 +     * that do not contain any encoded data, only side data.
3707 +     *
3708 +     * Some encoders need to output such packets, e.g. to update some stream
3709 +     * parameters at the end of encoding.
3710 +     *
3711 +     * @deprecated this field disables the default behaviour and
3712 +     *             it is kept only for compatibility.
3713 +     */
3714 +    attribute_deprecated
3715 +    int side_data_only_packets;
3716 +#endif
3717 +
3718 +    /**
3719 +     * Audio only. The number of "priming" samples (padding) inserted by the
3720 +     * encoder at the beginning of the audio. I.e. this number of leading
3721 +     * decoded samples must be discarded by the caller to get the original audio
3722 +     * without leading padding.
3723 +     *
3724 +     * - decoding: unused
3725 +     * - encoding: Set by libavcodec. The timestamps on the output packets are
3726 +     *             adjusted by the encoder so that they always refer to the
3727 +     *             first sample of the data actually contained in the packet,
3728 +     *             including any added padding.  E.g. if the timebase is
3729 +     *             1/samplerate and the timestamp of the first input sample is
3730 +     *             0, the timestamp of the first output packet will be
3731 +     *             -initial_padding.
3732 +     */
3733 +    int initial_padding;
3734 +
3735 +    /**
3736 +     * - decoding: For codecs that store a framerate value in the compressed
3737 +     *             bitstream, the decoder may export it here. { 0, 1} when
3738 +     *             unknown.
3739 +     * - encoding: May be used to signal the framerate of CFR content to an
3740 +     *             encoder.
3741 +     */
3742 +    AVRational framerate;
3743 +
3744 +    /**
3745 +     * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3746 +     * - encoding: unused.
3747 +     * - decoding: Set by libavcodec before calling get_format()
3748 +     */
3749 +    enum AVPixelFormat sw_pix_fmt;
3750 +
3751 +    /**
3752 +     * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3753 +     * - encoding unused.
3754 +     * - decoding set by user.
3755 +     */
3756 +    AVRational pkt_timebase;
3757 +
3758 +    /**
3759 +     * AVCodecDescriptor
3760 +     * - encoding: unused.
3761 +     * - decoding: set by libavcodec.
3762 +     */
3763 +    const AVCodecDescriptor *codec_descriptor;
3764 +
3765 +#if !FF_API_LOWRES
3766 +    /**
3767 +     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3768 +     * - encoding: unused
3769 +     * - decoding: Set by user.
3770 +     */
3771 +     int lowres;
3772 +#endif
3773 +
3774 +    /**
3775 +     * Current statistics for PTS correction.
3776 +     * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3777 +     * - encoding: unused
3778 +     */
3779 +    int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3780 +    int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3781 +    int64_t pts_correction_last_pts;       /// PTS of the last frame
3782 +    int64_t pts_correction_last_dts;       /// DTS of the last frame
3783 +
3784 +    /**
3785 +     * Character encoding of the input subtitles file.
3786 +     * - decoding: set by user
3787 +     * - encoding: unused
3788 +     */
3789 +    char *sub_charenc;
3790 +
3791 +    /**
3792 +     * Subtitles character encoding mode. Formats or codecs might be adjusting
3793 +     * this setting (if they are doing the conversion themselves for instance).
3794 +     * - decoding: set by libavcodec
3795 +     * - encoding: unused
3796 +     */
3797 +    int sub_charenc_mode;
3798 +#define FF_SUB_CHARENC_MODE_DO_NOTHING  -1  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
3799 +#define FF_SUB_CHARENC_MODE_AUTOMATIC    0  ///< libavcodec will select the mode itself
3800 +#define FF_SUB_CHARENC_MODE_PRE_DECODER  1  ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
3801 +#define FF_SUB_CHARENC_MODE_IGNORE       2  ///< neither convert the subtitles, nor check them for valid UTF-8
3802 +
3803 +    /**
3804 +     * Skip processing alpha if supported by codec.
3805 +     * Note that if the format uses pre-multiplied alpha (common with VP6,
3806 +     * and recommended due to better video quality/compression)
3807 +     * the image will look as if alpha-blended onto a black background.
3808 +     * However for formats that do not use pre-multiplied alpha
3809 +     * there might be serious artefacts (though e.g. libswscale currently
3810 +     * assumes pre-multiplied alpha anyway).
3811 +     *
3812 +     * - decoding: set by user
3813 +     * - encoding: unused
3814 +     */
3815 +    int skip_alpha;
3816 +
3817 +    /**
3818 +     * Number of samples to skip after a discontinuity
3819 +     * - decoding: unused
3820 +     * - encoding: set by libavcodec
3821 +     */
3822 +    int seek_preroll;
3823 +
3824 +#if !FF_API_DEBUG_MV
3825 +    /**
3826 +     * debug motion vectors
3827 +     * - encoding: Set by user.
3828 +     * - decoding: Set by user.
3829 +     */
3830 +    int debug_mv;
3831 +#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
3832 +#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
3833 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3834 +#endif
3835 +
3836 +    /**
3837 +     * custom intra quantization matrix
3838 +     * - encoding: Set by user, can be NULL.
3839 +     * - decoding: unused.
3840 +     */
3841 +    uint16_t *chroma_intra_matrix;
3842 +
3843 +    /**
3844 +     * dump format separator.
3845 +     * can be ", " or "\n      " or anything else
3846 +     * - encoding: Set by user.
3847 +     * - decoding: Set by user.
3848 +     */
3849 +    uint8_t *dump_separator;
3850 +
3851 +    /**
3852 +     * ',' separated list of allowed decoders.
3853 +     * If NULL then all are allowed
3854 +     * - encoding: unused
3855 +     * - decoding: set by user
3856 +     */
3857 +    char *codec_whitelist;
3858 +
3859 +    /**
3860 +     * Properties of the stream that gets decoded
3861 +     * - encoding: unused
3862 +     * - decoding: set by libavcodec
3863 +     */
3864 +    unsigned properties;
3865 +#define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
3866 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3867 +
3868 +    /**
3869 +     * Additional data associated with the entire coded stream.
3870 +     *
3871 +     * - decoding: unused
3872 +     * - encoding: may be set by libavcodec after avcodec_open2().
3873 +     */
3874 +    AVPacketSideData *coded_side_data;
3875 +    int            nb_coded_side_data;
3876 +
3877 +    /**
3878 +     * A reference to the AVHWFramesContext describing the input (for encoding)
3879 +     * or output (decoding) frames. The reference is set by the caller and
3880 +     * afterwards owned (and freed) by libavcodec - it should never be read by
3881 +     * the caller after being set.
3882 +     *
3883 +     * - decoding: This field should be set by the caller from the get_format()
3884 +     *             callback. The previous reference (if any) will always be
3885 +     *             unreffed by libavcodec before the get_format() call.
3886 +     *
3887 +     *             If the default get_buffer2() is used with a hwaccel pixel
3888 +     *             format, then this AVHWFramesContext will be used for
3889 +     *             allocating the frame buffers.
3890 +     *
3891 +     * - encoding: For hardware encoders configured to use a hwaccel pixel
3892 +     *             format, this field should be set by the caller to a reference
3893 +     *             to the AVHWFramesContext describing input frames.
3894 +     *             AVHWFramesContext.format must be equal to
3895 +     *             AVCodecContext.pix_fmt.
3896 +     *
3897 +     *             This field should be set before avcodec_open2() is called.
3898 +     */
3899 +    AVBufferRef *hw_frames_ctx;
3900 +
3901 +    /**
3902 +     * Control the form of AVSubtitle.rects[N]->ass
3903 +     * - decoding: set by user
3904 +     * - encoding: unused
3905 +     */
3906 +    int sub_text_format;
3907 +#define FF_SUB_TEXT_FMT_ASS              0
3908 +#if FF_API_ASS_TIMING
3909 +#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3910 +#endif
3911 +
3912 +    /**
3913 +     * Audio only. The amount of padding (in samples) appended by the encoder to
3914 +     * the end of the audio. I.e. this number of decoded samples must be
3915 +     * discarded by the caller from the end of the stream to get the original
3916 +     * audio without any trailing padding.
3917 +     *
3918 +     * - decoding: unused
3919 +     * - encoding: unused
3920 +     */
3921 +    int trailing_padding;
3922 +
3923 +    /**
3924 +     * The number of pixels per image to maximally accept.
3925 +     *
3926 +     * - decoding: set by user
3927 +     * - encoding: set by user
3928 +     */
3929 +    int64_t max_pixels;
3930 +
3931 +    /**
3932 +     * A reference to the AVHWDeviceContext describing the device which will
3933 +     * be used by a hardware encoder/decoder.  The reference is set by the
3934 +     * caller and afterwards owned (and freed) by libavcodec.
3935 +     *
3936 +     * This should be used if either the codec device does not require
3937 +     * hardware frames or any that are used are to be allocated internally by
3938 +     * libavcodec.  If the user wishes to supply any of the frames used as
3939 +     * encoder input or decoder output then hw_frames_ctx should be used
3940 +     * instead.  When hw_frames_ctx is set in get_format() for a decoder, this
3941 +     * field will be ignored while decoding the associated stream segment, but
3942 +     * may again be used on a following one after another get_format() call.
3943 +     *
3944 +     * For both encoders and decoders this field should be set before
3945 +     * avcodec_open2() is called and must not be written to thereafter.
3946 +     *
3947 +     * Note that some decoders may require this field to be set initially in
3948 +     * order to support hw_frames_ctx at all - in that case, all frames
3949 +     * contexts used must be created on the same device.
3950 +     */
3951 +    AVBufferRef *hw_device_ctx;
3952 +
3953 +    /**
3954 +     * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
3955 +     * decoding (if active).
3956 +     * - encoding: unused
3957 +     * - decoding: Set by user (either before avcodec_open2(), or in the
3958 +     *             AVCodecContext.get_format callback)
3959 +     */
3960 +    int hwaccel_flags;
3961 +
3962 +    /**
3963 +     * Video decoding only. Certain video codecs support cropping, meaning that
3964 +     * only a sub-rectangle of the decoded frame is intended for display.  This
3965 +     * option controls how cropping is handled by libavcodec.
3966 +     *
3967 +     * When set to 1 (the default), libavcodec will apply cropping internally.
3968 +     * I.e. it will modify the output frame width/height fields and offset the
3969 +     * data pointers (only by as much as possible while preserving alignment, or
3970 +     * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3971 +     * the frames output by the decoder refer only to the cropped area. The
3972 +     * crop_* fields of the output frames will be zero.
3973 +     *
3974 +     * When set to 0, the width/height fields of the output frames will be set
3975 +     * to the coded dimensions and the crop_* fields will describe the cropping
3976 +     * rectangle. Applying the cropping is left to the caller.
3977 +     *
3978 +     * @warning When hardware acceleration with opaque output frames is used,
3979 +     * libavcodec is unable to apply cropping from the top/left border.
3980 +     *
3981 +     * @note when this option is set to zero, the width/height fields of the
3982 +     * AVCodecContext and output AVFrames have different meanings. The codec
3983 +     * context fields store display dimensions (with the coded dimensions in
3984 +     * coded_width/height), while the frame fields store the coded dimensions
3985 +     * (with the display dimensions being determined by the crop_* fields).
3986 +     */
3987 +    int apply_cropping;
3988 +
3989 +    /*
3990 +     * Video decoding only.  Sets the number of extra hardware frames which
3991 +     * the decoder will allocate for use by the caller.  This must be set
3992 +     * before avcodec_open2() is called.
3993 +     *
3994 +     * Some hardware decoders require all frames that they will use for
3995 +     * output to be defined in advance before decoding starts.  For such
3996 +     * decoders, the hardware frame pool must therefore be of a fixed size.
3997 +     * The extra frames set here are on top of any number that the decoder
3998 +     * needs internally in order to operate normally (for example, frames
3999 +     * used as reference pictures).
4000 +     */
4001 +    int extra_hw_frames;
4002 +} AVCodecContext;
4003 +
4004 +#if FF_API_CODEC_GET_SET
4005 +/**
4006 + * Accessors for some AVCodecContext fields. These used to be provided for ABI
4007 + * compatibility, and do not need to be used anymore.
4008 + */
4009 +attribute_deprecated
4010 +AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
4011 +attribute_deprecated
4012 +void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
4013 +
4014 +attribute_deprecated
4015 +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
4016 +attribute_deprecated
4017 +void                     av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
4018 +
4019 +attribute_deprecated
4020 +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
4021 +
4022 +#if FF_API_LOWRES
4023 +attribute_deprecated
4024 +int  av_codec_get_lowres(const AVCodecContext *avctx);
4025 +attribute_deprecated
4026 +void av_codec_set_lowres(AVCodecContext *avctx, int val);
4027 +#endif
4028 +
4029 +attribute_deprecated
4030 +int  av_codec_get_seek_preroll(const AVCodecContext *avctx);
4031 +attribute_deprecated
4032 +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
4033 +
4034 +attribute_deprecated
4035 +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
4036 +attribute_deprecated
4037 +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
4038 +#endif
4039 +
4040 +/**
4041 + * AVProfile.
4042 + */
4043 +typedef struct AVProfile {
4044 +    int profile;
4045 +    const char *name; ///< short name for the profile
4046 +} AVProfile;
4047 +
4048 +enum {
4049 +    /**
4050 +     * The codec supports this format via the hw_device_ctx interface.
4051 +     *
4052 +     * When selecting this format, AVCodecContext.hw_device_ctx should
4053 +     * have been set to a device of the specified type before calling
4054 +     * avcodec_open2().
4055 +     */
4056 +    AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
4057 +    /**
4058 +     * The codec supports this format via the hw_frames_ctx interface.
4059 +     *
4060 +     * When selecting this format for a decoder,
4061 +     * AVCodecContext.hw_frames_ctx should be set to a suitable frames
4062 +     * context inside the get_format() callback.  The frames context
4063 +     * must have been created on a device of the specified type.
4064 +     */
4065 +    AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
4066 +    /**
4067 +     * The codec supports this format by some internal method.
4068 +     *
4069 +     * This format can be selected without any additional configuration -
4070 +     * no device or frames context is required.
4071 +     */
4072 +    AV_CODEC_HW_CONFIG_METHOD_INTERNAL      = 0x04,
4073 +    /**
4074 +     * The codec supports this format by some ad-hoc method.
4075 +     *
4076 +     * Additional settings and/or function calls are required.  See the
4077 +     * codec-specific documentation for details.  (Methods requiring
4078 +     * this sort of configuration are deprecated and others should be
4079 +     * used in preference.)
4080 +     */
4081 +    AV_CODEC_HW_CONFIG_METHOD_AD_HOC        = 0x08,
4082 +};
4083 +
4084 +typedef struct AVCodecHWConfig {
4085 +    /**
4086 +     * A hardware pixel format which the codec can use.
4087 +     */
4088 +    enum AVPixelFormat pix_fmt;
4089 +    /**
4090 +     * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
4091 +     * setup methods which can be used with this configuration.
4092 +     */
4093 +    int methods;
4094 +    /**
4095 +     * The device type associated with the configuration.
4096 +     *
4097 +     * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
4098 +     * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
4099 +     */
4100 +    enum AVHWDeviceType device_type;
4101 +} AVCodecHWConfig;
4102 +
4103 +typedef struct AVCodecDefault AVCodecDefault;
4104 +
4105 +struct AVSubtitle;
4106 +
4107 +/**
4108 + * AVCodec.
4109 + */
4110 +typedef struct AVCodec {
4111 +    /**
4112 +     * Name of the codec implementation.
4113 +     * The name is globally unique among encoders and among decoders (but an
4114 +     * encoder and a decoder can share the same name).
4115 +     * This is the primary way to find a codec from the user perspective.
4116 +     */
4117 +    const char *name;
4118 +    /**
4119 +     * Descriptive name for the codec, meant to be more human readable than name.
4120 +     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
4121 +     */
4122 +    const char *long_name;
4123 +    enum AVMediaType type;
4124 +    enum AVCodecID id;
4125 +    /**
4126 +     * Codec capabilities.
4127 +     * see AV_CODEC_CAP_*
4128 +     */
4129 +    int capabilities;
4130 +    const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
4131 +    const enum AVPixelFormat *pix_fmts;     ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
4132 +    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
4133 +    const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
4134 +    const uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
4135 +    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
4136 +    const AVClass *priv_class;              ///< AVClass for the private context
4137 +    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
4138 +
4139 +    /**
4140 +     * Group name of the codec implementation.
4141 +     * This is a short symbolic name of the wrapper backing this codec. A
4142 +     * wrapper uses some kind of external implementation for the codec, such
4143 +     * as an external library, or a codec implementation provided by the OS or
4144 +     * the hardware.
4145 +     * If this field is NULL, this is a builtin, libavcodec native codec.
4146 +     * If non-NULL, this will be the suffix in AVCodec.name in most cases
4147 +     * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
4148 +     */
4149 +    const char *wrapper_name;
4150 +
4151 +    /*****************************************************************
4152 +     * No fields below this line are part of the public API. They
4153 +     * may not be used outside of libavcodec and can be changed and
4154 +     * removed at will.
4155 +     * New public fields should be added right above.
4156 +     *****************************************************************
4157 +     */
4158 +    int priv_data_size;
4159 +    struct AVCodec *next;
4160 +    /**
4161 +     * @name Frame-level threading support functions
4162 +     * @{
4163 +     */
4164 +    /**
4165 +     * If defined, called on thread contexts when they are created.
4166 +     * If the codec allocates writable tables in init(), re-allocate them here.
4167 +     * priv_data will be set to a copy of the original.
4168 +     */
4169 +    int (*init_thread_copy)(AVCodecContext *);
4170 +    /**
4171 +     * Copy necessary context variables from a previous thread context to the current one.
4172 +     * If not defined, the next thread will start automatically; otherwise, the codec
4173 +     * must call ff_thread_finish_setup().
4174 +     *
4175 +     * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
4176 +     */
4177 +    int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
4178 +    /** @} */
4179 +
4180 +    /**
4181 +     * Private codec-specific defaults.
4182 +     */
4183 +    const AVCodecDefault *defaults;
4184 +
4185 +    /**
4186 +     * Initialize codec static data, called from avcodec_register().
4187 +     *
4188 +     * This is not intended for time consuming operations as it is
4189 +     * run for every codec regardless of that codec being used.
4190 +     */
4191 +    void (*init_static_data)(struct AVCodec *codec);
4192 +
4193 +    int (*init)(AVCodecContext *);
4194 +    int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
4195 +                      const struct AVSubtitle *sub);
4196 +    /**
4197 +     * Encode data to an AVPacket.
4198 +     *
4199 +     * @param      avctx          codec context
4200 +     * @param      avpkt          output AVPacket (may contain a user-provided buffer)
4201 +     * @param[in]  frame          AVFrame containing the raw data to be encoded
4202 +     * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
4203 +     *                            non-empty packet was returned in avpkt.
4204 +     * @return 0 on success, negative error code on failure
4205 +     */
4206 +    int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
4207 +                   int *got_packet_ptr);
4208 +    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
4209 +    int (*close)(AVCodecContext *);
4210 +    /**
4211 +     * Encode API with decoupled packet/frame dataflow. The API is the
4212 +     * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
4213 +     * that:
4214 +     * - never called if the codec is closed or the wrong type,
4215 +     * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
4216 +     * - only one drain frame is ever passed down,
4217 +     */
4218 +    int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
4219 +    int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
4220 +
4221 +    /**
4222 +     * Decode API with decoupled packet/frame dataflow. This function is called
4223 +     * to get one output frame. It should call ff_decode_get_packet() to obtain
4224 +     * input data.
4225 +     */
4226 +    int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
4227 +    /**
4228 +     * Flush buffers.
4229 +     * Will be called when seeking
4230 +     */
4231 +    void (*flush)(AVCodecContext *);
4232 +    /**
4233 +     * Internal codec capabilities.
4234 +     * See FF_CODEC_CAP_* in internal.h
4235 +     */
4236 +    int caps_internal;
4237 +
4238 +    /**
4239 +     * Decoding only, a comma-separated list of bitstream filters to apply to
4240 +     * packets before decoding.
4241 +     */
4242 +    const char *bsfs;
4243 +
4244 +    /**
4245 +     * Array of pointers to hardware configurations supported by the codec,
4246 +     * or NULL if no hardware supported.  The array is terminated by a NULL
4247 +     * pointer.
4248 +     *
4249 +     * The user can only access this field via avcodec_get_hw_config().
4250 +     */
4251 +    const struct AVCodecHWConfigInternal **hw_configs;
4252 +} AVCodec;
4253 +
4254 +#if FF_API_CODEC_GET_SET
4255 +attribute_deprecated
4256 +int av_codec_get_max_lowres(const AVCodec *codec);
4257 +#endif
4258 +
4259 +struct MpegEncContext;
4260 +
4261 +/**
4262 + * Retrieve supported hardware configurations for a codec.
4263 + *
4264 + * Values of index from zero to some maximum return the indexed configuration
4265 + * descriptor; all other values return NULL.  If the codec does not support
4266 + * any hardware configurations then it will always return NULL.
4267 + */
4268 +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
4269 +
4270 +/**
4271 + * @defgroup lavc_hwaccel AVHWAccel
4272 + *
4273 + * @note  Nothing in this structure should be accessed by the user.  At some
4274 + *        point in future it will not be externally visible at all.
4275 + *
4276 + * @{
4277 + */
4278 +typedef struct AVHWAccel {
4279 +    /**
4280 +     * Name of the hardware accelerated codec.
4281 +     * The name is globally unique among encoders and among decoders (but an
4282 +     * encoder and a decoder can share the same name).
4283 +     */
4284 +    const char *name;
4285 +
4286 +    /**
4287 +     * Type of codec implemented by the hardware accelerator.
4288 +     *
4289 +     * See AVMEDIA_TYPE_xxx
4290 +     */
4291 +    enum AVMediaType type;
4292 +
4293 +    /**
4294 +     * Codec implemented by the hardware accelerator.
4295 +     *
4296 +     * See AV_CODEC_ID_xxx
4297 +     */
4298 +    enum AVCodecID id;
4299 +
4300 +    /**
4301 +     * Supported pixel format.
4302 +     *
4303 +     * Only hardware accelerated formats are supported here.
4304 +     */
4305 +    enum AVPixelFormat pix_fmt;
4306 +
4307 +    /**
4308 +     * Hardware accelerated codec capabilities.
4309 +     * see AV_HWACCEL_CODEC_CAP_*
4310 +     */
4311 +    int capabilities;
4312 +
4313 +    /*****************************************************************
4314 +     * No fields below this line are part of the public API. They
4315 +     * may not be used outside of libavcodec and can be changed and
4316 +     * removed at will.
4317 +     * New public fields should be added right above.
4318 +     *****************************************************************
4319 +     */
4320 +
4321 +    /**
4322 +     * Allocate a custom buffer
4323 +     */
4324 +    int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
4325 +
4326 +    /**
4327 +     * Called at the beginning of each frame or field picture.
4328 +     *
4329 +     * Meaningful frame information (codec specific) is guaranteed to
4330 +     * be parsed at this point. This function is mandatory.
4331 +     *
4332 +     * Note that buf can be NULL along with buf_size set to 0.
4333 +     * Otherwise, this means the whole frame is available at this point.
4334 +     *
4335 +     * @param avctx the codec context
4336 +     * @param buf the frame data buffer base
4337 +     * @param buf_size the size of the frame in bytes
4338 +     * @return zero if successful, a negative value otherwise
4339 +     */
4340 +    int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4341 +
4342 +    /**
4343 +     * Callback for parameter data (SPS/PPS/VPS etc).
4344 +     *
4345 +     * Useful for hardware decoders which keep persistent state about the
4346 +     * video parameters, and need to receive any changes to update that state.
4347 +     *
4348 +     * @param avctx the codec context
4349 +     * @param type the nal unit type
4350 +     * @param buf the nal unit data buffer
4351 +     * @param buf_size the size of the nal unit in bytes
4352 +     * @return zero if successful, a negative value otherwise
4353 +     */
4354 +    int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
4355 +
4356 +    /**
4357 +     * Callback for each slice.
4358 +     *
4359 +     * Meaningful slice information (codec specific) is guaranteed to
4360 +     * be parsed at this point. This function is mandatory.
4361 +     * The only exception is XvMC, that works on MB level.
4362 +     *
4363 +     * @param avctx the codec context
4364 +     * @param buf the slice data buffer base
4365 +     * @param buf_size the size of the slice in bytes
4366 +     * @return zero if successful, a negative value otherwise
4367 +     */
4368 +    int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4369 +
4370 +    /**
4371 +     * Called at the end of each frame or field picture.
4372 +     *
4373 +     * The whole picture is parsed at this point and can now be sent
4374 +     * to the hardware accelerator. This function is mandatory.
4375 +     *
4376 +     * @param avctx the codec context
4377 +     * @return zero if successful, a negative value otherwise
4378 +     */
4379 +    int (*end_frame)(AVCodecContext *avctx);
4380 +
4381 +    /**
4382 +     * Size of per-frame hardware accelerator private data.
4383 +     *
4384 +     * Private data is allocated with av_mallocz() before
4385 +     * AVCodecContext.get_buffer() and deallocated after
4386 +     * AVCodecContext.release_buffer().
4387 +     */
4388 +    int frame_priv_data_size;
4389 +
4390 +    /**
4391 +     * Called for every Macroblock in a slice.
4392 +     *
4393 +     * XvMC uses it to replace the ff_mpv_reconstruct_mb().
4394 +     * Instead of decoding to raw picture, MB parameters are
4395 +     * stored in an array provided by the video driver.
4396 +     *
4397 +     * @param s the mpeg context
4398 +     */
4399 +    void (*decode_mb)(struct MpegEncContext *s);
4400 +
4401 +    /**
4402 +     * Initialize the hwaccel private data.
4403 +     *
4404 +     * This will be called from ff_get_format(), after hwaccel and
4405 +     * hwaccel_context are set and the hwaccel private data in AVCodecInternal
4406 +     * is allocated.
4407 +     */
4408 +    int (*init)(AVCodecContext *avctx);
4409 +
4410 +    /**
4411 +     * Uninitialize the hwaccel private data.
4412 +     *
4413 +     * This will be called from get_format() or avcodec_close(), after hwaccel
4414 +     * and hwaccel_context are already uninitialized.
4415 +     */
4416 +    int (*uninit)(AVCodecContext *avctx);
4417 +
4418 +    /**
4419 +     * Size of the private data to allocate in
4420 +     * AVCodecInternal.hwaccel_priv_data.
4421 +     */
4422 +    int priv_data_size;
4423 +
4424 +    /**
4425 +     * Internal hwaccel capabilities.
4426 +     */
4427 +    int caps_internal;
4428 +
4429 +    /**
4430 +     * Fill the given hw_frames context with current codec parameters. Called
4431 +     * from get_format. Refer to avcodec_get_hw_frames_parameters() for
4432 +     * details.
4433 +     *
4434 +     * This CAN be called before AVHWAccel.init is called, and you must assume
4435 +     * that avctx->hwaccel_priv_data is invalid.
4436 +     */
4437 +    int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
4438 +} AVHWAccel;
4439 +
4440 +/**
4441 + * HWAccel is experimental and is thus avoided in favor of non experimental
4442 + * codecs
4443 + */
4444 +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
4445 +
4446 +/**
4447 + * Hardware acceleration should be used for decoding even if the codec level
4448 + * used is unknown or higher than the maximum supported level reported by the
4449 + * hardware driver.
4450 + *
4451 + * It's generally a good idea to pass this flag unless you have a specific
4452 + * reason not to, as hardware tends to under-report supported levels.
4453 + */
4454 +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
4455 +
4456 +/**
4457 + * Hardware acceleration can output YUV pixel formats with a different chroma
4458 + * sampling than 4:2:0 and/or other than 8 bits per component.
4459 + */
4460 +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
4461 +
4462 +/**
4463 + * Hardware acceleration should still be attempted for decoding when the
4464 + * codec profile does not match the reported capabilities of the hardware.
4465 + *
4466 + * For example, this can be used to try to decode baseline profile H.264
4467 + * streams in hardware - it will often succeed, because many streams marked
4468 + * as baseline profile actually conform to constrained baseline profile.
4469 + *
4470 + * @warning If the stream is actually not supported then the behaviour is
4471 + *          undefined, and may include returning entirely incorrect output
4472 + *          while indicating success.
4473 + */
4474 +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
4475 +
4476 +/**
4477 + * @}
4478 + */
4479 +
4480 +#if FF_API_AVPICTURE
4481 +/**
4482 + * @defgroup lavc_picture AVPicture
4483 + *
4484 + * Functions for working with AVPicture
4485 + * @{
4486 + */
4487 +
4488 +/**
4489 + * Picture data structure.
4490 + *
4491 + * Up to four components can be stored into it, the last component is
4492 + * alpha.
4493 + * @deprecated use AVFrame or imgutils functions instead
4494 + */
4495 +typedef struct AVPicture {
4496 +    attribute_deprecated
4497 +    uint8_t *data[AV_NUM_DATA_POINTERS];    ///< pointers to the image data planes
4498 +    attribute_deprecated
4499 +    int linesize[AV_NUM_DATA_POINTERS];     ///< number of bytes per line
4500 +} AVPicture;
4501 +
4502 +/**
4503 + * @}
4504 + */
4505 +#endif
4506 +
4507 +enum AVSubtitleType {
4508 +    SUBTITLE_NONE,
4509 +
4510 +    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
4511 +
4512 +    /**
4513 +     * Plain text, the text field must be set by the decoder and is
4514 +     * authoritative. ass and pict fields may contain approximations.
4515 +     */
4516 +    SUBTITLE_TEXT,
4517 +
4518 +    /**
4519 +     * Formatted text, the ass field must be set by the decoder and is
4520 +     * authoritative. pict and text fields may contain approximations.
4521 +     */
4522 +    SUBTITLE_ASS,
4523 +};
4524 +
4525 +#define AV_SUBTITLE_FLAG_FORCED 0x00000001
4526 +
4527 +typedef struct AVSubtitleRect {
4528 +    int x;         ///< top left corner  of pict, undefined when pict is not set
4529 +    int y;         ///< top left corner  of pict, undefined when pict is not set
4530 +    int w;         ///< width            of pict, undefined when pict is not set
4531 +    int h;         ///< height           of pict, undefined when pict is not set
4532 +    int nb_colors; ///< number of colors in pict, undefined when pict is not set
4533 +
4534 +#if FF_API_AVPICTURE
4535 +    /**
4536 +     * @deprecated unused
4537 +     */
4538 +    attribute_deprecated
4539 +    AVPicture pict;
4540 +#endif
4541 +    /**
4542 +     * data+linesize for the bitmap of this subtitle.
4543 +     * Can be set for text/ass as well once they are rendered.
4544 +     */
4545 +    uint8_t *data[4];
4546 +    int linesize[4];
4547 +
4548 +    enum AVSubtitleType type;
4549 +
4550 +    char *text;                     ///< 0 terminated plain UTF-8 text
4551 +
4552 +    /**
4553 +     * 0 terminated ASS/SSA compatible event line.
4554 +     * The presentation of this is unaffected by the other values in this
4555 +     * struct.
4556 +     */
4557 +    char *ass;
4558 +
4559 +    int flags;
4560 +} AVSubtitleRect;
4561 +
4562 +typedef struct AVSubtitle {
4563 +    uint16_t format; /* 0 = graphics */
4564 +    uint32_t start_display_time; /* relative to packet pts, in ms */
4565 +    uint32_t end_display_time; /* relative to packet pts, in ms */
4566 +    unsigned num_rects;
4567 +    AVSubtitleRect **rects;
4568 +    int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
4569 +} AVSubtitle;
4570 +
4571 +/**
4572 + * This struct describes the properties of an encoded stream.
4573 + *
4574 + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
4575 + * be allocated with avcodec_parameters_alloc() and freed with
4576 + * avcodec_parameters_free().
4577 + */
4578 +typedef struct AVCodecParameters {
4579 +    /**
4580 +     * General type of the encoded data.
4581 +     */
4582 +    enum AVMediaType codec_type;
4583 +    /**
4584 +     * Specific type of the encoded data (the codec used).
4585 +     */
4586 +    enum AVCodecID   codec_id;
4587 +    /**
4588 +     * Additional information about the codec (corresponds to the AVI FOURCC).
4589 +     */
4590 +    uint32_t         codec_tag;
4591 +
4592 +    /**
4593 +     * Extra binary data needed for initializing the decoder, codec-dependent.
4594 +     *
4595 +     * Must be allocated with av_malloc() and will be freed by
4596 +     * avcodec_parameters_free(). The allocated size of extradata must be at
4597 +     * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
4598 +     * bytes zeroed.
4599 +     */
4600 +    uint8_t *extradata;
4601 +    /**
4602 +     * Size of the extradata content in bytes.
4603 +     */
4604 +    int      extradata_size;
4605 +
4606 +    /**
4607 +     * - video: the pixel format, the value corresponds to enum AVPixelFormat.
4608 +     * - audio: the sample format, the value corresponds to enum AVSampleFormat.
4609 +     */
4610 +    int format;
4611 +
4612 +    /**
4613 +     * The average bitrate of the encoded data (in bits per second).
4614 +     */
4615 +    int64_t bit_rate;
4616 +
4617 +    /**
4618 +     * The number of bits per sample in the codedwords.
4619 +     *
4620 +     * This is basically the bitrate per sample. It is mandatory for a bunch of
4621 +     * formats to actually decode them. It's the number of bits for one sample in
4622 +     * the actual coded bitstream.
4623 +     *
4624 +     * This could be for example 4 for ADPCM
4625 +     * For PCM formats this matches bits_per_raw_sample
4626 +     * Can be 0
4627 +     */
4628 +    int bits_per_coded_sample;
4629 +
4630 +    /**
4631 +     * This is the number of valid bits in each output sample. If the
4632 +     * sample format has more bits, the least significant bits are additional
4633 +     * padding bits, which are always 0. Use right shifts to reduce the sample
4634 +     * to its actual size. For example, audio formats with 24 bit samples will
4635 +     * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
4636 +     * To get the original sample use "(int32_t)sample >> 8"."
4637 +     *
4638 +     * For ADPCM this might be 12 or 16 or similar
4639 +     * Can be 0
4640 +     */
4641 +    int bits_per_raw_sample;
4642 +
4643 +    /**
4644 +     * Codec-specific bitstream restrictions that the stream conforms to.
4645 +     */
4646 +    int profile;
4647 +    int level;
4648 +
4649 +    /**
4650 +     * Video only. The dimensions of the video frame in pixels.
4651 +     */
4652 +    int width;
4653 +    int height;
4654 +
4655 +    /**
4656 +     * Video only. The aspect ratio (width / height) which a single pixel
4657 +     * should have when displayed.
4658 +     *
4659 +     * When the aspect ratio is unknown / undefined, the numerator should be
4660 +     * set to 0 (the denominator may have any value).
4661 +     */
4662 +    AVRational sample_aspect_ratio;
4663 +
4664 +    /**
4665 +     * Video only. The order of the fields in interlaced video.
4666 +     */
4667 +    enum AVFieldOrder                  field_order;
4668 +
4669 +    /**
4670 +     * Video only. Additional colorspace characteristics.
4671 +     */
4672 +    enum AVColorRange                  color_range;
4673 +    enum AVColorPrimaries              color_primaries;
4674 +    enum AVColorTransferCharacteristic color_trc;
4675 +    enum AVColorSpace                  color_space;
4676 +    enum AVChromaLocation              chroma_location;
4677 +
4678 +    /**
4679 +     * Video only. Number of delayed frames.
4680 +     */
4681 +    int video_delay;
4682 +
4683 +    /**
4684 +     * Audio only. The channel layout bitmask. May be 0 if the channel layout is
4685 +     * unknown or unspecified, otherwise the number of bits set must be equal to
4686 +     * the channels field.
4687 +     */
4688 +    uint64_t channel_layout;
4689 +    /**
4690 +     * Audio only. The number of audio channels.
4691 +     */
4692 +    int      channels;
4693 +    /**
4694 +     * Audio only. The number of audio samples per second.
4695 +     */
4696 +    int      sample_rate;
4697 +    /**
4698 +     * Audio only. The number of bytes per coded audio frame, required by some
4699 +     * formats.
4700 +     *
4701 +     * Corresponds to nBlockAlign in WAVEFORMATEX.
4702 +     */
4703 +    int      block_align;
4704 +    /**
4705 +     * Audio only. Audio frame size, if known. Required by some formats to be static.
4706 +     */
4707 +    int      frame_size;
4708 +
4709 +    /**
4710 +     * Audio only. The amount of padding (in samples) inserted by the encoder at
4711 +     * the beginning of the audio. I.e. this number of leading decoded samples
4712 +     * must be discarded by the caller to get the original audio without leading
4713 +     * padding.
4714 +     */
4715 +    int initial_padding;
4716 +    /**
4717 +     * Audio only. The amount of padding (in samples) appended by the encoder to
4718 +     * the end of the audio. I.e. this number of decoded samples must be
4719 +     * discarded by the caller from the end of the stream to get the original
4720 +     * audio without any trailing padding.
4721 +     */
4722 +    int trailing_padding;
4723 +    /**
4724 +     * Audio only. Number of samples to skip after a discontinuity.
4725 +     */
4726 +    int seek_preroll;
4727 +} AVCodecParameters;
4728 +
4729 +/**
4730 + * Iterate over all registered codecs.
4731 + *
4732 + * @param opaque a pointer where libavcodec will store the iteration state. Must
4733 + *               point to NULL to start the iteration.
4734 + *
4735 + * @return the next registered codec or NULL when the iteration is
4736 + *         finished
4737 + */
4738 +const AVCodec *av_codec_iterate(void **opaque);
4739 +
4740 +#if FF_API_NEXT
4741 +/**
4742 + * If c is NULL, returns the first registered codec,
4743 + * if c is non-NULL, returns the next registered codec after c,
4744 + * or NULL if c is the last one.
4745 + */
4746 +attribute_deprecated
4747 +AVCodec *av_codec_next(const AVCodec *c);
4748 +#endif
4749 +
4750 +/**
4751 + * Return the LIBAVCODEC_VERSION_INT constant.
4752 + */
4753 +unsigned avcodec_version(void);
4754 +
4755 +/**
4756 + * Return the libavcodec build-time configuration.
4757 + */
4758 +const char *avcodec_configuration(void);
4759 +
4760 +/**
4761 + * Return the libavcodec license.
4762 + */
4763 +const char *avcodec_license(void);
4764 +
4765 +#if FF_API_NEXT
4766 +/**
4767 + * Register the codec codec and initialize libavcodec.
4768 + *
4769 + * @warning either this function or avcodec_register_all() must be called
4770 + * before any other libavcodec functions.
4771 + *
4772 + * @see avcodec_register_all()
4773 + */
4774 +attribute_deprecated
4775 +void avcodec_register(AVCodec *codec);
4776 +
4777 +/**
4778 + * Register all the codecs, parsers and bitstream filters which were enabled at
4779 + * configuration time. If you do not call this function you can select exactly
4780 + * which formats you want to support, by using the individual registration
4781 + * functions.
4782 + *
4783 + * @see avcodec_register
4784 + * @see av_register_codec_parser
4785 + * @see av_register_bitstream_filter
4786 + */
4787 +attribute_deprecated
4788 +void avcodec_register_all(void);
4789 +#endif
4790 +
4791 +/**
4792 + * Allocate an AVCodecContext and set its fields to default values. The
4793 + * resulting struct should be freed with avcodec_free_context().
4794 + *
4795 + * @param codec if non-NULL, allocate private data and initialize defaults
4796 + *              for the given codec. It is illegal to then call avcodec_open2()
4797 + *              with a different codec.
4798 + *              If NULL, then the codec-specific defaults won't be initialized,
4799 + *              which may result in suboptimal default settings (this is
4800 + *              important mainly for encoders, e.g. libx264).
4801 + *
4802 + * @return An AVCodecContext filled with default values or NULL on failure.
4803 + */
4804 +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
4805 +
4806 +/**
4807 + * Free the codec context and everything associated with it and write NULL to
4808 + * the provided pointer.
4809 + */
4810 +void avcodec_free_context(AVCodecContext **avctx);
4811 +
4812 +#if FF_API_GET_CONTEXT_DEFAULTS
4813 +/**
4814 + * @deprecated This function should not be used, as closing and opening a codec
4815 + * context multiple time is not supported. A new codec context should be
4816 + * allocated for each new use.
4817 + */
4818 +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
4819 +#endif
4820 +
4821 +/**
4822 + * Get the AVClass for AVCodecContext. It can be used in combination with
4823 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4824 + *
4825 + * @see av_opt_find().
4826 + */
4827 +const AVClass *avcodec_get_class(void);
4828 +
4829 +#if FF_API_COPY_CONTEXT
4830 +/**
4831 + * Get the AVClass for AVFrame. It can be used in combination with
4832 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4833 + *
4834 + * @see av_opt_find().
4835 + */
4836 +const AVClass *avcodec_get_frame_class(void);
4837 +
4838 +/**
4839 + * Get the AVClass for AVSubtitleRect. It can be used in combination with
4840 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4841 + *
4842 + * @see av_opt_find().
4843 + */
4844 +const AVClass *avcodec_get_subtitle_rect_class(void);
4845 +
4846 +/**
4847 + * Copy the settings of the source AVCodecContext into the destination
4848 + * AVCodecContext. The resulting destination codec context will be
4849 + * unopened, i.e. you are required to call avcodec_open2() before you
4850 + * can use this AVCodecContext to decode/encode video/audio data.
4851 + *
4852 + * @param dest target codec context, should be initialized with
4853 + *             avcodec_alloc_context3(NULL), but otherwise uninitialized
4854 + * @param src source codec context
4855 + * @return AVERROR() on error (e.g. memory allocation error), 0 on success
4856 + *
4857 + * @deprecated The semantics of this function are ill-defined and it should not
4858 + * be used. If you need to transfer the stream parameters from one codec context
4859 + * to another, use an intermediate AVCodecParameters instance and the
4860 + * avcodec_parameters_from_context() / avcodec_parameters_to_context()
4861 + * functions.
4862 + */
4863 +attribute_deprecated
4864 +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
4865 +#endif
4866 +
4867 +/**
4868 + * Allocate a new AVCodecParameters and set its fields to default values
4869 + * (unknown/invalid/0). The returned struct must be freed with
4870 + * avcodec_parameters_free().
4871 + */
4872 +AVCodecParameters *avcodec_parameters_alloc(void);
4873 +
4874 +/**
4875 + * Free an AVCodecParameters instance and everything associated with it and
4876 + * write NULL to the supplied pointer.
4877 + */
4878 +void avcodec_parameters_free(AVCodecParameters **par);
4879 +
4880 +/**
4881 + * Copy the contents of src to dst. Any allocated fields in dst are freed and
4882 + * replaced with newly allocated duplicates of the corresponding fields in src.
4883 + *
4884 + * @return >= 0 on success, a negative AVERROR code on failure.
4885 + */
4886 +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
4887 +
4888 +/**
4889 + * Fill the parameters struct based on the values from the supplied codec
4890 + * context. Any allocated fields in par are freed and replaced with duplicates
4891 + * of the corresponding fields in codec.
4892 + *
4893 + * @return >= 0 on success, a negative AVERROR code on failure
4894 + */
4895 +int avcodec_parameters_from_context(AVCodecParameters *par,
4896 +                                    const AVCodecContext *codec);
4897 +
4898 +/**
4899 + * Fill the codec context based on the values from the supplied codec
4900 + * parameters. Any allocated fields in codec that have a corresponding field in
4901 + * par are freed and replaced with duplicates of the corresponding field in par.
4902 + * Fields in codec that do not have a counterpart in par are not touched.
4903 + *
4904 + * @return >= 0 on success, a negative AVERROR code on failure.
4905 + */
4906 +int avcodec_parameters_to_context(AVCodecContext *codec,
4907 +                                  const AVCodecParameters *par);
4908 +
4909 +/**
4910 + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
4911 + * function the context has to be allocated with avcodec_alloc_context3().
4912 + *
4913 + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
4914 + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
4915 + * retrieving a codec.
4916 + *
4917 + * @warning This function is not thread safe!
4918 + *
4919 + * @note Always call this function before using decoding routines (such as
4920 + * @ref avcodec_receive_frame()).
4921 + *
4922 + * @code
4923 + * avcodec_register_all();
4924 + * av_dict_set(&opts, "b", "2.5M", 0);
4925 + * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
4926 + * if (!codec)
4927 + *     exit(1);
4928 + *
4929 + * context = avcodec_alloc_context3(codec);
4930 + *
4931 + * if (avcodec_open2(context, codec, opts) < 0)
4932 + *     exit(1);
4933 + * @endcode
4934 + *
4935 + * @param avctx The context to initialize.
4936 + * @param codec The codec to open this context for. If a non-NULL codec has been
4937 + *              previously passed to avcodec_alloc_context3() or
4938 + *              for this context, then this parameter MUST be either NULL or
4939 + *              equal to the previously passed codec.
4940 + * @param options A dictionary filled with AVCodecContext and codec-private options.
4941 + *                On return this object will be filled with options that were not found.
4942 + *
4943 + * @return zero on success, a negative value on error
4944 + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
4945 + *      av_dict_set(), av_opt_find().
4946 + */
4947 +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
4948 +
4949 +/**
4950 + * Close a given AVCodecContext and free all the data associated with it
4951 + * (but not the AVCodecContext itself).
4952 + *
4953 + * Calling this function on an AVCodecContext that hasn't been opened will free
4954 + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
4955 + * codec. Subsequent calls will do nothing.
4956 + *
4957 + * @note Do not use this function. Use avcodec_free_context() to destroy a
4958 + * codec context (either open or closed). Opening and closing a codec context
4959 + * multiple times is not supported anymore -- use multiple codec contexts
4960 + * instead.
4961 + */
4962 +int avcodec_close(AVCodecContext *avctx);
4963 +
4964 +/**
4965 + * Free all allocated data in the given subtitle struct.
4966 + *
4967 + * @param sub AVSubtitle to free.
4968 + */
4969 +void avsubtitle_free(AVSubtitle *sub);
4970 +
4971 +/**
4972 + * @}
4973 + */
4974 +
4975 +/**
4976 + * @addtogroup lavc_packet
4977 + * @{
4978 + */
4979 +
4980 +/**
4981 + * Allocate an AVPacket and set its fields to default values.  The resulting
4982 + * struct must be freed using av_packet_free().
4983 + *
4984 + * @return An AVPacket filled with default values or NULL on failure.
4985 + *
4986 + * @note this only allocates the AVPacket itself, not the data buffers. Those
4987 + * must be allocated through other means such as av_new_packet.
4988 + *
4989 + * @see av_new_packet
4990 + */
4991 +AVPacket *av_packet_alloc(void);
4992 +
4993 +/**
4994 + * Create a new packet that references the same data as src.
4995 + *
4996 + * This is a shortcut for av_packet_alloc()+av_packet_ref().
4997 + *
4998 + * @return newly created AVPacket on success, NULL on error.
4999 + *
5000 + * @see av_packet_alloc
5001 + * @see av_packet_ref
5002 + */
5003 +AVPacket *av_packet_clone(const AVPacket *src);
5004 +
5005 +/**
5006 + * Free the packet, if the packet is reference counted, it will be
5007 + * unreferenced first.
5008 + *
5009 + * @param pkt packet to be freed. The pointer will be set to NULL.
5010 + * @note passing NULL is a no-op.
5011 + */
5012 +void av_packet_free(AVPacket **pkt);
5013 +
5014 +/**
5015 + * Initialize optional fields of a packet with default values.
5016 + *
5017 + * Note, this does not touch the data and size members, which have to be
5018 + * initialized separately.
5019 + *
5020 + * @param pkt packet
5021 + */
5022 +void av_init_packet(AVPacket *pkt);
5023 +
5024 +/**
5025 + * Allocate the payload of a packet and initialize its fields with
5026 + * default values.
5027 + *
5028 + * @param pkt packet
5029 + * @param size wanted payload size
5030 + * @return 0 if OK, AVERROR_xxx otherwise
5031 + */
5032 +int av_new_packet(AVPacket *pkt, int size);
5033 +
5034 +/**
5035 + * Reduce packet size, correctly zeroing padding
5036 + *
5037 + * @param pkt packet
5038 + * @param size new size
5039 + */
5040 +void av_shrink_packet(AVPacket *pkt, int size);
5041 +
5042 +/**
5043 + * Increase packet size, correctly zeroing padding
5044 + *
5045 + * @param pkt packet
5046 + * @param grow_by number of bytes by which to increase the size of the packet
5047 + */
5048 +int av_grow_packet(AVPacket *pkt, int grow_by);
5049 +
5050 +/**
5051 + * Initialize a reference-counted packet from av_malloc()ed data.
5052 + *
5053 + * @param pkt packet to be initialized. This function will set the data, size,
5054 + *        buf and destruct fields, all others are left untouched.
5055 + * @param data Data allocated by av_malloc() to be used as packet data. If this
5056 + *        function returns successfully, the data is owned by the underlying AVBuffer.
5057 + *        The caller may not access the data through other means.
5058 + * @param size size of data in bytes, without the padding. I.e. the full buffer
5059 + *        size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
5060 + *
5061 + * @return 0 on success, a negative AVERROR on error
5062 + */
5063 +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
5064 +
5065 +#if FF_API_AVPACKET_OLD_API
5066 +/**
5067 + * @warning This is a hack - the packet memory allocation stuff is broken. The
5068 + * packet is allocated if it was not really allocated.
5069 + *
5070 + * @deprecated Use av_packet_ref or av_packet_make_refcounted
5071 + */
5072 +attribute_deprecated
5073 +int av_dup_packet(AVPacket *pkt);
5074 +/**
5075 + * Copy packet, including contents
5076 + *
5077 + * @return 0 on success, negative AVERROR on fail
5078 + *
5079 + * @deprecated Use av_packet_ref
5080 + */
5081 +attribute_deprecated
5082 +int av_copy_packet(AVPacket *dst, const AVPacket *src);
5083 +
5084 +/**
5085 + * Copy packet side data
5086 + *
5087 + * @return 0 on success, negative AVERROR on fail
5088 + *
5089 + * @deprecated Use av_packet_copy_props
5090 + */
5091 +attribute_deprecated
5092 +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
5093 +
5094 +/**
5095 + * Free a packet.
5096 + *
5097 + * @deprecated Use av_packet_unref
5098 + *
5099 + * @param pkt packet to free
5100 + */
5101 +attribute_deprecated
5102 +void av_free_packet(AVPacket *pkt);
5103 +#endif
5104 +/**
5105 + * Allocate new information of a packet.
5106 + *
5107 + * @param pkt packet
5108 + * @param type side information type
5109 + * @param size side information size
5110 + * @return pointer to fresh allocated data or NULL otherwise
5111 + */
5112 +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5113 +                                 int size);
5114 +
5115 +/**
5116 + * Wrap an existing array as a packet side data.
5117 + *
5118 + * @param pkt packet
5119 + * @param type side information type
5120 + * @param data the side data array. It must be allocated with the av_malloc()
5121 + *             family of functions. The ownership of the data is transferred to
5122 + *             pkt.
5123 + * @param size side information size
5124 + * @return a non-negative number on success, a negative AVERROR code on
5125 + *         failure. On failure, the packet is unchanged and the data remains
5126 + *         owned by the caller.
5127 + */
5128 +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5129 +                            uint8_t *data, size_t size);
5130 +
5131 +/**
5132 + * Shrink the already allocated side data buffer
5133 + *
5134 + * @param pkt packet
5135 + * @param type side information type
5136 + * @param size new side information size
5137 + * @return 0 on success, < 0 on failure
5138 + */
5139 +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5140 +                               int size);
5141 +
5142 +/**
5143 + * Get side information from packet.
5144 + *
5145 + * @param pkt packet
5146 + * @param type desired side information type
5147 + * @param size pointer for side information size to store (optional)
5148 + * @return pointer to data if present or NULL otherwise
5149 + */
5150 +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
5151 +                                 int *size);
5152 +
5153 +#if FF_API_MERGE_SD_API
5154 +attribute_deprecated
5155 +int av_packet_merge_side_data(AVPacket *pkt);
5156 +
5157 +attribute_deprecated
5158 +int av_packet_split_side_data(AVPacket *pkt);
5159 +#endif
5160 +
5161 +const char *av_packet_side_data_name(enum AVPacketSideDataType type);
5162 +
5163 +/**
5164 + * Pack a dictionary for use in side_data.
5165 + *
5166 + * @param dict The dictionary to pack.
5167 + * @param size pointer to store the size of the returned data
5168 + * @return pointer to data if successful, NULL otherwise
5169 + */
5170 +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
5171 +/**
5172 + * Unpack a dictionary from side_data.
5173 + *
5174 + * @param data data from side_data
5175 + * @param size size of the data
5176 + * @param dict the metadata storage dictionary
5177 + * @return 0 on success, < 0 on failure
5178 + */
5179 +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
5180 +
5181 +
5182 +/**
5183 + * Convenience function to free all the side data stored.
5184 + * All the other fields stay untouched.
5185 + *
5186 + * @param pkt packet
5187 + */
5188 +void av_packet_free_side_data(AVPacket *pkt);
5189 +
5190 +/**
5191 + * Setup a new reference to the data described by a given packet
5192 + *
5193 + * If src is reference-counted, setup dst as a new reference to the
5194 + * buffer in src. Otherwise allocate a new buffer in dst and copy the
5195 + * data from src into it.
5196 + *
5197 + * All the other fields are copied from src.
5198 + *
5199 + * @see av_packet_unref
5200 + *
5201 + * @param dst Destination packet
5202 + * @param src Source packet
5203 + *
5204 + * @return 0 on success, a negative AVERROR on error.
5205 + */
5206 +int av_packet_ref(AVPacket *dst, const AVPacket *src);
5207 +
5208 +/**
5209 + * Wipe the packet.
5210 + *
5211 + * Unreference the buffer referenced by the packet and reset the
5212 + * remaining packet fields to their default values.
5213 + *
5214 + * @param pkt The packet to be unreferenced.
5215 + */
5216 +void av_packet_unref(AVPacket *pkt);
5217 +
5218 +/**
5219 + * Move every field in src to dst and reset src.
5220 + *
5221 + * @see av_packet_unref
5222 + *
5223 + * @param src Source packet, will be reset
5224 + * @param dst Destination packet
5225 + */
5226 +void av_packet_move_ref(AVPacket *dst, AVPacket *src);
5227 +
5228 +/**
5229 + * Copy only "properties" fields from src to dst.
5230 + *
5231 + * Properties for the purpose of this function are all the fields
5232 + * beside those related to the packet data (buf, data, size)
5233 + *
5234 + * @param dst Destination packet
5235 + * @param src Source packet
5236 + *
5237 + * @return 0 on success AVERROR on failure.
5238 + */
5239 +int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
5240 +
5241 +/**
5242 + * Ensure the data described by a given packet is reference counted.
5243 + *
5244 + * @note This function does not ensure that the reference will be writable.
5245 + *       Use av_packet_make_writable instead for that purpose.
5246 + *
5247 + * @see av_packet_ref
5248 + * @see av_packet_make_writable
5249 + *
5250 + * @param pkt packet whose data should be made reference counted.
5251 + *
5252 + * @return 0 on success, a negative AVERROR on error. On failure, the
5253 + *         packet is unchanged.
5254 + */
5255 +int av_packet_make_refcounted(AVPacket *pkt);
5256 +
5257 +/**
5258 + * Create a writable reference for the data described by a given packet,
5259 + * avoiding data copy if possible.
5260 + *
5261 + * @param pkt Packet whose data should be made writable.
5262 + *
5263 + * @return 0 on success, a negative AVERROR on failure. On failure, the
5264 + *         packet is unchanged.
5265 + */
5266 +int av_packet_make_writable(AVPacket *pkt);
5267 +
5268 +/**
5269 + * Convert valid timing fields (timestamps / durations) in a packet from one
5270 + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
5271 + * ignored.
5272 + *
5273 + * @param pkt packet on which the conversion will be performed
5274 + * @param tb_src source timebase, in which the timing fields in pkt are
5275 + *               expressed
5276 + * @param tb_dst destination timebase, to which the timing fields will be
5277 + *               converted
5278 + */
5279 +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
5280 +
5281 +/**
5282 + * @}
5283 + */
5284 +
5285 +/**
5286 + * @addtogroup lavc_decoding
5287 + * @{
5288 + */
5289 +
5290 +/**
5291 + * Find a registered decoder with a matching codec ID.
5292 + *
5293 + * @param id AVCodecID of the requested decoder
5294 + * @return A decoder if one was found, NULL otherwise.
5295 + */
5296 +AVCodec *avcodec_find_decoder(enum AVCodecID id);
5297 +
5298 +/**
5299 + * Find a registered decoder with the specified name.
5300 + *
5301 + * @param name name of the requested decoder
5302 + * @return A decoder if one was found, NULL otherwise.
5303 + */
5304 +AVCodec *avcodec_find_decoder_by_name(const char *name);
5305 +
5306 +/**
5307 + * The default callback for AVCodecContext.get_buffer2(). It is made public so
5308 + * it can be called by custom get_buffer2() implementations for decoders without
5309 + * AV_CODEC_CAP_DR1 set.
5310 + */
5311 +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
5312 +
5313 +/**
5314 + * Modify width and height values so that they will result in a memory
5315 + * buffer that is acceptable for the codec if you do not use any horizontal
5316 + * padding.
5317 + *
5318 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5319 + */
5320 +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
5321 +
5322 +/**
5323 + * Modify width and height values so that they will result in a memory
5324 + * buffer that is acceptable for the codec if you also ensure that all
5325 + * line sizes are a multiple of the respective linesize_align[i].
5326 + *
5327 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5328 + */
5329 +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
5330 +                               int linesize_align[AV_NUM_DATA_POINTERS]);
5331 +
5332 +/**
5333 + * Converts AVChromaLocation to swscale x/y chroma position.
5334 + *
5335 + * The positions represent the chroma (0,0) position in a coordinates system
5336 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5337 + *
5338 + * @param xpos  horizontal chroma sample position
5339 + * @param ypos  vertical   chroma sample position
5340 + */
5341 +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
5342 +
5343 +/**
5344 + * Converts swscale x/y chroma position to AVChromaLocation.
5345 + *
5346 + * The positions represent the chroma (0,0) position in a coordinates system
5347 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5348 + *
5349 + * @param xpos  horizontal chroma sample position
5350 + * @param ypos  vertical   chroma sample position
5351 + */
5352 +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
5353 +
5354 +/**
5355 + * Decode the audio frame of size avpkt->size from avpkt->data into frame.
5356 + *
5357 + * Some decoders may support multiple frames in a single AVPacket. Such
5358 + * decoders would then just decode the first frame and the return value would be
5359 + * less than the packet size. In this case, avcodec_decode_audio4 has to be
5360 + * called again with an AVPacket containing the remaining data in order to
5361 + * decode the second frame, etc...  Even if no frames are returned, the packet
5362 + * needs to be fed to the decoder with remaining data until it is completely
5363 + * consumed or an error occurs.
5364 + *
5365 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5366 + * and output. This means that for some packets they will not immediately
5367 + * produce decoded output and need to be flushed at the end of decoding to get
5368 + * all the decoded data. Flushing is done by calling this function with packets
5369 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5370 + * returning samples. It is safe to flush even those decoders that are not
5371 + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
5372 + *
5373 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5374 + *          larger than the actual read bytes because some optimized bitstream
5375 + *          readers read 32 or 64 bits at once and could read over the end.
5376 + *
5377 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5378 + * before packets may be fed to the decoder.
5379 + *
5380 + * @param      avctx the codec context
5381 + * @param[out] frame The AVFrame in which to store decoded audio samples.
5382 + *                   The decoder will allocate a buffer for the decoded frame by
5383 + *                   calling the AVCodecContext.get_buffer2() callback.
5384 + *                   When AVCodecContext.refcounted_frames is set to 1, the frame is
5385 + *                   reference counted and the returned reference belongs to the
5386 + *                   caller. The caller must release the frame using av_frame_unref()
5387 + *                   when the frame is no longer needed. The caller may safely write
5388 + *                   to the frame if av_frame_is_writable() returns 1.
5389 + *                   When AVCodecContext.refcounted_frames is set to 0, the returned
5390 + *                   reference belongs to the decoder and is valid only until the
5391 + *                   next call to this function or until closing or flushing the
5392 + *                   decoder. The caller may not write to it.
5393 + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
5394 + *                           non-zero. Note that this field being set to zero
5395 + *                           does not mean that an error has occurred. For
5396 + *                           decoders with AV_CODEC_CAP_DELAY set, no given decode
5397 + *                           call is guaranteed to produce a frame.
5398 + * @param[in]  avpkt The input AVPacket containing the input buffer.
5399 + *                   At least avpkt->data and avpkt->size should be set. Some
5400 + *                   decoders might also require additional fields to be set.
5401 + * @return A negative error code is returned if an error occurred during
5402 + *         decoding, otherwise the number of bytes consumed from the input
5403 + *         AVPacket is returned.
5404 + *
5405 +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5406 + */
5407 +attribute_deprecated
5408 +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
5409 +                          int *got_frame_ptr, const AVPacket *avpkt);
5410 +
5411 +/**
5412 + * Decode the video frame of size avpkt->size from avpkt->data into picture.
5413 + * Some decoders may support multiple frames in a single AVPacket, such
5414 + * decoders would then just decode the first frame.
5415 + *
5416 + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
5417 + * the actual read bytes because some optimized bitstream readers read 32 or 64
5418 + * bits at once and could read over the end.
5419 + *
5420 + * @warning The end of the input buffer buf should be set to 0 to ensure that
5421 + * no overreading happens for damaged MPEG streams.
5422 + *
5423 + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
5424 + * between input and output, these need to be fed with avpkt->data=NULL,
5425 + * avpkt->size=0 at the end to return the remaining frames.
5426 + *
5427 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5428 + * before packets may be fed to the decoder.
5429 + *
5430 + * @param avctx the codec context
5431 + * @param[out] picture The AVFrame in which the decoded video frame will be stored.
5432 + *             Use av_frame_alloc() to get an AVFrame. The codec will
5433 + *             allocate memory for the actual bitmap by calling the
5434 + *             AVCodecContext.get_buffer2() callback.
5435 + *             When AVCodecContext.refcounted_frames is set to 1, the frame is
5436 + *             reference counted and the returned reference belongs to the
5437 + *             caller. The caller must release the frame using av_frame_unref()
5438 + *             when the frame is no longer needed. The caller may safely write
5439 + *             to the frame if av_frame_is_writable() returns 1.
5440 + *             When AVCodecContext.refcounted_frames is set to 0, the returned
5441 + *             reference belongs to the decoder and is valid only until the
5442 + *             next call to this function or until closing or flushing the
5443 + *             decoder. The caller may not write to it.
5444 + *
5445 + * @param[in] avpkt The input AVPacket containing the input buffer.
5446 + *            You can create such packet with av_init_packet() and by then setting
5447 + *            data and size, some decoders might in addition need other fields like
5448 + *            flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
5449 + *            fields possible.
5450 + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
5451 + * @return On error a negative value is returned, otherwise the number of bytes
5452 + * used or zero if no frame could be decompressed.
5453 + *
5454 + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5455 + */
5456 +attribute_deprecated
5457 +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
5458 +                         int *got_picture_ptr,
5459 +                         const AVPacket *avpkt);
5460 +
5461 +/**
5462 + * Decode a subtitle message.
5463 + * Return a negative value on error, otherwise return the number of bytes used.
5464 + * If no subtitle could be decompressed, got_sub_ptr is zero.
5465 + * Otherwise, the subtitle is stored in *sub.
5466 + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
5467 + * simplicity, because the performance difference is expect to be negligible
5468 + * and reusing a get_buffer written for video codecs would probably perform badly
5469 + * due to a potentially very different allocation pattern.
5470 + *
5471 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5472 + * and output. This means that for some packets they will not immediately
5473 + * produce decoded output and need to be flushed at the end of decoding to get
5474 + * all the decoded data. Flushing is done by calling this function with packets
5475 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5476 + * returning subtitles. It is safe to flush even those decoders that are not
5477 + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
5478 + *
5479 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5480 + * before packets may be fed to the decoder.
5481 + *
5482 + * @param avctx the codec context
5483 + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
5484 + *                 must be freed with avsubtitle_free if *got_sub_ptr is set.
5485 + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
5486 + * @param[in] avpkt The input AVPacket containing the input buffer.
5487 + */
5488 +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
5489 +                            int *got_sub_ptr,
5490 +                            AVPacket *avpkt);
5491 +
5492 +/**
5493 + * Supply raw packet data as input to a decoder.
5494 + *
5495 + * Internally, this call will copy relevant AVCodecContext fields, which can
5496 + * influence decoding per-packet, and apply them when the packet is actually
5497 + * decoded. (For example AVCodecContext.skip_frame, which might direct the
5498 + * decoder to drop the frame contained by the packet sent with this function.)
5499 + *
5500 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5501 + *          larger than the actual read bytes because some optimized bitstream
5502 + *          readers read 32 or 64 bits at once and could read over the end.
5503 + *
5504 + * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
5505 + *          on the same AVCodecContext. It will return unexpected results now
5506 + *          or in future libavcodec versions.
5507 + *
5508 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5509 + *       before packets may be fed to the decoder.
5510 + *
5511 + * @param avctx codec context
5512 + * @param[in] avpkt The input AVPacket. Usually, this will be a single video
5513 + *                  frame, or several complete audio frames.
5514 + *                  Ownership of the packet remains with the caller, and the
5515 + *                  decoder will not write to the packet. The decoder may create
5516 + *                  a reference to the packet data (or copy it if the packet is
5517 + *                  not reference-counted).
5518 + *                  Unlike with older APIs, the packet is always fully consumed,
5519 + *                  and if it contains multiple frames (e.g. some audio codecs),
5520 + *                  will require you to call avcodec_receive_frame() multiple
5521 + *                  times afterwards before you can send a new packet.
5522 + *                  It can be NULL (or an AVPacket with data set to NULL and
5523 + *                  size set to 0); in this case, it is considered a flush
5524 + *                  packet, which signals the end of the stream. Sending the
5525 + *                  first flush packet will return success. Subsequent ones are
5526 + *                  unnecessary and will return AVERROR_EOF. If the decoder
5527 + *                  still has frames buffered, it will return them after sending
5528 + *                  a flush packet.
5529 + *
5530 + * @return 0 on success, otherwise negative error code:
5531 + *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5532 + *                         must read output with avcodec_receive_frame() (once
5533 + *                         all output is read, the packet should be resent, and
5534 + *                         the call will not fail with EAGAIN).
5535 + *      AVERROR_EOF:       the decoder has been flushed, and no new packets can
5536 + *                         be sent to it (also returned if more than 1 flush
5537 + *                         packet is sent)
5538 + *      AVERROR(EINVAL):   codec not opened, it is an encoder, or requires flush
5539 + *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5540 + *      other errors: legitimate decoding errors
5541 + */
5542 +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
5543 +
5544 +/**
5545 + * Return decoded output data from a decoder.
5546 + *
5547 + * @param avctx codec context
5548 + * @param frame This will be set to a reference-counted video or audio
5549 + *              frame (depending on the decoder type) allocated by the
5550 + *              decoder. Note that the function will always call
5551 + *              av_frame_unref(frame) before doing anything else.
5552 + *
5553 + * @return
5554 + *      0:                 success, a frame was returned
5555 + *      AVERROR(EAGAIN):   output is not available in this state - user must try
5556 + *                         to send new input
5557 + *      AVERROR_EOF:       the decoder has been fully flushed, and there will be
5558 + *                         no more output frames
5559 + *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5560 + *      other negative values: legitimate decoding errors
5561 + */
5562 +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
5563 +
5564 +/**
5565 + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
5566 + * to retrieve buffered output packets.
5567 + *
5568 + * @param avctx     codec context
5569 + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
5570 + *                  Ownership of the frame remains with the caller, and the
5571 + *                  encoder will not write to the frame. The encoder may create
5572 + *                  a reference to the frame data (or copy it if the frame is
5573 + *                  not reference-counted).
5574 + *                  It can be NULL, in which case it is considered a flush
5575 + *                  packet.  This signals the end of the stream. If the encoder
5576 + *                  still has packets buffered, it will return them after this
5577 + *                  call. Once flushing mode has been entered, additional flush
5578 + *                  packets are ignored, and sending frames will return
5579 + *                  AVERROR_EOF.
5580 + *
5581 + *                  For audio:
5582 + *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
5583 + *                  can have any number of samples.
5584 + *                  If it is not set, frame->nb_samples must be equal to
5585 + *                  avctx->frame_size for all frames except the last.
5586 + *                  The final frame may be smaller than avctx->frame_size.
5587 + * @return 0 on success, otherwise negative error code:
5588 + *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5589 + *                         must read output with avcodec_receive_packet() (once
5590 + *                         all output is read, the packet should be resent, and
5591 + *                         the call will not fail with EAGAIN).
5592 + *      AVERROR_EOF:       the encoder has been flushed, and no new frames can
5593 + *                         be sent to it
5594 + *      AVERROR(EINVAL):   codec not opened, refcounted_frames not set, it is a
5595 + *                         decoder, or requires flush
5596 + *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5597 + *      other errors: legitimate decoding errors
5598 + */
5599 +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
5600 +
5601 +/**
5602 + * Read encoded data from the encoder.
5603 + *
5604 + * @param avctx codec context
5605 + * @param avpkt This will be set to a reference-counted packet allocated by the
5606 + *              encoder. Note that the function will always call
5607 + *              av_frame_unref(frame) before doing anything else.
5608 + * @return 0 on success, otherwise negative error code:
5609 + *      AVERROR(EAGAIN):   output is not available in the current state - user
5610 + *                         must try to send input
5611 + *      AVERROR_EOF:       the encoder has been fully flushed, and there will be
5612 + *                         no more output packets
5613 + *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5614 + *      other errors: legitimate decoding errors
5615 + */
5616 +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
5617 +
5618 +/**
5619 + * Create and return a AVHWFramesContext with values adequate for hardware
5620 + * decoding. This is meant to get called from the get_format callback, and is
5621 + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
5622 + * This API is for decoding with certain hardware acceleration modes/APIs only.
5623 + *
5624 + * The returned AVHWFramesContext is not initialized. The caller must do this
5625 + * with av_hwframe_ctx_init().
5626 + *
5627 + * Calling this function is not a requirement, but makes it simpler to avoid
5628 + * codec or hardware API specific details when manually allocating frames.
5629 + *
5630 + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
5631 + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
5632 + * it unnecessary to call this function or having to care about
5633 + * AVHWFramesContext initialization at all.
5634 + *
5635 + * There are a number of requirements for calling this function:
5636 + *
5637 + * - It must be called from get_format with the same avctx parameter that was
5638 + *   passed to get_format. Calling it outside of get_format is not allowed, and
5639 + *   can trigger undefined behavior.
5640 + * - The function is not always supported (see description of return values).
5641 + *   Even if this function returns successfully, hwaccel initialization could
5642 + *   fail later. (The degree to which implementations check whether the stream
5643 + *   is actually supported varies. Some do this check only after the user's
5644 + *   get_format callback returns.)
5645 + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
5646 + *   user decides to use a AVHWFramesContext prepared with this API function,
5647 + *   the user must return the same hw_pix_fmt from get_format.
5648 + * - The device_ref passed to this function must support the given hw_pix_fmt.
5649 + * - After calling this API function, it is the user's responsibility to
5650 + *   initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
5651 + *   and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
5652 + *   before returning from get_format (this is implied by the normal
5653 + *   AVCodecContext.hw_frames_ctx API rules).
5654 + * - The AVHWFramesContext parameters may change every time time get_format is
5655 + *   called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
5656 + *   you are inherently required to go through this process again on every
5657 + *   get_format call.
5658 + * - It is perfectly possible to call this function without actually using
5659 + *   the resulting AVHWFramesContext. One use-case might be trying to reuse a
5660 + *   previously initialized AVHWFramesContext, and calling this API function
5661 + *   only to test whether the required frame parameters have changed.
5662 + * - Fields that use dynamically allocated values of any kind must not be set
5663 + *   by the user unless setting them is explicitly allowed by the documentation.
5664 + *   If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
5665 + *   the new free callback must call the potentially set previous free callback.
5666 + *   This API call may set any dynamically allocated fields, including the free
5667 + *   callback.
5668 + *
5669 + * The function will set at least the following fields on AVHWFramesContext
5670 + * (potentially more, depending on hwaccel API):
5671 + *
5672 + * - All fields set by av_hwframe_ctx_alloc().
5673 + * - Set the format field to hw_pix_fmt.
5674 + * - Set the sw_format field to the most suited and most versatile format. (An
5675 + *   implication is that this will prefer generic formats over opaque formats
5676 + *   with arbitrary restrictions, if possible.)
5677 + * - Set the width/height fields to the coded frame size, rounded up to the
5678 + *   API-specific minimum alignment.
5679 + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
5680 + *   field to the number of maximum reference surfaces possible with the codec,
5681 + *   plus 1 surface for the user to work (meaning the user can safely reference
5682 + *   at most 1 decoded surface at a time), plus additional buffering introduced
5683 + *   by frame threading. If the hwaccel does not require pre-allocation, the
5684 + *   field is left to 0, and the decoder will allocate new surfaces on demand
5685 + *   during decoding.
5686 + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
5687 + *   hardware API.
5688 + *
5689 + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
5690 + * with basic frame parameters set.
5691 + *
5692 + * The function is stateless, and does not change the AVCodecContext or the
5693 + * device_ref AVHWDeviceContext.
5694 + *
5695 + * @param avctx The context which is currently calling get_format, and which
5696 + *              implicitly contains all state needed for filling the returned
5697 + *              AVHWFramesContext properly.
5698 + * @param device_ref A reference to the AVHWDeviceContext describing the device
5699 + *                   which will be used by the hardware decoder.
5700 + * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
5701 + * @param out_frames_ref On success, set to a reference to an _uninitialized_
5702 + *                       AVHWFramesContext, created from the given device_ref.
5703 + *                       Fields will be set to values required for decoding.
5704 + *                       Not changed if an error is returned.
5705 + * @return zero on success, a negative value on error. The following error codes
5706 + *         have special semantics:
5707 + *      AVERROR(ENOENT): the decoder does not support this functionality. Setup
5708 + *                       is always manual, or it is a decoder which does not
5709 + *                       support setting AVCodecContext.hw_frames_ctx at all,
5710 + *                       or it is a software format.
5711 + *      AVERROR(EINVAL): it is known that hardware decoding is not supported for
5712 + *                       this configuration, or the device_ref is not supported
5713 + *                       for the hwaccel referenced by hw_pix_fmt.
5714 + */
5715 +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
5716 +                                     AVBufferRef *device_ref,
5717 +                                     enum AVPixelFormat hw_pix_fmt,
5718 +                                     AVBufferRef **out_frames_ref);
5719 +
5720 +
5721 +
5722 +/**
5723 + * @defgroup lavc_parsing Frame parsing
5724 + * @{
5725 + */
5726 +
5727 +enum AVPictureStructure {
5728 +    AV_PICTURE_STRUCTURE_UNKNOWN,      //< unknown
5729 +    AV_PICTURE_STRUCTURE_TOP_FIELD,    //< coded as top field
5730 +    AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
5731 +    AV_PICTURE_STRUCTURE_FRAME,        //< coded as frame
5732 +};
5733 +
5734 +typedef struct AVCodecParserContext {
5735 +    void *priv_data;
5736 +    struct AVCodecParser *parser;
5737 +    int64_t frame_offset; /* offset of the current frame */
5738 +    int64_t cur_offset; /* current offset
5739 +                           (incremented by each av_parser_parse()) */
5740 +    int64_t next_frame_offset; /* offset of the next frame */
5741 +    /* video info */
5742 +    int pict_type; /* XXX: Put it back in AVCodecContext. */
5743 +    /**
5744 +     * This field is used for proper frame duration computation in lavf.
5745 +     * It signals, how much longer the frame duration of the current frame
5746 +     * is compared to normal frame duration.
5747 +     *
5748 +     * frame_duration = (1 + repeat_pict) * time_base
5749 +     *
5750 +     * It is used by codecs like H.264 to display telecined material.
5751 +     */
5752 +    int repeat_pict; /* XXX: Put it back in AVCodecContext. */
5753 +    int64_t pts;     /* pts of the current frame */
5754 +    int64_t dts;     /* dts of the current frame */
5755 +
5756 +    /* private data */
5757 +    int64_t last_pts;
5758 +    int64_t last_dts;
5759 +    int fetch_timestamp;
5760 +
5761 +#define AV_PARSER_PTS_NB 4
5762 +    int cur_frame_start_index;
5763 +    int64_t cur_frame_offset[AV_PARSER_PTS_NB];
5764 +    int64_t cur_frame_pts[AV_PARSER_PTS_NB];
5765 +    int64_t cur_frame_dts[AV_PARSER_PTS_NB];
5766 +
5767 +    int flags;
5768 +#define PARSER_FLAG_COMPLETE_FRAMES           0x0001
5769 +#define PARSER_FLAG_ONCE                      0x0002
5770 +/// Set if the parser has a valid file offset
5771 +#define PARSER_FLAG_FETCHED_OFFSET            0x0004
5772 +#define PARSER_FLAG_USE_CODEC_TS              0x1000
5773 +
5774 +    int64_t offset;      ///< byte offset from starting packet start
5775 +    int64_t cur_frame_end[AV_PARSER_PTS_NB];
5776 +
5777 +    /**
5778 +     * Set by parser to 1 for key frames and 0 for non-key frames.
5779 +     * It is initialized to -1, so if the parser doesn't set this flag,
5780 +     * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
5781 +     * will be used.
5782 +     */
5783 +    int key_frame;
5784 +
5785 +#if FF_API_CONVERGENCE_DURATION
5786 +    /**
5787 +     * @deprecated unused
5788 +     */
5789 +    attribute_deprecated
5790 +    int64_t convergence_duration;
5791 +#endif
5792 +
5793 +    // Timestamp generation support:
5794 +    /**
5795 +     * Synchronization point for start of timestamp generation.
5796 +     *
5797 +     * Set to >0 for sync point, 0 for no sync point and <0 for undefined
5798 +     * (default).
5799 +     *
5800 +     * For example, this corresponds to presence of H.264 buffering period
5801 +     * SEI message.
5802 +     */
5803 +    int dts_sync_point;
5804 +
5805 +    /**
5806 +     * Offset of the current timestamp against last timestamp sync point in
5807 +     * units of AVCodecContext.time_base.
5808 +     *
5809 +     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5810 +     * contain a valid timestamp offset.
5811 +     *
5812 +     * Note that the timestamp of sync point has usually a nonzero
5813 +     * dts_ref_dts_delta, which refers to the previous sync point. Offset of
5814 +     * the next frame after timestamp sync point will be usually 1.
5815 +     *
5816 +     * For example, this corresponds to H.264 cpb_removal_delay.
5817 +     */
5818 +    int dts_ref_dts_delta;
5819 +
5820 +    /**
5821 +     * Presentation delay of current frame in units of AVCodecContext.time_base.
5822 +     *
5823 +     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5824 +     * contain valid non-negative timestamp delta (presentation time of a frame
5825 +     * must not lie in the past).
5826 +     *
5827 +     * This delay represents the difference between decoding and presentation
5828 +     * time of the frame.
5829 +     *
5830 +     * For example, this corresponds to H.264 dpb_output_delay.
5831 +     */
5832 +    int pts_dts_delta;
5833 +
5834 +    /**
5835 +     * Position of the packet in file.
5836 +     *
5837 +     * Analogous to cur_frame_pts/dts
5838 +     */
5839 +    int64_t cur_frame_pos[AV_PARSER_PTS_NB];
5840 +
5841 +    /**
5842 +     * Byte position of currently parsed frame in stream.
5843 +     */
5844 +    int64_t pos;
5845 +
5846 +    /**
5847 +     * Previous frame byte position.
5848 +     */
5849 +    int64_t last_pos;
5850 +
5851 +    /**
5852 +     * Duration of the current frame.
5853 +     * For audio, this is in units of 1 / AVCodecContext.sample_rate.
5854 +     * For all other types, this is in units of AVCodecContext.time_base.
5855 +     */
5856 +    int duration;
5857 +
5858 +    enum AVFieldOrder field_order;
5859 +
5860 +    /**
5861 +     * Indicate whether a picture is coded as a frame, top field or bottom field.
5862 +     *
5863 +     * For example, H.264 field_pic_flag equal to 0 corresponds to
5864 +     * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
5865 +     * equal to 1 and bottom_field_flag equal to 0 corresponds to
5866 +     * AV_PICTURE_STRUCTURE_TOP_FIELD.
5867 +     */
5868 +    enum AVPictureStructure picture_structure;
5869 +
5870 +    /**
5871 +     * Picture number incremented in presentation or output order.
5872 +     * This field may be reinitialized at the first picture of a new sequence.
5873 +     *
5874 +     * For example, this corresponds to H.264 PicOrderCnt.
5875 +     */
5876 +    int output_picture_number;
5877 +
5878 +    /**
5879 +     * Dimensions of the decoded video intended for presentation.
5880 +     */
5881 +    int width;
5882 +    int height;
5883 +
5884 +    /**
5885 +     * Dimensions of the coded video.
5886 +     */
5887 +    int coded_width;
5888 +    int coded_height;
5889 +
5890 +    /**
5891 +     * The format of the coded data, corresponds to enum AVPixelFormat for video
5892 +     * and for enum AVSampleFormat for audio.
5893 +     *
5894 +     * Note that a decoder can have considerable freedom in how exactly it
5895 +     * decodes the data, so the format reported here might be different from the
5896 +     * one returned by a decoder.
5897 +     */
5898 +    int format;
5899 +} AVCodecParserContext;
5900 +
5901 +typedef struct AVCodecParser {
5902 +    int codec_ids[5]; /* several codec IDs are permitted */
5903 +    int priv_data_size;
5904 +    int (*parser_init)(AVCodecParserContext *s);
5905 +    /* This callback never returns an error, a negative value means that
5906 +     * the frame start was in a previous packet. */
5907 +    int (*parser_parse)(AVCodecParserContext *s,
5908 +                        AVCodecContext *avctx,
5909 +                        const uint8_t **poutbuf, int *poutbuf_size,
5910 +                        const uint8_t *buf, int buf_size);
5911 +    void (*parser_close)(AVCodecParserContext *s);
5912 +    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
5913 +    struct AVCodecParser *next;
5914 +} AVCodecParser;
5915 +
5916 +/**
5917 + * Iterate over all registered codec parsers.
5918 + *
5919 + * @param opaque a pointer where libavcodec will store the iteration state. Must
5920 + *               point to NULL to start the iteration.
5921 + *
5922 + * @return the next registered codec parser or NULL when the iteration is
5923 + *         finished
5924 + */
5925 +const AVCodecParser *av_parser_iterate(void **opaque);
5926 +
5927 +attribute_deprecated
5928 +AVCodecParser *av_parser_next(const AVCodecParser *c);
5929 +
5930 +attribute_deprecated
5931 +void av_register_codec_parser(AVCodecParser *parser);
5932 +AVCodecParserContext *av_parser_init(int codec_id);
5933 +
5934 +/**
5935 + * Parse a packet.
5936 + *
5937 + * @param s             parser context.
5938 + * @param avctx         codec context.
5939 + * @param poutbuf       set to pointer to parsed buffer or NULL if not yet finished.
5940 + * @param poutbuf_size  set to size of parsed buffer or zero if not yet finished.
5941 + * @param buf           input buffer.
5942 + * @param buf_size      buffer size in bytes without the padding. I.e. the full buffer
5943 +                        size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
5944 +                        To signal EOF, this should be 0 (so that the last frame
5945 +                        can be output).
5946 + * @param pts           input presentation timestamp.
5947 + * @param dts           input decoding timestamp.
5948 + * @param pos           input byte position in stream.
5949 + * @return the number of bytes of the input bitstream used.
5950 + *
5951 + * Example:
5952 + * @code
5953 + *   while(in_len){
5954 + *       len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
5955 + *                                        in_data, in_len,
5956 + *                                        pts, dts, pos);
5957 + *       in_data += len;
5958 + *       in_len  -= len;
5959 + *
5960 + *       if(size)
5961 + *          decode_frame(data, size);
5962 + *   }
5963 + * @endcode
5964 + */
5965 +int av_parser_parse2(AVCodecParserContext *s,
5966 +                     AVCodecContext *avctx,
5967 +                     uint8_t **poutbuf, int *poutbuf_size,
5968 +                     const uint8_t *buf, int buf_size,
5969 +                     int64_t pts, int64_t dts,
5970 +                     int64_t pos);
5971 +
5972 +/**
5973 + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
5974 + * @deprecated use AVBitStreamFilter
5975 + */
5976 +int av_parser_change(AVCodecParserContext *s,
5977 +                     AVCodecContext *avctx,
5978 +                     uint8_t **poutbuf, int *poutbuf_size,
5979 +                     const uint8_t *buf, int buf_size, int keyframe);
5980 +void av_parser_close(AVCodecParserContext *s);
5981 +
5982 +/**
5983 + * @}
5984 + * @}
5985 + */
5986 +
5987 +/**
5988 + * @addtogroup lavc_encoding
5989 + * @{
5990 + */
5991 +
5992 +/**
5993 + * Find a registered encoder with a matching codec ID.
5994 + *
5995 + * @param id AVCodecID of the requested encoder
5996 + * @return An encoder if one was found, NULL otherwise.
5997 + */
5998 +AVCodec *avcodec_find_encoder(enum AVCodecID id);
5999 +
6000 +/**
6001 + * Find a registered encoder with the specified name.
6002 + *
6003 + * @param name name of the requested encoder
6004 + * @return An encoder if one was found, NULL otherwise.
6005 + */
6006 +AVCodec *avcodec_find_encoder_by_name(const char *name);
6007 +
6008 +/**
6009 + * Encode a frame of audio.
6010 + *
6011 + * Takes input samples from frame and writes the next output packet, if
6012 + * available, to avpkt. The output packet does not necessarily contain data for
6013 + * the most recent frame, as encoders can delay, split, and combine input frames
6014 + * internally as needed.
6015 + *
6016 + * @param avctx     codec context
6017 + * @param avpkt     output AVPacket.
6018 + *                  The user can supply an output buffer by setting
6019 + *                  avpkt->data and avpkt->size prior to calling the
6020 + *                  function, but if the size of the user-provided data is not
6021 + *                  large enough, encoding will fail. If avpkt->data and
6022 + *                  avpkt->size are set, avpkt->destruct must also be set. All
6023 + *                  other AVPacket fields will be reset by the encoder using
6024 + *                  av_init_packet(). If avpkt->data is NULL, the encoder will
6025 + *                  allocate it. The encoder will set avpkt->size to the size
6026 + *                  of the output packet.
6027 + *
6028 + *                  If this function fails or produces no output, avpkt will be
6029 + *                  freed using av_packet_unref().
6030 + * @param[in] frame AVFrame containing the raw audio data to be encoded.
6031 + *                  May be NULL when flushing an encoder that has the
6032 + *                  AV_CODEC_CAP_DELAY capability set.
6033 + *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
6034 + *                  can have any number of samples.
6035 + *                  If it is not set, frame->nb_samples must be equal to
6036 + *                  avctx->frame_size for all frames except the last.
6037 + *                  The final frame may be smaller than avctx->frame_size.
6038 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6039 + *                            output packet is non-empty, and to 0 if it is
6040 + *                            empty. If the function returns an error, the
6041 + *                            packet can be assumed to be invalid, and the
6042 + *                            value of got_packet_ptr is undefined and should
6043 + *                            not be used.
6044 + * @return          0 on success, negative error code on failure
6045 + *
6046 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6047 + */
6048 +attribute_deprecated
6049 +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
6050 +                          const AVFrame *frame, int *got_packet_ptr);
6051 +
6052 +/**
6053 + * Encode a frame of video.
6054 + *
6055 + * Takes input raw video data from frame and writes the next output packet, if
6056 + * available, to avpkt. The output packet does not necessarily contain data for
6057 + * the most recent frame, as encoders can delay and reorder input frames
6058 + * internally as needed.
6059 + *
6060 + * @param avctx     codec context
6061 + * @param avpkt     output AVPacket.
6062 + *                  The user can supply an output buffer by setting
6063 + *                  avpkt->data and avpkt->size prior to calling the
6064 + *                  function, but if the size of the user-provided data is not
6065 + *                  large enough, encoding will fail. All other AVPacket fields
6066 + *                  will be reset by the encoder using av_init_packet(). If
6067 + *                  avpkt->data is NULL, the encoder will allocate it.
6068 + *                  The encoder will set avpkt->size to the size of the
6069 + *                  output packet. The returned data (if any) belongs to the
6070 + *                  caller, he is responsible for freeing it.
6071 + *
6072 + *                  If this function fails or produces no output, avpkt will be
6073 + *                  freed using av_packet_unref().
6074 + * @param[in] frame AVFrame containing the raw video data to be encoded.
6075 + *                  May be NULL when flushing an encoder that has the
6076 + *                  AV_CODEC_CAP_DELAY capability set.
6077 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6078 + *                            output packet is non-empty, and to 0 if it is
6079 + *                            empty. If the function returns an error, the
6080 + *                            packet can be assumed to be invalid, and the
6081 + *                            value of got_packet_ptr is undefined and should
6082 + *                            not be used.
6083 + * @return          0 on success, negative error code on failure
6084 + *
6085 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6086 + */
6087 +attribute_deprecated
6088 +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
6089 +                          const AVFrame *frame, int *got_packet_ptr);
6090 +
6091 +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
6092 +                            const AVSubtitle *sub);
6093 +
6094 +
6095 +/**
6096 + * @}
6097 + */
6098 +
6099 +#if FF_API_AVPICTURE
6100 +/**
6101 + * @addtogroup lavc_picture
6102 + * @{
6103 + */
6104 +
6105 +/**
6106 + * @deprecated unused
6107 + */
6108 +attribute_deprecated
6109 +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
6110 +
6111 +/**
6112 + * @deprecated unused
6113 + */
6114 +attribute_deprecated
6115 +void avpicture_free(AVPicture *picture);
6116 +
6117 +/**
6118 + * @deprecated use av_image_fill_arrays() instead.
6119 + */
6120 +attribute_deprecated
6121 +int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
6122 +                   enum AVPixelFormat pix_fmt, int width, int height);
6123 +
6124 +/**
6125 + * @deprecated use av_image_copy_to_buffer() instead.
6126 + */
6127 +attribute_deprecated
6128 +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
6129 +                     int width, int height,
6130 +                     unsigned char *dest, int dest_size);
6131 +
6132 +/**
6133 + * @deprecated use av_image_get_buffer_size() instead.
6134 + */
6135 +attribute_deprecated
6136 +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
6137 +
6138 +/**
6139 + * @deprecated av_image_copy() instead.
6140 + */
6141 +attribute_deprecated
6142 +void av_picture_copy(AVPicture *dst, const AVPicture *src,
6143 +                     enum AVPixelFormat pix_fmt, int width, int height);
6144 +
6145 +/**
6146 + * @deprecated unused
6147 + */
6148 +attribute_deprecated
6149 +int av_picture_crop(AVPicture *dst, const AVPicture *src,
6150 +                    enum AVPixelFormat pix_fmt, int top_band, int left_band);
6151 +
6152 +/**
6153 + * @deprecated unused
6154 + */
6155 +attribute_deprecated
6156 +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
6157 +            int padtop, int padbottom, int padleft, int padright, int *color);
6158 +
6159 +/**
6160 + * @}
6161 + */
6162 +#endif
6163 +
6164 +/**
6165 + * @defgroup lavc_misc Utility functions
6166 + * @ingroup libavc
6167 + *
6168 + * Miscellaneous utility functions related to both encoding and decoding
6169 + * (or neither).
6170 + * @{
6171 + */
6172 +
6173 +/**
6174 + * @defgroup lavc_misc_pixfmt Pixel formats
6175 + *
6176 + * Functions for working with pixel formats.
6177 + * @{
6178 + */
6179 +
6180 +#if FF_API_GETCHROMA
6181 +/**
6182 + * @deprecated Use av_pix_fmt_get_chroma_sub_sample
6183 + */
6184 +
6185 +attribute_deprecated
6186 +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
6187 +#endif
6188 +
6189 +/**
6190 + * Return a value representing the fourCC code associated to the
6191 + * pixel format pix_fmt, or 0 if no associated fourCC code can be
6192 + * found.
6193 + */
6194 +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
6195 +
6196 +/**
6197 + * @deprecated see av_get_pix_fmt_loss()
6198 + */
6199 +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
6200 +                             int has_alpha);
6201 +
6202 +/**
6203 + * Find the best pixel format to convert to given a certain source pixel
6204 + * format.  When converting from one pixel format to another, information loss
6205 + * may occur.  For example, when converting from RGB24 to GRAY, the color
6206 + * information will be lost. Similarly, other losses occur when converting from
6207 + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
6208 + * the given pixel formats should be used to suffer the least amount of loss.
6209 + * The pixel formats from which it chooses one, are determined by the
6210 + * pix_fmt_list parameter.
6211 + *
6212 + *
6213 + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
6214 + * @param[in] src_pix_fmt source pixel format
6215 + * @param[in] has_alpha Whether the source pixel format alpha channel is used.
6216 + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
6217 + * @return The best pixel format to convert to or -1 if none was found.
6218 + */
6219 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
6220 +                                            enum AVPixelFormat src_pix_fmt,
6221 +                                            int has_alpha, int *loss_ptr);
6222 +
6223 +/**
6224 + * @deprecated see av_find_best_pix_fmt_of_2()
6225 + */
6226 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6227 +                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6228 +
6229 +attribute_deprecated
6230 +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6231 +                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6232 +
6233 +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
6234 +
6235 +/**
6236 + * @}
6237 + */
6238 +
6239 +#if FF_API_TAG_STRING
6240 +/**
6241 + * Put a string representing the codec tag codec_tag in buf.
6242 + *
6243 + * @param buf       buffer to place codec tag in
6244 + * @param buf_size size in bytes of buf
6245 + * @param codec_tag codec tag to assign
6246 + * @return the length of the string that would have been generated if
6247 + * enough space had been available, excluding the trailing null
6248 + *
6249 + * @deprecated see av_fourcc_make_string() and av_fourcc2str().
6250 + */
6251 +attribute_deprecated
6252 +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
6253 +#endif
6254 +
6255 +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
6256 +
6257 +/**
6258 + * Return a name for the specified profile, if available.
6259 + *
6260 + * @param codec the codec that is searched for the given profile
6261 + * @param profile the profile value for which a name is requested
6262 + * @return A name for the profile if found, NULL otherwise.
6263 + */
6264 +const char *av_get_profile_name(const AVCodec *codec, int profile);
6265 +
6266 +/**
6267 + * Return a name for the specified profile, if available.
6268 + *
6269 + * @param codec_id the ID of the codec to which the requested profile belongs
6270 + * @param profile the profile value for which a name is requested
6271 + * @return A name for the profile if found, NULL otherwise.
6272 + *
6273 + * @note unlike av_get_profile_name(), which searches a list of profiles
6274 + *       supported by a specific decoder or encoder implementation, this
6275 + *       function searches the list of profiles from the AVCodecDescriptor
6276 + */
6277 +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
6278 +
6279 +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
6280 +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
6281 +//FIXME func typedef
6282 +
6283 +/**
6284 + * Fill AVFrame audio data and linesize pointers.
6285 + *
6286 + * The buffer buf must be a preallocated buffer with a size big enough
6287 + * to contain the specified samples amount. The filled AVFrame data
6288 + * pointers will point to this buffer.
6289 + *
6290 + * AVFrame extended_data channel pointers are allocated if necessary for
6291 + * planar audio.
6292 + *
6293 + * @param frame       the AVFrame
6294 + *                    frame->nb_samples must be set prior to calling the
6295 + *                    function. This function fills in frame->data,
6296 + *                    frame->extended_data, frame->linesize[0].
6297 + * @param nb_channels channel count
6298 + * @param sample_fmt  sample format
6299 + * @param buf         buffer to use for frame data
6300 + * @param buf_size    size of buffer
6301 + * @param align       plane size sample alignment (0 = default)
6302 + * @return            >=0 on success, negative error code on failure
6303 + * @todo return the size in bytes required to store the samples in
6304 + * case of success, at the next libavutil bump
6305 + */
6306 +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
6307 +                             enum AVSampleFormat sample_fmt, const uint8_t *buf,
6308 +                             int buf_size, int align);
6309 +
6310 +/**
6311 + * Reset the internal decoder state / flush internal buffers. Should be called
6312 + * e.g. when seeking or when switching to a different stream.
6313 + *
6314 + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
6315 + * this invalidates the frames previously returned from the decoder. When
6316 + * refcounted frames are used, the decoder just releases any references it might
6317 + * keep internally, but the caller's reference remains valid.
6318 + */
6319 +void avcodec_flush_buffers(AVCodecContext *avctx);
6320 +
6321 +/**
6322 + * Return codec bits per sample.
6323 + *
6324 + * @param[in] codec_id the codec
6325 + * @return Number of bits per sample or zero if unknown for the given codec.
6326 + */
6327 +int av_get_bits_per_sample(enum AVCodecID codec_id);
6328 +
6329 +/**
6330 + * Return the PCM codec associated with a sample format.
6331 + * @param be  endianness, 0 for little, 1 for big,
6332 + *            -1 (or anything else) for native
6333 + * @return  AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
6334 + */
6335 +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
6336 +
6337 +/**
6338 + * Return codec bits per sample.
6339 + * Only return non-zero if the bits per sample is exactly correct, not an
6340 + * approximation.
6341 + *
6342 + * @param[in] codec_id the codec
6343 + * @return Number of bits per sample or zero if unknown for the given codec.
6344 + */
6345 +int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
6346 +
6347 +/**
6348 + * Return audio frame duration.
6349 + *
6350 + * @param avctx        codec context
6351 + * @param frame_bytes  size of the frame, or 0 if unknown
6352 + * @return             frame duration, in samples, if known. 0 if not able to
6353 + *                     determine.
6354 + */
6355 +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
6356 +
6357 +/**
6358 + * This function is the same as av_get_audio_frame_duration(), except it works
6359 + * with AVCodecParameters instead of an AVCodecContext.
6360 + */
6361 +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
6362 +
6363 +#if FF_API_OLD_BSF
6364 +typedef struct AVBitStreamFilterContext {
6365 +    void *priv_data;
6366 +    const struct AVBitStreamFilter *filter;
6367 +    AVCodecParserContext *parser;
6368 +    struct AVBitStreamFilterContext *next;
6369 +    /**
6370 +     * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
6371 +     * Not for access by library users.
6372 +     */
6373 +    char *args;
6374 +} AVBitStreamFilterContext;
6375 +#endif
6376 +
6377 +typedef struct AVBSFInternal AVBSFInternal;
6378 +
6379 +/**
6380 + * The bitstream filter state.
6381 + *
6382 + * This struct must be allocated with av_bsf_alloc() and freed with
6383 + * av_bsf_free().
6384 + *
6385 + * The fields in the struct will only be changed (by the caller or by the
6386 + * filter) as described in their documentation, and are to be considered
6387 + * immutable otherwise.
6388 + */
6389 +typedef struct AVBSFContext {
6390 +    /**
6391 +     * A class for logging and AVOptions
6392 +     */
6393 +    const AVClass *av_class;
6394 +
6395 +    /**
6396 +     * The bitstream filter this context is an instance of.
6397 +     */
6398 +    const struct AVBitStreamFilter *filter;
6399 +
6400 +    /**
6401 +     * Opaque libavcodec internal data. Must not be touched by the caller in any
6402 +     * way.
6403 +     */
6404 +    AVBSFInternal *internal;
6405 +
6406 +    /**
6407 +     * Opaque filter-specific private data. If filter->priv_class is non-NULL,
6408 +     * this is an AVOptions-enabled struct.
6409 +     */
6410 +    void *priv_data;
6411 +
6412 +    /**
6413 +     * Parameters of the input stream. This field is allocated in
6414 +     * av_bsf_alloc(), it needs to be filled by the caller before
6415 +     * av_bsf_init().
6416 +     */
6417 +    AVCodecParameters *par_in;
6418 +
6419 +    /**
6420 +     * Parameters of the output stream. This field is allocated in
6421 +     * av_bsf_alloc(), it is set by the filter in av_bsf_init().
6422 +     */
6423 +    AVCodecParameters *par_out;
6424 +
6425 +    /**
6426 +     * The timebase used for the timestamps of the input packets. Set by the
6427 +     * caller before av_bsf_init().
6428 +     */
6429 +    AVRational time_base_in;
6430 +
6431 +    /**
6432 +     * The timebase used for the timestamps of the output packets. Set by the
6433 +     * filter in av_bsf_init().
6434 +     */
6435 +    AVRational time_base_out;
6436 +} AVBSFContext;
6437 +
6438 +typedef struct AVBitStreamFilter {
6439 +    const char *name;
6440 +
6441 +    /**
6442 +     * A list of codec ids supported by the filter, terminated by
6443 +     * AV_CODEC_ID_NONE.
6444 +     * May be NULL, in that case the bitstream filter works with any codec id.
6445 +     */
6446 +    const enum AVCodecID *codec_ids;
6447 +
6448 +    /**
6449 +     * A class for the private data, used to declare bitstream filter private
6450 +     * AVOptions. This field is NULL for bitstream filters that do not declare
6451 +     * any options.
6452 +     *
6453 +     * If this field is non-NULL, the first member of the filter private data
6454 +     * must be a pointer to AVClass, which will be set by libavcodec generic
6455 +     * code to this class.
6456 +     */
6457 +    const AVClass *priv_class;
6458 +
6459 +    /*****************************************************************
6460 +     * No fields below this line are part of the public API. They
6461 +     * may not be used outside of libavcodec and can be changed and
6462 +     * removed at will.
6463 +     * New public fields should be added right above.
6464 +     *****************************************************************
6465 +     */
6466 +
6467 +    int priv_data_size;
6468 +    int (*init)(AVBSFContext *ctx);
6469 +    int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
6470 +    void (*close)(AVBSFContext *ctx);
6471 +} AVBitStreamFilter;
6472 +
6473 +#if FF_API_OLD_BSF
6474 +/**
6475 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6476 + * is deprecated. Use the new bitstream filtering API (using AVBSFContext).
6477 + */
6478 +attribute_deprecated
6479 +void av_register_bitstream_filter(AVBitStreamFilter *bsf);
6480 +/**
6481 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6482 + * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init()
6483 + * from the new bitstream filtering API (using AVBSFContext).
6484 + */
6485 +attribute_deprecated
6486 +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
6487 +/**
6488 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6489 + * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the
6490 + * new bitstream filtering API (using AVBSFContext).
6491 + */
6492 +attribute_deprecated
6493 +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
6494 +                               AVCodecContext *avctx, const char *args,
6495 +                               uint8_t **poutbuf, int *poutbuf_size,
6496 +                               const uint8_t *buf, int buf_size, int keyframe);
6497 +/**
6498 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6499 + * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using
6500 + * AVBSFContext).
6501 + */
6502 +attribute_deprecated
6503 +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
6504 +/**
6505 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6506 + * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using
6507 + * AVBSFContext).
6508 + */
6509 +attribute_deprecated
6510 +const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
6511 +#endif
6512 +
6513 +/**
6514 + * @return a bitstream filter with the specified name or NULL if no such
6515 + *         bitstream filter exists.
6516 + */
6517 +const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
6518 +
6519 +/**
6520 + * Iterate over all registered bitstream filters.
6521 + *
6522 + * @param opaque a pointer where libavcodec will store the iteration state. Must
6523 + *               point to NULL to start the iteration.
6524 + *
6525 + * @return the next registered bitstream filter or NULL when the iteration is
6526 + *         finished
6527 + */
6528 +const AVBitStreamFilter *av_bsf_iterate(void **opaque);
6529 +#if FF_API_NEXT
6530 +attribute_deprecated
6531 +const AVBitStreamFilter *av_bsf_next(void **opaque);
6532 +#endif
6533 +
6534 +/**
6535 + * Allocate a context for a given bitstream filter. The caller must fill in the
6536 + * context parameters as described in the documentation and then call
6537 + * av_bsf_init() before sending any data to the filter.
6538 + *
6539 + * @param filter the filter for which to allocate an instance.
6540 + * @param ctx a pointer into which the pointer to the newly-allocated context
6541 + *            will be written. It must be freed with av_bsf_free() after the
6542 + *            filtering is done.
6543 + *
6544 + * @return 0 on success, a negative AVERROR code on failure
6545 + */
6546 +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
6547 +
6548 +/**
6549 + * Prepare the filter for use, after all the parameters and options have been
6550 + * set.
6551 + */
6552 +int av_bsf_init(AVBSFContext *ctx);
6553 +
6554 +/**
6555 + * Submit a packet for filtering.
6556 + *
6557 + * After sending each packet, the filter must be completely drained by calling
6558 + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
6559 + * AVERROR_EOF.
6560 + *
6561 + * @param pkt the packet to filter. The bitstream filter will take ownership of
6562 + * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
6563 + * This parameter may be NULL, which signals the end of the stream (i.e. no more
6564 + * packets will be sent). That will cause the filter to output any packets it
6565 + * may have buffered internally.
6566 + *
6567 + * @return 0 on success, a negative AVERROR on error.
6568 + */
6569 +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
6570 +
6571 +/**
6572 + * Retrieve a filtered packet.
6573 + *
6574 + * @param[out] pkt this struct will be filled with the contents of the filtered
6575 + *                 packet. It is owned by the caller and must be freed using
6576 + *                 av_packet_unref() when it is no longer needed.
6577 + *                 This parameter should be "clean" (i.e. freshly allocated
6578 + *                 with av_packet_alloc() or unreffed with av_packet_unref())
6579 + *                 when this function is called. If this function returns
6580 + *                 successfully, the contents of pkt will be completely
6581 + *                 overwritten by the returned data. On failure, pkt is not
6582 + *                 touched.
6583 + *
6584 + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the
6585 + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there
6586 + * will be no further output from the filter. Another negative AVERROR value if
6587 + * an error occurs.
6588 + *
6589 + * @note one input packet may result in several output packets, so after sending
6590 + * a packet with av_bsf_send_packet(), this function needs to be called
6591 + * repeatedly until it stops returning 0. It is also possible for a filter to
6592 + * output fewer packets than were sent to it, so this function may return
6593 + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
6594 + */
6595 +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
6596 +
6597 +/**
6598 + * Free a bitstream filter context and everything associated with it; write NULL
6599 + * into the supplied pointer.
6600 + */
6601 +void av_bsf_free(AVBSFContext **ctx);
6602 +
6603 +/**
6604 + * Get the AVClass for AVBSFContext. It can be used in combination with
6605 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
6606 + *
6607 + * @see av_opt_find().
6608 + */
6609 +const AVClass *av_bsf_get_class(void);
6610 +
6611 +/**
6612 + * Structure for chain/list of bitstream filters.
6613 + * Empty list can be allocated by av_bsf_list_alloc().
6614 + */
6615 +typedef struct AVBSFList AVBSFList;
6616 +
6617 +/**
6618 + * Allocate empty list of bitstream filters.
6619 + * The list must be later freed by av_bsf_list_free()
6620 + * or finalized by av_bsf_list_finalize().
6621 + *
6622 + * @return Pointer to @ref AVBSFList on success, NULL in case of failure
6623 + */
6624 +AVBSFList *av_bsf_list_alloc(void);
6625 +
6626 +/**
6627 + * Free list of bitstream filters.
6628 + *
6629 + * @param lst Pointer to pointer returned by av_bsf_list_alloc()
6630 + */
6631 +void av_bsf_list_free(AVBSFList **lst);
6632 +
6633 +/**
6634 + * Append bitstream filter to the list of bitstream filters.
6635 + *
6636 + * @param lst List to append to
6637 + * @param bsf Filter context to be appended
6638 + *
6639 + * @return >=0 on success, negative AVERROR in case of failure
6640 + */
6641 +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
6642 +
6643 +/**
6644 + * Construct new bitstream filter context given it's name and options
6645 + * and append it to the list of bitstream filters.
6646 + *
6647 + * @param lst      List to append to
6648 + * @param bsf_name Name of the bitstream filter
6649 + * @param options  Options for the bitstream filter, can be set to NULL
6650 + *
6651 + * @return >=0 on success, negative AVERROR in case of failure
6652 + */
6653 +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
6654 +/**
6655 + * Finalize list of bitstream filters.
6656 + *
6657 + * This function will transform @ref AVBSFList to single @ref AVBSFContext,
6658 + * so the whole chain of bitstream filters can be treated as single filter
6659 + * freshly allocated by av_bsf_alloc().
6660 + * If the call is successful, @ref AVBSFList structure is freed and lst
6661 + * will be set to NULL. In case of failure, caller is responsible for
6662 + * freeing the structure by av_bsf_list_free()
6663 + *
6664 + * @param      lst Filter list structure to be transformed
6665 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6666 + *                 representing the chain of bitstream filters
6667 + *
6668 + * @return >=0 on success, negative AVERROR in case of failure
6669 + */
6670 +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
6671 +
6672 +/**
6673 + * Parse string describing list of bitstream filters and create single
6674 + * @ref AVBSFContext describing the whole chain of bitstream filters.
6675 + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
6676 + * allocated by av_bsf_alloc().
6677 + *
6678 + * @param      str String describing chain of bitstream filters in format
6679 + *                 `bsf1[=opt1=val1:opt2=val2][,bsf2]`
6680 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6681 + *                 representing the chain of bitstream filters
6682 + *
6683 + * @return >=0 on success, negative AVERROR in case of failure
6684 + */
6685 +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
6686 +
6687 +/**
6688 + * Get null/pass-through bitstream filter.
6689 + *
6690 + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
6691 + *
6692 + * @return
6693 + */
6694 +int av_bsf_get_null_filter(AVBSFContext **bsf);
6695 +
6696 +/* memory */
6697 +
6698 +/**
6699 + * Same behaviour av_fast_malloc but the buffer has additional
6700 + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
6701 + *
6702 + * In addition the whole buffer will initially and after resizes
6703 + * be 0-initialized so that no uninitialized data will ever appear.
6704 + */
6705 +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
6706 +
6707 +/**
6708 + * Same behaviour av_fast_padded_malloc except that buffer will always
6709 + * be 0-initialized after call.
6710 + */
6711 +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
6712 +
6713 +/**
6714 + * Encode extradata length to a buffer. Used by xiph codecs.
6715 + *
6716 + * @param s buffer to write to; must be at least (v/255+1) bytes long
6717 + * @param v size of extradata in bytes
6718 + * @return number of bytes written to the buffer.
6719 + */
6720 +unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
6721 +
6722 +#if FF_API_USER_VISIBLE_AVHWACCEL
6723 +/**
6724 + * Register the hardware accelerator hwaccel.
6725 + *
6726 + * @deprecated  This function doesn't do anything.
6727 + */
6728 +attribute_deprecated
6729 +void av_register_hwaccel(AVHWAccel *hwaccel);
6730 +
6731 +/**
6732 + * If hwaccel is NULL, returns the first registered hardware accelerator,
6733 + * if hwaccel is non-NULL, returns the next registered hardware accelerator
6734 + * after hwaccel, or NULL if hwaccel is the last one.
6735 + *
6736 + * @deprecated  AVHWaccel structures contain no user-serviceable parts, so
6737 + *              this function should not be used.
6738 + */
6739 +attribute_deprecated
6740 +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
6741 +#endif
6742 +
6743 +#if FF_API_LOCKMGR
6744 +/**
6745 + * Lock operation used by lockmgr
6746 + *
6747 + * @deprecated Deprecated together with av_lockmgr_register().
6748 + */
6749 +enum AVLockOp {
6750 +  AV_LOCK_CREATE,  ///< Create a mutex
6751 +  AV_LOCK_OBTAIN,  ///< Lock the mutex
6752 +  AV_LOCK_RELEASE, ///< Unlock the mutex
6753 +  AV_LOCK_DESTROY, ///< Free mutex resources
6754 +};
6755 +
6756 +/**
6757 + * Register a user provided lock manager supporting the operations
6758 + * specified by AVLockOp. The "mutex" argument to the function points
6759 + * to a (void *) where the lockmgr should store/get a pointer to a user
6760 + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
6761 + * value left by the last call for all other ops. If the lock manager is
6762 + * unable to perform the op then it should leave the mutex in the same
6763 + * state as when it was called and return a non-zero value. However,
6764 + * when called with AV_LOCK_DESTROY the mutex will always be assumed to
6765 + * have been successfully destroyed. If av_lockmgr_register succeeds
6766 + * it will return a non-negative value, if it fails it will return a
6767 + * negative value and destroy all mutex and unregister all callbacks.
6768 + * av_lockmgr_register is not thread-safe, it must be called from a
6769 + * single thread before any calls which make use of locking are used.
6770 + *
6771 + * @param cb User defined callback. av_lockmgr_register invokes calls
6772 + *           to this callback and the previously registered callback.
6773 + *           The callback will be used to create more than one mutex
6774 + *           each of which must be backed by its own underlying locking
6775 + *           mechanism (i.e. do not use a single static object to
6776 + *           implement your lock manager). If cb is set to NULL the
6777 + *           lockmgr will be unregistered.
6778 + *
6779 + * @deprecated This function does nothing, and always returns 0. Be sure to
6780 + *             build with thread support to get basic thread safety.
6781 + */
6782 +attribute_deprecated
6783 +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
6784 +#endif
6785 +
6786 +/**
6787 + * Get the type of the given codec.
6788 + */
6789 +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
6790 +
6791 +/**
6792 + * Get the name of a codec.
6793 + * @return  a static string identifying the codec; never NULL
6794 + */
6795 +const char *avcodec_get_name(enum AVCodecID id);
6796 +
6797 +/**
6798 + * @return a positive value if s is open (i.e. avcodec_open2() was called on it
6799 + * with no corresponding avcodec_close()), 0 otherwise.
6800 + */
6801 +int avcodec_is_open(AVCodecContext *s);
6802 +
6803 +/**
6804 + * @return a non-zero number if codec is an encoder, zero otherwise
6805 + */
6806 +int av_codec_is_encoder(const AVCodec *codec);
6807 +
6808 +/**
6809 + * @return a non-zero number if codec is a decoder, zero otherwise
6810 + */
6811 +int av_codec_is_decoder(const AVCodec *codec);
6812 +
6813 +/**
6814 + * @return descriptor for given codec ID or NULL if no descriptor exists.
6815 + */
6816 +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
6817 +
6818 +/**
6819 + * Iterate over all codec descriptors known to libavcodec.
6820 + *
6821 + * @param prev previous descriptor. NULL to get the first descriptor.
6822 + *
6823 + * @return next descriptor or NULL after the last descriptor
6824 + */
6825 +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
6826 +
6827 +/**
6828 + * @return codec descriptor with the given name or NULL if no such descriptor
6829 + *         exists.
6830 + */
6831 +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
6832 +
6833 +/**
6834 + * Allocate a CPB properties structure and initialize its fields to default
6835 + * values.
6836 + *
6837 + * @param size if non-NULL, the size of the allocated struct will be written
6838 + *             here. This is useful for embedding it in side data.
6839 + *
6840 + * @return the newly allocated struct or NULL on failure
6841 + */
6842 +AVCPBProperties *av_cpb_properties_alloc(size_t *size);
6843 +
6844 +/**
6845 + * @}
6846 + */
6847 +
6848 +#endif /* AVCODEC_AVCODEC_H */
6849 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6850 new file mode 100644
6851 --- /dev/null
6852 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6853 @@ -0,0 +1,118 @@
6854 +/*
6855 + * This file is part of FFmpeg.
6856 + *
6857 + * FFmpeg is free software; you can redistribute it and/or
6858 + * modify it under the terms of the GNU Lesser General Public
6859 + * License as published by the Free Software Foundation; either
6860 + * version 2.1 of the License, or (at your option) any later version.
6861 + *
6862 + * FFmpeg is distributed in the hope that it will be useful,
6863 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6864 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6865 + * Lesser General Public License for more details.
6866 + *
6867 + * You should have received a copy of the GNU Lesser General Public
6868 + * License along with FFmpeg; if not, write to the Free Software
6869 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6870 + */
6871 +
6872 +#ifndef AVCODEC_AVFFT_H
6873 +#define AVCODEC_AVFFT_H
6874 +
6875 +/**
6876 + * @file
6877 + * @ingroup lavc_fft
6878 + * FFT functions
6879 + */
6880 +
6881 +/**
6882 + * @defgroup lavc_fft FFT functions
6883 + * @ingroup lavc_misc
6884 + *
6885 + * @{
6886 + */
6887 +
6888 +typedef float FFTSample;
6889 +
6890 +typedef struct FFTComplex {
6891 +    FFTSample re, im;
6892 +} FFTComplex;
6893 +
6894 +typedef struct FFTContext FFTContext;
6895 +
6896 +/**
6897 + * Set up a complex FFT.
6898 + * @param nbits           log2 of the length of the input array
6899 + * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
6900 + */
6901 +FFTContext *av_fft_init(int nbits, int inverse);
6902 +
6903 +/**
6904 + * Do the permutation needed BEFORE calling ff_fft_calc().
6905 + */
6906 +void av_fft_permute(FFTContext *s, FFTComplex *z);
6907 +
6908 +/**
6909 + * Do a complex FFT with the parameters defined in av_fft_init(). The
6910 + * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
6911 + */
6912 +void av_fft_calc(FFTContext *s, FFTComplex *z);
6913 +
6914 +void av_fft_end(FFTContext *s);
6915 +
6916 +FFTContext *av_mdct_init(int nbits, int inverse, double scale);
6917 +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6918 +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
6919 +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6920 +void av_mdct_end(FFTContext *s);
6921 +
6922 +/* Real Discrete Fourier Transform */
6923 +
6924 +enum RDFTransformType {
6925 +    DFT_R2C,
6926 +    IDFT_C2R,
6927 +    IDFT_R2C,
6928 +    DFT_C2R,
6929 +};
6930 +
6931 +typedef struct RDFTContext RDFTContext;
6932 +
6933 +/**
6934 + * Set up a real FFT.
6935 + * @param nbits           log2 of the length of the input array
6936 + * @param trans           the type of transform
6937 + */
6938 +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
6939 +void av_rdft_calc(RDFTContext *s, FFTSample *data);
6940 +void av_rdft_end(RDFTContext *s);
6941 +
6942 +/* Discrete Cosine Transform */
6943 +
6944 +typedef struct DCTContext DCTContext;
6945 +
6946 +enum DCTTransformType {
6947 +    DCT_II = 0,
6948 +    DCT_III,
6949 +    DCT_I,
6950 +    DST_I,
6951 +};
6952 +
6953 +/**
6954 + * Set up DCT.
6955 + *
6956 + * @param nbits           size of the input array:
6957 + *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
6958 + *                        (1 << nbits) + 1 for DCT-I
6959 + * @param type            the type of transform
6960 + *
6961 + * @note the first element of the input of DST-I is ignored
6962 + */
6963 +DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
6964 +void av_dct_calc(DCTContext *s, FFTSample *data);
6965 +void av_dct_end (DCTContext *s);
6966 +
6967 +/**
6968 + * @}
6969 + */
6970 +
6971 +#endif /* AVCODEC_AVFFT_H */
6972 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6973 new file mode 100644
6974 --- /dev/null
6975 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6976 @@ -0,0 +1,86 @@
6977 +/*
6978 + * Video Acceleration API (shared data between FFmpeg and the video player)
6979 + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
6980 + *
6981 + * Copyright (C) 2008-2009 Splitted-Desktop Systems
6982 + *
6983 + * This file is part of FFmpeg.
6984 + *
6985 + * FFmpeg is free software; you can redistribute it and/or
6986 + * modify it under the terms of the GNU Lesser General Public
6987 + * License as published by the Free Software Foundation; either
6988 + * version 2.1 of the License, or (at your option) any later version.
6989 + *
6990 + * FFmpeg is distributed in the hope that it will be useful,
6991 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6992 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6993 + * Lesser General Public License for more details.
6994 + *
6995 + * You should have received a copy of the GNU Lesser General Public
6996 + * License along with FFmpeg; if not, write to the Free Software
6997 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6998 + */
6999 +
7000 +#ifndef AVCODEC_VAAPI_H
7001 +#define AVCODEC_VAAPI_H
7002 +
7003 +/**
7004 + * @file
7005 + * @ingroup lavc_codec_hwaccel_vaapi
7006 + * Public libavcodec VA API header.
7007 + */
7008 +
7009 +#include <stdint.h>
7010 +#include "libavutil/attributes.h"
7011 +#include "version.h"
7012 +
7013 +#if FF_API_STRUCT_VAAPI_CONTEXT
7014 +
7015 +/**
7016 + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
7017 + * @ingroup lavc_codec_hwaccel
7018 + * @{
7019 + */
7020 +
7021 +/**
7022 + * This structure is used to share data between the FFmpeg library and
7023 + * the client video application.
7024 + * This shall be zero-allocated and available as
7025 + * AVCodecContext.hwaccel_context. All user members can be set once
7026 + * during initialization or through each AVCodecContext.get_buffer()
7027 + * function call. In any case, they must be valid prior to calling
7028 + * decoding functions.
7029 + *
7030 + * Deprecated: use AVCodecContext.hw_frames_ctx instead.
7031 + */
7032 +struct attribute_deprecated vaapi_context {
7033 +    /**
7034 +     * Window system dependent data
7035 +     *
7036 +     * - encoding: unused
7037 +     * - decoding: Set by user
7038 +     */
7039 +    void *display;
7040 +
7041 +    /**
7042 +     * Configuration ID
7043 +     *
7044 +     * - encoding: unused
7045 +     * - decoding: Set by user
7046 +     */
7047 +    uint32_t config_id;
7048 +
7049 +    /**
7050 +     * Context ID (video decode pipeline)
7051 +     *
7052 +     * - encoding: unused
7053 +     * - decoding: Set by user
7054 +     */
7055 +    uint32_t context_id;
7056 +};
7057 +
7058 +/* @} */
7059 +
7060 +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
7061 +
7062 +#endif /* AVCODEC_VAAPI_H */
7063 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7064 new file mode 100644
7065 --- /dev/null
7066 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7067 @@ -0,0 +1,176 @@
7068 +/*
7069 + * The Video Decode and Presentation API for UNIX (VDPAU) is used for
7070 + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
7071 + *
7072 + * Copyright (C) 2008 NVIDIA
7073 + *
7074 + * This file is part of FFmpeg.
7075 + *
7076 + * FFmpeg is free software; you can redistribute it and/or
7077 + * modify it under the terms of the GNU Lesser General Public
7078 + * License as published by the Free Software Foundation; either
7079 + * version 2.1 of the License, or (at your option) any later version.
7080 + *
7081 + * FFmpeg is distributed in the hope that it will be useful,
7082 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7083 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7084 + * Lesser General Public License for more details.
7085 + *
7086 + * You should have received a copy of the GNU Lesser General Public
7087 + * License along with FFmpeg; if not, write to the Free Software
7088 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7089 + */
7090 +
7091 +#ifndef AVCODEC_VDPAU_H
7092 +#define AVCODEC_VDPAU_H
7093 +
7094 +/**
7095 + * @file
7096 + * @ingroup lavc_codec_hwaccel_vdpau
7097 + * Public libavcodec VDPAU header.
7098 + */
7099 +
7100 +
7101 +/**
7102 + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
7103 + * @ingroup lavc_codec_hwaccel
7104 + *
7105 + * VDPAU hardware acceleration has two modules
7106 + * - VDPAU decoding
7107 + * - VDPAU presentation
7108 + *
7109 + * The VDPAU decoding module parses all headers using FFmpeg
7110 + * parsing mechanisms and uses VDPAU for the actual decoding.
7111 + *
7112 + * As per the current implementation, the actual decoding
7113 + * and rendering (API calls) are done as part of the VDPAU
7114 + * presentation (vo_vdpau.c) module.
7115 + *
7116 + * @{
7117 + */
7118 +
7119 +#include <vdpau/vdpau.h>
7120 +
7121 +#include "libavutil/avconfig.h"
7122 +#include "libavutil/attributes.h"
7123 +
7124 +#include "avcodec.h"
7125 +#include "version.h"
7126 +
7127 +struct AVCodecContext;
7128 +struct AVFrame;
7129 +
7130 +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
7131 +                               const VdpPictureInfo *, uint32_t,
7132 +                               const VdpBitstreamBuffer *);
7133 +
7134 +/**
7135 + * This structure is used to share data between the libavcodec library and
7136 + * the client video application.
7137 + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
7138 + * function and make it available as
7139 + * AVCodecContext.hwaccel_context. Members can be set by the user once
7140 + * during initialization or through each AVCodecContext.get_buffer()
7141 + * function call. In any case, they must be valid prior to calling
7142 + * decoding functions.
7143 + *
7144 + * The size of this structure is not a part of the public ABI and must not
7145 + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
7146 + * AVVDPAUContext.
7147 + */
7148 +typedef struct AVVDPAUContext {
7149 +    /**
7150 +     * VDPAU decoder handle
7151 +     *
7152 +     * Set by user.
7153 +     */
7154 +    VdpDecoder decoder;
7155 +
7156 +    /**
7157 +     * VDPAU decoder render callback
7158 +     *
7159 +     * Set by the user.
7160 +     */
7161 +    VdpDecoderRender *render;
7162 +
7163 +    AVVDPAU_Render2 render2;
7164 +} AVVDPAUContext;
7165 +
7166 +/**
7167 + * @brief allocation function for AVVDPAUContext
7168 + *
7169 + * Allows extending the struct without breaking API/ABI
7170 + */
7171 +AVVDPAUContext *av_alloc_vdpaucontext(void);
7172 +
7173 +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
7174 +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
7175 +
7176 +/**
7177 + * Associate a VDPAU device with a codec context for hardware acceleration.
7178 + * This function is meant to be called from the get_format() codec callback,
7179 + * or earlier. It can also be called after avcodec_flush_buffers() to change
7180 + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
7181 + * display preemption).
7182 + *
7183 + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
7184 + * successfully.
7185 + *
7186 + * @param avctx decoding context whose get_format() callback is invoked
7187 + * @param device VDPAU device handle to use for hardware acceleration
7188 + * @param get_proc_address VDPAU device driver
7189 + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
7190 + *
7191 + * @return 0 on success, an AVERROR code on failure.
7192 + */
7193 +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
7194 +                          VdpGetProcAddress *get_proc_address, unsigned flags);
7195 +
7196 +/**
7197 + * Gets the parameters to create an adequate VDPAU video surface for the codec
7198 + * context using VDPAU hardware decoding acceleration.
7199 + *
7200 + * @note Behavior is undefined if the context was not successfully bound to a
7201 + * VDPAU device using av_vdpau_bind_context().
7202 + *
7203 + * @param avctx the codec context being used for decoding the stream
7204 + * @param type storage space for the VDPAU video surface chroma type
7205 + *              (or NULL to ignore)
7206 + * @param width storage space for the VDPAU video surface pixel width
7207 + *              (or NULL to ignore)
7208 + * @param height storage space for the VDPAU video surface pixel height
7209 + *              (or NULL to ignore)
7210 + *
7211 + * @return 0 on success, a negative AVERROR code on failure.
7212 + */
7213 +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
7214 +                                    uint32_t *width, uint32_t *height);
7215 +
7216 +/**
7217 + * Allocate an AVVDPAUContext.
7218 + *
7219 + * @return Newly-allocated AVVDPAUContext or NULL on failure.
7220 + */
7221 +AVVDPAUContext *av_vdpau_alloc_context(void);
7222 +
7223 +#if FF_API_VDPAU_PROFILE
7224 +/**
7225 + * Get a decoder profile that should be used for initializing a VDPAU decoder.
7226 + * Should be called from the AVCodecContext.get_format() callback.
7227 + *
7228 + * @deprecated Use av_vdpau_bind_context() instead.
7229 + *
7230 + * @param avctx the codec context being used for decoding the stream
7231 + * @param profile a pointer into which the result will be written on success.
7232 + *                The contents of profile are undefined if this function returns
7233 + *                an error.
7234 + *
7235 + * @return 0 on success (non-negative), a negative AVERROR on failure.
7236 + */
7237 +attribute_deprecated
7238 +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
7239 +#endif
7240 +
7241 +/* @}*/
7242 +
7243 +#endif /* AVCODEC_VDPAU_H */
7244 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7245 new file mode 100644
7246 --- /dev/null
7247 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7248 @@ -0,0 +1,137 @@
7249 +/*
7250 + * This file is part of FFmpeg.
7251 + *
7252 + * FFmpeg is free software; you can redistribute it and/or
7253 + * modify it under the terms of the GNU Lesser General Public
7254 + * License as published by the Free Software Foundation; either
7255 + * version 2.1 of the License, or (at your option) any later version.
7256 + *
7257 + * FFmpeg is distributed in the hope that it will be useful,
7258 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7259 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7260 + * Lesser General Public License for more details.
7261 + *
7262 + * You should have received a copy of the GNU Lesser General Public
7263 + * License along with FFmpeg; if not, write to the Free Software
7264 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7265 + */
7266 +
7267 +#ifndef AVCODEC_VERSION_H
7268 +#define AVCODEC_VERSION_H
7269 +
7270 +/**
7271 + * @file
7272 + * @ingroup libavc
7273 + * Libavcodec version macros.
7274 + */
7275 +
7276 +#include "libavutil/version.h"
7277 +
7278 +#define LIBAVCODEC_VERSION_MAJOR  58
7279 +#define LIBAVCODEC_VERSION_MINOR  18
7280 +#define LIBAVCODEC_VERSION_MICRO 100
7281 +
7282 +#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
7283 +                                               LIBAVCODEC_VERSION_MINOR, \
7284 +                                               LIBAVCODEC_VERSION_MICRO)
7285 +#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
7286 +                                           LIBAVCODEC_VERSION_MINOR,    \
7287 +                                           LIBAVCODEC_VERSION_MICRO)
7288 +#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
7289 +
7290 +#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
7291 +
7292 +/**
7293 + * FF_API_* defines may be placed below to indicate public API that will be
7294 + * dropped at a future version bump. The defines themselves are not part of
7295 + * the public API and may change, break or disappear at any time.
7296 + *
7297 + * @note, when bumping the major version it is recommended to manually
7298 + * disable each FF_API_* in its own commit instead of disabling them all
7299 + * at once through the bump. This improves the git bisect-ability of the change.
7300 + */
7301 +
7302 +#ifndef FF_API_LOWRES
7303 +#define FF_API_LOWRES            (LIBAVCODEC_VERSION_MAJOR < 59)
7304 +#endif
7305 +#ifndef FF_API_DEBUG_MV
7306 +#define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 58)
7307 +#endif
7308 +#ifndef FF_API_AVCTX_TIMEBASE
7309 +#define FF_API_AVCTX_TIMEBASE    (LIBAVCODEC_VERSION_MAJOR < 59)
7310 +#endif
7311 +#ifndef FF_API_CODED_FRAME
7312 +#define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
7313 +#endif
7314 +#ifndef FF_API_SIDEDATA_ONLY_PKT
7315 +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
7316 +#endif
7317 +#ifndef FF_API_VDPAU_PROFILE
7318 +#define FF_API_VDPAU_PROFILE     (LIBAVCODEC_VERSION_MAJOR < 59)
7319 +#endif
7320 +#ifndef FF_API_CONVERGENCE_DURATION
7321 +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
7322 +#endif
7323 +#ifndef FF_API_AVPICTURE
7324 +#define FF_API_AVPICTURE         (LIBAVCODEC_VERSION_MAJOR < 59)
7325 +#endif
7326 +#ifndef FF_API_AVPACKET_OLD_API
7327 +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7328 +#endif
7329 +#ifndef FF_API_RTP_CALLBACK
7330 +#define FF_API_RTP_CALLBACK      (LIBAVCODEC_VERSION_MAJOR < 59)
7331 +#endif
7332 +#ifndef FF_API_VBV_DELAY
7333 +#define FF_API_VBV_DELAY         (LIBAVCODEC_VERSION_MAJOR < 59)
7334 +#endif
7335 +#ifndef FF_API_CODER_TYPE
7336 +#define FF_API_CODER_TYPE        (LIBAVCODEC_VERSION_MAJOR < 59)
7337 +#endif
7338 +#ifndef FF_API_STAT_BITS
7339 +#define FF_API_STAT_BITS         (LIBAVCODEC_VERSION_MAJOR < 59)
7340 +#endif
7341 +#ifndef FF_API_PRIVATE_OPT
7342 +#define FF_API_PRIVATE_OPT      (LIBAVCODEC_VERSION_MAJOR < 59)
7343 +#endif
7344 +#ifndef FF_API_ASS_TIMING
7345 +#define FF_API_ASS_TIMING       (LIBAVCODEC_VERSION_MAJOR < 59)
7346 +#endif
7347 +#ifndef FF_API_OLD_BSF
7348 +#define FF_API_OLD_BSF          (LIBAVCODEC_VERSION_MAJOR < 59)
7349 +#endif
7350 +#ifndef FF_API_COPY_CONTEXT
7351 +#define FF_API_COPY_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 59)
7352 +#endif
7353 +#ifndef FF_API_GET_CONTEXT_DEFAULTS
7354 +#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
7355 +#endif
7356 +#ifndef FF_API_NVENC_OLD_NAME
7357 +#define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
7358 +#endif
7359 +#ifndef FF_API_STRUCT_VAAPI_CONTEXT
7360 +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7361 +#endif
7362 +#ifndef FF_API_MERGE_SD_API
7363 +#define FF_API_MERGE_SD_API      (LIBAVCODEC_VERSION_MAJOR < 59)
7364 +#endif
7365 +#ifndef FF_API_TAG_STRING
7366 +#define FF_API_TAG_STRING        (LIBAVCODEC_VERSION_MAJOR < 59)
7367 +#endif
7368 +#ifndef FF_API_GETCHROMA
7369 +#define FF_API_GETCHROMA         (LIBAVCODEC_VERSION_MAJOR < 59)
7370 +#endif
7371 +#ifndef FF_API_CODEC_GET_SET
7372 +#define FF_API_CODEC_GET_SET     (LIBAVCODEC_VERSION_MAJOR < 59)
7373 +#endif
7374 +#ifndef FF_API_USER_VISIBLE_AVHWACCEL
7375 +#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
7376 +#endif
7377 +#ifndef FF_API_LOCKMGR
7378 +#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
7379 +#endif
7380 +#ifndef FF_API_NEXT
7381 +#define FF_API_NEXT              (LIBAVCODEC_VERSION_MAJOR < 59)
7382 +#endif
7383 +
7384 +
7385 +#endif /* AVCODEC_VERSION_H */
7386 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7387 new file mode 100644
7388 --- /dev/null
7389 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7390 @@ -0,0 +1,167 @@
7391 +/*
7392 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7393 + *
7394 + * This file is part of FFmpeg.
7395 + *
7396 + * FFmpeg is free software; you can redistribute it and/or
7397 + * modify it under the terms of the GNU Lesser General Public
7398 + * License as published by the Free Software Foundation; either
7399 + * version 2.1 of the License, or (at your option) any later version.
7400 + *
7401 + * FFmpeg is distributed in the hope that it will be useful,
7402 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7403 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7404 + * Lesser General Public License for more details.
7405 + *
7406 + * You should have received a copy of the GNU Lesser General Public
7407 + * License along with FFmpeg; if not, write to the Free Software
7408 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7409 + */
7410 +
7411 +/**
7412 + * @file
7413 + * Macro definitions for various function/variable attributes
7414 + */
7415 +
7416 +#ifndef AVUTIL_ATTRIBUTES_H
7417 +#define AVUTIL_ATTRIBUTES_H
7418 +
7419 +#ifdef __GNUC__
7420 +#    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
7421 +#    define AV_GCC_VERSION_AT_MOST(x,y)  (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
7422 +#else
7423 +#    define AV_GCC_VERSION_AT_LEAST(x,y) 0
7424 +#    define AV_GCC_VERSION_AT_MOST(x,y)  0
7425 +#endif
7426 +
7427 +#ifndef av_always_inline
7428 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7429 +#    define av_always_inline __attribute__((always_inline)) inline
7430 +#elif defined(_MSC_VER)
7431 +#    define av_always_inline __forceinline
7432 +#else
7433 +#    define av_always_inline inline
7434 +#endif
7435 +#endif
7436 +
7437 +#ifndef av_extern_inline
7438 +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
7439 +#    define av_extern_inline extern inline
7440 +#else
7441 +#    define av_extern_inline inline
7442 +#endif
7443 +#endif
7444 +
7445 +#if AV_GCC_VERSION_AT_LEAST(3,4)
7446 +#    define av_warn_unused_result __attribute__((warn_unused_result))
7447 +#else
7448 +#    define av_warn_unused_result
7449 +#endif
7450 +
7451 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7452 +#    define av_noinline __attribute__((noinline))
7453 +#elif defined(_MSC_VER)
7454 +#    define av_noinline __declspec(noinline)
7455 +#else
7456 +#    define av_noinline
7457 +#endif
7458 +
7459 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7460 +#    define av_pure __attribute__((pure))
7461 +#else
7462 +#    define av_pure
7463 +#endif
7464 +
7465 +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
7466 +#    define av_const __attribute__((const))
7467 +#else
7468 +#    define av_const
7469 +#endif
7470 +
7471 +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
7472 +#    define av_cold __attribute__((cold))
7473 +#else
7474 +#    define av_cold
7475 +#endif
7476 +
7477 +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
7478 +#    define av_flatten __attribute__((flatten))
7479 +#else
7480 +#    define av_flatten
7481 +#endif
7482 +
7483 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7484 +#    define attribute_deprecated __attribute__((deprecated))
7485 +#elif defined(_MSC_VER)
7486 +#    define attribute_deprecated __declspec(deprecated)
7487 +#else
7488 +#    define attribute_deprecated
7489 +#endif
7490 +
7491 +/**
7492 + * Disable warnings about deprecated features
7493 + * This is useful for sections of code kept for backward compatibility and
7494 + * scheduled for removal.
7495 + */
7496 +#ifndef AV_NOWARN_DEPRECATED
7497 +#if AV_GCC_VERSION_AT_LEAST(4,6)
7498 +#    define AV_NOWARN_DEPRECATED(code) \
7499 +        _Pragma("GCC diagnostic push") \
7500 +        _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
7501 +        code \
7502 +        _Pragma("GCC diagnostic pop")
7503 +#elif defined(_MSC_VER)
7504 +#    define AV_NOWARN_DEPRECATED(code) \
7505 +        __pragma(warning(push)) \
7506 +        __pragma(warning(disable : 4996)) \
7507 +        code; \
7508 +        __pragma(warning(pop))
7509 +#else
7510 +#    define AV_NOWARN_DEPRECATED(code) code
7511 +#endif
7512 +#endif
7513 +
7514 +#if defined(__GNUC__) || defined(__clang__)
7515 +#    define av_unused __attribute__((unused))
7516 +#else
7517 +#    define av_unused
7518 +#endif
7519 +
7520 +/**
7521 + * Mark a variable as used and prevent the compiler from optimizing it
7522 + * away.  This is useful for variables accessed only from inline
7523 + * assembler without the compiler being aware.
7524 + */
7525 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7526 +#    define av_used __attribute__((used))
7527 +#else
7528 +#    define av_used
7529 +#endif
7530 +
7531 +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
7532 +#   define av_alias __attribute__((may_alias))
7533 +#else
7534 +#   define av_alias
7535 +#endif
7536 +
7537 +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
7538 +#    define av_uninit(x) x=x
7539 +#else
7540 +#    define av_uninit(x) x
7541 +#endif
7542 +
7543 +#if defined(__GNUC__) || defined(__clang__)
7544 +#    define av_builtin_constant_p __builtin_constant_p
7545 +#    define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
7546 +#else
7547 +#    define av_builtin_constant_p(x) 0
7548 +#    define av_printf_format(fmtpos, attrpos)
7549 +#endif
7550 +
7551 +#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
7552 +#    define av_noreturn __attribute__((noreturn))
7553 +#else
7554 +#    define av_noreturn
7555 +#endif
7556 +
7557 +#endif /* AVUTIL_ATTRIBUTES_H */
7558 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7559 new file mode 100644
7560 --- /dev/null
7561 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7562 @@ -0,0 +1,6 @@
7563 +/* Generated by ffmpeg configure */
7564 +#ifndef AVUTIL_AVCONFIG_H
7565 +#define AVUTIL_AVCONFIG_H
7566 +#define AV_HAVE_BIGENDIAN 0
7567 +#define AV_HAVE_FAST_UNALIGNED 1
7568 +#endif /* AVUTIL_AVCONFIG_H */
7569 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7570 new file mode 100644
7571 --- /dev/null
7572 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7573 @@ -0,0 +1,365 @@
7574 +/*
7575 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7576 + *
7577 + * This file is part of FFmpeg.
7578 + *
7579 + * FFmpeg is free software; you can redistribute it and/or
7580 + * modify it under the terms of the GNU Lesser General Public
7581 + * License as published by the Free Software Foundation; either
7582 + * version 2.1 of the License, or (at your option) any later version.
7583 + *
7584 + * FFmpeg is distributed in the hope that it will be useful,
7585 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7586 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7587 + * Lesser General Public License for more details.
7588 + *
7589 + * You should have received a copy of the GNU Lesser General Public
7590 + * License along with FFmpeg; if not, write to the Free Software
7591 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7592 + */
7593 +
7594 +#ifndef AVUTIL_AVUTIL_H
7595 +#define AVUTIL_AVUTIL_H
7596 +
7597 +/**
7598 + * @file
7599 + * @ingroup lavu
7600 + * Convenience header that includes @ref lavu "libavutil"'s core.
7601 + */
7602 +
7603 +/**
7604 + * @mainpage
7605 + *
7606 + * @section ffmpeg_intro Introduction
7607 + *
7608 + * This document describes the usage of the different libraries
7609 + * provided by FFmpeg.
7610 + *
7611 + * @li @ref libavc "libavcodec" encoding/decoding library
7612 + * @li @ref lavfi "libavfilter" graph-based frame editing library
7613 + * @li @ref libavf "libavformat" I/O and muxing/demuxing library
7614 + * @li @ref lavd "libavdevice" special devices muxing/demuxing library
7615 + * @li @ref lavu "libavutil" common utility library
7616 + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
7617 + * @li @ref lpp  "libpostproc" post processing library
7618 + * @li @ref libsws "libswscale" color conversion and scaling library
7619 + *
7620 + * @section ffmpeg_versioning Versioning and compatibility
7621 + *
7622 + * Each of the FFmpeg libraries contains a version.h header, which defines a
7623 + * major, minor and micro version number with the
7624 + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
7625 + * number is incremented with backward incompatible changes - e.g. removing
7626 + * parts of the public API, reordering public struct members, etc. The minor
7627 + * version number is incremented for backward compatible API changes or major
7628 + * new features - e.g. adding a new public function or a new decoder. The micro
7629 + * version number is incremented for smaller changes that a calling program
7630 + * might still want to check for - e.g. changing behavior in a previously
7631 + * unspecified situation.
7632 + *
7633 + * FFmpeg guarantees backward API and ABI compatibility for each library as long
7634 + * as its major version number is unchanged. This means that no public symbols
7635 + * will be removed or renamed. Types and names of the public struct members and
7636 + * values of public macros and enums will remain the same (unless they were
7637 + * explicitly declared as not part of the public API). Documented behavior will
7638 + * not change.
7639 + *
7640 + * In other words, any correct program that works with a given FFmpeg snapshot
7641 + * should work just as well without any changes with any later snapshot with the
7642 + * same major versions. This applies to both rebuilding the program against new
7643 + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
7644 + * links against.
7645 + *
7646 + * However, new public symbols may be added and new members may be appended to
7647 + * public structs whose size is not part of public ABI (most public structs in
7648 + * FFmpeg). New macros and enum values may be added. Behavior in undocumented
7649 + * situations may change slightly (and be documented). All those are accompanied
7650 + * by an entry in doc/APIchanges and incrementing either the minor or micro
7651 + * version number.
7652 + */
7653 +
7654 +/**
7655 + * @defgroup lavu libavutil
7656 + * Common code shared across all FFmpeg libraries.
7657 + *
7658 + * @note
7659 + * libavutil is designed to be modular. In most cases, in order to use the
7660 + * functions provided by one component of libavutil you must explicitly include
7661 + * the specific header containing that feature. If you are only using
7662 + * media-related components, you could simply include libavutil/avutil.h, which
7663 + * brings in most of the "core" components.
7664 + *
7665 + * @{
7666 + *
7667 + * @defgroup lavu_crypto Crypto and Hashing
7668 + *
7669 + * @{
7670 + * @}
7671 + *
7672 + * @defgroup lavu_math Mathematics
7673 + * @{
7674 + *
7675 + * @}
7676 + *
7677 + * @defgroup lavu_string String Manipulation
7678 + *
7679 + * @{
7680 + *
7681 + * @}
7682 + *
7683 + * @defgroup lavu_mem Memory Management
7684 + *
7685 + * @{
7686 + *
7687 + * @}
7688 + *
7689 + * @defgroup lavu_data Data Structures
7690 + * @{
7691 + *
7692 + * @}
7693 + *
7694 + * @defgroup lavu_video Video related
7695 + *
7696 + * @{
7697 + *
7698 + * @}
7699 + *
7700 + * @defgroup lavu_audio Audio related
7701 + *
7702 + * @{
7703 + *
7704 + * @}
7705 + *
7706 + * @defgroup lavu_error Error Codes
7707 + *
7708 + * @{
7709 + *
7710 + * @}
7711 + *
7712 + * @defgroup lavu_log Logging Facility
7713 + *
7714 + * @{
7715 + *
7716 + * @}
7717 + *
7718 + * @defgroup lavu_misc Other
7719 + *
7720 + * @{
7721 + *
7722 + * @defgroup preproc_misc Preprocessor String Macros
7723 + *
7724 + * @{
7725 + *
7726 + * @}
7727 + *
7728 + * @defgroup version_utils Library Version Macros
7729 + *
7730 + * @{
7731 + *
7732 + * @}
7733 + */
7734 +
7735 +
7736 +/**
7737 + * @addtogroup lavu_ver
7738 + * @{
7739 + */
7740 +
7741 +/**
7742 + * Return the LIBAVUTIL_VERSION_INT constant.
7743 + */
7744 +unsigned avutil_version(void);
7745 +
7746 +/**
7747 + * Return an informative version string. This usually is the actual release
7748 + * version number or a git commit description. This string has no fixed format
7749 + * and can change any time. It should never be parsed by code.
7750 + */
7751 +const char *av_version_info(void);
7752 +
7753 +/**
7754 + * Return the libavutil build-time configuration.
7755 + */
7756 +const char *avutil_configuration(void);
7757 +
7758 +/**
7759 + * Return the libavutil license.
7760 + */
7761 +const char *avutil_license(void);
7762 +
7763 +/**
7764 + * @}
7765 + */
7766 +
7767 +/**
7768 + * @addtogroup lavu_media Media Type
7769 + * @brief Media Type
7770 + */
7771 +
7772 +enum AVMediaType {
7773 +    AVMEDIA_TYPE_UNKNOWN = -1,  ///< Usually treated as AVMEDIA_TYPE_DATA
7774 +    AVMEDIA_TYPE_VIDEO,
7775 +    AVMEDIA_TYPE_AUDIO,
7776 +    AVMEDIA_TYPE_DATA,          ///< Opaque data information usually continuous
7777 +    AVMEDIA_TYPE_SUBTITLE,
7778 +    AVMEDIA_TYPE_ATTACHMENT,    ///< Opaque data information usually sparse
7779 +    AVMEDIA_TYPE_NB
7780 +};
7781 +
7782 +/**
7783 + * Return a string describing the media_type enum, NULL if media_type
7784 + * is unknown.
7785 + */
7786 +const char *av_get_media_type_string(enum AVMediaType media_type);
7787 +
7788 +/**
7789 + * @defgroup lavu_const Constants
7790 + * @{
7791 + *
7792 + * @defgroup lavu_enc Encoding specific
7793 + *
7794 + * @note those definition should move to avcodec
7795 + * @{
7796 + */
7797 +
7798 +#define FF_LAMBDA_SHIFT 7
7799 +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
7800 +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
7801 +#define FF_LAMBDA_MAX (256*128-1)
7802 +
7803 +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
7804 +
7805 +/**
7806 + * @}
7807 + * @defgroup lavu_time Timestamp specific
7808 + *
7809 + * FFmpeg internal timebase and timestamp definitions
7810 + *
7811 + * @{
7812 + */
7813 +
7814 +/**
7815 + * @brief Undefined timestamp value
7816 + *
7817 + * Usually reported by demuxer that work on containers that do not provide
7818 + * either pts or dts.
7819 + */
7820 +
7821 +#define AV_NOPTS_VALUE          ((int64_t)UINT64_C(0x8000000000000000))
7822 +
7823 +/**
7824 + * Internal time base represented as integer
7825 + */
7826 +
7827 +#define AV_TIME_BASE            1000000
7828 +
7829 +/**
7830 + * Internal time base represented as fractional value
7831 + */
7832 +
7833 +#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
7834 +
7835 +/**
7836 + * @}
7837 + * @}
7838 + * @defgroup lavu_picture Image related
7839 + *
7840 + * AVPicture types, pixel formats and basic image planes manipulation.
7841 + *
7842 + * @{
7843 + */
7844 +
7845 +enum AVPictureType {
7846 +    AV_PICTURE_TYPE_NONE = 0, ///< Undefined
7847 +    AV_PICTURE_TYPE_I,     ///< Intra
7848 +    AV_PICTURE_TYPE_P,     ///< Predicted
7849 +    AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
7850 +    AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG-4
7851 +    AV_PICTURE_TYPE_SI,    ///< Switching Intra
7852 +    AV_PICTURE_TYPE_SP,    ///< Switching Predicted
7853 +    AV_PICTURE_TYPE_BI,    ///< BI type
7854 +};
7855 +
7856 +/**
7857 + * Return a single letter to describe the given picture type
7858 + * pict_type.
7859 + *
7860 + * @param[in] pict_type the picture type @return a single character
7861 + * representing the picture type, '?' if pict_type is unknown
7862 + */
7863 +char av_get_picture_type_char(enum AVPictureType pict_type);
7864 +
7865 +/**
7866 + * @}
7867 + */
7868 +
7869 +#include "common.h"
7870 +#include "error.h"
7871 +#include "rational.h"
7872 +#include "version.h"
7873 +#include "macros.h"
7874 +#include "mathematics.h"
7875 +#include "log.h"
7876 +#include "pixfmt.h"
7877 +
7878 +/**
7879 + * Return x default pointer in case p is NULL.
7880 + */
7881 +static inline void *av_x_if_null(const void *p, const void *x)
7882 +{
7883 +    return (void *)(intptr_t)(p ? p : x);
7884 +}
7885 +
7886 +/**
7887 + * Compute the length of an integer list.
7888 + *
7889 + * @param elsize  size in bytes of each list element (only 1, 2, 4 or 8)
7890 + * @param term    list terminator (usually 0 or -1)
7891 + * @param list    pointer to the list
7892 + * @return  length of the list, in elements, not counting the terminator
7893 + */
7894 +unsigned av_int_list_length_for_size(unsigned elsize,
7895 +                                     const void *list, uint64_t term) av_pure;
7896 +
7897 +/**
7898 + * Compute the length of an integer list.
7899 + *
7900 + * @param term  list terminator (usually 0 or -1)
7901 + * @param list  pointer to the list
7902 + * @return  length of the list, in elements, not counting the terminator
7903 + */
7904 +#define av_int_list_length(list, term) \
7905 +    av_int_list_length_for_size(sizeof(*(list)), list, term)
7906 +
7907 +/**
7908 + * Open a file using a UTF-8 filename.
7909 + * The API of this function matches POSIX fopen(), errors are returned through
7910 + * errno.
7911 + */
7912 +FILE *av_fopen_utf8(const char *path, const char *mode);
7913 +
7914 +/**
7915 + * Return the fractional representation of the internal time base.
7916 + */
7917 +AVRational av_get_time_base_q(void);
7918 +
7919 +#define AV_FOURCC_MAX_STRING_SIZE 32
7920 +
7921 +#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
7922 +
7923 +/**
7924 + * Fill the provided buffer with a string containing a FourCC (four-character
7925 + * code) representation.
7926 + *
7927 + * @param buf    a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
7928 + * @param fourcc the fourcc to represent
7929 + * @return the buffer in input
7930 + */
7931 +char *av_fourcc_make_string(char *buf, uint32_t fourcc);
7932 +
7933 +/**
7934 + * @}
7935 + * @}
7936 + */
7937 +
7938 +#endif /* AVUTIL_AVUTIL_H */
7939 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7940 new file mode 100644
7941 --- /dev/null
7942 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7943 @@ -0,0 +1,291 @@
7944 +/*
7945 + * This file is part of FFmpeg.
7946 + *
7947 + * FFmpeg is free software; you can redistribute it and/or
7948 + * modify it under the terms of the GNU Lesser General Public
7949 + * License as published by the Free Software Foundation; either
7950 + * version 2.1 of the License, or (at your option) any later version.
7951 + *
7952 + * FFmpeg is distributed in the hope that it will be useful,
7953 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7954 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7955 + * Lesser General Public License for more details.
7956 + *
7957 + * You should have received a copy of the GNU Lesser General Public
7958 + * License along with FFmpeg; if not, write to the Free Software
7959 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7960 + */
7961 +
7962 +/**
7963 + * @file
7964 + * @ingroup lavu_buffer
7965 + * refcounted data buffer API
7966 + */
7967 +
7968 +#ifndef AVUTIL_BUFFER_H
7969 +#define AVUTIL_BUFFER_H
7970 +
7971 +#include <stdint.h>
7972 +
7973 +/**
7974 + * @defgroup lavu_buffer AVBuffer
7975 + * @ingroup lavu_data
7976 + *
7977 + * @{
7978 + * AVBuffer is an API for reference-counted data buffers.
7979 + *
7980 + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
7981 + * represents the data buffer itself; it is opaque and not meant to be accessed
7982 + * by the caller directly, but only through AVBufferRef. However, the caller may
7983 + * e.g. compare two AVBuffer pointers to check whether two different references
7984 + * are describing the same data buffer. AVBufferRef represents a single
7985 + * reference to an AVBuffer and it is the object that may be manipulated by the
7986 + * caller directly.
7987 + *
7988 + * There are two functions provided for creating a new AVBuffer with a single
7989 + * reference -- av_buffer_alloc() to just allocate a new buffer, and
7990 + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
7991 + * reference, additional references may be created with av_buffer_ref().
7992 + * Use av_buffer_unref() to free a reference (this will automatically free the
7993 + * data once all the references are freed).
7994 + *
7995 + * The convention throughout this API and the rest of FFmpeg is such that the
7996 + * buffer is considered writable if there exists only one reference to it (and
7997 + * it has not been marked as read-only). The av_buffer_is_writable() function is
7998 + * provided to check whether this is true and av_buffer_make_writable() will
7999 + * automatically create a new writable buffer when necessary.
8000 + * Of course nothing prevents the calling code from violating this convention,
8001 + * however that is safe only when all the existing references are under its
8002 + * control.
8003 + *
8004 + * @note Referencing and unreferencing the buffers is thread-safe and thus
8005 + * may be done from multiple threads simultaneously without any need for
8006 + * additional locking.
8007 + *
8008 + * @note Two different references to the same buffer can point to different
8009 + * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
8010 + */
8011 +
8012 +/**
8013 + * A reference counted buffer type. It is opaque and is meant to be used through
8014 + * references (AVBufferRef).
8015 + */
8016 +typedef struct AVBuffer AVBuffer;
8017 +
8018 +/**
8019 + * A reference to a data buffer.
8020 + *
8021 + * The size of this struct is not a part of the public ABI and it is not meant
8022 + * to be allocated directly.
8023 + */
8024 +typedef struct AVBufferRef {
8025 +    AVBuffer *buffer;
8026 +
8027 +    /**
8028 +     * The data buffer. It is considered writable if and only if
8029 +     * this is the only reference to the buffer, in which case
8030 +     * av_buffer_is_writable() returns 1.
8031 +     */
8032 +    uint8_t *data;
8033 +    /**
8034 +     * Size of data in bytes.
8035 +     */
8036 +    int      size;
8037 +} AVBufferRef;
8038 +
8039 +/**
8040 + * Allocate an AVBuffer of the given size using av_malloc().
8041 + *
8042 + * @return an AVBufferRef of given size or NULL when out of memory
8043 + */
8044 +AVBufferRef *av_buffer_alloc(int size);
8045 +
8046 +/**
8047 + * Same as av_buffer_alloc(), except the returned buffer will be initialized
8048 + * to zero.
8049 + */
8050 +AVBufferRef *av_buffer_allocz(int size);
8051 +
8052 +/**
8053 + * Always treat the buffer as read-only, even when it has only one
8054 + * reference.
8055 + */
8056 +#define AV_BUFFER_FLAG_READONLY (1 << 0)
8057 +
8058 +/**
8059 + * Create an AVBuffer from an existing array.
8060 + *
8061 + * If this function is successful, data is owned by the AVBuffer. The caller may
8062 + * only access data through the returned AVBufferRef and references derived from
8063 + * it.
8064 + * If this function fails, data is left untouched.
8065 + * @param data   data array
8066 + * @param size   size of data in bytes
8067 + * @param free   a callback for freeing this buffer's data
8068 + * @param opaque parameter to be got for processing or passed to free
8069 + * @param flags  a combination of AV_BUFFER_FLAG_*
8070 + *
8071 + * @return an AVBufferRef referring to data on success, NULL on failure.
8072 + */
8073 +AVBufferRef *av_buffer_create(uint8_t *data, int size,
8074 +                              void (*free)(void *opaque, uint8_t *data),
8075 +                              void *opaque, int flags);
8076 +
8077 +/**
8078 + * Default free callback, which calls av_free() on the buffer data.
8079 + * This function is meant to be passed to av_buffer_create(), not called
8080 + * directly.
8081 + */
8082 +void av_buffer_default_free(void *opaque, uint8_t *data);
8083 +
8084 +/**
8085 + * Create a new reference to an AVBuffer.
8086 + *
8087 + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
8088 + * failure.
8089 + */
8090 +AVBufferRef *av_buffer_ref(AVBufferRef *buf);
8091 +
8092 +/**
8093 + * Free a given reference and automatically free the buffer if there are no more
8094 + * references to it.
8095 + *
8096 + * @param buf the reference to be freed. The pointer is set to NULL on return.
8097 + */
8098 +void av_buffer_unref(AVBufferRef **buf);
8099 +
8100 +/**
8101 + * @return 1 if the caller may write to the data referred to by buf (which is
8102 + * true if and only if buf is the only reference to the underlying AVBuffer).
8103 + * Return 0 otherwise.
8104 + * A positive answer is valid until av_buffer_ref() is called on buf.
8105 + */
8106 +int av_buffer_is_writable(const AVBufferRef *buf);
8107 +
8108 +/**
8109 + * @return the opaque parameter set by av_buffer_create.
8110 + */
8111 +void *av_buffer_get_opaque(const AVBufferRef *buf);
8112 +
8113 +int av_buffer_get_ref_count(const AVBufferRef *buf);
8114 +
8115 +/**
8116 + * Create a writable reference from a given buffer reference, avoiding data copy
8117 + * if possible.
8118 + *
8119 + * @param buf buffer reference to make writable. On success, buf is either left
8120 + *            untouched, or it is unreferenced and a new writable AVBufferRef is
8121 + *            written in its place. On failure, buf is left untouched.
8122 + * @return 0 on success, a negative AVERROR on failure.
8123 + */
8124 +int av_buffer_make_writable(AVBufferRef **buf);
8125 +
8126 +/**
8127 + * Reallocate a given buffer.
8128 + *
8129 + * @param buf  a buffer reference to reallocate. On success, buf will be
8130 + *             unreferenced and a new reference with the required size will be
8131 + *             written in its place. On failure buf will be left untouched. *buf
8132 + *             may be NULL, then a new buffer is allocated.
8133 + * @param size required new buffer size.
8134 + * @return 0 on success, a negative AVERROR on failure.
8135 + *
8136 + * @note the buffer is actually reallocated with av_realloc() only if it was
8137 + * initially allocated through av_buffer_realloc(NULL) and there is only one
8138 + * reference to it (i.e. the one passed to this function). In all other cases
8139 + * a new buffer is allocated and the data is copied.
8140 + */
8141 +int av_buffer_realloc(AVBufferRef **buf, int size);
8142 +
8143 +/**
8144 + * @}
8145 + */
8146 +
8147 +/**
8148 + * @defgroup lavu_bufferpool AVBufferPool
8149 + * @ingroup lavu_data
8150 + *
8151 + * @{
8152 + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
8153 + *
8154 + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
8155 + * meant to solve this in cases when the caller needs a set of buffers of the
8156 + * same size (the most obvious use case being buffers for raw video or audio
8157 + * frames).
8158 + *
8159 + * At the beginning, the user must call av_buffer_pool_init() to create the
8160 + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
8161 + * get a reference to a new buffer, similar to av_buffer_alloc(). This new
8162 + * reference works in all aspects the same way as the one created by
8163 + * av_buffer_alloc(). However, when the last reference to this buffer is
8164 + * unreferenced, it is returned to the pool instead of being freed and will be
8165 + * reused for subsequent av_buffer_pool_get() calls.
8166 + *
8167 + * When the caller is done with the pool and no longer needs to allocate any new
8168 + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
8169 + * Once all the buffers are released, it will automatically be freed.
8170 + *
8171 + * Allocating and releasing buffers with this API is thread-safe as long as
8172 + * either the default alloc callback is used, or the user-supplied one is
8173 + * thread-safe.
8174 + */
8175 +
8176 +/**
8177 + * The buffer pool. This structure is opaque and not meant to be accessed
8178 + * directly. It is allocated with av_buffer_pool_init() and freed with
8179 + * av_buffer_pool_uninit().
8180 + */
8181 +typedef struct AVBufferPool AVBufferPool;
8182 +
8183 +/**
8184 + * Allocate and initialize a buffer pool.
8185 + *
8186 + * @param size size of each buffer in this pool
8187 + * @param alloc a function that will be used to allocate new buffers when the
8188 + * pool is empty. May be NULL, then the default allocator will be used
8189 + * (av_buffer_alloc()).
8190 + * @return newly created buffer pool on success, NULL on error.
8191 + */
8192 +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
8193 +
8194 +/**
8195 + * Allocate and initialize a buffer pool with a more complex allocator.
8196 + *
8197 + * @param size size of each buffer in this pool
8198 + * @param opaque arbitrary user data used by the allocator
8199 + * @param alloc a function that will be used to allocate new buffers when the
8200 + *              pool is empty.
8201 + * @param pool_free a function that will be called immediately before the pool
8202 + *                  is freed. I.e. after av_buffer_pool_uninit() is called
8203 + *                  by the caller and all the frames are returned to the pool
8204 + *                  and freed. It is intended to uninitialize the user opaque
8205 + *                  data.
8206 + * @return newly created buffer pool on success, NULL on error.
8207 + */
8208 +AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
8209 +                                   AVBufferRef* (*alloc)(void *opaque, int size),
8210 +                                   void (*pool_free)(void *opaque));
8211 +
8212 +/**
8213 + * Mark the pool as being available for freeing. It will actually be freed only
8214 + * once all the allocated buffers associated with the pool are released. Thus it
8215 + * is safe to call this function while some of the allocated buffers are still
8216 + * in use.
8217 + *
8218 + * @param pool pointer to the pool to be freed. It will be set to NULL.
8219 + */
8220 +void av_buffer_pool_uninit(AVBufferPool **pool);
8221 +
8222 +/**
8223 + * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
8224 + * This function may be called simultaneously from multiple threads.
8225 + *
8226 + * @return a reference to the new buffer on success, NULL on error.
8227 + */
8228 +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
8229 +
8230 +/**
8231 + * @}
8232 + */
8233 +
8234 +#endif /* AVUTIL_BUFFER_H */
8235 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8236 new file mode 100644
8237 --- /dev/null
8238 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8239 @@ -0,0 +1,232 @@
8240 +/*
8241 + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8242 + * Copyright (c) 2008 Peter Ross
8243 + *
8244 + * This file is part of FFmpeg.
8245 + *
8246 + * FFmpeg is free software; you can redistribute it and/or
8247 + * modify it under the terms of the GNU Lesser General Public
8248 + * License as published by the Free Software Foundation; either
8249 + * version 2.1 of the License, or (at your option) any later version.
8250 + *
8251 + * FFmpeg is distributed in the hope that it will be useful,
8252 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8253 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8254 + * Lesser General Public License for more details.
8255 + *
8256 + * You should have received a copy of the GNU Lesser General Public
8257 + * License along with FFmpeg; if not, write to the Free Software
8258 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8259 + */
8260 +
8261 +#ifndef AVUTIL_CHANNEL_LAYOUT_H
8262 +#define AVUTIL_CHANNEL_LAYOUT_H
8263 +
8264 +#include <stdint.h>
8265 +
8266 +/**
8267 + * @file
8268 + * audio channel layout utility functions
8269 + */
8270 +
8271 +/**
8272 + * @addtogroup lavu_audio
8273 + * @{
8274 + */
8275 +
8276 +/**
8277 + * @defgroup channel_masks Audio channel masks
8278 + *
8279 + * A channel layout is a 64-bits integer with a bit set for every channel.
8280 + * The number of bits set must be equal to the number of channels.
8281 + * The value 0 means that the channel layout is not known.
8282 + * @note this data structure is not powerful enough to handle channels
8283 + * combinations that have the same channel multiple times, such as
8284 + * dual-mono.
8285 + *
8286 + * @{
8287 + */
8288 +#define AV_CH_FRONT_LEFT             0x00000001
8289 +#define AV_CH_FRONT_RIGHT            0x00000002
8290 +#define AV_CH_FRONT_CENTER           0x00000004
8291 +#define AV_CH_LOW_FREQUENCY          0x00000008
8292 +#define AV_CH_BACK_LEFT              0x00000010
8293 +#define AV_CH_BACK_RIGHT             0x00000020
8294 +#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
8295 +#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
8296 +#define AV_CH_BACK_CENTER            0x00000100
8297 +#define AV_CH_SIDE_LEFT              0x00000200
8298 +#define AV_CH_SIDE_RIGHT             0x00000400
8299 +#define AV_CH_TOP_CENTER             0x00000800
8300 +#define AV_CH_TOP_FRONT_LEFT         0x00001000
8301 +#define AV_CH_TOP_FRONT_CENTER       0x00002000
8302 +#define AV_CH_TOP_FRONT_RIGHT        0x00004000
8303 +#define AV_CH_TOP_BACK_LEFT          0x00008000
8304 +#define AV_CH_TOP_BACK_CENTER        0x00010000
8305 +#define AV_CH_TOP_BACK_RIGHT         0x00020000
8306 +#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
8307 +#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
8308 +#define AV_CH_WIDE_LEFT              0x0000000080000000ULL
8309 +#define AV_CH_WIDE_RIGHT             0x0000000100000000ULL
8310 +#define AV_CH_SURROUND_DIRECT_LEFT   0x0000000200000000ULL
8311 +#define AV_CH_SURROUND_DIRECT_RIGHT  0x0000000400000000ULL
8312 +#define AV_CH_LOW_FREQUENCY_2        0x0000000800000000ULL
8313 +
8314 +/** Channel mask value used for AVCodecContext.request_channel_layout
8315 +    to indicate that the user requests the channel order of the decoder output
8316 +    to be the native codec channel order. */
8317 +#define AV_CH_LAYOUT_NATIVE          0x8000000000000000ULL
8318 +
8319 +/**
8320 + * @}
8321 + * @defgroup channel_mask_c Audio channel layouts
8322 + * @{
8323 + * */
8324 +#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
8325 +#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
8326 +#define AV_CH_LAYOUT_2POINT1           (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
8327 +#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
8328 +#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
8329 +#define AV_CH_LAYOUT_3POINT1           (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
8330 +#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
8331 +#define AV_CH_LAYOUT_4POINT1           (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
8332 +#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8333 +#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8334 +#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8335 +#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
8336 +#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8337 +#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
8338 +#define AV_CH_LAYOUT_6POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
8339 +#define AV_CH_LAYOUT_6POINT0_FRONT     (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8340 +#define AV_CH_LAYOUT_HEXAGONAL         (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
8341 +#define AV_CH_LAYOUT_6POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
8342 +#define AV_CH_LAYOUT_6POINT1_BACK      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
8343 +#define AV_CH_LAYOUT_6POINT1_FRONT     (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
8344 +#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8345 +#define AV_CH_LAYOUT_7POINT0_FRONT     (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8346 +#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8347 +#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8348 +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8349 +#define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
8350 +#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)
8351 +#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
8352 +
8353 +enum AVMatrixEncoding {
8354 +    AV_MATRIX_ENCODING_NONE,
8355 +    AV_MATRIX_ENCODING_DOLBY,
8356 +    AV_MATRIX_ENCODING_DPLII,
8357 +    AV_MATRIX_ENCODING_DPLIIX,
8358 +    AV_MATRIX_ENCODING_DPLIIZ,
8359 +    AV_MATRIX_ENCODING_DOLBYEX,
8360 +    AV_MATRIX_ENCODING_DOLBYHEADPHONE,
8361 +    AV_MATRIX_ENCODING_NB
8362 +};
8363 +
8364 +/**
8365 + * Return a channel layout id that matches name, or 0 if no match is found.
8366 + *
8367 + * name can be one or several of the following notations,
8368 + * separated by '+' or '|':
8369 + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
8370 + *   5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
8371 + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
8372 + *   SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
8373 + * - a number of channels, in decimal, followed by 'c', yielding
8374 + *   the default channel layout for that number of channels (@see
8375 + *   av_get_default_channel_layout);
8376 + * - a channel layout mask, in hexadecimal starting with "0x" (see the
8377 + *   AV_CH_* macros).
8378 + *
8379 + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
8380 + */
8381 +uint64_t av_get_channel_layout(const char *name);
8382 +
8383 +/**
8384 + * Return a channel layout and the number of channels based on the specified name.
8385 + *
8386 + * This function is similar to (@see av_get_channel_layout), but can also parse
8387 + * unknown channel layout specifications.
8388 + *
8389 + * @param[in]  name             channel layout specification string
8390 + * @param[out] channel_layout   parsed channel layout (0 if unknown)
8391 + * @param[out] nb_channels      number of channels
8392 + *
8393 + * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
8394 + */
8395 +int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
8396 +
8397 +/**
8398 + * Return a description of a channel layout.
8399 + * If nb_channels is <= 0, it is guessed from the channel_layout.
8400 + *
8401 + * @param buf put here the string containing the channel layout
8402 + * @param buf_size size in bytes of the buffer
8403 + */
8404 +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
8405 +
8406 +struct AVBPrint;
8407 +/**
8408 + * Append a description of a channel layout to a bprint buffer.
8409 + */
8410 +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
8411 +
8412 +/**
8413 + * Return the number of channels in the channel layout.
8414 + */
8415 +int av_get_channel_layout_nb_channels(uint64_t channel_layout);
8416 +
8417 +/**
8418 + * Return default channel layout for a given number of channels.
8419 + */
8420 +int64_t av_get_default_channel_layout(int nb_channels);
8421 +
8422 +/**
8423 + * Get the index of a channel in channel_layout.
8424 + *
8425 + * @param channel a channel layout describing exactly one channel which must be
8426 + *                present in channel_layout.
8427 + *
8428 + * @return index of channel in channel_layout on success, a negative AVERROR
8429 + *         on error.
8430 + */
8431 +int av_get_channel_layout_channel_index(uint64_t channel_layout,
8432 +                                        uint64_t channel);
8433 +
8434 +/**
8435 + * Get the channel with the given index in channel_layout.
8436 + */
8437 +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
8438 +
8439 +/**
8440 + * Get the name of a given channel.
8441 + *
8442 + * @return channel name on success, NULL on error.
8443 + */
8444 +const char *av_get_channel_name(uint64_t channel);
8445 +
8446 +/**
8447 + * Get the description of a given channel.
8448 + *
8449 + * @param channel  a channel layout with a single channel
8450 + * @return  channel description on success, NULL on error
8451 + */
8452 +const char *av_get_channel_description(uint64_t channel);
8453 +
8454 +/**
8455 + * Get the value and name of a standard channel layout.
8456 + *
8457 + * @param[in]  index   index in an internal list, starting at 0
8458 + * @param[out] layout  channel layout mask
8459 + * @param[out] name    name of the layout
8460 + * @return  0  if the layout exists,
8461 + *          <0 if index is beyond the limits
8462 + */
8463 +int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
8464 +                                   const char **name);
8465 +
8466 +/**
8467 + * @}
8468 + * @}
8469 + */
8470 +
8471 +#endif /* AVUTIL_CHANNEL_LAYOUT_H */
8472 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8473 new file mode 100644
8474 --- /dev/null
8475 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8476 @@ -0,0 +1,560 @@
8477 +/*
8478 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8479 + *
8480 + * This file is part of FFmpeg.
8481 + *
8482 + * FFmpeg is free software; you can redistribute it and/or
8483 + * modify it under the terms of the GNU Lesser General Public
8484 + * License as published by the Free Software Foundation; either
8485 + * version 2.1 of the License, or (at your option) any later version.
8486 + *
8487 + * FFmpeg is distributed in the hope that it will be useful,
8488 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8489 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8490 + * Lesser General Public License for more details.
8491 + *
8492 + * You should have received a copy of the GNU Lesser General Public
8493 + * License along with FFmpeg; if not, write to the Free Software
8494 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8495 + */
8496 +
8497 +/**
8498 + * @file
8499 + * common internal and external API header
8500 + */
8501 +
8502 +#ifndef AVUTIL_COMMON_H
8503 +#define AVUTIL_COMMON_H
8504 +
8505 +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
8506 +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
8507 +#endif
8508 +
8509 +#include <errno.h>
8510 +#include <inttypes.h>
8511 +#include <limits.h>
8512 +#include <math.h>
8513 +#include <stdint.h>
8514 +#include <stdio.h>
8515 +#include <stdlib.h>
8516 +#include <string.h>
8517 +
8518 +#include "attributes.h"
8519 +#include "macros.h"
8520 +#include "version.h"
8521 +#include "libavutil/avconfig.h"
8522 +
8523 +#if AV_HAVE_BIGENDIAN
8524 +#   define AV_NE(be, le) (be)
8525 +#else
8526 +#   define AV_NE(be, le) (le)
8527 +#endif
8528 +
8529 +//rounded division & shift
8530 +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
8531 +/* assume b>0 */
8532 +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
8533 +/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
8534 +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
8535 +                                                       : ((a) + (1<<(b)) - 1) >> (b))
8536 +/* Backwards compat. */
8537 +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
8538 +
8539 +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
8540 +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
8541 +
8542 +/**
8543 + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
8544 + * are not representable as absolute values of their type. This is the same
8545 + * as with *abs()
8546 + * @see FFNABS()
8547 + */
8548 +#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
8549 +#define FFSIGN(a) ((a) > 0 ? 1 : -1)
8550 +
8551 +/**
8552 + * Negative Absolute value.
8553 + * this works for all integers of all types.
8554 + * As with many macros, this evaluates its argument twice, it thus must not have
8555 + * a sideeffect, that is FFNABS(x++) has undefined behavior.
8556 + */
8557 +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
8558 +
8559 +/**
8560 + * Comparator.
8561 + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
8562 + * if x == y. This is useful for instance in a qsort comparator callback.
8563 + * Furthermore, compilers are able to optimize this to branchless code, and
8564 + * there is no risk of overflow with signed types.
8565 + * As with many macros, this evaluates its argument multiple times, it thus
8566 + * must not have a side-effect.
8567 + */
8568 +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
8569 +
8570 +#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
8571 +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
8572 +#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
8573 +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
8574 +
8575 +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
8576 +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
8577 +
8578 +/* misc math functions */
8579 +
8580 +#ifdef HAVE_AV_CONFIG_H
8581 +#   include "config.h"
8582 +#   include "intmath.h"
8583 +#endif
8584 +
8585 +/* Pull in unguarded fallback defines at the end of this file. */
8586 +#include "common.h"
8587 +
8588 +#ifndef av_log2
8589 +av_const int av_log2(unsigned v);
8590 +#endif
8591 +
8592 +#ifndef av_log2_16bit
8593 +av_const int av_log2_16bit(unsigned v);
8594 +#endif
8595 +
8596 +/**
8597 + * Clip a signed integer value into the amin-amax range.
8598 + * @param a value to clip
8599 + * @param amin minimum value of the clip range
8600 + * @param amax maximum value of the clip range
8601 + * @return clipped value
8602 + */
8603 +static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
8604 +{
8605 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8606 +    if (amin > amax) abort();
8607 +#endif
8608 +    if      (a < amin) return amin;
8609 +    else if (a > amax) return amax;
8610 +    else               return a;
8611 +}
8612 +
8613 +/**
8614 + * Clip a signed 64bit integer value into the amin-amax range.
8615 + * @param a value to clip
8616 + * @param amin minimum value of the clip range
8617 + * @param amax maximum value of the clip range
8618 + * @return clipped value
8619 + */
8620 +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
8621 +{
8622 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8623 +    if (amin > amax) abort();
8624 +#endif
8625 +    if      (a < amin) return amin;
8626 +    else if (a > amax) return amax;
8627 +    else               return a;
8628 +}
8629 +
8630 +/**
8631 + * Clip a signed integer value into the 0-255 range.
8632 + * @param a value to clip
8633 + * @return clipped value
8634 + */
8635 +static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
8636 +{
8637 +    if (a&(~0xFF)) return (~a)>>31;
8638 +    else           return a;
8639 +}
8640 +
8641 +/**
8642 + * Clip a signed integer value into the -128,127 range.
8643 + * @param a value to clip
8644 + * @return clipped value
8645 + */
8646 +static av_always_inline av_const int8_t av_clip_int8_c(int a)
8647 +{
8648 +    if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
8649 +    else                  return a;
8650 +}
8651 +
8652 +/**
8653 + * Clip a signed integer value into the 0-65535 range.
8654 + * @param a value to clip
8655 + * @return clipped value
8656 + */
8657 +static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
8658 +{
8659 +    if (a&(~0xFFFF)) return (~a)>>31;
8660 +    else             return a;
8661 +}
8662 +
8663 +/**
8664 + * Clip a signed integer value into the -32768,32767 range.
8665 + * @param a value to clip
8666 + * @return clipped value
8667 + */
8668 +static av_always_inline av_const int16_t av_clip_int16_c(int a)
8669 +{
8670 +    if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
8671 +    else                      return a;
8672 +}
8673 +
8674 +/**
8675 + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
8676 + * @param a value to clip
8677 + * @return clipped value
8678 + */
8679 +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
8680 +{
8681 +    if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
8682 +    else                                         return (int32_t)a;
8683 +}
8684 +
8685 +/**
8686 + * Clip a signed integer into the -(2^p),(2^p-1) range.
8687 + * @param  a value to clip
8688 + * @param  p bit position to clip at
8689 + * @return clipped value
8690 + */
8691 +static av_always_inline av_const int av_clip_intp2_c(int a, int p)
8692 +{
8693 +    if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
8694 +        return (a >> 31) ^ ((1 << p) - 1);
8695 +    else
8696 +        return a;
8697 +}
8698 +
8699 +/**
8700 + * Clip a signed integer to an unsigned power of two range.
8701 + * @param  a value to clip
8702 + * @param  p bit position to clip at
8703 + * @return clipped value
8704 + */
8705 +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
8706 +{
8707 +    if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
8708 +    else                   return  a;
8709 +}
8710 +
8711 +/**
8712 + * Clear high bits from an unsigned integer starting with specific bit position
8713 + * @param  a value to clip
8714 + * @param  p bit position to clip at
8715 + * @return clipped value
8716 + */
8717 +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
8718 +{
8719 +    return a & ((1 << p) - 1);
8720 +}
8721 +
8722 +/**
8723 + * Add two signed 32-bit values with saturation.
8724 + *
8725 + * @param  a one value
8726 + * @param  b another value
8727 + * @return sum with signed saturation
8728 + */
8729 +static av_always_inline int av_sat_add32_c(int a, int b)
8730 +{
8731 +    return av_clipl_int32((int64_t)a + b);
8732 +}
8733 +
8734 +/**
8735 + * Add a doubled value to another value with saturation at both stages.
8736 + *
8737 + * @param  a first value
8738 + * @param  b value doubled and added to a
8739 + * @return sum sat(a + sat(2*b)) with signed saturation
8740 + */
8741 +static av_always_inline int av_sat_dadd32_c(int a, int b)
8742 +{
8743 +    return av_sat_add32(a, av_sat_add32(b, b));
8744 +}
8745 +
8746 +/**
8747 + * Subtract two signed 32-bit values with saturation.
8748 + *
8749 + * @param  a one value
8750 + * @param  b another value
8751 + * @return difference with signed saturation
8752 + */
8753 +static av_always_inline int av_sat_sub32_c(int a, int b)
8754 +{
8755 +    return av_clipl_int32((int64_t)a - b);
8756 +}
8757 +
8758 +/**
8759 + * Subtract a doubled value from another value with saturation at both stages.
8760 + *
8761 + * @param  a first value
8762 + * @param  b value doubled and subtracted from a
8763 + * @return difference sat(a - sat(2*b)) with signed saturation
8764 + */
8765 +static av_always_inline int av_sat_dsub32_c(int a, int b)
8766 +{
8767 +    return av_sat_sub32(a, av_sat_add32(b, b));
8768 +}
8769 +
8770 +/**
8771 + * Clip a float value into the amin-amax range.
8772 + * @param a value to clip
8773 + * @param amin minimum value of the clip range
8774 + * @param amax maximum value of the clip range
8775 + * @return clipped value
8776 + */
8777 +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
8778 +{
8779 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8780 +    if (amin > amax) abort();
8781 +#endif
8782 +    if      (a < amin) return amin;
8783 +    else if (a > amax) return amax;
8784 +    else               return a;
8785 +}
8786 +
8787 +/**
8788 + * Clip a double value into the amin-amax range.
8789 + * @param a value to clip
8790 + * @param amin minimum value of the clip range
8791 + * @param amax maximum value of the clip range
8792 + * @return clipped value
8793 + */
8794 +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
8795 +{
8796 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8797 +    if (amin > amax) abort();
8798 +#endif
8799 +    if      (a < amin) return amin;
8800 +    else if (a > amax) return amax;
8801 +    else               return a;
8802 +}
8803 +
8804 +/** Compute ceil(log2(x)).
8805 + * @param x value used to compute ceil(log2(x))
8806 + * @return computed ceiling of log2(x)
8807 + */
8808 +static av_always_inline av_const int av_ceil_log2_c(int x)
8809 +{
8810 +    return av_log2((x - 1) << 1);
8811 +}
8812 +
8813 +/**
8814 + * Count number of bits set to one in x
8815 + * @param x value to count bits of
8816 + * @return the number of bits set to one in x
8817 + */
8818 +static av_always_inline av_const int av_popcount_c(uint32_t x)
8819 +{
8820 +    x -= (x >> 1) & 0x55555555;
8821 +    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
8822 +    x = (x + (x >> 4)) & 0x0F0F0F0F;
8823 +    x += x >> 8;
8824 +    return (x + (x >> 16)) & 0x3F;
8825 +}
8826 +
8827 +/**
8828 + * Count number of bits set to one in x
8829 + * @param x value to count bits of
8830 + * @return the number of bits set to one in x
8831 + */
8832 +static av_always_inline av_const int av_popcount64_c(uint64_t x)
8833 +{
8834 +    return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
8835 +}
8836 +
8837 +static av_always_inline av_const int av_parity_c(uint32_t v)
8838 +{
8839 +    return av_popcount(v) & 1;
8840 +}
8841 +
8842 +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
8843 +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
8844 +
8845 +/**
8846 + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
8847 + *
8848 + * @param val      Output value, must be an lvalue of type uint32_t.
8849 + * @param GET_BYTE Expression reading one byte from the input.
8850 + *                 Evaluated up to 7 times (4 for the currently
8851 + *                 assigned Unicode range).  With a memory buffer
8852 + *                 input, this could be *ptr++.
8853 + * @param ERROR    Expression to be evaluated on invalid input,
8854 + *                 typically a goto statement.
8855 + *
8856 + * @warning ERROR should not contain a loop control statement which
8857 + * could interact with the internal while loop, and should force an
8858 + * exit from the macro code (e.g. through a goto or a return) in order
8859 + * to prevent undefined results.
8860 + */
8861 +#define GET_UTF8(val, GET_BYTE, ERROR)\
8862 +    val= (GET_BYTE);\
8863 +    {\
8864 +        uint32_t top = (val & 128) >> 1;\
8865 +        if ((val & 0xc0) == 0x80 || val >= 0xFE)\
8866 +            ERROR\
8867 +        while (val & top) {\
8868 +            int tmp= (GET_BYTE) - 128;\
8869 +            if(tmp>>6)\
8870 +                ERROR\
8871 +            val= (val<<6) + tmp;\
8872 +            top <<= 5;\
8873 +        }\
8874 +        val &= (top << 1) - 1;\
8875 +    }
8876 +
8877 +/**
8878 + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
8879 + *
8880 + * @param val       Output value, must be an lvalue of type uint32_t.
8881 + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
8882 + *                  to native byte order.  Evaluated one or two times.
8883 + * @param ERROR     Expression to be evaluated on invalid input,
8884 + *                  typically a goto statement.
8885 + */
8886 +#define GET_UTF16(val, GET_16BIT, ERROR)\
8887 +    val = GET_16BIT;\
8888 +    {\
8889 +        unsigned int hi = val - 0xD800;\
8890 +        if (hi < 0x800) {\
8891 +            val = GET_16BIT - 0xDC00;\
8892 +            if (val > 0x3FFU || hi > 0x3FFU)\
8893 +                ERROR\
8894 +            val += (hi<<10) + 0x10000;\
8895 +        }\
8896 +    }\
8897 +
8898 +/**
8899 + * @def PUT_UTF8(val, tmp, PUT_BYTE)
8900 + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
8901 + * @param val is an input-only argument and should be of type uint32_t. It holds
8902 + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
8903 + * val is given as a function it is executed only once.
8904 + * @param tmp is a temporary variable and should be of type uint8_t. It
8905 + * represents an intermediate value during conversion that is to be
8906 + * output by PUT_BYTE.
8907 + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
8908 + * It could be a function or a statement, and uses tmp as the input byte.
8909 + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
8910 + * executed up to 4 times for values in the valid UTF-8 range and up to
8911 + * 7 times in the general case, depending on the length of the converted
8912 + * Unicode character.
8913 + */
8914 +#define PUT_UTF8(val, tmp, PUT_BYTE)\
8915 +    {\
8916 +        int bytes, shift;\
8917 +        uint32_t in = val;\
8918 +        if (in < 0x80) {\
8919 +            tmp = in;\
8920 +            PUT_BYTE\
8921 +        } else {\
8922 +            bytes = (av_log2(in) + 4) / 5;\
8923 +            shift = (bytes - 1) * 6;\
8924 +            tmp = (256 - (256 >> bytes)) | (in >> shift);\
8925 +            PUT_BYTE\
8926 +            while (shift >= 6) {\
8927 +                shift -= 6;\
8928 +                tmp = 0x80 | ((in >> shift) & 0x3f);\
8929 +                PUT_BYTE\
8930 +            }\
8931 +        }\
8932 +    }
8933 +
8934 +/**
8935 + * @def PUT_UTF16(val, tmp, PUT_16BIT)
8936 + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
8937 + * @param val is an input-only argument and should be of type uint32_t. It holds
8938 + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
8939 + * val is given as a function it is executed only once.
8940 + * @param tmp is a temporary variable and should be of type uint16_t. It
8941 + * represents an intermediate value during conversion that is to be
8942 + * output by PUT_16BIT.
8943 + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
8944 + * in desired endianness. It could be a function or a statement, and uses tmp
8945 + * as the input byte.  For example, PUT_BYTE could be "*output++ = tmp;"
8946 + * PUT_BYTE will be executed 1 or 2 times depending on input character.
8947 + */
8948 +#define PUT_UTF16(val, tmp, PUT_16BIT)\
8949 +    {\
8950 +        uint32_t in = val;\
8951 +        if (in < 0x10000) {\
8952 +            tmp = in;\
8953 +            PUT_16BIT\
8954 +        } else {\
8955 +            tmp = 0xD800 | ((in - 0x10000) >> 10);\
8956 +            PUT_16BIT\
8957 +            tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
8958 +            PUT_16BIT\
8959 +        }\
8960 +    }\
8961 +
8962 +
8963 +
8964 +#include "mem.h"
8965 +
8966 +#ifdef HAVE_AV_CONFIG_H
8967 +#    include "internal.h"
8968 +#endif /* HAVE_AV_CONFIG_H */
8969 +
8970 +#endif /* AVUTIL_COMMON_H */
8971 +
8972 +/*
8973 + * The following definitions are outside the multiple inclusion guard
8974 + * to ensure they are immediately available in intmath.h.
8975 + */
8976 +
8977 +#ifndef av_ceil_log2
8978 +#   define av_ceil_log2     av_ceil_log2_c
8979 +#endif
8980 +#ifndef av_clip
8981 +#   define av_clip          av_clip_c
8982 +#endif
8983 +#ifndef av_clip64
8984 +#   define av_clip64        av_clip64_c
8985 +#endif
8986 +#ifndef av_clip_uint8
8987 +#   define av_clip_uint8    av_clip_uint8_c
8988 +#endif
8989 +#ifndef av_clip_int8
8990 +#   define av_clip_int8     av_clip_int8_c
8991 +#endif
8992 +#ifndef av_clip_uint16
8993 +#   define av_clip_uint16   av_clip_uint16_c
8994 +#endif
8995 +#ifndef av_clip_int16
8996 +#   define av_clip_int16    av_clip_int16_c
8997 +#endif
8998 +#ifndef av_clipl_int32
8999 +#   define av_clipl_int32   av_clipl_int32_c
9000 +#endif
9001 +#ifndef av_clip_intp2
9002 +#   define av_clip_intp2    av_clip_intp2_c
9003 +#endif
9004 +#ifndef av_clip_uintp2
9005 +#   define av_clip_uintp2   av_clip_uintp2_c
9006 +#endif
9007 +#ifndef av_mod_uintp2
9008 +#   define av_mod_uintp2    av_mod_uintp2_c
9009 +#endif
9010 +#ifndef av_sat_add32
9011 +#   define av_sat_add32     av_sat_add32_c
9012 +#endif
9013 +#ifndef av_sat_dadd32
9014 +#   define av_sat_dadd32    av_sat_dadd32_c
9015 +#endif
9016 +#ifndef av_sat_sub32
9017 +#   define av_sat_sub32     av_sat_sub32_c
9018 +#endif
9019 +#ifndef av_sat_dsub32
9020 +#   define av_sat_dsub32    av_sat_dsub32_c
9021 +#endif
9022 +#ifndef av_clipf
9023 +#   define av_clipf         av_clipf_c
9024 +#endif
9025 +#ifndef av_clipd
9026 +#   define av_clipd         av_clipd_c
9027 +#endif
9028 +#ifndef av_popcount
9029 +#   define av_popcount      av_popcount_c
9030 +#endif
9031 +#ifndef av_popcount64
9032 +#   define av_popcount64    av_popcount64_c
9033 +#endif
9034 +#ifndef av_parity
9035 +#   define av_parity        av_parity_c
9036 +#endif
9037 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9038 new file mode 100644
9039 --- /dev/null
9040 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9041 @@ -0,0 +1,130 @@
9042 +/*
9043 + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
9044 + *
9045 + * This file is part of FFmpeg.
9046 + *
9047 + * FFmpeg is free software; you can redistribute it and/or
9048 + * modify it under the terms of the GNU Lesser General Public
9049 + * License as published by the Free Software Foundation; either
9050 + * version 2.1 of the License, or (at your option) any later version.
9051 + *
9052 + * FFmpeg is distributed in the hope that it will be useful,
9053 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9054 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9055 + * Lesser General Public License for more details.
9056 + *
9057 + * You should have received a copy of the GNU Lesser General Public
9058 + * License along with FFmpeg; if not, write to the Free Software
9059 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9060 + */
9061 +
9062 +#ifndef AVUTIL_CPU_H
9063 +#define AVUTIL_CPU_H
9064 +
9065 +#include <stddef.h>
9066 +
9067 +#include "attributes.h"
9068 +
9069 +#define AV_CPU_FLAG_FORCE    0x80000000 /* force usage of selected flags (OR) */
9070 +
9071 +    /* lower 16 bits - CPU features */
9072 +#define AV_CPU_FLAG_MMX          0x0001 ///< standard MMX
9073 +#define AV_CPU_FLAG_MMXEXT       0x0002 ///< SSE integer functions or AMD MMX ext
9074 +#define AV_CPU_FLAG_MMX2         0x0002 ///< SSE integer functions or AMD MMX ext
9075 +#define AV_CPU_FLAG_3DNOW        0x0004 ///< AMD 3DNOW
9076 +#define AV_CPU_FLAG_SSE          0x0008 ///< SSE functions
9077 +#define AV_CPU_FLAG_SSE2         0x0010 ///< PIV SSE2 functions
9078 +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
9079 +                                        ///< than regular MMX/SSE (e.g. Core1)
9080 +#define AV_CPU_FLAG_3DNOWEXT     0x0020 ///< AMD 3DNowExt
9081 +#define AV_CPU_FLAG_SSE3         0x0040 ///< Prescott SSE3 functions
9082 +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
9083 +                                        ///< than regular MMX/SSE (e.g. Core1)
9084 +#define AV_CPU_FLAG_SSSE3        0x0080 ///< Conroe SSSE3 functions
9085 +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
9086 +#define AV_CPU_FLAG_ATOM     0x10000000 ///< Atom processor, some SSSE3 instructions are slower
9087 +#define AV_CPU_FLAG_SSE4         0x0100 ///< Penryn SSE4.1 functions
9088 +#define AV_CPU_FLAG_SSE42        0x0200 ///< Nehalem SSE4.2 functions
9089 +#define AV_CPU_FLAG_AESNI       0x80000 ///< Advanced Encryption Standard functions
9090 +#define AV_CPU_FLAG_AVX          0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
9091 +#define AV_CPU_FLAG_AVXSLOW   0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
9092 +#define AV_CPU_FLAG_XOP          0x0400 ///< Bulldozer XOP functions
9093 +#define AV_CPU_FLAG_FMA4         0x0800 ///< Bulldozer FMA4 functions
9094 +#define AV_CPU_FLAG_CMOV         0x1000 ///< supports cmov instruction
9095 +#define AV_CPU_FLAG_AVX2         0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
9096 +#define AV_CPU_FLAG_FMA3        0x10000 ///< Haswell FMA3 functions
9097 +#define AV_CPU_FLAG_BMI1        0x20000 ///< Bit Manipulation Instruction Set 1
9098 +#define AV_CPU_FLAG_BMI2        0x40000 ///< Bit Manipulation Instruction Set 2
9099 +#define AV_CPU_FLAG_AVX512     0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
9100 +
9101 +#define AV_CPU_FLAG_ALTIVEC      0x0001 ///< standard
9102 +#define AV_CPU_FLAG_VSX          0x0002 ///< ISA 2.06
9103 +#define AV_CPU_FLAG_POWER8       0x0004 ///< ISA 2.07
9104 +
9105 +#define AV_CPU_FLAG_ARMV5TE      (1 << 0)
9106 +#define AV_CPU_FLAG_ARMV6        (1 << 1)
9107 +#define AV_CPU_FLAG_ARMV6T2      (1 << 2)
9108 +#define AV_CPU_FLAG_VFP          (1 << 3)
9109 +#define AV_CPU_FLAG_VFPV3        (1 << 4)
9110 +#define AV_CPU_FLAG_NEON         (1 << 5)
9111 +#define AV_CPU_FLAG_ARMV8        (1 << 6)
9112 +#define AV_CPU_FLAG_VFP_VM       (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
9113 +#define AV_CPU_FLAG_SETEND       (1 <<16)
9114 +
9115 +/**
9116 + * Return the flags which specify extensions supported by the CPU.
9117 + * The returned value is affected by av_force_cpu_flags() if that was used
9118 + * before. So av_get_cpu_flags() can easily be used in an application to
9119 + * detect the enabled cpu flags.
9120 + */
9121 +int av_get_cpu_flags(void);
9122 +
9123 +/**
9124 + * Disables cpu detection and forces the specified flags.
9125 + * -1 is a special case that disables forcing of specific flags.
9126 + */
9127 +void av_force_cpu_flags(int flags);
9128 +
9129 +/**
9130 + * Set a mask on flags returned by av_get_cpu_flags().
9131 + * This function is mainly useful for testing.
9132 + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
9133 + */
9134 +attribute_deprecated void av_set_cpu_flags_mask(int mask);
9135 +
9136 +/**
9137 + * Parse CPU flags from a string.
9138 + *
9139 + * The returned flags contain the specified flags as well as related unspecified flags.
9140 + *
9141 + * This function exists only for compatibility with libav.
9142 + * Please use av_parse_cpu_caps() when possible.
9143 + * @return a combination of AV_CPU_* flags, negative on error.
9144 + */
9145 +attribute_deprecated
9146 +int av_parse_cpu_flags(const char *s);
9147 +
9148 +/**
9149 + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
9150 + *
9151 + * @return negative on error.
9152 + */
9153 +int av_parse_cpu_caps(unsigned *flags, const char *s);
9154 +
9155 +/**
9156 + * @return the number of logical CPU cores present.
9157 + */
9158 +int av_cpu_count(void);
9159 +
9160 +/**
9161 + * Get the maximum data alignment that may be required by FFmpeg.
9162 + *
9163 + * Note that this is affected by the build configuration and the CPU flags mask,
9164 + * so e.g. if the CPU supports AVX, but libavutil has been built with
9165 + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
9166 + *  av_set_cpu_flags_mask(), then this function will behave as if AVX is not
9167 + *  present.
9168 + */
9169 +size_t av_cpu_max_align(void);
9170 +
9171 +#endif /* AVUTIL_CPU_H */
9172 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9173 new file mode 100644
9174 --- /dev/null
9175 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9176 @@ -0,0 +1,200 @@
9177 +/*
9178 + * This file is part of FFmpeg.
9179 + *
9180 + * FFmpeg is free software; you can redistribute it and/or
9181 + * modify it under the terms of the GNU Lesser General Public
9182 + * License as published by the Free Software Foundation; either
9183 + * version 2.1 of the License, or (at your option) any later version.
9184 + *
9185 + * FFmpeg is distributed in the hope that it will be useful,
9186 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9187 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9188 + * Lesser General Public License for more details.
9189 + *
9190 + * You should have received a copy of the GNU Lesser General Public
9191 + * License along with FFmpeg; if not, write to the Free Software
9192 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9193 + */
9194 +
9195 +/**
9196 + * @file
9197 + * Public dictionary API.
9198 + * @deprecated
9199 + *  AVDictionary is provided for compatibility with libav. It is both in
9200 + *  implementation as well as API inefficient. It does not scale and is
9201 + *  extremely slow with large dictionaries.
9202 + *  It is recommended that new code uses our tree container from tree.c/h
9203 + *  where applicable, which uses AVL trees to achieve O(log n) performance.
9204 + */
9205 +
9206 +#ifndef AVUTIL_DICT_H
9207 +#define AVUTIL_DICT_H
9208 +
9209 +#include <stdint.h>
9210 +
9211 +#include "version.h"
9212 +
9213 +/**
9214 + * @addtogroup lavu_dict AVDictionary
9215 + * @ingroup lavu_data
9216 + *
9217 + * @brief Simple key:value store
9218 + *
9219 + * @{
9220 + * Dictionaries are used for storing key:value pairs. To create
9221 + * an AVDictionary, simply pass an address of a NULL pointer to
9222 + * av_dict_set(). NULL can be used as an empty dictionary wherever
9223 + * a pointer to an AVDictionary is required.
9224 + * Use av_dict_get() to retrieve an entry or iterate over all
9225 + * entries and finally av_dict_free() to free the dictionary
9226 + * and all its contents.
9227 + *
9228 + @code
9229 +   AVDictionary *d = NULL;           // "create" an empty dictionary
9230 +   AVDictionaryEntry *t = NULL;
9231 +
9232 +   av_dict_set(&d, "foo", "bar", 0); // add an entry
9233 +
9234 +   char *k = av_strdup("key");       // if your strings are already allocated,
9235 +   char *v = av_strdup("value");     // you can avoid copying them like this
9236 +   av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
9237 +
9238 +   while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
9239 +       <....>                             // iterate over all entries in d
9240 +   }
9241 +   av_dict_free(&d);
9242 + @endcode
9243 + */
9244 +
9245 +#define AV_DICT_MATCH_CASE      1   /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
9246 +#define AV_DICT_IGNORE_SUFFIX   2   /**< Return first entry in a dictionary whose first part corresponds to the search key,
9247 +                                         ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
9248 +#define AV_DICT_DONT_STRDUP_KEY 4   /**< Take ownership of a key that's been
9249 +                                         allocated with av_malloc() or another memory allocation function. */
9250 +#define AV_DICT_DONT_STRDUP_VAL 8   /**< Take ownership of a value that's been
9251 +                                         allocated with av_malloc() or another memory allocation function. */
9252 +#define AV_DICT_DONT_OVERWRITE 16   ///< Don't overwrite existing entries.
9253 +#define AV_DICT_APPEND         32   /**< If the entry already exists, append to it.  Note that no
9254 +                                      delimiter is added, the strings are simply concatenated. */
9255 +#define AV_DICT_MULTIKEY       64   /**< Allow to store several equal keys in the dictionary */
9256 +
9257 +typedef struct AVDictionaryEntry {
9258 +    char *key;
9259 +    char *value;
9260 +} AVDictionaryEntry;
9261 +
9262 +typedef struct AVDictionary AVDictionary;
9263 +
9264 +/**
9265 + * Get a dictionary entry with matching key.
9266 + *
9267 + * The returned entry key or value must not be changed, or it will
9268 + * cause undefined behavior.
9269 + *
9270 + * To iterate through all the dictionary entries, you can set the matching key
9271 + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
9272 + *
9273 + * @param prev Set to the previous matching element to find the next.
9274 + *             If set to NULL the first matching element is returned.
9275 + * @param key matching key
9276 + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
9277 + * @return found entry or NULL in case no matching entry was found in the dictionary
9278 + */
9279 +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
9280 +                               const AVDictionaryEntry *prev, int flags);
9281 +
9282 +/**
9283 + * Get number of entries in dictionary.
9284 + *
9285 + * @param m dictionary
9286 + * @return  number of entries in dictionary
9287 + */
9288 +int av_dict_count(const AVDictionary *m);
9289 +
9290 +/**
9291 + * Set the given entry in *pm, overwriting an existing entry.
9292 + *
9293 + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
9294 + * these arguments will be freed on error.
9295 + *
9296 + * Warning: Adding a new entry to a dictionary invalidates all existing entries
9297 + * previously returned with av_dict_get.
9298 + *
9299 + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
9300 + * a dictionary struct is allocated and put in *pm.
9301 + * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
9302 + * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
9303 + *        Passing a NULL value will cause an existing entry to be deleted.
9304 + * @return >= 0 on success otherwise an error code <0
9305 + */
9306 +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
9307 +
9308 +/**
9309 + * Convenience wrapper for av_dict_set that converts the value to a string
9310 + * and stores it.
9311 + *
9312 + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
9313 + */
9314 +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
9315 +
9316 +/**
9317 + * Parse the key/value pairs list and add the parsed entries to a dictionary.
9318 + *
9319 + * In case of failure, all the successfully set entries are stored in
9320 + * *pm. You may need to manually free the created dictionary.
9321 + *
9322 + * @param key_val_sep  a 0-terminated list of characters used to separate
9323 + *                     key from value
9324 + * @param pairs_sep    a 0-terminated list of characters used to separate
9325 + *                     two pairs from each other
9326 + * @param flags        flags to use when adding to dictionary.
9327 + *                     AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
9328 + *                     are ignored since the key/value tokens will always
9329 + *                     be duplicated.
9330 + * @return             0 on success, negative AVERROR code on failure
9331 + */
9332 +int av_dict_parse_string(AVDictionary **pm, const char *str,
9333 +                         const char *key_val_sep, const char *pairs_sep,
9334 +                         int flags);
9335 +
9336 +/**
9337 + * Copy entries from one AVDictionary struct into another.
9338 + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
9339 + *            this function will allocate a struct for you and put it in *dst
9340 + * @param src pointer to source AVDictionary struct
9341 + * @param flags flags to use when setting entries in *dst
9342 + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
9343 + * @return 0 on success, negative AVERROR code on failure. If dst was allocated
9344 + *           by this function, callers should free the associated memory.
9345 + */
9346 +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
9347 +
9348 +/**
9349 + * Free all the memory allocated for an AVDictionary struct
9350 + * and all keys and values.
9351 + */
9352 +void av_dict_free(AVDictionary **m);
9353 +
9354 +/**
9355 + * Get dictionary entries as a string.
9356 + *
9357 + * Create a string containing dictionary's entries.
9358 + * Such string may be passed back to av_dict_parse_string().
9359 + * @note String is escaped with backslashes ('\').
9360 + *
9361 + * @param[in]  m             dictionary
9362 + * @param[out] buffer        Pointer to buffer that will be allocated with string containg entries.
9363 + *                           Buffer must be freed by the caller when is no longer needed.
9364 + * @param[in]  key_val_sep   character used to separate key from value
9365 + * @param[in]  pairs_sep     character used to separate two pairs from each other
9366 + * @return                   >= 0 on success, negative on error
9367 + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
9368 + */
9369 +int av_dict_get_string(const AVDictionary *m, char **buffer,
9370 +                       const char key_val_sep, const char pairs_sep);
9371 +
9372 +/**
9373 + * @}
9374 + */
9375 +
9376 +#endif /* AVUTIL_DICT_H */
9377 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9378 new file mode 100644
9379 --- /dev/null
9380 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9381 @@ -0,0 +1,126 @@
9382 +/*
9383 + * This file is part of FFmpeg.
9384 + *
9385 + * FFmpeg is free software; you can redistribute it and/or
9386 + * modify it under the terms of the GNU Lesser General Public
9387 + * License as published by the Free Software Foundation; either
9388 + * version 2.1 of the License, or (at your option) any later version.
9389 + *
9390 + * FFmpeg is distributed in the hope that it will be useful,
9391 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9392 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9393 + * Lesser General Public License for more details.
9394 + *
9395 + * You should have received a copy of the GNU Lesser General Public
9396 + * License along with FFmpeg; if not, write to the Free Software
9397 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9398 + */
9399 +
9400 +/**
9401 + * @file
9402 + * error code definitions
9403 + */
9404 +
9405 +#ifndef AVUTIL_ERROR_H
9406 +#define AVUTIL_ERROR_H
9407 +
9408 +#include <errno.h>
9409 +#include <stddef.h>
9410 +
9411 +/**
9412 + * @addtogroup lavu_error
9413 + *
9414 + * @{
9415 + */
9416 +
9417 +
9418 +/* error handling */
9419 +#if EDOM > 0
9420 +#define AVERROR(e) (-(e))   ///< Returns a negative error code from a POSIX error code, to return from library functions.
9421 +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
9422 +#else
9423 +/* Some platforms have E* and errno already negated. */
9424 +#define AVERROR(e) (e)
9425 +#define AVUNERROR(e) (e)
9426 +#endif
9427 +
9428 +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
9429 +
9430 +#define AVERROR_BSF_NOT_FOUND      FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
9431 +#define AVERROR_BUG                FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
9432 +#define AVERROR_BUFFER_TOO_SMALL   FFERRTAG( 'B','U','F','S') ///< Buffer too small
9433 +#define AVERROR_DECODER_NOT_FOUND  FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
9434 +#define AVERROR_DEMUXER_NOT_FOUND  FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
9435 +#define AVERROR_ENCODER_NOT_FOUND  FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
9436 +#define AVERROR_EOF                FFERRTAG( 'E','O','F',' ') ///< End of file
9437 +#define AVERROR_EXIT               FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
9438 +#define AVERROR_EXTERNAL           FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
9439 +#define AVERROR_FILTER_NOT_FOUND   FFERRTAG(0xF8,'F','I','L') ///< Filter not found
9440 +#define AVERROR_INVALIDDATA        FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
9441 +#define AVERROR_MUXER_NOT_FOUND    FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
9442 +#define AVERROR_OPTION_NOT_FOUND   FFERRTAG(0xF8,'O','P','T') ///< Option not found
9443 +#define AVERROR_PATCHWELCOME       FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
9444 +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
9445 +
9446 +#define AVERROR_STREAM_NOT_FOUND   FFERRTAG(0xF8,'S','T','R') ///< Stream not found
9447 +/**
9448 + * This is semantically identical to AVERROR_BUG
9449 + * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
9450 + */
9451 +#define AVERROR_BUG2               FFERRTAG( 'B','U','G',' ')
9452 +#define AVERROR_UNKNOWN            FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
9453 +#define AVERROR_EXPERIMENTAL       (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
9454 +#define AVERROR_INPUT_CHANGED      (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
9455 +#define AVERROR_OUTPUT_CHANGED     (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
9456 +/* HTTP & RTSP errors */
9457 +#define AVERROR_HTTP_BAD_REQUEST   FFERRTAG(0xF8,'4','0','0')
9458 +#define AVERROR_HTTP_UNAUTHORIZED  FFERRTAG(0xF8,'4','0','1')
9459 +#define AVERROR_HTTP_FORBIDDEN     FFERRTAG(0xF8,'4','0','3')
9460 +#define AVERROR_HTTP_NOT_FOUND     FFERRTAG(0xF8,'4','0','4')
9461 +#define AVERROR_HTTP_OTHER_4XX     FFERRTAG(0xF8,'4','X','X')
9462 +#define AVERROR_HTTP_SERVER_ERROR  FFERRTAG(0xF8,'5','X','X')
9463 +
9464 +#define AV_ERROR_MAX_STRING_SIZE 64
9465 +
9466 +/**
9467 + * Put a description of the AVERROR code errnum in errbuf.
9468 + * In case of failure the global variable errno is set to indicate the
9469 + * error. Even in case of failure av_strerror() will print a generic
9470 + * error message indicating the errnum provided to errbuf.
9471 + *
9472 + * @param errnum      error code to describe
9473 + * @param errbuf      buffer to which description is written
9474 + * @param errbuf_size the size in bytes of errbuf
9475 + * @return 0 on success, a negative value if a description for errnum
9476 + * cannot be found
9477 + */
9478 +int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
9479 +
9480 +/**
9481 + * Fill the provided buffer with a string containing an error string
9482 + * corresponding to the AVERROR code errnum.
9483 + *
9484 + * @param errbuf         a buffer
9485 + * @param errbuf_size    size in bytes of errbuf
9486 + * @param errnum         error code to describe
9487 + * @return the buffer in input, filled with the error description
9488 + * @see av_strerror()
9489 + */
9490 +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
9491 +{
9492 +    av_strerror(errnum, errbuf, errbuf_size);
9493 +    return errbuf;
9494 +}
9495 +
9496 +/**
9497 + * Convenience macro, the return value should be used only directly in
9498 + * function arguments but never stand-alone.
9499 + */
9500 +#define av_err2str(errnum) \
9501 +    av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
9502 +
9503 +/**
9504 + * @}
9505 + */
9506 +
9507 +#endif /* AVUTIL_ERROR_H */
9508 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9509 new file mode 100644
9510 --- /dev/null
9511 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9512 @@ -0,0 +1,893 @@
9513 +/*
9514 + * This file is part of FFmpeg.
9515 + *
9516 + * FFmpeg is free software; you can redistribute it and/or
9517 + * modify it under the terms of the GNU Lesser General Public
9518 + * License as published by the Free Software Foundation; either
9519 + * version 2.1 of the License, or (at your option) any later version.
9520 + *
9521 + * FFmpeg is distributed in the hope that it will be useful,
9522 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9523 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9524 + * Lesser General Public License for more details.
9525 + *
9526 + * You should have received a copy of the GNU Lesser General Public
9527 + * License along with FFmpeg; if not, write to the Free Software
9528 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9529 + */
9530 +
9531 +/**
9532 + * @file
9533 + * @ingroup lavu_frame
9534 + * reference-counted frame API
9535 + */
9536 +
9537 +#ifndef AVUTIL_FRAME_H
9538 +#define AVUTIL_FRAME_H
9539 +
9540 +#include <stddef.h>
9541 +#include <stdint.h>
9542 +
9543 +#include "avutil.h"
9544 +#include "buffer.h"
9545 +#include "dict.h"
9546 +#include "rational.h"
9547 +#include "samplefmt.h"
9548 +#include "pixfmt.h"
9549 +#include "version.h"
9550 +
9551 +
9552 +/**
9553 + * @defgroup lavu_frame AVFrame
9554 + * @ingroup lavu_data
9555 + *
9556 + * @{
9557 + * AVFrame is an abstraction for reference-counted raw multimedia data.
9558 + */
9559 +
9560 +enum AVFrameSideDataType {
9561 +    /**
9562 +     * The data is the AVPanScan struct defined in libavcodec.
9563 +     */
9564 +    AV_FRAME_DATA_PANSCAN,
9565 +    /**
9566 +     * ATSC A53 Part 4 Closed Captions.
9567 +     * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
9568 +     * The number of bytes of CC data is AVFrameSideData.size.
9569 +     */
9570 +    AV_FRAME_DATA_A53_CC,
9571 +    /**
9572 +     * Stereoscopic 3d metadata.
9573 +     * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
9574 +     */
9575 +    AV_FRAME_DATA_STEREO3D,
9576 +    /**
9577 +     * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
9578 +     */
9579 +    AV_FRAME_DATA_MATRIXENCODING,
9580 +    /**
9581 +     * Metadata relevant to a downmix procedure.
9582 +     * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
9583 +     */
9584 +    AV_FRAME_DATA_DOWNMIX_INFO,
9585 +    /**
9586 +     * ReplayGain information in the form of the AVReplayGain struct.
9587 +     */
9588 +    AV_FRAME_DATA_REPLAYGAIN,
9589 +    /**
9590 +     * This side data contains a 3x3 transformation matrix describing an affine
9591 +     * transformation that needs to be applied to the frame for correct
9592 +     * presentation.
9593 +     *
9594 +     * See libavutil/display.h for a detailed description of the data.
9595 +     */
9596 +    AV_FRAME_DATA_DISPLAYMATRIX,
9597 +    /**
9598 +     * Active Format Description data consisting of a single byte as specified
9599 +     * in ETSI TS 101 154 using AVActiveFormatDescription enum.
9600 +     */
9601 +    AV_FRAME_DATA_AFD,
9602 +    /**
9603 +     * Motion vectors exported by some codecs (on demand through the export_mvs
9604 +     * flag set in the libavcodec AVCodecContext flags2 option).
9605 +     * The data is the AVMotionVector struct defined in
9606 +     * libavutil/motion_vector.h.
9607 +     */
9608 +    AV_FRAME_DATA_MOTION_VECTORS,
9609 +    /**
9610 +     * Recommmends skipping the specified number of samples. This is exported
9611 +     * only if the "skip_manual" AVOption is set in libavcodec.
9612 +     * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
9613 +     * @code
9614 +     * u32le number of samples to skip from start of this packet
9615 +     * u32le number of samples to skip from end of this packet
9616 +     * u8    reason for start skip
9617 +     * u8    reason for end   skip (0=padding silence, 1=convergence)
9618 +     * @endcode
9619 +     */
9620 +    AV_FRAME_DATA_SKIP_SAMPLES,
9621 +    /**
9622 +     * This side data must be associated with an audio frame and corresponds to
9623 +     * enum AVAudioServiceType defined in avcodec.h.
9624 +     */
9625 +    AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
9626 +    /**
9627 +     * Mastering display metadata associated with a video frame. The payload is
9628 +     * an AVMasteringDisplayMetadata type and contains information about the
9629 +     * mastering display color volume.
9630 +     */
9631 +    AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
9632 +    /**
9633 +     * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
9634 +     * This is set on the first frame of a GOP that has a temporal reference of 0.
9635 +     */
9636 +    AV_FRAME_DATA_GOP_TIMECODE,
9637 +
9638 +    /**
9639 +     * The data represents the AVSphericalMapping structure defined in
9640 +     * libavutil/spherical.h.
9641 +     */
9642 +    AV_FRAME_DATA_SPHERICAL,
9643 +
9644 +    /**
9645 +     * Content light level (based on CTA-861.3). This payload contains data in
9646 +     * the form of the AVContentLightMetadata struct.
9647 +     */
9648 +    AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
9649 +
9650 +    /**
9651 +     * The data contains an ICC profile as an opaque octet buffer following the
9652 +     * format described by ISO 15076-1 with an optional name defined in the
9653 +     * metadata key entry "name".
9654 +     */
9655 +    AV_FRAME_DATA_ICC_PROFILE,
9656 +
9657 +#if FF_API_FRAME_QP
9658 +    /**
9659 +     * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
9660 +     * The contents of this side data are undocumented and internal; use
9661 +     * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
9662 +     * meaningful way instead.
9663 +     */
9664 +    AV_FRAME_DATA_QP_TABLE_PROPERTIES,
9665 +
9666 +    /**
9667 +     * Raw QP table data. Its format is described by
9668 +     * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
9669 +     * av_frame_get_qp_table() to access this instead.
9670 +     */
9671 +    AV_FRAME_DATA_QP_TABLE_DATA,
9672 +#endif
9673 +};
9674 +
9675 +enum AVActiveFormatDescription {
9676 +    AV_AFD_SAME         = 8,
9677 +    AV_AFD_4_3          = 9,
9678 +    AV_AFD_16_9         = 10,
9679 +    AV_AFD_14_9         = 11,
9680 +    AV_AFD_4_3_SP_14_9  = 13,
9681 +    AV_AFD_16_9_SP_14_9 = 14,
9682 +    AV_AFD_SP_4_3       = 15,
9683 +};
9684 +
9685 +
9686 +/**
9687 + * Structure to hold side data for an AVFrame.
9688 + *
9689 + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
9690 + * to the end with a minor bump.
9691 + */
9692 +typedef struct AVFrameSideData {
9693 +    enum AVFrameSideDataType type;
9694 +    uint8_t *data;
9695 +    int      size;
9696 +    AVDictionary *metadata;
9697 +    AVBufferRef *buf;
9698 +} AVFrameSideData;
9699 +
9700 +/**
9701 + * This structure describes decoded (raw) audio or video data.
9702 + *
9703 + * AVFrame must be allocated using av_frame_alloc(). Note that this only
9704 + * allocates the AVFrame itself, the buffers for the data must be managed
9705 + * through other means (see below).
9706 + * AVFrame must be freed with av_frame_free().
9707 + *
9708 + * AVFrame is typically allocated once and then reused multiple times to hold
9709 + * different data (e.g. a single AVFrame to hold frames received from a
9710 + * decoder). In such a case, av_frame_unref() will free any references held by
9711 + * the frame and reset it to its original clean state before it
9712 + * is reused again.
9713 + *
9714 + * The data described by an AVFrame is usually reference counted through the
9715 + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
9716 + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
9717 + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
9718 + * every single data plane must be contained in one of the buffers in
9719 + * AVFrame.buf or AVFrame.extended_buf.
9720 + * There may be a single buffer for all the data, or one separate buffer for
9721 + * each plane, or anything in between.
9722 + *
9723 + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
9724 + * to the end with a minor bump.
9725 + *
9726 + * Fields can be accessed through AVOptions, the name string used, matches the
9727 + * C structure field name for fields accessible through AVOptions. The AVClass
9728 + * for AVFrame can be obtained from avcodec_get_frame_class()
9729 + */
9730 +typedef struct AVFrame {
9731 +#define AV_NUM_DATA_POINTERS 8
9732 +    /**
9733 +     * pointer to the picture/channel planes.
9734 +     * This might be different from the first allocated byte
9735 +     *
9736 +     * Some decoders access areas outside 0,0 - width,height, please
9737 +     * see avcodec_align_dimensions2(). Some filters and swscale can read
9738 +     * up to 16 bytes beyond the planes, if these filters are to be used,
9739 +     * then 16 extra bytes must be allocated.
9740 +     *
9741 +     * NOTE: Except for hwaccel formats, pointers not needed by the format
9742 +     * MUST be set to NULL.
9743 +     */
9744 +    uint8_t *data[AV_NUM_DATA_POINTERS];
9745 +
9746 +    /**
9747 +     * For video, size in bytes of each picture line.
9748 +     * For audio, size in bytes of each plane.
9749 +     *
9750 +     * For audio, only linesize[0] may be set. For planar audio, each channel
9751 +     * plane must be the same size.
9752 +     *
9753 +     * For video the linesizes should be multiples of the CPUs alignment
9754 +     * preference, this is 16 or 32 for modern desktop CPUs.
9755 +     * Some code requires such alignment other code can be slower without
9756 +     * correct alignment, for yet other it makes no difference.
9757 +     *
9758 +     * @note The linesize may be larger than the size of usable data -- there
9759 +     * may be extra padding present for performance reasons.
9760 +     */
9761 +    int linesize[AV_NUM_DATA_POINTERS];
9762 +
9763 +    /**
9764 +     * pointers to the data planes/channels.
9765 +     *
9766 +     * For video, this should simply point to data[].
9767 +     *
9768 +     * For planar audio, each channel has a separate data pointer, and
9769 +     * linesize[0] contains the size of each channel buffer.
9770 +     * For packed audio, there is just one data pointer, and linesize[0]
9771 +     * contains the total size of the buffer for all channels.
9772 +     *
9773 +     * Note: Both data and extended_data should always be set in a valid frame,
9774 +     * but for planar audio with more channels that can fit in data,
9775 +     * extended_data must be used in order to access all channels.
9776 +     */
9777 +    uint8_t **extended_data;
9778 +
9779 +    /**
9780 +     * @name Video dimensions
9781 +     * Video frames only. The coded dimensions (in pixels) of the video frame,
9782 +     * i.e. the size of the rectangle that contains some well-defined values.
9783 +     *
9784 +     * @note The part of the frame intended for display/presentation is further
9785 +     * restricted by the @ref cropping "Cropping rectangle".
9786 +     * @{
9787 +     */
9788 +    int width, height;
9789 +    /**
9790 +     * @}
9791 +     */
9792 +
9793 +    /**
9794 +     * number of audio samples (per channel) described by this frame
9795 +     */
9796 +    int nb_samples;
9797 +
9798 +    /**
9799 +     * format of the frame, -1 if unknown or unset
9800 +     * Values correspond to enum AVPixelFormat for video frames,
9801 +     * enum AVSampleFormat for audio)
9802 +     */
9803 +    int format;
9804 +
9805 +    /**
9806 +     * 1 -> keyframe, 0-> not
9807 +     */
9808 +    int key_frame;
9809 +
9810 +    /**
9811 +     * Picture type of the frame.
9812 +     */
9813 +    enum AVPictureType pict_type;
9814 +
9815 +    /**
9816 +     * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
9817 +     */
9818 +    AVRational sample_aspect_ratio;
9819 +
9820 +    /**
9821 +     * Presentation timestamp in time_base units (time when frame should be shown to user).
9822 +     */
9823 +    int64_t pts;
9824 +
9825 +#if FF_API_PKT_PTS
9826 +    /**
9827 +     * PTS copied from the AVPacket that was decoded to produce this frame.
9828 +     * @deprecated use the pts field instead
9829 +     */
9830 +    attribute_deprecated
9831 +    int64_t pkt_pts;
9832 +#endif
9833 +
9834 +    /**
9835 +     * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
9836 +     * This is also the Presentation time of this AVFrame calculated from
9837 +     * only AVPacket.dts values without pts values.
9838 +     */
9839 +    int64_t pkt_dts;
9840 +
9841 +    /**
9842 +     * picture number in bitstream order
9843 +     */
9844 +    int coded_picture_number;
9845 +    /**
9846 +     * picture number in display order
9847 +     */
9848 +    int display_picture_number;
9849 +
9850 +    /**
9851 +     * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
9852 +     */
9853 +    int quality;
9854 +
9855 +    /**
9856 +     * for some private data of the user
9857 +     */
9858 +    void *opaque;
9859 +
9860 +#if FF_API_ERROR_FRAME
9861 +    /**
9862 +     * @deprecated unused
9863 +     */
9864 +    attribute_deprecated
9865 +    uint64_t error[AV_NUM_DATA_POINTERS];
9866 +#endif
9867 +
9868 +    /**
9869 +     * When decoding, this signals how much the picture must be delayed.
9870 +     * extra_delay = repeat_pict / (2*fps)
9871 +     */
9872 +    int repeat_pict;
9873 +
9874 +    /**
9875 +     * The content of the picture is interlaced.
9876 +     */
9877 +    int interlaced_frame;
9878 +
9879 +    /**
9880 +     * If the content is interlaced, is top field displayed first.
9881 +     */
9882 +    int top_field_first;
9883 +
9884 +    /**
9885 +     * Tell user application that palette has changed from previous frame.
9886 +     */
9887 +    int palette_has_changed;
9888 +
9889 +    /**
9890 +     * reordered opaque 64 bits (generally an integer or a double precision float
9891 +     * PTS but can be anything).
9892 +     * The user sets AVCodecContext.reordered_opaque to represent the input at
9893 +     * that time,
9894 +     * the decoder reorders values as needed and sets AVFrame.reordered_opaque
9895 +     * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
9896 +     * @deprecated in favor of pkt_pts
9897 +     */
9898 +    int64_t reordered_opaque;
9899 +
9900 +    /**
9901 +     * Sample rate of the audio data.
9902 +     */
9903 +    int sample_rate;
9904 +
9905 +    /**
9906 +     * Channel layout of the audio data.
9907 +     */
9908 +    uint64_t channel_layout;
9909 +
9910 +    /**
9911 +     * AVBuffer references backing the data for this frame. If all elements of
9912 +     * this array are NULL, then this frame is not reference counted. This array
9913 +     * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
9914 +     * also be non-NULL for all j < i.
9915 +     *
9916 +     * There may be at most one AVBuffer per data plane, so for video this array
9917 +     * always contains all the references. For planar audio with more than
9918 +     * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
9919 +     * this array. Then the extra AVBufferRef pointers are stored in the
9920 +     * extended_buf array.
9921 +     */
9922 +    AVBufferRef *buf[AV_NUM_DATA_POINTERS];
9923 +
9924 +    /**
9925 +     * For planar audio which requires more than AV_NUM_DATA_POINTERS
9926 +     * AVBufferRef pointers, this array will hold all the references which
9927 +     * cannot fit into AVFrame.buf.
9928 +     *
9929 +     * Note that this is different from AVFrame.extended_data, which always
9930 +     * contains all the pointers. This array only contains the extra pointers,
9931 +     * which cannot fit into AVFrame.buf.
9932 +     *
9933 +     * This array is always allocated using av_malloc() by whoever constructs
9934 +     * the frame. It is freed in av_frame_unref().
9935 +     */
9936 +    AVBufferRef **extended_buf;
9937 +    /**
9938 +     * Number of elements in extended_buf.
9939 +     */
9940 +    int        nb_extended_buf;
9941 +
9942 +    AVFrameSideData **side_data;
9943 +    int            nb_side_data;
9944 +
9945 +/**
9946 + * @defgroup lavu_frame_flags AV_FRAME_FLAGS
9947 + * @ingroup lavu_frame
9948 + * Flags describing additional frame properties.
9949 + *
9950 + * @{
9951 + */
9952 +
9953 +/**
9954 + * The frame data may be corrupted, e.g. due to decoding errors.
9955 + */
9956 +#define AV_FRAME_FLAG_CORRUPT       (1 << 0)
9957 +/**
9958 + * A flag to mark the frames which need to be decoded, but shouldn't be output.
9959 + */
9960 +#define AV_FRAME_FLAG_DISCARD   (1 << 2)
9961 +/**
9962 + * @}
9963 + */
9964 +
9965 +    /**
9966 +     * Frame flags, a combination of @ref lavu_frame_flags
9967 +     */
9968 +    int flags;
9969 +
9970 +    /**
9971 +     * MPEG vs JPEG YUV range.
9972 +     * - encoding: Set by user
9973 +     * - decoding: Set by libavcodec
9974 +     */
9975 +    enum AVColorRange color_range;
9976 +
9977 +    enum AVColorPrimaries color_primaries;
9978 +
9979 +    enum AVColorTransferCharacteristic color_trc;
9980 +
9981 +    /**
9982 +     * YUV colorspace type.
9983 +     * - encoding: Set by user
9984 +     * - decoding: Set by libavcodec
9985 +     */
9986 +    enum AVColorSpace colorspace;
9987 +
9988 +    enum AVChromaLocation chroma_location;
9989 +
9990 +    /**
9991 +     * frame timestamp estimated using various heuristics, in stream time base
9992 +     * - encoding: unused
9993 +     * - decoding: set by libavcodec, read by user.
9994 +     */
9995 +    int64_t best_effort_timestamp;
9996 +
9997 +    /**
9998 +     * reordered pos from the last AVPacket that has been input into the decoder
9999 +     * - encoding: unused
10000 +     * - decoding: Read by user.
10001 +     */
10002 +    int64_t pkt_pos;
10003 +
10004 +    /**
10005 +     * duration of the corresponding packet, expressed in
10006 +     * AVStream->time_base units, 0 if unknown.
10007 +     * - encoding: unused
10008 +     * - decoding: Read by user.
10009 +     */
10010 +    int64_t pkt_duration;
10011 +
10012 +    /**
10013 +     * metadata.
10014 +     * - encoding: Set by user.
10015 +     * - decoding: Set by libavcodec.
10016 +     */
10017 +    AVDictionary *metadata;
10018 +
10019 +    /**
10020 +     * decode error flags of the frame, set to a combination of
10021 +     * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
10022 +     * were errors during the decoding.
10023 +     * - encoding: unused
10024 +     * - decoding: set by libavcodec, read by user.
10025 +     */
10026 +    int decode_error_flags;
10027 +#define FF_DECODE_ERROR_INVALID_BITSTREAM   1
10028 +#define FF_DECODE_ERROR_MISSING_REFERENCE   2
10029 +
10030 +    /**
10031 +     * number of audio channels, only used for audio.
10032 +     * - encoding: unused
10033 +     * - decoding: Read by user.
10034 +     */
10035 +    int channels;
10036 +
10037 +    /**
10038 +     * size of the corresponding packet containing the compressed
10039 +     * frame.
10040 +     * It is set to a negative value if unknown.
10041 +     * - encoding: unused
10042 +     * - decoding: set by libavcodec, read by user.
10043 +     */
10044 +    int pkt_size;
10045 +
10046 +#if FF_API_FRAME_QP
10047 +    /**
10048 +     * QP table
10049 +     */
10050 +    attribute_deprecated
10051 +    int8_t *qscale_table;
10052 +    /**
10053 +     * QP store stride
10054 +     */
10055 +    attribute_deprecated
10056 +    int qstride;
10057 +
10058 +    attribute_deprecated
10059 +    int qscale_type;
10060 +
10061 +    attribute_deprecated
10062 +    AVBufferRef *qp_table_buf;
10063 +#endif
10064 +    /**
10065 +     * For hwaccel-format frames, this should be a reference to the
10066 +     * AVHWFramesContext describing the frame.
10067 +     */
10068 +    AVBufferRef *hw_frames_ctx;
10069 +
10070 +    /**
10071 +     * AVBufferRef for free use by the API user. FFmpeg will never check the
10072 +     * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
10073 +     * the frame is unreferenced. av_frame_copy_props() calls create a new
10074 +     * reference with av_buffer_ref() for the target frame's opaque_ref field.
10075 +     *
10076 +     * This is unrelated to the opaque field, although it serves a similar
10077 +     * purpose.
10078 +     */
10079 +    AVBufferRef *opaque_ref;
10080 +
10081 +    /**
10082 +     * @anchor cropping
10083 +     * @name Cropping
10084 +     * Video frames only. The number of pixels to discard from the the
10085 +     * top/bottom/left/right border of the frame to obtain the sub-rectangle of
10086 +     * the frame intended for presentation.
10087 +     * @{
10088 +     */
10089 +    size_t crop_top;
10090 +    size_t crop_bottom;
10091 +    size_t crop_left;
10092 +    size_t crop_right;
10093 +    /**
10094 +     * @}
10095 +     */
10096 +
10097 +    /**
10098 +     * AVBufferRef for internal use by a single libav* library.
10099 +     * Must not be used to transfer data between libraries.
10100 +     * Has to be NULL when ownership of the frame leaves the respective library.
10101 +     *
10102 +     * Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
10103 +     *
10104 +     * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
10105 +     * av_frame_copy_props() calls create a new reference with av_buffer_ref()
10106 +     * for the target frame's private_ref field.
10107 +     */
10108 +    AVBufferRef *private_ref;
10109 +} AVFrame;
10110 +
10111 +#if FF_API_FRAME_GET_SET
10112 +/**
10113 + * Accessors for some AVFrame fields. These used to be provided for ABI
10114 + * compatibility, and do not need to be used anymore.
10115 + */
10116 +attribute_deprecated
10117 +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
10118 +attribute_deprecated
10119 +void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
10120 +attribute_deprecated
10121 +int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
10122 +attribute_deprecated
10123 +void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
10124 +attribute_deprecated
10125 +int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
10126 +attribute_deprecated
10127 +void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
10128 +attribute_deprecated
10129 +int64_t av_frame_get_channel_layout       (const AVFrame *frame);
10130 +attribute_deprecated
10131 +void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
10132 +attribute_deprecated
10133 +int     av_frame_get_channels             (const AVFrame *frame);
10134 +attribute_deprecated
10135 +void    av_frame_set_channels             (AVFrame *frame, int     val);
10136 +attribute_deprecated
10137 +int     av_frame_get_sample_rate          (const AVFrame *frame);
10138 +attribute_deprecated
10139 +void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
10140 +attribute_deprecated
10141 +AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
10142 +attribute_deprecated
10143 +void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
10144 +attribute_deprecated
10145 +int     av_frame_get_decode_error_flags   (const AVFrame *frame);
10146 +attribute_deprecated
10147 +void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
10148 +attribute_deprecated
10149 +int     av_frame_get_pkt_size(const AVFrame *frame);
10150 +attribute_deprecated
10151 +void    av_frame_set_pkt_size(AVFrame *frame, int val);
10152 +#if FF_API_FRAME_QP
10153 +attribute_deprecated
10154 +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
10155 +attribute_deprecated
10156 +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
10157 +#endif
10158 +attribute_deprecated
10159 +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
10160 +attribute_deprecated
10161 +void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
10162 +attribute_deprecated
10163 +enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
10164 +attribute_deprecated
10165 +void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
10166 +#endif
10167 +
10168 +/**
10169 + * Get the name of a colorspace.
10170 + * @return a static string identifying the colorspace; can be NULL.
10171 + */
10172 +const char *av_get_colorspace_name(enum AVColorSpace val);
10173 +
10174 +/**
10175 + * Allocate an AVFrame and set its fields to default values.  The resulting
10176 + * struct must be freed using av_frame_free().
10177 + *
10178 + * @return An AVFrame filled with default values or NULL on failure.
10179 + *
10180 + * @note this only allocates the AVFrame itself, not the data buffers. Those
10181 + * must be allocated through other means, e.g. with av_frame_get_buffer() or
10182 + * manually.
10183 + */
10184 +AVFrame *av_frame_alloc(void);
10185 +
10186 +/**
10187 + * Free the frame and any dynamically allocated objects in it,
10188 + * e.g. extended_data. If the frame is reference counted, it will be
10189 + * unreferenced first.
10190 + *
10191 + * @param frame frame to be freed. The pointer will be set to NULL.
10192 + */
10193 +void av_frame_free(AVFrame **frame);
10194 +
10195 +/**
10196 + * Set up a new reference to the data described by the source frame.
10197 + *
10198 + * Copy frame properties from src to dst and create a new reference for each
10199 + * AVBufferRef from src.
10200 + *
10201 + * If src is not reference counted, new buffers are allocated and the data is
10202 + * copied.
10203 + *
10204 + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
10205 + *           or newly allocated with av_frame_alloc() before calling this
10206 + *           function, or undefined behavior will occur.
10207 + *
10208 + * @return 0 on success, a negative AVERROR on error
10209 + */
10210 +int av_frame_ref(AVFrame *dst, const AVFrame *src);
10211 +
10212 +/**
10213 + * Create a new frame that references the same data as src.
10214 + *
10215 + * This is a shortcut for av_frame_alloc()+av_frame_ref().
10216 + *
10217 + * @return newly created AVFrame on success, NULL on error.
10218 + */
10219 +AVFrame *av_frame_clone(const AVFrame *src);
10220 +
10221 +/**
10222 + * Unreference all the buffers referenced by frame and reset the frame fields.
10223 + */
10224 +void av_frame_unref(AVFrame *frame);
10225 +
10226 +/**
10227 + * Move everything contained in src to dst and reset src.
10228 + *
10229 + * @warning: dst is not unreferenced, but directly overwritten without reading
10230 + *           or deallocating its contents. Call av_frame_unref(dst) manually
10231 + *           before calling this function to ensure that no memory is leaked.
10232 + */
10233 +void av_frame_move_ref(AVFrame *dst, AVFrame *src);
10234 +
10235 +/**
10236 + * Allocate new buffer(s) for audio or video data.
10237 + *
10238 + * The following fields must be set on frame before calling this function:
10239 + * - format (pixel format for video, sample format for audio)
10240 + * - width and height for video
10241 + * - nb_samples and channel_layout for audio
10242 + *
10243 + * This function will fill AVFrame.data and AVFrame.buf arrays and, if
10244 + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
10245 + * For planar formats, one buffer will be allocated for each plane.
10246 + *
10247 + * @warning: if frame already has been allocated, calling this function will
10248 + *           leak memory. In addition, undefined behavior can occur in certain
10249 + *           cases.
10250 + *
10251 + * @param frame frame in which to store the new buffers.
10252 + * @param align Required buffer size alignment. If equal to 0, alignment will be
10253 + *              chosen automatically for the current CPU. It is highly
10254 + *              recommended to pass 0 here unless you know what you are doing.
10255 + *
10256 + * @return 0 on success, a negative AVERROR on error.
10257 + */
10258 +int av_frame_get_buffer(AVFrame *frame, int align);
10259 +
10260 +/**
10261 + * Check if the frame data is writable.
10262 + *
10263 + * @return A positive value if the frame data is writable (which is true if and
10264 + * only if each of the underlying buffers has only one reference, namely the one
10265 + * stored in this frame). Return 0 otherwise.
10266 + *
10267 + * If 1 is returned the answer is valid until av_buffer_ref() is called on any
10268 + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
10269 + *
10270 + * @see av_frame_make_writable(), av_buffer_is_writable()
10271 + */
10272 +int av_frame_is_writable(AVFrame *frame);
10273 +
10274 +/**
10275 + * Ensure that the frame data is writable, avoiding data copy if possible.
10276 + *
10277 + * Do nothing if the frame is writable, allocate new buffers and copy the data
10278 + * if it is not.
10279 + *
10280 + * @return 0 on success, a negative AVERROR on error.
10281 + *
10282 + * @see av_frame_is_writable(), av_buffer_is_writable(),
10283 + * av_buffer_make_writable()
10284 + */
10285 +int av_frame_make_writable(AVFrame *frame);
10286 +
10287 +/**
10288 + * Copy the frame data from src to dst.
10289 + *
10290 + * This function does not allocate anything, dst must be already initialized and
10291 + * allocated with the same parameters as src.
10292 + *
10293 + * This function only copies the frame data (i.e. the contents of the data /
10294 + * extended data arrays), not any other properties.
10295 + *
10296 + * @return >= 0 on success, a negative AVERROR on error.
10297 + */
10298 +int av_frame_copy(AVFrame *dst, const AVFrame *src);
10299 +
10300 +/**
10301 + * Copy only "metadata" fields from src to dst.
10302 + *
10303 + * Metadata for the purpose of this function are those fields that do not affect
10304 + * the data layout in the buffers.  E.g. pts, sample rate (for audio) or sample
10305 + * aspect ratio (for video), but not width/height or channel layout.
10306 + * Side data is also copied.
10307 + */
10308 +int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
10309 +
10310 +/**
10311 + * Get the buffer reference a given data plane is stored in.
10312 + *
10313 + * @param plane index of the data plane of interest in frame->extended_data.
10314 + *
10315 + * @return the buffer reference that contains the plane or NULL if the input
10316 + * frame is not valid.
10317 + */
10318 +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
10319 +
10320 +/**
10321 + * Add a new side data to a frame.
10322 + *
10323 + * @param frame a frame to which the side data should be added
10324 + * @param type type of the added side data
10325 + * @param size size of the side data
10326 + *
10327 + * @return newly added side data on success, NULL on error
10328 + */
10329 +AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
10330 +                                        enum AVFrameSideDataType type,
10331 +                                        int size);
10332 +
10333 +/**
10334 + * Add a new side data to a frame from an existing AVBufferRef
10335 + *
10336 + * @param frame a frame to which the side data should be added
10337 + * @param type  the type of the added side data
10338 + * @param buf   an AVBufferRef to add as side data. The ownership of
10339 + *              the reference is transferred to the frame.
10340 + *
10341 + * @return newly added side data on success, NULL on error. On failure
10342 + *         the frame is unchanged and the AVBufferRef remains owned by
10343 + *         the caller.
10344 + */
10345 +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
10346 +                                                 enum AVFrameSideDataType type,
10347 +                                                 AVBufferRef *buf);
10348 +
10349 +/**
10350 + * @return a pointer to the side data of a given type on success, NULL if there
10351 + * is no side data with such type in this frame.
10352 + */
10353 +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
10354 +                                        enum AVFrameSideDataType type);
10355 +
10356 +/**
10357 + * If side data of the supplied type exists in the frame, free it and remove it
10358 + * from the frame.
10359 + */
10360 +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
10361 +
10362 +
10363 +/**
10364 + * Flags for frame cropping.
10365 + */
10366 +enum {
10367 +    /**
10368 +     * Apply the maximum possible cropping, even if it requires setting the
10369 +     * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
10370 +     * to FFmpeg API is generally not allowed, and causes undefined behavior
10371 +     * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
10372 +     * are explicitly documented to accept it. Use this flag only if you
10373 +     * absolutely know what you are doing.
10374 +     */
10375 +    AV_FRAME_CROP_UNALIGNED     = 1 << 0,
10376 +};
10377 +
10378 +/**
10379 + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
10380 + * crop_bottom fields. If cropping is successful, the function will adjust the
10381 + * data pointers and the width/height fields, and set the crop fields to 0.
10382 + *
10383 + * In all cases, the cropping boundaries will be rounded to the inherent
10384 + * alignment of the pixel format. In some cases, such as for opaque hwaccel
10385 + * formats, the left/top cropping is ignored. The crop fields are set to 0 even
10386 + * if the cropping was rounded or ignored.
10387 + *
10388 + * @param frame the frame which should be cropped
10389 + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
10390 + *
10391 + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
10392 + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
10393 + */
10394 +int av_frame_apply_cropping(AVFrame *frame, int flags);
10395 +
10396 +/**
10397 + * @return a string identifying the side data type
10398 + */
10399 +const char *av_frame_side_data_name(enum AVFrameSideDataType type);
10400 +
10401 +/**
10402 + * @}
10403 + */
10404 +
10405 +#endif /* AVUTIL_FRAME_H */
10406 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10407 new file mode 100644
10408 --- /dev/null
10409 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10410 @@ -0,0 +1,584 @@
10411 +/*
10412 + * This file is part of FFmpeg.
10413 + *
10414 + * FFmpeg is free software; you can redistribute it and/or
10415 + * modify it under the terms of the GNU Lesser General Public
10416 + * License as published by the Free Software Foundation; either
10417 + * version 2.1 of the License, or (at your option) any later version.
10418 + *
10419 + * FFmpeg is distributed in the hope that it will be useful,
10420 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10421 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10422 + * Lesser General Public License for more details.
10423 + *
10424 + * You should have received a copy of the GNU Lesser General Public
10425 + * License along with FFmpeg; if not, write to the Free Software
10426 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
10427 + */
10428 +
10429 +#ifndef AVUTIL_HWCONTEXT_H
10430 +#define AVUTIL_HWCONTEXT_H
10431 +
10432 +#include "buffer.h"
10433 +#include "frame.h"
10434 +#include "log.h"
10435 +#include "pixfmt.h"
10436 +
10437 +enum AVHWDeviceType {
10438 +    AV_HWDEVICE_TYPE_NONE,
10439 +    AV_HWDEVICE_TYPE_VDPAU,
10440 +    AV_HWDEVICE_TYPE_CUDA,
10441 +    AV_HWDEVICE_TYPE_VAAPI,
10442 +    AV_HWDEVICE_TYPE_DXVA2,
10443 +    AV_HWDEVICE_TYPE_QSV,
10444 +    AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
10445 +    AV_HWDEVICE_TYPE_D3D11VA,
10446 +    AV_HWDEVICE_TYPE_DRM,
10447 +    AV_HWDEVICE_TYPE_OPENCL,
10448 +    AV_HWDEVICE_TYPE_MEDIACODEC,
10449 +};
10450 +
10451 +typedef struct AVHWDeviceInternal AVHWDeviceInternal;
10452 +
10453 +/**
10454 + * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
10455 + * i.e. state that is not tied to a concrete processing configuration.
10456 + * E.g., in an API that supports hardware-accelerated encoding and decoding,
10457 + * this struct will (if possible) wrap the state that is common to both encoding
10458 + * and decoding and from which specific instances of encoders or decoders can be
10459 + * derived.
10460 + *
10461 + * This struct is reference-counted with the AVBuffer mechanism. The
10462 + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
10463 + * points to the actual AVHWDeviceContext. Further objects derived from
10464 + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
10465 + * specific properties) will hold an internal reference to it. After all the
10466 + * references are released, the AVHWDeviceContext itself will be freed,
10467 + * optionally invoking a user-specified callback for uninitializing the hardware
10468 + * state.
10469 + */
10470 +typedef struct AVHWDeviceContext {
10471 +    /**
10472 +     * A class for logging. Set by av_hwdevice_ctx_alloc().
10473 +     */
10474 +    const AVClass *av_class;
10475 +
10476 +    /**
10477 +     * Private data used internally by libavutil. Must not be accessed in any
10478 +     * way by the caller.
10479 +     */
10480 +    AVHWDeviceInternal *internal;
10481 +
10482 +    /**
10483 +     * This field identifies the underlying API used for hardware access.
10484 +     *
10485 +     * This field is set when this struct is allocated and never changed
10486 +     * afterwards.
10487 +     */
10488 +    enum AVHWDeviceType type;
10489 +
10490 +    /**
10491 +     * The format-specific data, allocated and freed by libavutil along with
10492 +     * this context.
10493 +     *
10494 +     * Should be cast by the user to the format-specific context defined in the
10495 +     * corresponding header (hwcontext_*.h) and filled as described in the
10496 +     * documentation before calling av_hwdevice_ctx_init().
10497 +     *
10498 +     * After calling av_hwdevice_ctx_init() this struct should not be modified
10499 +     * by the caller.
10500 +     */
10501 +    void *hwctx;
10502 +
10503 +    /**
10504 +     * This field may be set by the caller before calling av_hwdevice_ctx_init().
10505 +     *
10506 +     * If non-NULL, this callback will be called when the last reference to
10507 +     * this context is unreferenced, immediately before it is freed.
10508 +     *
10509 +     * @note when other objects (e.g an AVHWFramesContext) are derived from this
10510 +     *       struct, this callback will be invoked after all such child objects
10511 +     *       are fully uninitialized and their respective destructors invoked.
10512 +     */
10513 +    void (*free)(struct AVHWDeviceContext *ctx);
10514 +
10515 +    /**
10516 +     * Arbitrary user data, to be used e.g. by the free() callback.
10517 +     */
10518 +    void *user_opaque;
10519 +} AVHWDeviceContext;
10520 +
10521 +typedef struct AVHWFramesInternal AVHWFramesInternal;
10522 +
10523 +/**
10524 + * This struct describes a set or pool of "hardware" frames (i.e. those with
10525 + * data not located in normal system memory). All the frames in the pool are
10526 + * assumed to be allocated in the same way and interchangeable.
10527 + *
10528 + * This struct is reference-counted with the AVBuffer mechanism and tied to a
10529 + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
10530 + * yields a reference, whose data field points to the actual AVHWFramesContext
10531 + * struct.
10532 + */
10533 +typedef struct AVHWFramesContext {
10534 +    /**
10535 +     * A class for logging.
10536 +     */
10537 +    const AVClass *av_class;
10538 +
10539 +    /**
10540 +     * Private data used internally by libavutil. Must not be accessed in any
10541 +     * way by the caller.
10542 +     */
10543 +    AVHWFramesInternal *internal;
10544 +
10545 +    /**
10546 +     * A reference to the parent AVHWDeviceContext. This reference is owned and
10547 +     * managed by the enclosing AVHWFramesContext, but the caller may derive
10548 +     * additional references from it.
10549 +     */
10550 +    AVBufferRef *device_ref;
10551 +
10552 +    /**
10553 +     * The parent AVHWDeviceContext. This is simply a pointer to
10554 +     * device_ref->data provided for convenience.
10555 +     *
10556 +     * Set by libavutil in av_hwframe_ctx_init().
10557 +     */
10558 +    AVHWDeviceContext *device_ctx;
10559 +
10560 +    /**
10561 +     * The format-specific data, allocated and freed automatically along with
10562 +     * this context.
10563 +     *
10564 +     * Should be cast by the user to the format-specific context defined in the
10565 +     * corresponding header (hwframe_*.h) and filled as described in the
10566 +     * documentation before calling av_hwframe_ctx_init().
10567 +     *
10568 +     * After any frames using this context are created, the contents of this
10569 +     * struct should not be modified by the caller.
10570 +     */
10571 +    void *hwctx;
10572 +
10573 +    /**
10574 +     * This field may be set by the caller before calling av_hwframe_ctx_init().
10575 +     *
10576 +     * If non-NULL, this callback will be called when the last reference to
10577 +     * this context is unreferenced, immediately before it is freed.
10578 +     */
10579 +    void (*free)(struct AVHWFramesContext *ctx);
10580 +
10581 +    /**
10582 +     * Arbitrary user data, to be used e.g. by the free() callback.
10583 +     */
10584 +    void *user_opaque;
10585 +
10586 +    /**
10587 +     * A pool from which the frames are allocated by av_hwframe_get_buffer().
10588 +     * This field may be set by the caller before calling av_hwframe_ctx_init().
10589 +     * The buffers returned by calling av_buffer_pool_get() on this pool must
10590 +     * have the properties described in the documentation in the corresponding hw
10591 +     * type's header (hwcontext_*.h). The pool will be freed strictly before
10592 +     * this struct's free() callback is invoked.
10593 +     *
10594 +     * This field may be NULL, then libavutil will attempt to allocate a pool
10595 +     * internally. Note that certain device types enforce pools allocated at
10596 +     * fixed size (frame count), which cannot be extended dynamically. In such a
10597 +     * case, initial_pool_size must be set appropriately.
10598 +     */
10599 +    AVBufferPool *pool;
10600 +
10601 +    /**
10602 +     * Initial size of the frame pool. If a device type does not support
10603 +     * dynamically resizing the pool, then this is also the maximum pool size.
10604 +     *
10605 +     * May be set by the caller before calling av_hwframe_ctx_init(). Must be
10606 +     * set if pool is NULL and the device type does not support dynamic pools.
10607 +     */
10608 +    int initial_pool_size;
10609 +
10610 +    /**
10611 +     * The pixel format identifying the underlying HW surface type.
10612 +     *
10613 +     * Must be a hwaccel format, i.e. the corresponding descriptor must have the
10614 +     * AV_PIX_FMT_FLAG_HWACCEL flag set.
10615 +     *
10616 +     * Must be set by the user before calling av_hwframe_ctx_init().
10617 +     */
10618 +    enum AVPixelFormat format;
10619 +
10620 +    /**
10621 +     * The pixel format identifying the actual data layout of the hardware
10622 +     * frames.
10623 +     *
10624 +     * Must be set by the caller before calling av_hwframe_ctx_init().
10625 +     *
10626 +     * @note when the underlying API does not provide the exact data layout, but
10627 +     * only the colorspace/bit depth, this field should be set to the fully
10628 +     * planar version of that format (e.g. for 8-bit 420 YUV it should be
10629 +     * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
10630 +     */
10631 +    enum AVPixelFormat sw_format;
10632 +
10633 +    /**
10634 +     * The allocated dimensions of the frames in this pool.
10635 +     *
10636 +     * Must be set by the user before calling av_hwframe_ctx_init().
10637 +     */
10638 +    int width, height;
10639 +} AVHWFramesContext;
10640 +
10641 +/**
10642 + * Look up an AVHWDeviceType by name.
10643 + *
10644 + * @param name String name of the device type (case-insensitive).
10645 + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
10646 + *         not found.
10647 + */
10648 +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
10649 +
10650 +/** Get the string name of an AVHWDeviceType.
10651 + *
10652 + * @param type Type from enum AVHWDeviceType.
10653 + * @return Pointer to a static string containing the name, or NULL if the type
10654 + *         is not valid.
10655 + */
10656 +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
10657 +
10658 +/**
10659 + * Iterate over supported device types.
10660 + *
10661 + * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
10662 + *             returned by this function in subsequent iterations.
10663 + * @return The next usable device type from enum AVHWDeviceType, or
10664 + *         AV_HWDEVICE_TYPE_NONE if there are no more.
10665 + */
10666 +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
10667 +
10668 +/**
10669 + * Allocate an AVHWDeviceContext for a given hardware type.
10670 + *
10671 + * @param type the type of the hardware device to allocate.
10672 + * @return a reference to the newly created AVHWDeviceContext on success or NULL
10673 + *         on failure.
10674 + */
10675 +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
10676 +
10677 +/**
10678 + * Finalize the device context before use. This function must be called after
10679 + * the context is filled with all the required information and before it is
10680 + * used in any way.
10681 + *
10682 + * @param ref a reference to the AVHWDeviceContext
10683 + * @return 0 on success, a negative AVERROR code on failure
10684 + */
10685 +int av_hwdevice_ctx_init(AVBufferRef *ref);
10686 +
10687 +/**
10688 + * Open a device of the specified type and create an AVHWDeviceContext for it.
10689 + *
10690 + * This is a convenience function intended to cover the simple cases. Callers
10691 + * who need to fine-tune device creation/management should open the device
10692 + * manually and then wrap it in an AVHWDeviceContext using
10693 + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
10694 + *
10695 + * The returned context is already initialized and ready for use, the caller
10696 + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
10697 + * the created AVHWDeviceContext are set by this function and should not be
10698 + * touched by the caller.
10699 + *
10700 + * @param device_ctx On success, a reference to the newly-created device context
10701 + *                   will be written here. The reference is owned by the caller
10702 + *                   and must be released with av_buffer_unref() when no longer
10703 + *                   needed. On failure, NULL will be written to this pointer.
10704 + * @param type The type of the device to create.
10705 + * @param device A type-specific string identifying the device to open.
10706 + * @param opts A dictionary of additional (type-specific) options to use in
10707 + *             opening the device. The dictionary remains owned by the caller.
10708 + * @param flags currently unused
10709 + *
10710 + * @return 0 on success, a negative AVERROR code on failure.
10711 + */
10712 +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
10713 +                           const char *device, AVDictionary *opts, int flags);
10714 +
10715 +/**
10716 + * Create a new device of the specified type from an existing device.
10717 + *
10718 + * If the source device is a device of the target type or was originally
10719 + * derived from such a device (possibly through one or more intermediate
10720 + * devices of other types), then this will return a reference to the
10721 + * existing device of the same type as is requested.
10722 + *
10723 + * Otherwise, it will attempt to derive a new device from the given source
10724 + * device.  If direct derivation to the new type is not implemented, it will
10725 + * attempt the same derivation from each ancestor of the source device in
10726 + * turn looking for an implemented derivation method.
10727 + *
10728 + * @param dst_ctx On success, a reference to the newly-created
10729 + *                AVHWDeviceContext.
10730 + * @param type    The type of the new device to create.
10731 + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
10732 + *                used to create the new device.
10733 + * @param flags   Currently unused; should be set to zero.
10734 + * @return        Zero on success, a negative AVERROR code on failure.
10735 + */
10736 +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
10737 +                                   enum AVHWDeviceType type,
10738 +                                   AVBufferRef *src_ctx, int flags);
10739 +
10740 +
10741 +/**
10742 + * Allocate an AVHWFramesContext tied to a given device context.
10743 + *
10744 + * @param device_ctx a reference to a AVHWDeviceContext. This function will make
10745 + *                   a new reference for internal use, the one passed to the
10746 + *                   function remains owned by the caller.
10747 + * @return a reference to the newly created AVHWFramesContext on success or NULL
10748 + *         on failure.
10749 + */
10750 +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
10751 +
10752 +/**
10753 + * Finalize the context before use. This function must be called after the
10754 + * context is filled with all the required information and before it is attached
10755 + * to any frames.
10756 + *
10757 + * @param ref a reference to the AVHWFramesContext
10758 + * @return 0 on success, a negative AVERROR code on failure
10759 + */
10760 +int av_hwframe_ctx_init(AVBufferRef *ref);
10761 +
10762 +/**
10763 + * Allocate a new frame attached to the given AVHWFramesContext.
10764 + *
10765 + * @param hwframe_ctx a reference to an AVHWFramesContext
10766 + * @param frame an empty (freshly allocated or unreffed) frame to be filled with
10767 + *              newly allocated buffers.
10768 + * @param flags currently unused, should be set to zero
10769 + * @return 0 on success, a negative AVERROR code on failure
10770 + */
10771 +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
10772 +
10773 +/**
10774 + * Copy data to or from a hw surface. At least one of dst/src must have an
10775 + * AVHWFramesContext attached.
10776 + *
10777 + * If src has an AVHWFramesContext attached, then the format of dst (if set)
10778 + * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
10779 + * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
10780 + * If dst has an AVHWFramesContext attached, then the format of src must use one
10781 + * of the formats returned by av_hwframe_transfer_get_formats(dst,
10782 + * AV_HWFRAME_TRANSFER_DIRECTION_TO)
10783 + *
10784 + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
10785 + * data buffers will be allocated by this function using av_frame_get_buffer().
10786 + * If dst->format is set, then this format will be used, otherwise (when
10787 + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
10788 + *
10789 + * The two frames must have matching allocated dimensions (i.e. equal to
10790 + * AVHWFramesContext.width/height), since not all device types support
10791 + * transferring a sub-rectangle of the whole surface. The display dimensions
10792 + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
10793 + * also have to be equal for both frames. When the display dimensions are
10794 + * smaller than the allocated dimensions, the content of the padding in the
10795 + * destination frame is unspecified.
10796 + *
10797 + * @param dst the destination frame. dst is not touched on failure.
10798 + * @param src the source frame.
10799 + * @param flags currently unused, should be set to zero
10800 + * @return 0 on success, a negative AVERROR error code on failure.
10801 + */
10802 +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
10803 +
10804 +enum AVHWFrameTransferDirection {
10805 +    /**
10806 +     * Transfer the data from the queried hw frame.
10807 +     */
10808 +    AV_HWFRAME_TRANSFER_DIRECTION_FROM,
10809 +
10810 +    /**
10811 +     * Transfer the data to the queried hw frame.
10812 +     */
10813 +    AV_HWFRAME_TRANSFER_DIRECTION_TO,
10814 +};
10815 +
10816 +/**
10817 + * Get a list of possible source or target formats usable in
10818 + * av_hwframe_transfer_data().
10819 + *
10820 + * @param hwframe_ctx the frame context to obtain the information for
10821 + * @param dir the direction of the transfer
10822 + * @param formats the pointer to the output format list will be written here.
10823 + *                The list is terminated with AV_PIX_FMT_NONE and must be freed
10824 + *                by the caller when no longer needed using av_free().
10825 + *                If this function returns successfully, the format list will
10826 + *                have at least one item (not counting the terminator).
10827 + *                On failure, the contents of this pointer are unspecified.
10828 + * @param flags currently unused, should be set to zero
10829 + * @return 0 on success, a negative AVERROR code on failure.
10830 + */
10831 +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
10832 +                                    enum AVHWFrameTransferDirection dir,
10833 +                                    enum AVPixelFormat **formats, int flags);
10834 +
10835 +
10836 +/**
10837 + * This struct describes the constraints on hardware frames attached to
10838 + * a given device with a hardware-specific configuration.  This is returned
10839 + * by av_hwdevice_get_hwframe_constraints() and must be freed by
10840 + * av_hwframe_constraints_free() after use.
10841 + */
10842 +typedef struct AVHWFramesConstraints {
10843 +    /**
10844 +     * A list of possible values for format in the hw_frames_ctx,
10845 +     * terminated by AV_PIX_FMT_NONE.  This member will always be filled.
10846 +     */
10847 +    enum AVPixelFormat *valid_hw_formats;
10848 +
10849 +    /**
10850 +     * A list of possible values for sw_format in the hw_frames_ctx,
10851 +     * terminated by AV_PIX_FMT_NONE.  Can be NULL if this information is
10852 +     * not known.
10853 +     */
10854 +    enum AVPixelFormat *valid_sw_formats;
10855 +
10856 +    /**
10857 +     * The minimum size of frames in this hw_frames_ctx.
10858 +     * (Zero if not known.)
10859 +     */
10860 +    int min_width;
10861 +    int min_height;
10862 +
10863 +    /**
10864 +     * The maximum size of frames in this hw_frames_ctx.
10865 +     * (INT_MAX if not known / no limit.)
10866 +     */
10867 +    int max_width;
10868 +    int max_height;
10869 +} AVHWFramesConstraints;
10870 +
10871 +/**
10872 + * Allocate a HW-specific configuration structure for a given HW device.
10873 + * After use, the user must free all members as required by the specific
10874 + * hardware structure being used, then free the structure itself with
10875 + * av_free().
10876 + *
10877 + * @param device_ctx a reference to the associated AVHWDeviceContext.
10878 + * @return The newly created HW-specific configuration structure on
10879 + *         success or NULL on failure.
10880 + */
10881 +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
10882 +
10883 +/**
10884 + * Get the constraints on HW frames given a device and the HW-specific
10885 + * configuration to be used with that device.  If no HW-specific
10886 + * configuration is provided, returns the maximum possible capabilities
10887 + * of the device.
10888 + *
10889 + * @param ref a reference to the associated AVHWDeviceContext.
10890 + * @param hwconfig a filled HW-specific configuration structure, or NULL
10891 + *        to return the maximum possible capabilities of the device.
10892 + * @return AVHWFramesConstraints structure describing the constraints
10893 + *         on the device, or NULL if not available.
10894 + */
10895 +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
10896 +                                                           const void *hwconfig);
10897 +
10898 +/**
10899 + * Free an AVHWFrameConstraints structure.
10900 + *
10901 + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
10902 + */
10903 +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
10904 +
10905 +
10906 +/**
10907 + * Flags to apply to frame mappings.
10908 + */
10909 +enum {
10910 +    /**
10911 +     * The mapping must be readable.
10912 +     */
10913 +    AV_HWFRAME_MAP_READ      = 1 << 0,
10914 +    /**
10915 +     * The mapping must be writeable.
10916 +     */
10917 +    AV_HWFRAME_MAP_WRITE     = 1 << 1,
10918 +    /**
10919 +     * The mapped frame will be overwritten completely in subsequent
10920 +     * operations, so the current frame data need not be loaded.  Any values
10921 +     * which are not overwritten are unspecified.
10922 +     */
10923 +    AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
10924 +    /**
10925 +     * The mapping must be direct.  That is, there must not be any copying in
10926 +     * the map or unmap steps.  Note that performance of direct mappings may
10927 +     * be much lower than normal memory.
10928 +     */
10929 +    AV_HWFRAME_MAP_DIRECT    = 1 << 3,
10930 +};
10931 +
10932 +/**
10933 + * Map a hardware frame.
10934 + *
10935 + * This has a number of different possible effects, depending on the format
10936 + * and origin of the src and dst frames.  On input, src should be a usable
10937 + * frame with valid buffers and dst should be blank (typically as just created
10938 + * by av_frame_alloc()).  src should have an associated hwframe context, and
10939 + * dst may optionally have a format and associated hwframe context.
10940 + *
10941 + * If src was created by mapping a frame from the hwframe context of dst,
10942 + * then this function undoes the mapping - dst is replaced by a reference to
10943 + * the frame that src was originally mapped from.
10944 + *
10945 + * If both src and dst have an associated hwframe context, then this function
10946 + * attempts to map the src frame from its hardware context to that of dst and
10947 + * then fill dst with appropriate data to be usable there.  This will only be
10948 + * possible if the hwframe contexts and associated devices are compatible -
10949 + * given compatible devices, av_hwframe_ctx_create_derived() can be used to
10950 + * create a hwframe context for dst in which mapping should be possible.
10951 + *
10952 + * If src has a hwframe context but dst does not, then the src frame is
10953 + * mapped to normal memory and should thereafter be usable as a normal frame.
10954 + * If the format is set on dst, then the mapping will attempt to create dst
10955 + * with that format and fail if it is not possible.  If format is unset (is
10956 + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
10957 + * format to use is (probably the sw_format of the src hwframe context).
10958 + *
10959 + * A return value of AVERROR(ENOSYS) indicates that the mapping is not
10960 + * possible with the given arguments and hwframe setup, while other return
10961 + * values indicate that it failed somehow.
10962 + *
10963 + * @param dst Destination frame, to contain the mapping.
10964 + * @param src Source frame, to be mapped.
10965 + * @param flags Some combination of AV_HWFRAME_MAP_* flags.
10966 + * @return Zero on success, negative AVERROR code on failure.
10967 + */
10968 +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
10969 +
10970 +
10971 +/**
10972 + * Create and initialise an AVHWFramesContext as a mapping of another existing
10973 + * AVHWFramesContext on a different device.
10974 + *
10975 + * av_hwframe_ctx_init() should not be called after this.
10976 + *
10977 + * @param derived_frame_ctx  On success, a reference to the newly created
10978 + *                           AVHWFramesContext.
10979 + * @param derived_device_ctx A reference to the device to create the new
10980 + *                           AVHWFramesContext on.
10981 + * @param source_frame_ctx   A reference to an existing AVHWFramesContext
10982 + *                           which will be mapped to the derived context.
10983 + * @param flags  Some combination of AV_HWFRAME_MAP_* flags, defining the
10984 + *               mapping parameters to apply to frames which are allocated
10985 + *               in the derived device.
10986 + * @return       Zero on success, negative AVERROR code on failure.
10987 + */
10988 +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
10989 +                                  enum AVPixelFormat format,
10990 +                                  AVBufferRef *derived_device_ctx,
10991 +                                  AVBufferRef *source_frame_ctx,
10992 +                                  int flags);
10993 +
10994 +#endif /* AVUTIL_HWCONTEXT_H */
10995 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
10996 new file mode 100644
10997 --- /dev/null
10998 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
10999 @@ -0,0 +1,77 @@
11000 +/*
11001 + * Copyright (c) 2011 Mans Rullgard
11002 + *
11003 + * This file is part of FFmpeg.
11004 + *
11005 + * FFmpeg is free software; you can redistribute it and/or
11006 + * modify it under the terms of the GNU Lesser General Public
11007 + * License as published by the Free Software Foundation; either
11008 + * version 2.1 of the License, or (at your option) any later version.
11009 + *
11010 + * FFmpeg is distributed in the hope that it will be useful,
11011 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11012 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11013 + * Lesser General Public License for more details.
11014 + *
11015 + * You should have received a copy of the GNU Lesser General Public
11016 + * License along with FFmpeg; if not, write to the Free Software
11017 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11018 + */
11019 +
11020 +#ifndef AVUTIL_INTFLOAT_H
11021 +#define AVUTIL_INTFLOAT_H
11022 +
11023 +#include <stdint.h>
11024 +#include "attributes.h"
11025 +
11026 +union av_intfloat32 {
11027 +    uint32_t i;
11028 +    float    f;
11029 +};
11030 +
11031 +union av_intfloat64 {
11032 +    uint64_t i;
11033 +    double   f;
11034 +};
11035 +
11036 +/**
11037 + * Reinterpret a 32-bit integer as a float.
11038 + */
11039 +static av_always_inline float av_int2float(uint32_t i)
11040 +{
11041 +    union av_intfloat32 v;
11042 +    v.i = i;
11043 +    return v.f;
11044 +}
11045 +
11046 +/**
11047 + * Reinterpret a float as a 32-bit integer.
11048 + */
11049 +static av_always_inline uint32_t av_float2int(float f)
11050 +{
11051 +    union av_intfloat32 v;
11052 +    v.f = f;
11053 +    return v.i;
11054 +}
11055 +
11056 +/**
11057 + * Reinterpret a 64-bit integer as a double.
11058 + */
11059 +static av_always_inline double av_int2double(uint64_t i)
11060 +{
11061 +    union av_intfloat64 v;
11062 +    v.i = i;
11063 +    return v.f;
11064 +}
11065 +
11066 +/**
11067 + * Reinterpret a double as a 64-bit integer.
11068 + */
11069 +static av_always_inline uint64_t av_double2int(double f)
11070 +{
11071 +    union av_intfloat64 v;
11072 +    v.f = f;
11073 +    return v.i;
11074 +}
11075 +
11076 +#endif /* AVUTIL_INTFLOAT_H */
11077 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11078 new file mode 100644
11079 --- /dev/null
11080 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11081 @@ -0,0 +1,362 @@
11082 +/*
11083 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11084 + *
11085 + * This file is part of FFmpeg.
11086 + *
11087 + * FFmpeg is free software; you can redistribute it and/or
11088 + * modify it under the terms of the GNU Lesser General Public
11089 + * License as published by the Free Software Foundation; either
11090 + * version 2.1 of the License, or (at your option) any later version.
11091 + *
11092 + * FFmpeg is distributed in the hope that it will be useful,
11093 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11094 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11095 + * Lesser General Public License for more details.
11096 + *
11097 + * You should have received a copy of the GNU Lesser General Public
11098 + * License along with FFmpeg; if not, write to the Free Software
11099 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11100 + */
11101 +
11102 +#ifndef AVUTIL_LOG_H
11103 +#define AVUTIL_LOG_H
11104 +
11105 +#include <stdarg.h>
11106 +#include "avutil.h"
11107 +#include "attributes.h"
11108 +#include "version.h"
11109 +
11110 +typedef enum {
11111 +    AV_CLASS_CATEGORY_NA = 0,
11112 +    AV_CLASS_CATEGORY_INPUT,
11113 +    AV_CLASS_CATEGORY_OUTPUT,
11114 +    AV_CLASS_CATEGORY_MUXER,
11115 +    AV_CLASS_CATEGORY_DEMUXER,
11116 +    AV_CLASS_CATEGORY_ENCODER,
11117 +    AV_CLASS_CATEGORY_DECODER,
11118 +    AV_CLASS_CATEGORY_FILTER,
11119 +    AV_CLASS_CATEGORY_BITSTREAM_FILTER,
11120 +    AV_CLASS_CATEGORY_SWSCALER,
11121 +    AV_CLASS_CATEGORY_SWRESAMPLER,
11122 +    AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
11123 +    AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
11124 +    AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
11125 +    AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
11126 +    AV_CLASS_CATEGORY_DEVICE_OUTPUT,
11127 +    AV_CLASS_CATEGORY_DEVICE_INPUT,
11128 +    AV_CLASS_CATEGORY_NB  ///< not part of ABI/API
11129 +}AVClassCategory;
11130 +
11131 +#define AV_IS_INPUT_DEVICE(category) \
11132 +    (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
11133 +     ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
11134 +     ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
11135 +
11136 +#define AV_IS_OUTPUT_DEVICE(category) \
11137 +    (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
11138 +     ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
11139 +     ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
11140 +
11141 +struct AVOptionRanges;
11142 +
11143 +/**
11144 + * Describe the class of an AVClass context structure. That is an
11145 + * arbitrary struct of which the first field is a pointer to an
11146 + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
11147 + */
11148 +typedef struct AVClass {
11149 +    /**
11150 +     * The name of the class; usually it is the same name as the
11151 +     * context structure type to which the AVClass is associated.
11152 +     */
11153 +    const char* class_name;
11154 +
11155 +    /**
11156 +     * A pointer to a function which returns the name of a context
11157 +     * instance ctx associated with the class.
11158 +     */
11159 +    const char* (*item_name)(void* ctx);
11160 +
11161 +    /**
11162 +     * a pointer to the first option specified in the class if any or NULL
11163 +     *
11164 +     * @see av_set_default_options()
11165 +     */
11166 +    const struct AVOption *option;
11167 +
11168 +    /**
11169 +     * LIBAVUTIL_VERSION with which this structure was created.
11170 +     * This is used to allow fields to be added without requiring major
11171 +     * version bumps everywhere.
11172 +     */
11173 +
11174 +    int version;
11175 +
11176 +    /**
11177 +     * Offset in the structure where log_level_offset is stored.
11178 +     * 0 means there is no such variable
11179 +     */
11180 +    int log_level_offset_offset;
11181 +
11182 +    /**
11183 +     * Offset in the structure where a pointer to the parent context for
11184 +     * logging is stored. For example a decoder could pass its AVCodecContext
11185 +     * to eval as such a parent context, which an av_log() implementation
11186 +     * could then leverage to display the parent context.
11187 +     * The offset can be NULL.
11188 +     */
11189 +    int parent_log_context_offset;
11190 +
11191 +    /**
11192 +     * Return next AVOptions-enabled child or NULL
11193 +     */
11194 +    void* (*child_next)(void *obj, void *prev);
11195 +
11196 +    /**
11197 +     * Return an AVClass corresponding to the next potential
11198 +     * AVOptions-enabled child.
11199 +     *
11200 +     * The difference between child_next and this is that
11201 +     * child_next iterates over _already existing_ objects, while
11202 +     * child_class_next iterates over _all possible_ children.
11203 +     */
11204 +    const struct AVClass* (*child_class_next)(const struct AVClass *prev);
11205 +
11206 +    /**
11207 +     * Category used for visualization (like color)
11208 +     * This is only set if the category is equal for all objects using this class.
11209 +     * available since version (51 << 16 | 56 << 8 | 100)
11210 +     */
11211 +    AVClassCategory category;
11212 +
11213 +    /**
11214 +     * Callback to return the category.
11215 +     * available since version (51 << 16 | 59 << 8 | 100)
11216 +     */
11217 +    AVClassCategory (*get_category)(void* ctx);
11218 +
11219 +    /**
11220 +     * Callback to return the supported/allowed ranges.
11221 +     * available since version (52.12)
11222 +     */
11223 +    int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
11224 +} AVClass;
11225 +
11226 +/**
11227 + * @addtogroup lavu_log
11228 + *
11229 + * @{
11230 + *
11231 + * @defgroup lavu_log_constants Logging Constants
11232 + *
11233 + * @{
11234 + */
11235 +
11236 +/**
11237 + * Print no output.
11238 + */
11239 +#define AV_LOG_QUIET    -8
11240 +
11241 +/**
11242 + * Something went really wrong and we will crash now.
11243 + */
11244 +#define AV_LOG_PANIC     0
11245 +
11246 +/**
11247 + * Something went wrong and recovery is not possible.
11248 + * For example, no header was found for a format which depends
11249 + * on headers or an illegal combination of parameters is used.
11250 + */
11251 +#define AV_LOG_FATAL     8
11252 +
11253 +/**
11254 + * Something went wrong and cannot losslessly be recovered.
11255 + * However, not all future data is affected.
11256 + */
11257 +#define AV_LOG_ERROR    16
11258 +
11259 +/**
11260 + * Something somehow does not look correct. This may or may not
11261 + * lead to problems. An example would be the use of '-vstrict -2'.
11262 + */
11263 +#define AV_LOG_WARNING  24
11264 +
11265 +/**
11266 + * Standard information.
11267 + */
11268 +#define AV_LOG_INFO     32
11269 +
11270 +/**
11271 + * Detailed information.
11272 + */
11273 +#define AV_LOG_VERBOSE  40
11274 +
11275 +/**
11276 + * Stuff which is only useful for libav* developers.
11277 + */
11278 +#define AV_LOG_DEBUG    48
11279 +
11280 +/**
11281 + * Extremely verbose debugging, useful for libav* development.
11282 + */
11283 +#define AV_LOG_TRACE    56
11284 +
11285 +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
11286 +
11287 +/**
11288 + * @}
11289 + */
11290 +
11291 +/**
11292 + * Sets additional colors for extended debugging sessions.
11293 + * @code
11294 +   av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
11295 +   @endcode
11296 + * Requires 256color terminal support. Uses outside debugging is not
11297 + * recommended.
11298 + */
11299 +#define AV_LOG_C(x) ((x) << 8)
11300 +
11301 +/**
11302 + * Send the specified message to the log if the level is less than or equal
11303 + * to the current av_log_level. By default, all logging messages are sent to
11304 + * stderr. This behavior can be altered by setting a different logging callback
11305 + * function.
11306 + * @see av_log_set_callback
11307 + *
11308 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11309 + *        pointer to an AVClass struct or NULL if general log.
11310 + * @param level The importance level of the message expressed using a @ref
11311 + *        lavu_log_constants "Logging Constant".
11312 + * @param fmt The format string (printf-compatible) that specifies how
11313 + *        subsequent arguments are converted to output.
11314 + */
11315 +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
11316 +
11317 +
11318 +/**
11319 + * Send the specified message to the log if the level is less than or equal
11320 + * to the current av_log_level. By default, all logging messages are sent to
11321 + * stderr. This behavior can be altered by setting a different logging callback
11322 + * function.
11323 + * @see av_log_set_callback
11324 + *
11325 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11326 + *        pointer to an AVClass struct.
11327 + * @param level The importance level of the message expressed using a @ref
11328 + *        lavu_log_constants "Logging Constant".
11329 + * @param fmt The format string (printf-compatible) that specifies how
11330 + *        subsequent arguments are converted to output.
11331 + * @param vl The arguments referenced by the format string.
11332 + */
11333 +void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
11334 +
11335 +/**
11336 + * Get the current log level
11337 + *
11338 + * @see lavu_log_constants
11339 + *
11340 + * @return Current log level
11341 + */
11342 +int av_log_get_level(void);
11343 +
11344 +/**
11345 + * Set the log level
11346 + *
11347 + * @see lavu_log_constants
11348 + *
11349 + * @param level Logging level
11350 + */
11351 +void av_log_set_level(int level);
11352 +
11353 +/**
11354 + * Set the logging callback
11355 + *
11356 + * @note The callback must be thread safe, even if the application does not use
11357 + *       threads itself as some codecs are multithreaded.
11358 + *
11359 + * @see av_log_default_callback
11360 + *
11361 + * @param callback A logging function with a compatible signature.
11362 + */
11363 +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
11364 +
11365 +/**
11366 + * Default logging callback
11367 + *
11368 + * It prints the message to stderr, optionally colorizing it.
11369 + *
11370 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11371 + *        pointer to an AVClass struct.
11372 + * @param level The importance level of the message expressed using a @ref
11373 + *        lavu_log_constants "Logging Constant".
11374 + * @param fmt The format string (printf-compatible) that specifies how
11375 + *        subsequent arguments are converted to output.
11376 + * @param vl The arguments referenced by the format string.
11377 + */
11378 +void av_log_default_callback(void *avcl, int level, const char *fmt,
11379 +                             va_list vl);
11380 +
11381 +/**
11382 + * Return the context name
11383 + *
11384 + * @param  ctx The AVClass context
11385 + *
11386 + * @return The AVClass class_name
11387 + */
11388 +const char* av_default_item_name(void* ctx);
11389 +AVClassCategory av_default_get_category(void *ptr);
11390 +
11391 +/**
11392 + * Format a line of log the same way as the default callback.
11393 + * @param line          buffer to receive the formatted line
11394 + * @param line_size     size of the buffer
11395 + * @param print_prefix  used to store whether the prefix must be printed;
11396 + *                      must point to a persistent integer initially set to 1
11397 + */
11398 +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
11399 +                        char *line, int line_size, int *print_prefix);
11400 +
11401 +/**
11402 + * Format a line of log the same way as the default callback.
11403 + * @param line          buffer to receive the formatted line;
11404 + *                      may be NULL if line_size is 0
11405 + * @param line_size     size of the buffer; at most line_size-1 characters will
11406 + *                      be written to the buffer, plus one null terminator
11407 + * @param print_prefix  used to store whether the prefix must be printed;
11408 + *                      must point to a persistent integer initially set to 1
11409 + * @return Returns a negative value if an error occurred, otherwise returns
11410 + *         the number of characters that would have been written for a
11411 + *         sufficiently large buffer, not including the terminating null
11412 + *         character. If the return value is not less than line_size, it means
11413 + *         that the log message was truncated to fit the buffer.
11414 + */
11415 +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
11416 +                        char *line, int line_size, int *print_prefix);
11417 +
11418 +/**
11419 + * Skip repeated messages, this requires the user app to use av_log() instead of
11420 + * (f)printf as the 2 would otherwise interfere and lead to
11421 + * "Last message repeated x times" messages below (f)printf messages with some
11422 + * bad luck.
11423 + * Also to receive the last, "last repeated" line if any, the user app must
11424 + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
11425 + */
11426 +#define AV_LOG_SKIP_REPEATED 1
11427 +
11428 +/**
11429 + * Include the log severity in messages originating from codecs.
11430 + *
11431 + * Results in messages such as:
11432 + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
11433 + */
11434 +#define AV_LOG_PRINT_LEVEL 2
11435 +
11436 +void av_log_set_flags(int arg);
11437 +int av_log_get_flags(void);
11438 +
11439 +/**
11440 + * @}
11441 + */
11442 +
11443 +#endif /* AVUTIL_LOG_H */
11444 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11445 new file mode 100644
11446 --- /dev/null
11447 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11448 @@ -0,0 +1,50 @@
11449 +/*
11450 + * This file is part of FFmpeg.
11451 + *
11452 + * FFmpeg is free software; you can redistribute it and/or
11453 + * modify it under the terms of the GNU Lesser General Public
11454 + * License as published by the Free Software Foundation; either
11455 + * version 2.1 of the License, or (at your option) any later version.
11456 + *
11457 + * FFmpeg is distributed in the hope that it will be useful,
11458 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11459 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11460 + * Lesser General Public License for more details.
11461 + *
11462 + * You should have received a copy of the GNU Lesser General Public
11463 + * License along with FFmpeg; if not, write to the Free Software
11464 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11465 + */
11466 +
11467 +/**
11468 + * @file
11469 + * @ingroup lavu
11470 + * Utility Preprocessor macros
11471 + */
11472 +
11473 +#ifndef AVUTIL_MACROS_H
11474 +#define AVUTIL_MACROS_H
11475 +
11476 +/**
11477 + * @addtogroup preproc_misc Preprocessor String Macros
11478 + *
11479 + * String manipulation macros
11480 + *
11481 + * @{
11482 + */
11483 +
11484 +#define AV_STRINGIFY(s)         AV_TOSTRING(s)
11485 +#define AV_TOSTRING(s) #s
11486 +
11487 +#define AV_GLUE(a, b) a ## b
11488 +#define AV_JOIN(a, b) AV_GLUE(a, b)
11489 +
11490 +/**
11491 + * @}
11492 + */
11493 +
11494 +#define AV_PRAGMA(s) _Pragma(#s)
11495 +
11496 +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
11497 +
11498 +#endif /* AVUTIL_MACROS_H */
11499 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11500 new file mode 100644
11501 --- /dev/null
11502 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11503 @@ -0,0 +1,242 @@
11504 +/*
11505 + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
11506 + *
11507 + * This file is part of FFmpeg.
11508 + *
11509 + * FFmpeg is free software; you can redistribute it and/or
11510 + * modify it under the terms of the GNU Lesser General Public
11511 + * License as published by the Free Software Foundation; either
11512 + * version 2.1 of the License, or (at your option) any later version.
11513 + *
11514 + * FFmpeg is distributed in the hope that it will be useful,
11515 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11516 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11517 + * Lesser General Public License for more details.
11518 + *
11519 + * You should have received a copy of the GNU Lesser General Public
11520 + * License along with FFmpeg; if not, write to the Free Software
11521 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11522 + */
11523 +
11524 +/**
11525 + * @file
11526 + * @addtogroup lavu_math
11527 + * Mathematical utilities for working with timestamp and time base.
11528 + */
11529 +
11530 +#ifndef AVUTIL_MATHEMATICS_H
11531 +#define AVUTIL_MATHEMATICS_H
11532 +
11533 +#include <stdint.h>
11534 +#include <math.h>
11535 +#include "attributes.h"
11536 +#include "rational.h"
11537 +#include "intfloat.h"
11538 +
11539 +#ifndef M_E
11540 +#define M_E            2.7182818284590452354   /* e */
11541 +#endif
11542 +#ifndef M_LN2
11543 +#define M_LN2          0.69314718055994530942  /* log_e 2 */
11544 +#endif
11545 +#ifndef M_LN10
11546 +#define M_LN10         2.30258509299404568402  /* log_e 10 */
11547 +#endif
11548 +#ifndef M_LOG2_10
11549 +#define M_LOG2_10      3.32192809488736234787  /* log_2 10 */
11550 +#endif
11551 +#ifndef M_PHI
11552 +#define M_PHI          1.61803398874989484820   /* phi / golden ratio */
11553 +#endif
11554 +#ifndef M_PI
11555 +#define M_PI           3.14159265358979323846  /* pi */
11556 +#endif
11557 +#ifndef M_PI_2
11558 +#define M_PI_2         1.57079632679489661923  /* pi/2 */
11559 +#endif
11560 +#ifndef M_SQRT1_2
11561 +#define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
11562 +#endif
11563 +#ifndef M_SQRT2
11564 +#define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
11565 +#endif
11566 +#ifndef NAN
11567 +#define NAN            av_int2float(0x7fc00000)
11568 +#endif
11569 +#ifndef INFINITY
11570 +#define INFINITY       av_int2float(0x7f800000)
11571 +#endif
11572 +
11573 +/**
11574 + * @addtogroup lavu_math
11575 + *
11576 + * @{
11577 + */
11578 +
11579 +/**
11580 + * Rounding methods.
11581 + */
11582 +enum AVRounding {
11583 +    AV_ROUND_ZERO     = 0, ///< Round toward zero.
11584 +    AV_ROUND_INF      = 1, ///< Round away from zero.
11585 +    AV_ROUND_DOWN     = 2, ///< Round toward -infinity.
11586 +    AV_ROUND_UP       = 3, ///< Round toward +infinity.
11587 +    AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
11588 +    /**
11589 +     * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
11590 +     * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
11591 +     *
11592 +     * Unlike other values of the enumeration AVRounding, this value is a
11593 +     * bitmask that must be used in conjunction with another value of the
11594 +     * enumeration through a bitwise OR, in order to set behavior for normal
11595 +     * cases.
11596 +     *
11597 +     * @code{.c}
11598 +     * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11599 +     * // Rescaling 3:
11600 +     * //     Calculating 3 * 1 / 2
11601 +     * //     3 / 2 is rounded up to 2
11602 +     * //     => 2
11603 +     *
11604 +     * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11605 +     * // Rescaling AV_NOPTS_VALUE:
11606 +     * //     AV_NOPTS_VALUE == INT64_MIN
11607 +     * //     AV_NOPTS_VALUE is passed through
11608 +     * //     => AV_NOPTS_VALUE
11609 +     * @endcode
11610 +     */
11611 +    AV_ROUND_PASS_MINMAX = 8192,
11612 +};
11613 +
11614 +/**
11615 + * Compute the greatest common divisor of two integer operands.
11616 + *
11617 + * @param a,b Operands
11618 + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
11619 + * if a == 0 and b == 0, returns 0.
11620 + */
11621 +int64_t av_const av_gcd(int64_t a, int64_t b);
11622 +
11623 +/**
11624 + * Rescale a 64-bit integer with rounding to nearest.
11625 + *
11626 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11627 + * directly can overflow.
11628 + *
11629 + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
11630 + *
11631 + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
11632 + */
11633 +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
11634 +
11635 +/**
11636 + * Rescale a 64-bit integer with specified rounding.
11637 + *
11638 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11639 + * directly can overflow, and does not support different rounding methods.
11640 + *
11641 + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
11642 + */
11643 +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
11644 +
11645 +/**
11646 + * Rescale a 64-bit integer by 2 rational numbers.
11647 + *
11648 + * The operation is mathematically equivalent to `a * bq / cq`.
11649 + *
11650 + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
11651 + *
11652 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
11653 + */
11654 +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
11655 +
11656 +/**
11657 + * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
11658 + *
11659 + * The operation is mathematically equivalent to `a * bq / cq`.
11660 + *
11661 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
11662 + */
11663 +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
11664 +                         enum AVRounding rnd) av_const;
11665 +
11666 +/**
11667 + * Compare two timestamps each in its own time base.
11668 + *
11669 + * @return One of the following values:
11670 + *         - -1 if `ts_a` is before `ts_b`
11671 + *         - 1 if `ts_a` is after `ts_b`
11672 + *         - 0 if they represent the same position
11673 + *
11674 + * @warning
11675 + * The result of the function is undefined if one of the timestamps is outside
11676 + * the `int64_t` range when represented in the other's timebase.
11677 + */
11678 +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
11679 +
11680 +/**
11681 + * Compare the remainders of two integer operands divided by a common divisor.
11682 + *
11683 + * In other words, compare the least significant `log2(mod)` bits of integers
11684 + * `a` and `b`.
11685 + *
11686 + * @code{.c}
11687 + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10  (0x1) < 0x02 % 0x10  (0x2)
11688 + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
11689 + * @endcode
11690 + *
11691 + * @param a,b Operands
11692 + * @param mod Divisor; must be a power of 2
11693 + * @return
11694 + *         - a negative value if `a % mod < b % mod`
11695 + *         - a positive value if `a % mod > b % mod`
11696 + *         - zero             if `a % mod == b % mod`
11697 + */
11698 +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
11699 +
11700 +/**
11701 + * Rescale a timestamp while preserving known durations.
11702 + *
11703 + * This function is designed to be called per audio packet to scale the input
11704 + * timestamp to a different time base. Compared to a simple av_rescale_q()
11705 + * call, this function is robust against possible inconsistent frame durations.
11706 + *
11707 + * The `last` parameter is a state variable that must be preserved for all
11708 + * subsequent calls for the same stream. For the first call, `*last` should be
11709 + * initialized to #AV_NOPTS_VALUE.
11710 + *
11711 + * @param[in]     in_tb    Input time base
11712 + * @param[in]     in_ts    Input timestamp
11713 + * @param[in]     fs_tb    Duration time base; typically this is finer-grained
11714 + *                         (greater) than `in_tb` and `out_tb`
11715 + * @param[in]     duration Duration till the next call to this function (i.e.
11716 + *                         duration of the current packet/frame)
11717 + * @param[in,out] last     Pointer to a timestamp expressed in terms of
11718 + *                         `fs_tb`, acting as a state variable
11719 + * @param[in]     out_tb   Output timebase
11720 + * @return        Timestamp expressed in terms of `out_tb`
11721 + *
11722 + * @note In the context of this function, "duration" is in term of samples, not
11723 + *       seconds.
11724 + */
11725 +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts,  AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
11726 +
11727 +/**
11728 + * Add a value to a timestamp.
11729 + *
11730 + * This function guarantees that when the same value is repeatly added that
11731 + * no accumulation of rounding errors occurs.
11732 + *
11733 + * @param[in] ts     Input timestamp
11734 + * @param[in] ts_tb  Input timestamp time base
11735 + * @param[in] inc    Value to be added
11736 + * @param[in] inc_tb Time base of `inc`
11737 + */
11738 +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
11739 +
11740 +
11741 +/**
11742 + * @}
11743 + */
11744 +
11745 +#endif /* AVUTIL_MATHEMATICS_H */
11746 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11747 new file mode 100644
11748 --- /dev/null
11749 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11750 @@ -0,0 +1,700 @@
11751 +/*
11752 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11753 + *
11754 + * This file is part of FFmpeg.
11755 + *
11756 + * FFmpeg is free software; you can redistribute it and/or
11757 + * modify it under the terms of the GNU Lesser General Public
11758 + * License as published by the Free Software Foundation; either
11759 + * version 2.1 of the License, or (at your option) any later version.
11760 + *
11761 + * FFmpeg is distributed in the hope that it will be useful,
11762 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11763 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11764 + * Lesser General Public License for more details.
11765 + *
11766 + * You should have received a copy of the GNU Lesser General Public
11767 + * License along with FFmpeg; if not, write to the Free Software
11768 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11769 + */
11770 +
11771 +/**
11772 + * @file
11773 + * @ingroup lavu_mem
11774 + * Memory handling functions
11775 + */
11776 +
11777 +#ifndef AVUTIL_MEM_H
11778 +#define AVUTIL_MEM_H
11779 +
11780 +#include <limits.h>
11781 +#include <stdint.h>
11782 +
11783 +#include "attributes.h"
11784 +#include "error.h"
11785 +#include "avutil.h"
11786 +
11787 +/**
11788 + * @addtogroup lavu_mem
11789 + * Utilities for manipulating memory.
11790 + *
11791 + * FFmpeg has several applications of memory that are not required of a typical
11792 + * program. For example, the computing-heavy components like video decoding and
11793 + * encoding can be sped up significantly through the use of aligned memory.
11794 + *
11795 + * However, for each of FFmpeg's applications of memory, there might not be a
11796 + * recognized or standardized API for that specific use. Memory alignment, for
11797 + * instance, varies wildly depending on operating systems, architectures, and
11798 + * compilers. Hence, this component of @ref libavutil is created to make
11799 + * dealing with memory consistently possible on all platforms.
11800 + *
11801 + * @{
11802 + *
11803 + * @defgroup lavu_mem_macros Alignment Macros
11804 + * Helper macros for declaring aligned variables.
11805 + * @{
11806 + */
11807 +
11808 +/**
11809 + * @def DECLARE_ALIGNED(n,t,v)
11810 + * Declare a variable that is aligned in memory.
11811 + *
11812 + * @code{.c}
11813 + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
11814 + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
11815 + *
11816 + * // The default-alignment equivalent would be
11817 + * uint16_t aligned_int = 42;
11818 + * uint8_t aligned_array[128];
11819 + * @endcode
11820 + *
11821 + * @param n Minimum alignment in bytes
11822 + * @param t Type of the variable (or array element)
11823 + * @param v Name of the variable
11824 + */
11825 +
11826 +/**
11827 + * @def DECLARE_ASM_ALIGNED(n,t,v)
11828 + * Declare an aligned variable appropriate for use in inline assembly code.
11829 + *
11830 + * @code{.c}
11831 + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11832 + * @endcode
11833 + *
11834 + * @param n Minimum alignment in bytes
11835 + * @param t Type of the variable (or array element)
11836 + * @param v Name of the variable
11837 + */
11838 +
11839 +/**
11840 + * @def DECLARE_ASM_CONST(n,t,v)
11841 + * Declare a static constant aligned variable appropriate for use in inline
11842 + * assembly code.
11843 + *
11844 + * @code{.c}
11845 + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11846 + * @endcode
11847 + *
11848 + * @param n Minimum alignment in bytes
11849 + * @param t Type of the variable (or array element)
11850 + * @param v Name of the variable
11851 + */
11852 +
11853 +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
11854 +    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
11855 +    #define DECLARE_ASM_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
11856 +    #define DECLARE_ASM_CONST(n,t,v)    const t __attribute__ ((aligned (n))) v
11857 +#elif defined(__DJGPP__)
11858 +    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (FFMIN(n, 16)))) v
11859 +    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11860 +    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11861 +#elif defined(__GNUC__) || defined(__clang__)
11862 +    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
11863 +    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (n))) v
11864 +    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (n))) v
11865 +#elif defined(_MSC_VER)
11866 +    #define DECLARE_ALIGNED(n,t,v)      __declspec(align(n)) t v
11867 +    #define DECLARE_ASM_ALIGNED(n,t,v)  __declspec(align(n)) t v
11868 +    #define DECLARE_ASM_CONST(n,t,v)    __declspec(align(n)) static const t v
11869 +#else
11870 +    #define DECLARE_ALIGNED(n,t,v)      t v
11871 +    #define DECLARE_ASM_ALIGNED(n,t,v)  t v
11872 +    #define DECLARE_ASM_CONST(n,t,v)    static const t v
11873 +#endif
11874 +
11875 +/**
11876 + * @}
11877 + */
11878 +
11879 +/**
11880 + * @defgroup lavu_mem_attrs Function Attributes
11881 + * Function attributes applicable to memory handling functions.
11882 + *
11883 + * These function attributes can help compilers emit more useful warnings, or
11884 + * generate better code.
11885 + * @{
11886 + */
11887 +
11888 +/**
11889 + * @def av_malloc_attrib
11890 + * Function attribute denoting a malloc-like function.
11891 + *
11892 + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251">Function attribute `malloc` in GCC's documentation</a>
11893 + */
11894 +
11895 +#if AV_GCC_VERSION_AT_LEAST(3,1)
11896 +    #define av_malloc_attrib __attribute__((__malloc__))
11897 +#else
11898 +    #define av_malloc_attrib
11899 +#endif
11900 +
11901 +/**
11902 + * @def av_alloc_size(...)
11903 + * Function attribute used on a function that allocates memory, whose size is
11904 + * given by the specified parameter(s).
11905 + *
11906 + * @code{.c}
11907 + * void *av_malloc(size_t size) av_alloc_size(1);
11908 + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
11909 + * @endcode
11910 + *
11911 + * @param ... One or two parameter indexes, separated by a comma
11912 + *
11913 + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220">Function attribute `alloc_size` in GCC's documentation</a>
11914 + */
11915 +
11916 +#if AV_GCC_VERSION_AT_LEAST(4,3)
11917 +    #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
11918 +#else
11919 +    #define av_alloc_size(...)
11920 +#endif
11921 +
11922 +/**
11923 + * @}
11924 + */
11925 +
11926 +/**
11927 + * @defgroup lavu_mem_funcs Heap Management
11928 + * Functions responsible for allocating, freeing, and copying memory.
11929 + *
11930 + * All memory allocation functions have a built-in upper limit of `INT_MAX`
11931 + * bytes. This may be changed with av_max_alloc(), although exercise extreme
11932 + * caution when doing so.
11933 + *
11934 + * @{
11935 + */
11936 +
11937 +/**
11938 + * Allocate a memory block with alignment suitable for all memory accesses
11939 + * (including vectors if available on the CPU).
11940 + *
11941 + * @param size Size in bytes for the memory block to be allocated
11942 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11943 + *         be allocated
11944 + * @see av_mallocz()
11945 + */
11946 +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
11947 +
11948 +/**
11949 + * Allocate a memory block with alignment suitable for all memory accesses
11950 + * (including vectors if available on the CPU) and zero all the bytes of the
11951 + * block.
11952 + *
11953 + * @param size Size in bytes for the memory block to be allocated
11954 + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
11955 + * @see av_malloc()
11956 + */
11957 +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
11958 +
11959 +/**
11960 + * Allocate a memory block for an array with av_malloc().
11961 + *
11962 + * The allocated memory will have size `size * nmemb` bytes.
11963 + *
11964 + * @param nmemb Number of element
11965 + * @param size  Size of a single element
11966 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11967 + *         be allocated
11968 + * @see av_malloc()
11969 + */
11970 +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
11971 +
11972 +/**
11973 + * Allocate a memory block for an array with av_mallocz().
11974 + *
11975 + * The allocated memory will have size `size * nmemb` bytes.
11976 + *
11977 + * @param nmemb Number of elements
11978 + * @param size  Size of the single element
11979 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11980 + *         be allocated
11981 + *
11982 + * @see av_mallocz()
11983 + * @see av_malloc_array()
11984 + */
11985 +av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
11986 +
11987 +/**
11988 + * Non-inlined equivalent of av_mallocz_array().
11989 + *
11990 + * Created for symmetry with the calloc() C function.
11991 + */
11992 +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
11993 +
11994 +/**
11995 + * Allocate, reallocate, or free a block of memory.
11996 + *
11997 + * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
11998 + * zero, free the memory block pointed to by `ptr`. Otherwise, expand or
11999 + * shrink that block of memory according to `size`.
12000 + *
12001 + * @param ptr  Pointer to a memory block already allocated with
12002 + *             av_realloc() or `NULL`
12003 + * @param size Size in bytes of the memory block to be allocated or
12004 + *             reallocated
12005 + *
12006 + * @return Pointer to a newly-reallocated block or `NULL` if the block
12007 + *         cannot be reallocated or the function is used to free the memory block
12008 + *
12009 + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
12010 + *          correctly aligned.
12011 + * @see av_fast_realloc()
12012 + * @see av_reallocp()
12013 + */
12014 +void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
12015 +
12016 +/**
12017 + * Allocate, reallocate, or free a block of memory through a pointer to a
12018 + * pointer.
12019 + *
12020 + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
12021 + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
12022 + * shrink that block of memory according to `size`.
12023 + *
12024 + * @param[in,out] ptr  Pointer to a pointer to a memory block already allocated
12025 + *                     with av_realloc(), or a pointer to `NULL`. The pointer
12026 + *                     is updated on success, or freed on failure.
12027 + * @param[in]     size Size in bytes for the memory block to be allocated or
12028 + *                     reallocated
12029 + *
12030 + * @return Zero on success, an AVERROR error code on failure
12031 + *
12032 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12033 + *          correctly aligned.
12034 + */
12035 +av_warn_unused_result
12036 +int av_reallocp(void *ptr, size_t size);
12037 +
12038 +/**
12039 + * Allocate, reallocate, or free a block of memory.
12040 + *
12041 + * This function does the same thing as av_realloc(), except:
12042 + * - It takes two size arguments and allocates `nelem * elsize` bytes,
12043 + *   after checking the result of the multiplication for integer overflow.
12044 + * - It frees the input block in case of failure, thus avoiding the memory
12045 + *   leak with the classic
12046 + *   @code{.c}
12047 + *   buf = realloc(buf);
12048 + *   if (!buf)
12049 + *       return -1;
12050 + *   @endcode
12051 + *   pattern.
12052 + */
12053 +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
12054 +
12055 +/**
12056 + * Allocate, reallocate, or free an array.
12057 + *
12058 + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
12059 + * `nmemb` is zero, free the memory block pointed to by `ptr`.
12060 + *
12061 + * @param ptr   Pointer to a memory block already allocated with
12062 + *              av_realloc() or `NULL`
12063 + * @param nmemb Number of elements in the array
12064 + * @param size  Size of the single element of the array
12065 + *
12066 + * @return Pointer to a newly-reallocated block or NULL if the block
12067 + *         cannot be reallocated or the function is used to free the memory block
12068 + *
12069 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12070 + *          correctly aligned.
12071 + * @see av_reallocp_array()
12072 + */
12073 +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
12074 +
12075 +/**
12076 + * Allocate, reallocate, or free an array through a pointer to a pointer.
12077 + *
12078 + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
12079 + * zero, free the memory block pointed to by `*ptr`.
12080 + *
12081 + * @param[in,out] ptr   Pointer to a pointer to a memory block already
12082 + *                      allocated with av_realloc(), or a pointer to `NULL`.
12083 + *                      The pointer is updated on success, or freed on failure.
12084 + * @param[in]     nmemb Number of elements
12085 + * @param[in]     size  Size of the single element
12086 + *
12087 + * @return Zero on success, an AVERROR error code on failure
12088 + *
12089 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12090 + *          correctly aligned.
12091 + */
12092 +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
12093 +
12094 +/**
12095 + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
12096 + *
12097 + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
12098 + *
12099 + * If the given buffer is not large enough, and reallocation fails, `NULL` is
12100 + * returned and `*size` is set to 0, but the original buffer is not changed or
12101 + * freed.
12102 + *
12103 + * A typical use pattern follows:
12104 + *
12105 + * @code{.c}
12106 + * uint8_t *buf = ...;
12107 + * uint8_t *new_buf = av_fast_realloc(buf, &current_size, size_needed);
12108 + * if (!new_buf) {
12109 + *     // Allocation failed; clean up original buffer
12110 + *     av_freep(&buf);
12111 + *     return AVERROR(ENOMEM);
12112 + * }
12113 + * @endcode
12114 + *
12115 + * @param[in,out] ptr      Already allocated buffer, or `NULL`
12116 + * @param[in,out] size     Pointer to current size of buffer `ptr`. `*size` is
12117 + *                         changed to `min_size` in case of success or 0 in
12118 + *                         case of failure
12119 + * @param[in]     min_size New size of buffer `ptr`
12120 + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
12121 + *         buffer if the buffer was not large enough, or `NULL` in case of
12122 + *         error
12123 + * @see av_realloc()
12124 + * @see av_fast_malloc()
12125 + */
12126 +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
12127 +
12128 +/**
12129 + * Allocate a buffer, reusing the given one if large enough.
12130 + *
12131 + * Contrary to av_fast_realloc(), the current buffer contents might not be
12132 + * preserved and on error the old buffer is freed, thus no special handling to
12133 + * avoid memleaks is necessary.
12134 + *
12135 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12136 + * `size_needed` is greater than 0.
12137 + *
12138 + * @code{.c}
12139 + * uint8_t *buf = ...;
12140 + * av_fast_malloc(&buf, &current_size, size_needed);
12141 + * if (!buf) {
12142 + *     // Allocation failed; buf already freed
12143 + *     return AVERROR(ENOMEM);
12144 + * }
12145 + * @endcode
12146 + *
12147 + * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
12148 + *                         `*ptr` will be overwritten with pointer to new
12149 + *                         buffer on success or `NULL` on failure
12150 + * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
12151 + *                         changed to `min_size` in case of success or 0 in
12152 + *                         case of failure
12153 + * @param[in]     min_size New size of buffer `*ptr`
12154 + * @see av_realloc()
12155 + * @see av_fast_mallocz()
12156 + */
12157 +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
12158 +
12159 +/**
12160 + * Allocate and clear a buffer, reusing the given one if large enough.
12161 + *
12162 + * Like av_fast_malloc(), but all newly allocated space is initially cleared.
12163 + * Reused buffer is not cleared.
12164 + *
12165 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12166 + * `size_needed` is greater than 0.
12167 + *
12168 + * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
12169 + *                         `*ptr` will be overwritten with pointer to new
12170 + *                         buffer on success or `NULL` on failure
12171 + * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
12172 + *                         changed to `min_size` in case of success or 0 in
12173 + *                         case of failure
12174 + * @param[in]     min_size New size of buffer `*ptr`
12175 + * @see av_fast_malloc()
12176 + */
12177 +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
12178 +
12179 +/**
12180 + * Free a memory block which has been allocated with a function of av_malloc()
12181 + * or av_realloc() family.
12182 + *
12183 + * @param ptr Pointer to the memory block which should be freed.
12184 + *
12185 + * @note `ptr = NULL` is explicitly allowed.
12186 + * @note It is recommended that you use av_freep() instead, to prevent leaving
12187 + *       behind dangling pointers.
12188 + * @see av_freep()
12189 + */
12190 +void av_free(void *ptr);
12191 +
12192 +/**
12193 + * Free a memory block which has been allocated with a function of av_malloc()
12194 + * or av_realloc() family, and set the pointer pointing to it to `NULL`.
12195 + *
12196 + * @code{.c}
12197 + * uint8_t *buf = av_malloc(16);
12198 + * av_free(buf);
12199 + * // buf now contains a dangling pointer to freed memory, and accidental
12200 + * // dereference of buf will result in a use-after-free, which may be a
12201 + * // security risk.
12202 + *
12203 + * uint8_t *buf = av_malloc(16);
12204 + * av_freep(&buf);
12205 + * // buf is now NULL, and accidental dereference will only result in a
12206 + * // NULL-pointer dereference.
12207 + * @endcode
12208 + *
12209 + * @param ptr Pointer to the pointer to the memory block which should be freed
12210 + * @note `*ptr = NULL` is safe and leads to no action.
12211 + * @see av_free()
12212 + */
12213 +void av_freep(void *ptr);
12214 +
12215 +/**
12216 + * Duplicate a string.
12217 + *
12218 + * @param s String to be duplicated
12219 + * @return Pointer to a newly-allocated string containing a
12220 + *         copy of `s` or `NULL` if the string cannot be allocated
12221 + * @see av_strndup()
12222 + */
12223 +char *av_strdup(const char *s) av_malloc_attrib;
12224 +
12225 +/**
12226 + * Duplicate a substring of a string.
12227 + *
12228 + * @param s   String to be duplicated
12229 + * @param len Maximum length of the resulting string (not counting the
12230 + *            terminating byte)
12231 + * @return Pointer to a newly-allocated string containing a
12232 + *         substring of `s` or `NULL` if the string cannot be allocated
12233 + */
12234 +char *av_strndup(const char *s, size_t len) av_malloc_attrib;
12235 +
12236 +/**
12237 + * Duplicate a buffer with av_malloc().
12238 + *
12239 + * @param p    Buffer to be duplicated
12240 + * @param size Size in bytes of the buffer copied
12241 + * @return Pointer to a newly allocated buffer containing a
12242 + *         copy of `p` or `NULL` if the buffer cannot be allocated
12243 + */
12244 +void *av_memdup(const void *p, size_t size);
12245 +
12246 +/**
12247 + * Overlapping memcpy() implementation.
12248 + *
12249 + * @param dst  Destination buffer
12250 + * @param back Number of bytes back to start copying (i.e. the initial size of
12251 + *             the overlapping window); must be > 0
12252 + * @param cnt  Number of bytes to copy; must be >= 0
12253 + *
12254 + * @note `cnt > back` is valid, this will copy the bytes we just copied,
12255 + *       thus creating a repeating pattern with a period length of `back`.
12256 + */
12257 +void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
12258 +
12259 +/**
12260 + * @}
12261 + */
12262 +
12263 +/**
12264 + * @defgroup lavu_mem_dynarray Dynamic Array
12265 + *
12266 + * Utilities to make an array grow when needed.
12267 + *
12268 + * Sometimes, the programmer would want to have an array that can grow when
12269 + * needed. The libavutil dynamic array utilities fill that need.
12270 + *
12271 + * libavutil supports two systems of appending elements onto a dynamically
12272 + * allocated array, the first one storing the pointer to the value in the
12273 + * array, and the second storing the value directly. In both systems, the
12274 + * caller is responsible for maintaining a variable containing the length of
12275 + * the array, as well as freeing of the array after use.
12276 + *
12277 + * The first system stores pointers to values in a block of dynamically
12278 + * allocated memory. Since only pointers are stored, the function does not need
12279 + * to know the size of the type. Both av_dynarray_add() and
12280 + * av_dynarray_add_nofree() implement this system.
12281 + *
12282 + * @code
12283 + * type **array = NULL; //< an array of pointers to values
12284 + * int    nb    = 0;    //< a variable to keep track of the length of the array
12285 + *
12286 + * type to_be_added  = ...;
12287 + * type to_be_added2 = ...;
12288 + *
12289 + * av_dynarray_add(&array, &nb, &to_be_added);
12290 + * if (nb == 0)
12291 + *     return AVERROR(ENOMEM);
12292 + *
12293 + * av_dynarray_add(&array, &nb, &to_be_added2);
12294 + * if (nb == 0)
12295 + *     return AVERROR(ENOMEM);
12296 + *
12297 + * // Now:
12298 + * //  nb           == 2
12299 + * // &to_be_added  == array[0]
12300 + * // &to_be_added2 == array[1]
12301 + *
12302 + * av_freep(&array);
12303 + * @endcode
12304 + *
12305 + * The second system stores the value directly in a block of memory. As a
12306 + * result, the function has to know the size of the type. av_dynarray2_add()
12307 + * implements this mechanism.
12308 + *
12309 + * @code
12310 + * type *array = NULL; //< an array of values
12311 + * int   nb    = 0;    //< a variable to keep track of the length of the array
12312 + *
12313 + * type to_be_added  = ...;
12314 + * type to_be_added2 = ...;
12315 + *
12316 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
12317 + * if (!addr)
12318 + *     return AVERROR(ENOMEM);
12319 + * memcpy(addr, &to_be_added, sizeof(to_be_added));
12320 + *
12321 + * // Shortcut of the above.
12322 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
12323 + *                               (const void *)&to_be_added2);
12324 + * if (!addr)
12325 + *     return AVERROR(ENOMEM);
12326 + *
12327 + * // Now:
12328 + * //  nb           == 2
12329 + * //  to_be_added  == array[0]
12330 + * //  to_be_added2 == array[1]
12331 + *
12332 + * av_freep(&array);
12333 + * @endcode
12334 + *
12335 + * @{
12336 + */
12337 +
12338 +/**
12339 + * Add the pointer to an element to a dynamic array.
12340 + *
12341 + * The array to grow is supposed to be an array of pointers to
12342 + * structures, and the element to add must be a pointer to an already
12343 + * allocated structure.
12344 + *
12345 + * The array is reallocated when its size reaches powers of 2.
12346 + * Therefore, the amortized cost of adding an element is constant.
12347 + *
12348 + * In case of success, the pointer to the array is updated in order to
12349 + * point to the new grown array, and the number pointed to by `nb_ptr`
12350 + * is incremented.
12351 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12352 + * `*nb_ptr` is set to 0.
12353 + *
12354 + * @param[in,out] tab_ptr Pointer to the array to grow
12355 + * @param[in,out] nb_ptr  Pointer to the number of elements in the array
12356 + * @param[in]     elem    Element to add
12357 + * @see av_dynarray_add_nofree(), av_dynarray2_add()
12358 + */
12359 +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
12360 +
12361 +/**
12362 + * Add an element to a dynamic array.
12363 + *
12364 + * Function has the same functionality as av_dynarray_add(),
12365 + * but it doesn't free memory on fails. It returns error code
12366 + * instead and leave current buffer untouched.
12367 + *
12368 + * @return >=0 on success, negative otherwise
12369 + * @see av_dynarray_add(), av_dynarray2_add()
12370 + */
12371 +av_warn_unused_result
12372 +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
12373 +
12374 +/**
12375 + * Add an element of size `elem_size` to a dynamic array.
12376 + *
12377 + * The array is reallocated when its number of elements reaches powers of 2.
12378 + * Therefore, the amortized cost of adding an element is constant.
12379 + *
12380 + * In case of success, the pointer to the array is updated in order to
12381 + * point to the new grown array, and the number pointed to by `nb_ptr`
12382 + * is incremented.
12383 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12384 + * `*nb_ptr` is set to 0.
12385 + *
12386 + * @param[in,out] tab_ptr   Pointer to the array to grow
12387 + * @param[in,out] nb_ptr    Pointer to the number of elements in the array
12388 + * @param[in]     elem_size Size in bytes of an element in the array
12389 + * @param[in]     elem_data Pointer to the data of the element to add. If
12390 + *                          `NULL`, the space of the newly added element is
12391 + *                          allocated but left uninitialized.
12392 + *
12393 + * @return Pointer to the data of the element to copy in the newly allocated
12394 + *         space
12395 + * @see av_dynarray_add(), av_dynarray_add_nofree()
12396 + */
12397 +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
12398 +                       const uint8_t *elem_data);
12399 +
12400 +/**
12401 + * @}
12402 + */
12403 +
12404 +/**
12405 + * @defgroup lavu_mem_misc Miscellaneous Functions
12406 + *
12407 + * Other functions related to memory allocation.
12408 + *
12409 + * @{
12410 + */
12411 +
12412 +/**
12413 + * Multiply two `size_t` values checking for overflow.
12414 + *
12415 + * @param[in]  a,b Operands of multiplication
12416 + * @param[out] r   Pointer to the result of the operation
12417 + * @return 0 on success, AVERROR(EINVAL) on overflow
12418 + */
12419 +static inline int av_size_mult(size_t a, size_t b, size_t *r)
12420 +{
12421 +    size_t t = a * b;
12422 +    /* Hack inspired from glibc: don't try the division if nelem and elsize
12423 +     * are both less than sqrt(SIZE_MAX). */
12424 +    if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
12425 +        return AVERROR(EINVAL);
12426 +    *r = t;
12427 +    return 0;
12428 +}
12429 +
12430 +/**
12431 + * Set the maximum size that may be allocated in one block.
12432 + *
12433 + * The value specified with this function is effective for all libavutil's @ref
12434 + * lavu_mem_funcs "heap management functions."
12435 + *
12436 + * By default, the max value is defined as `INT_MAX`.
12437 + *
12438 + * @param max Value to be set as the new maximum size
12439 + *
12440 + * @warning Exercise extreme caution when using this function. Don't touch
12441 + *          this if you do not understand the full consequence of doing so.
12442 + */
12443 +void av_max_alloc(size_t max);
12444 +
12445 +/**
12446 + * @}
12447 + * @}
12448 + */
12449 +
12450 +#endif /* AVUTIL_MEM_H */
12451 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12452 new file mode 100644
12453 --- /dev/null
12454 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12455 @@ -0,0 +1,529 @@
12456 +/*
12457 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
12458 + *
12459 + * This file is part of FFmpeg.
12460 + *
12461 + * FFmpeg is free software; you can redistribute it and/or
12462 + * modify it under the terms of the GNU Lesser General Public
12463 + * License as published by the Free Software Foundation; either
12464 + * version 2.1 of the License, or (at your option) any later version.
12465 + *
12466 + * FFmpeg is distributed in the hope that it will be useful,
12467 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12468 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12469 + * Lesser General Public License for more details.
12470 + *
12471 + * You should have received a copy of the GNU Lesser General Public
12472 + * License along with FFmpeg; if not, write to the Free Software
12473 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12474 + */
12475 +
12476 +#ifndef AVUTIL_PIXFMT_H
12477 +#define AVUTIL_PIXFMT_H
12478 +
12479 +/**
12480 + * @file
12481 + * pixel format definitions
12482 + */
12483 +
12484 +#include "libavutil/avconfig.h"
12485 +#include "version.h"
12486 +
12487 +#define AVPALETTE_SIZE 1024
12488 +#define AVPALETTE_COUNT 256
12489 +
12490 +/**
12491 + * Pixel format.
12492 + *
12493 + * @note
12494 + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
12495 + * color is put together as:
12496 + *  (A << 24) | (R << 16) | (G << 8) | B
12497 + * This is stored as BGRA on little-endian CPU architectures and ARGB on
12498 + * big-endian CPUs.
12499 + *
12500 + * @par
12501 + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
12502 + * image data is stored in AVFrame.data[0]. The palette is transported in
12503 + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
12504 + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
12505 + * also endian-specific). Note also that the individual RGB32 palette
12506 + * components stored in AVFrame.data[1] should be in the range 0..255.
12507 + * This is important as many custom PAL8 video codecs that were designed
12508 + * to run on the IBM VGA graphics adapter use 6-bit palette components.
12509 + *
12510 + * @par
12511 + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
12512 + * for pal8. This palette is filled in automatically by the function
12513 + * allocating the picture.
12514 + */
12515 +enum AVPixelFormat {
12516 +    AV_PIX_FMT_NONE = -1,
12517 +    AV_PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
12518 +    AV_PIX_FMT_YUYV422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
12519 +    AV_PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...
12520 +    AV_PIX_FMT_BGR24,     ///< packed RGB 8:8:8, 24bpp, BGRBGR...
12521 +    AV_PIX_FMT_YUV422P,   ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12522 +    AV_PIX_FMT_YUV444P,   ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
12523 +    AV_PIX_FMT_YUV410P,   ///< planar YUV 4:1:0,  9bpp, (1 Cr & Cb sample per 4x4 Y samples)
12524 +    AV_PIX_FMT_YUV411P,   ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
12525 +    AV_PIX_FMT_GRAY8,     ///<        Y        ,  8bpp
12526 +    AV_PIX_FMT_MONOWHITE, ///<        Y        ,  1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
12527 +    AV_PIX_FMT_MONOBLACK, ///<        Y        ,  1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
12528 +    AV_PIX_FMT_PAL8,      ///< 8 bits with AV_PIX_FMT_RGB32 palette
12529 +    AV_PIX_FMT_YUVJ420P,  ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
12530 +    AV_PIX_FMT_YUVJ422P,  ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
12531 +    AV_PIX_FMT_YUVJ444P,  ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
12532 +    AV_PIX_FMT_UYVY422,   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
12533 +    AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
12534 +    AV_PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
12535 +    AV_PIX_FMT_BGR4,      ///< packed RGB 1:2:1 bitstream,  4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
12536 +    AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1B 2G 1R(lsb)
12537 +    AV_PIX_FMT_RGB8,      ///< packed RGB 3:3:2,  8bpp, (msb)2R 3G 3B(lsb)
12538 +    AV_PIX_FMT_RGB4,      ///< packed RGB 1:2:1 bitstream,  4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
12539 +    AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1R 2G 1B(lsb)
12540 +    AV_PIX_FMT_NV12,      ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
12541 +    AV_PIX_FMT_NV21,      ///< as above, but U and V bytes are swapped
12542 +
12543 +    AV_PIX_FMT_ARGB,      ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
12544 +    AV_PIX_FMT_RGBA,      ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
12545 +    AV_PIX_FMT_ABGR,      ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
12546 +    AV_PIX_FMT_BGRA,      ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
12547 +
12548 +    AV_PIX_FMT_GRAY16BE,  ///<        Y        , 16bpp, big-endian
12549 +    AV_PIX_FMT_GRAY16LE,  ///<        Y        , 16bpp, little-endian
12550 +    AV_PIX_FMT_YUV440P,   ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
12551 +    AV_PIX_FMT_YUVJ440P,  ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
12552 +    AV_PIX_FMT_YUVA420P,  ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
12553 +    AV_PIX_FMT_RGB48BE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
12554 +    AV_PIX_FMT_RGB48LE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
12555 +
12556 +    AV_PIX_FMT_RGB565BE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), big-endian
12557 +    AV_PIX_FMT_RGB565LE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), little-endian
12558 +    AV_PIX_FMT_RGB555BE,  ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian   , X=unused/undefined
12559 +    AV_PIX_FMT_RGB555LE,  ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
12560 +
12561 +    AV_PIX_FMT_BGR565BE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), big-endian
12562 +    AV_PIX_FMT_BGR565LE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), little-endian
12563 +    AV_PIX_FMT_BGR555BE,  ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian   , X=unused/undefined
12564 +    AV_PIX_FMT_BGR555LE,  ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
12565 +
12566 +#if FF_API_VAAPI
12567 +    /** @name Deprecated pixel formats */
12568 +    /**@{*/
12569 +    AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
12570 +    AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
12571 +    AV_PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
12572 +    /**@}*/
12573 +    AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
12574 +#else
12575 +    /**
12576 +     *  Hardware acceleration through VA-API, data[3] contains a
12577 +     *  VASurfaceID.
12578 +     */
12579 +    AV_PIX_FMT_VAAPI,
12580 +#endif
12581 +
12582 +    AV_PIX_FMT_YUV420P16LE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12583 +    AV_PIX_FMT_YUV420P16BE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12584 +    AV_PIX_FMT_YUV422P16LE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12585 +    AV_PIX_FMT_YUV422P16BE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12586 +    AV_PIX_FMT_YUV444P16LE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12587 +    AV_PIX_FMT_YUV444P16BE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12588 +    AV_PIX_FMT_DXVA2_VLD,    ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
12589 +
12590 +    AV_PIX_FMT_RGB444LE,  ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
12591 +    AV_PIX_FMT_RGB444BE,  ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian,    X=unused/undefined
12592 +    AV_PIX_FMT_BGR444LE,  ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
12593 +    AV_PIX_FMT_BGR444BE,  ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian,    X=unused/undefined
12594 +    AV_PIX_FMT_YA8,       ///< 8 bits gray, 8 bits alpha
12595 +
12596 +    AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12597 +    AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12598 +
12599 +    AV_PIX_FMT_BGR48BE,   ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
12600 +    AV_PIX_FMT_BGR48LE,   ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
12601 +
12602 +    /**
12603 +     * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
12604 +     * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
12605 +     * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
12606 +     */
12607 +    AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12608 +    AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12609 +    AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12610 +    AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12611 +    AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12612 +    AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12613 +    AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12614 +    AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12615 +    AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12616 +    AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12617 +    AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12618 +    AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12619 +    AV_PIX_FMT_GBRP,      ///< planar GBR 4:4:4 24bpp
12620 +    AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
12621 +    AV_PIX_FMT_GBRP9BE,   ///< planar GBR 4:4:4 27bpp, big-endian
12622 +    AV_PIX_FMT_GBRP9LE,   ///< planar GBR 4:4:4 27bpp, little-endian
12623 +    AV_PIX_FMT_GBRP10BE,  ///< planar GBR 4:4:4 30bpp, big-endian
12624 +    AV_PIX_FMT_GBRP10LE,  ///< planar GBR 4:4:4 30bpp, little-endian
12625 +    AV_PIX_FMT_GBRP16BE,  ///< planar GBR 4:4:4 48bpp, big-endian
12626 +    AV_PIX_FMT_GBRP16LE,  ///< planar GBR 4:4:4 48bpp, little-endian
12627 +    AV_PIX_FMT_YUVA422P,  ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
12628 +    AV_PIX_FMT_YUVA444P,  ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
12629 +    AV_PIX_FMT_YUVA420P9BE,  ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
12630 +    AV_PIX_FMT_YUVA420P9LE,  ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
12631 +    AV_PIX_FMT_YUVA422P9BE,  ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
12632 +    AV_PIX_FMT_YUVA422P9LE,  ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
12633 +    AV_PIX_FMT_YUVA444P9BE,  ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12634 +    AV_PIX_FMT_YUVA444P9LE,  ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12635 +    AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12636 +    AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12637 +    AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12638 +    AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12639 +    AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12640 +    AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12641 +    AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12642 +    AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12643 +    AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12644 +    AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12645 +    AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12646 +    AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12647 +
12648 +    AV_PIX_FMT_VDPAU,     ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
12649 +
12650 +    AV_PIX_FMT_XYZ12LE,      ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0
12651 +    AV_PIX_FMT_XYZ12BE,      ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0
12652 +    AV_PIX_FMT_NV16,         ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12653 +    AV_PIX_FMT_NV20LE,       ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12654 +    AV_PIX_FMT_NV20BE,       ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12655 +
12656 +    AV_PIX_FMT_RGBA64BE,     ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
12657 +    AV_PIX_FMT_RGBA64LE,     ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
12658 +    AV_PIX_FMT_BGRA64BE,     ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
12659 +    AV_PIX_FMT_BGRA64LE,     ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
12660 +
12661 +    AV_PIX_FMT_YVYU422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
12662 +
12663 +    AV_PIX_FMT_YA16BE,       ///< 16 bits gray, 16 bits alpha (big-endian)
12664 +    AV_PIX_FMT_YA16LE,       ///< 16 bits gray, 16 bits alpha (little-endian)
12665 +
12666 +    AV_PIX_FMT_GBRAP,        ///< planar GBRA 4:4:4:4 32bpp
12667 +    AV_PIX_FMT_GBRAP16BE,    ///< planar GBRA 4:4:4:4 64bpp, big-endian
12668 +    AV_PIX_FMT_GBRAP16LE,    ///< planar GBRA 4:4:4:4 64bpp, little-endian
12669 +    /**
12670 +     *  HW acceleration through QSV, data[3] contains a pointer to the
12671 +     *  mfxFrameSurface1 structure.
12672 +     */
12673 +    AV_PIX_FMT_QSV,
12674 +    /**
12675 +     * HW acceleration though MMAL, data[3] contains a pointer to the
12676 +     * MMAL_BUFFER_HEADER_T structure.
12677 +     */
12678 +    AV_PIX_FMT_MMAL,
12679 +
12680 +    AV_PIX_FMT_D3D11VA_VLD,  ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
12681 +
12682 +    /**
12683 +     * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
12684 +     * exactly as for system memory frames.
12685 +     */
12686 +    AV_PIX_FMT_CUDA,
12687 +
12688 +    AV_PIX_FMT_0RGB,        ///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   X=unused/undefined
12689 +    AV_PIX_FMT_RGB0,        ///< packed RGB 8:8:8, 32bpp, RGBXRGBX...   X=unused/undefined
12690 +    AV_PIX_FMT_0BGR,        ///< packed BGR 8:8:8, 32bpp, XBGRXBGR...   X=unused/undefined
12691 +    AV_PIX_FMT_BGR0,        ///< packed BGR 8:8:8, 32bpp, BGRXBGRX...   X=unused/undefined
12692 +
12693 +    AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12694 +    AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12695 +    AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12696 +    AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12697 +    AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12698 +    AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12699 +    AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12700 +    AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12701 +    AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12702 +    AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12703 +    AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12704 +    AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12705 +    AV_PIX_FMT_GBRP12BE,    ///< planar GBR 4:4:4 36bpp, big-endian
12706 +    AV_PIX_FMT_GBRP12LE,    ///< planar GBR 4:4:4 36bpp, little-endian
12707 +    AV_PIX_FMT_GBRP14BE,    ///< planar GBR 4:4:4 42bpp, big-endian
12708 +    AV_PIX_FMT_GBRP14LE,    ///< planar GBR 4:4:4 42bpp, little-endian
12709 +    AV_PIX_FMT_YUVJ411P,    ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range
12710 +
12711 +    AV_PIX_FMT_BAYER_BGGR8,    ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
12712 +    AV_PIX_FMT_BAYER_RGGB8,    ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
12713 +    AV_PIX_FMT_BAYER_GBRG8,    ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
12714 +    AV_PIX_FMT_BAYER_GRBG8,    ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
12715 +    AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
12716 +    AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
12717 +    AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
12718 +    AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
12719 +    AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
12720 +    AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
12721 +    AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
12722 +    AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
12723 +
12724 +    AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
12725 +
12726 +    AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12727 +    AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12728 +    AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12729 +    AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12730 +    AV_PIX_FMT_AYUV64LE,    ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12731 +    AV_PIX_FMT_AYUV64BE,    ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12732 +
12733 +    AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
12734 +
12735 +    AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
12736 +    AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
12737 +
12738 +    AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp, big-endian
12739 +    AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp, little-endian
12740 +
12741 +    AV_PIX_FMT_GBRAP10BE,  ///< planar GBR 4:4:4:4 40bpp, big-endian
12742 +    AV_PIX_FMT_GBRAP10LE,  ///< planar GBR 4:4:4:4 40bpp, little-endian
12743 +
12744 +    AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
12745 +
12746 +    AV_PIX_FMT_GRAY12BE,   ///<        Y        , 12bpp, big-endian
12747 +    AV_PIX_FMT_GRAY12LE,   ///<        Y        , 12bpp, little-endian
12748 +    AV_PIX_FMT_GRAY10BE,   ///<        Y        , 10bpp, big-endian
12749 +    AV_PIX_FMT_GRAY10LE,   ///<        Y        , 10bpp, little-endian
12750 +
12751 +    AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
12752 +    AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
12753 +
12754 +    /**
12755 +     * Hardware surfaces for Direct3D11.
12756 +     *
12757 +     * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
12758 +     * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
12759 +     *
12760 +     * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
12761 +     * texture array index of the frame as intptr_t if the ID3D11Texture2D is
12762 +     * an array texture (or always 0 if it's a normal texture).
12763 +     */
12764 +    AV_PIX_FMT_D3D11,
12765 +
12766 +    AV_PIX_FMT_GRAY9BE,   ///<        Y        , 9bpp, big-endian
12767 +    AV_PIX_FMT_GRAY9LE,   ///<        Y        , 9bpp, little-endian
12768 +
12769 +    AV_PIX_FMT_GBRPF32BE,  ///< IEEE-754 single precision planar GBR 4:4:4,     96bpp, big-endian
12770 +    AV_PIX_FMT_GBRPF32LE,  ///< IEEE-754 single precision planar GBR 4:4:4,     96bpp, little-endian
12771 +    AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
12772 +    AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
12773 +
12774 +    /**
12775 +     * DRM-managed buffers exposed through PRIME buffer sharing.
12776 +     *
12777 +     * data[0] points to an AVDRMFrameDescriptor.
12778 +     */
12779 +    AV_PIX_FMT_DRM_PRIME,
12780 +    /**
12781 +     * Hardware surfaces for OpenCL.
12782 +     *
12783 +     * data[i] contain 2D image objects (typed in C as cl_mem, used
12784 +     * in OpenCL as image2d_t) for each plane of the surface.
12785 +     */
12786 +    AV_PIX_FMT_OPENCL,
12787 +
12788 +    AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
12789 +};
12790 +
12791 +#if AV_HAVE_BIGENDIAN
12792 +#   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
12793 +#else
12794 +#   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
12795 +#endif
12796 +
12797 +#define AV_PIX_FMT_RGB32   AV_PIX_FMT_NE(ARGB, BGRA)
12798 +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
12799 +#define AV_PIX_FMT_BGR32   AV_PIX_FMT_NE(ABGR, RGBA)
12800 +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
12801 +#define AV_PIX_FMT_0RGB32  AV_PIX_FMT_NE(0RGB, BGR0)
12802 +#define AV_PIX_FMT_0BGR32  AV_PIX_FMT_NE(0BGR, RGB0)
12803 +
12804 +#define AV_PIX_FMT_GRAY9  AV_PIX_FMT_NE(GRAY9BE,  GRAY9LE)
12805 +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
12806 +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
12807 +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
12808 +#define AV_PIX_FMT_YA16   AV_PIX_FMT_NE(YA16BE,   YA16LE)
12809 +#define AV_PIX_FMT_RGB48  AV_PIX_FMT_NE(RGB48BE,  RGB48LE)
12810 +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
12811 +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
12812 +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
12813 +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
12814 +#define AV_PIX_FMT_BGR48  AV_PIX_FMT_NE(BGR48BE,  BGR48LE)
12815 +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
12816 +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
12817 +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
12818 +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
12819 +
12820 +#define AV_PIX_FMT_YUV420P9  AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
12821 +#define AV_PIX_FMT_YUV422P9  AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
12822 +#define AV_PIX_FMT_YUV444P9  AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
12823 +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
12824 +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
12825 +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
12826 +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
12827 +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
12828 +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
12829 +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
12830 +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
12831 +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
12832 +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
12833 +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
12834 +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
12835 +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
12836 +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
12837 +
12838 +#define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
12839 +#define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
12840 +#define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
12841 +#define AV_PIX_FMT_GBRP14    AV_PIX_FMT_NE(GBRP14BE,    GBRP14LE)
12842 +#define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
12843 +#define AV_PIX_FMT_GBRAP10   AV_PIX_FMT_NE(GBRAP10BE,   GBRAP10LE)
12844 +#define AV_PIX_FMT_GBRAP12   AV_PIX_FMT_NE(GBRAP12BE,   GBRAP12LE)
12845 +#define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
12846 +
12847 +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    BAYER_BGGR16LE)
12848 +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE,    BAYER_RGGB16LE)
12849 +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE,    BAYER_GBRG16LE)
12850 +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE,    BAYER_GRBG16LE)
12851 +
12852 +#define AV_PIX_FMT_GBRPF32    AV_PIX_FMT_NE(GBRPF32BE,  GBRPF32LE)
12853 +#define AV_PIX_FMT_GBRAPF32   AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
12854 +
12855 +#define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
12856 +#define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
12857 +#define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
12858 +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
12859 +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
12860 +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
12861 +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
12862 +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
12863 +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
12864 +
12865 +#define AV_PIX_FMT_XYZ12      AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
12866 +#define AV_PIX_FMT_NV20       AV_PIX_FMT_NE(NV20BE,  NV20LE)
12867 +#define AV_PIX_FMT_AYUV64     AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
12868 +#define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
12869 +#define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
12870 +
12871 +/**
12872 +  * Chromaticity coordinates of the source primaries.
12873 +  * These values match the ones defined by ISO/IEC 23001-8_2013 Â§ 7.1.
12874 +  */
12875 +enum AVColorPrimaries {
12876 +    AVCOL_PRI_RESERVED0   = 0,
12877 +    AVCOL_PRI_BT709       = 1,  ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
12878 +    AVCOL_PRI_UNSPECIFIED = 2,
12879 +    AVCOL_PRI_RESERVED    = 3,
12880 +    AVCOL_PRI_BT470M      = 4,  ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12881 +
12882 +    AVCOL_PRI_BT470BG     = 5,  ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
12883 +    AVCOL_PRI_SMPTE170M   = 6,  ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12884 +    AVCOL_PRI_SMPTE240M   = 7,  ///< functionally identical to above
12885 +    AVCOL_PRI_FILM        = 8,  ///< colour filters using Illuminant C
12886 +    AVCOL_PRI_BT2020      = 9,  ///< ITU-R BT2020
12887 +    AVCOL_PRI_SMPTE428    = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
12888 +    AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
12889 +    AVCOL_PRI_SMPTE431    = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
12890 +    AVCOL_PRI_SMPTE432    = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
12891 +    AVCOL_PRI_JEDEC_P22   = 22, ///< JEDEC P22 phosphors
12892 +    AVCOL_PRI_NB                ///< Not part of ABI
12893 +};
12894 +
12895 +/**
12896 + * Color Transfer Characteristic.
12897 + * These values match the ones defined by ISO/IEC 23001-8_2013 Â§ 7.2.
12898 + */
12899 +enum AVColorTransferCharacteristic {
12900 +    AVCOL_TRC_RESERVED0    = 0,
12901 +    AVCOL_TRC_BT709        = 1,  ///< also ITU-R BT1361
12902 +    AVCOL_TRC_UNSPECIFIED  = 2,
12903 +    AVCOL_TRC_RESERVED     = 3,
12904 +    AVCOL_TRC_GAMMA22      = 4,  ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
12905 +    AVCOL_TRC_GAMMA28      = 5,  ///< also ITU-R BT470BG
12906 +    AVCOL_TRC_SMPTE170M    = 6,  ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
12907 +    AVCOL_TRC_SMPTE240M    = 7,
12908 +    AVCOL_TRC_LINEAR       = 8,  ///< "Linear transfer characteristics"
12909 +    AVCOL_TRC_LOG          = 9,  ///< "Logarithmic transfer characteristic (100:1 range)"
12910 +    AVCOL_TRC_LOG_SQRT     = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
12911 +    AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
12912 +    AVCOL_TRC_BT1361_ECG   = 12, ///< ITU-R BT1361 Extended Colour Gamut
12913 +    AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
12914 +    AVCOL_TRC_BT2020_10    = 14, ///< ITU-R BT2020 for 10-bit system
12915 +    AVCOL_TRC_BT2020_12    = 15, ///< ITU-R BT2020 for 12-bit system
12916 +    AVCOL_TRC_SMPTE2084    = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
12917 +    AVCOL_TRC_SMPTEST2084  = AVCOL_TRC_SMPTE2084,
12918 +    AVCOL_TRC_SMPTE428     = 17, ///< SMPTE ST 428-1
12919 +    AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
12920 +    AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
12921 +    AVCOL_TRC_NB                 ///< Not part of ABI
12922 +};
12923 +
12924 +/**
12925 + * YUV colorspace type.
12926 + * These values match the ones defined by ISO/IEC 23001-8_2013 Â§ 7.3.
12927 + */
12928 +enum AVColorSpace {
12929 +    AVCOL_SPC_RGB         = 0,  ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
12930 +    AVCOL_SPC_BT709       = 1,  ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
12931 +    AVCOL_SPC_UNSPECIFIED = 2,
12932 +    AVCOL_SPC_RESERVED    = 3,
12933 +    AVCOL_SPC_FCC         = 4,  ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12934 +    AVCOL_SPC_BT470BG     = 5,  ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
12935 +    AVCOL_SPC_SMPTE170M   = 6,  ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12936 +    AVCOL_SPC_SMPTE240M   = 7,  ///< functionally identical to above
12937 +    AVCOL_SPC_YCGCO       = 8,  ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
12938 +    AVCOL_SPC_YCOCG       = AVCOL_SPC_YCGCO,
12939 +    AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance system
12940 +    AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
12941 +    AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
12942 +    AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
12943 +    AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
12944 +    AVCOL_SPC_ICTCP       = 14, ///< ITU-R BT.2100-0, ICtCp
12945 +    AVCOL_SPC_NB                ///< Not part of ABI
12946 +};
12947 +
12948 +/**
12949 + * MPEG vs JPEG YUV range.
12950 + */
12951 +enum AVColorRange {
12952 +    AVCOL_RANGE_UNSPECIFIED = 0,
12953 +    AVCOL_RANGE_MPEG        = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
12954 +    AVCOL_RANGE_JPEG        = 2, ///< the normal     2^n-1   "JPEG" YUV ranges
12955 +    AVCOL_RANGE_NB               ///< Not part of ABI
12956 +};
12957 +
12958 +/**
12959 + * Location of chroma samples.
12960 + *
12961 + * Illustration showing the location of the first (top left) chroma sample of the
12962 + * image, the left shows only luma, the right
12963 + * shows the location of the chroma sample, the 2 could be imagined to overlay
12964 + * each other but are drawn separately due to limitations of ASCII
12965 + *
12966 + *                1st 2nd       1st 2nd horizontal luma sample positions
12967 + *                 v   v         v   v
12968 + *                 ______        ______
12969 + *1st luma line > |X   X ...    |3 4 X ...     X are luma samples,
12970 + *                |             |1 2           1-6 are possible chroma positions
12971 + *2nd luma line > |X   X ...    |5 6 X ...     0 is undefined/unknown position
12972 + */
12973 +enum AVChromaLocation {
12974 +    AVCHROMA_LOC_UNSPECIFIED = 0,
12975 +    AVCHROMA_LOC_LEFT        = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
12976 +    AVCHROMA_LOC_CENTER      = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
12977 +    AVCHROMA_LOC_TOPLEFT     = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
12978 +    AVCHROMA_LOC_TOP         = 4,
12979 +    AVCHROMA_LOC_BOTTOMLEFT  = 5,
12980 +    AVCHROMA_LOC_BOTTOM      = 6,
12981 +    AVCHROMA_LOC_NB               ///< Not part of ABI
12982 +};
12983 +
12984 +#endif /* AVUTIL_PIXFMT_H */
12985 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12986 new file mode 100644
12987 --- /dev/null
12988 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12989 @@ -0,0 +1,214 @@
12990 +/*
12991 + * rational numbers
12992 + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
12993 + *
12994 + * This file is part of FFmpeg.
12995 + *
12996 + * FFmpeg is free software; you can redistribute it and/or
12997 + * modify it under the terms of the GNU Lesser General Public
12998 + * License as published by the Free Software Foundation; either
12999 + * version 2.1 of the License, or (at your option) any later version.
13000 + *
13001 + * FFmpeg is distributed in the hope that it will be useful,
13002 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13003 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13004 + * Lesser General Public License for more details.
13005 + *
13006 + * You should have received a copy of the GNU Lesser General Public
13007 + * License along with FFmpeg; if not, write to the Free Software
13008 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13009 + */
13010 +
13011 +/**
13012 + * @file
13013 + * @ingroup lavu_math_rational
13014 + * Utilties for rational number calculation.
13015 + * @author Michael Niedermayer <michaelni@gmx.at>
13016 + */
13017 +
13018 +#ifndef AVUTIL_RATIONAL_H
13019 +#define AVUTIL_RATIONAL_H
13020 +
13021 +#include <stdint.h>
13022 +#include <limits.h>
13023 +#include "attributes.h"
13024 +
13025 +/**
13026 + * @defgroup lavu_math_rational AVRational
13027 + * @ingroup lavu_math
13028 + * Rational number calculation.
13029 + *
13030 + * While rational numbers can be expressed as floating-point numbers, the
13031 + * conversion process is a lossy one, so are floating-point operations. On the
13032 + * other hand, the nature of FFmpeg demands highly accurate calculation of
13033 + * timestamps. This set of rational number utilities serves as a generic
13034 + * interface for manipulating rational numbers as pairs of numerators and
13035 + * denominators.
13036 + *
13037 + * Many of the functions that operate on AVRational's have the suffix `_q`, in
13038 + * reference to the mathematical symbol "â„š" (Q) which denotes the set of all
13039 + * rational numbers.
13040 + *
13041 + * @{
13042 + */
13043 +
13044 +/**
13045 + * Rational number (pair of numerator and denominator).
13046 + */
13047 +typedef struct AVRational{
13048 +    int num; ///< Numerator
13049 +    int den; ///< Denominator
13050 +} AVRational;
13051 +
13052 +/**
13053 + * Create an AVRational.
13054 + *
13055 + * Useful for compilers that do not support compound literals.
13056 + *
13057 + * @note The return value is not reduced.
13058 + * @see av_reduce()
13059 + */
13060 +static inline AVRational av_make_q(int num, int den)
13061 +{
13062 +    AVRational r = { num, den };
13063 +    return r;
13064 +}
13065 +
13066 +/**
13067 + * Compare two rationals.
13068 + *
13069 + * @param a First rational
13070 + * @param b Second rational
13071 + *
13072 + * @return One of the following values:
13073 + *         - 0 if `a == b`
13074 + *         - 1 if `a > b`
13075 + *         - -1 if `a < b`
13076 + *         - `INT_MIN` if one of the values is of the form `0 / 0`
13077 + */
13078 +static inline int av_cmp_q(AVRational a, AVRational b){
13079 +    const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
13080 +
13081 +    if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
13082 +    else if(b.den && a.den) return 0;
13083 +    else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
13084 +    else                    return INT_MIN;
13085 +}
13086 +
13087 +/**
13088 + * Convert an AVRational to a `double`.
13089 + * @param a AVRational to convert
13090 + * @return `a` in floating-point form
13091 + * @see av_d2q()
13092 + */
13093 +static inline double av_q2d(AVRational a){
13094 +    return a.num / (double) a.den;
13095 +}
13096 +
13097 +/**
13098 + * Reduce a fraction.
13099 + *
13100 + * This is useful for framerate calculations.
13101 + *
13102 + * @param[out] dst_num Destination numerator
13103 + * @param[out] dst_den Destination denominator
13104 + * @param[in]      num Source numerator
13105 + * @param[in]      den Source denominator
13106 + * @param[in]      max Maximum allowed values for `dst_num` & `dst_den`
13107 + * @return 1 if the operation is exact, 0 otherwise
13108 + */
13109 +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
13110 +
13111 +/**
13112 + * Multiply two rationals.
13113 + * @param b First rational
13114 + * @param c Second rational
13115 + * @return b*c
13116 + */
13117 +AVRational av_mul_q(AVRational b, AVRational c) av_const;
13118 +
13119 +/**
13120 + * Divide one rational by another.
13121 + * @param b First rational
13122 + * @param c Second rational
13123 + * @return b/c
13124 + */
13125 +AVRational av_div_q(AVRational b, AVRational c) av_const;
13126 +
13127 +/**
13128 + * Add two rationals.
13129 + * @param b First rational
13130 + * @param c Second rational
13131 + * @return b+c
13132 + */
13133 +AVRational av_add_q(AVRational b, AVRational c) av_const;
13134 +
13135 +/**
13136 + * Subtract one rational from another.
13137 + * @param b First rational
13138 + * @param c Second rational
13139 + * @return b-c
13140 + */
13141 +AVRational av_sub_q(AVRational b, AVRational c) av_const;
13142 +
13143 +/**
13144 + * Invert a rational.
13145 + * @param q value
13146 + * @return 1 / q
13147 + */
13148 +static av_always_inline AVRational av_inv_q(AVRational q)
13149 +{
13150 +    AVRational r = { q.den, q.num };
13151 +    return r;
13152 +}
13153 +
13154 +/**
13155 + * Convert a double precision floating point number to a rational.
13156 + *
13157 + * In case of infinity, the returned value is expressed as `{1, 0}` or
13158 + * `{-1, 0}` depending on the sign.
13159 + *
13160 + * @param d   `double` to convert
13161 + * @param max Maximum allowed numerator and denominator
13162 + * @return `d` in AVRational form
13163 + * @see av_q2d()
13164 + */
13165 +AVRational av_d2q(double d, int max) av_const;
13166 +
13167 +/**
13168 + * Find which of the two rationals is closer to another rational.
13169 + *
13170 + * @param q     Rational to be compared against
13171 + * @param q1,q2 Rationals to be tested
13172 + * @return One of the following values:
13173 + *         - 1 if `q1` is nearer to `q` than `q2`
13174 + *         - -1 if `q2` is nearer to `q` than `q1`
13175 + *         - 0 if they have the same distance
13176 + */
13177 +int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
13178 +
13179 +/**
13180 + * Find the value in a list of rationals nearest a given reference rational.
13181 + *
13182 + * @param q      Reference rational
13183 + * @param q_list Array of rationals terminated by `{0, 0}`
13184 + * @return Index of the nearest value found in the array
13185 + */
13186 +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
13187 +
13188 +/**
13189 + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
13190 + * format.
13191 + *
13192 + * @param q Rational to be converted
13193 + * @return Equivalent floating-point value, expressed as an unsigned 32-bit
13194 + *         integer.
13195 + * @note The returned value is platform-indepedant.
13196 + */
13197 +uint32_t av_q2intfloat(AVRational q);
13198 +
13199 +/**
13200 + * @}
13201 + */
13202 +
13203 +#endif /* AVUTIL_RATIONAL_H */
13204 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13205 new file mode 100644
13206 --- /dev/null
13207 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13208 @@ -0,0 +1,272 @@
13209 +/*
13210 + * This file is part of FFmpeg.
13211 + *
13212 + * FFmpeg is free software; you can redistribute it and/or
13213 + * modify it under the terms of the GNU Lesser General Public
13214 + * License as published by the Free Software Foundation; either
13215 + * version 2.1 of the License, or (at your option) any later version.
13216 + *
13217 + * FFmpeg is distributed in the hope that it will be useful,
13218 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13219 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13220 + * Lesser General Public License for more details.
13221 + *
13222 + * You should have received a copy of the GNU Lesser General Public
13223 + * License along with FFmpeg; if not, write to the Free Software
13224 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13225 + */
13226 +
13227 +#ifndef AVUTIL_SAMPLEFMT_H
13228 +#define AVUTIL_SAMPLEFMT_H
13229 +
13230 +#include <stdint.h>
13231 +
13232 +#include "avutil.h"
13233 +#include "attributes.h"
13234 +
13235 +/**
13236 + * @addtogroup lavu_audio
13237 + * @{
13238 + *
13239 + * @defgroup lavu_sampfmts Audio sample formats
13240 + *
13241 + * Audio sample format enumeration and related convenience functions.
13242 + * @{
13243 + */
13244 +
13245 +/**
13246 + * Audio sample formats
13247 + *
13248 + * - The data described by the sample format is always in native-endian order.
13249 + *   Sample values can be expressed by native C types, hence the lack of a signed
13250 + *   24-bit sample format even though it is a common raw audio data format.
13251 + *
13252 + * - The floating-point formats are based on full volume being in the range
13253 + *   [-1.0, 1.0]. Any values outside this range are beyond full volume level.
13254 + *
13255 + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
13256 + *   (such as AVFrame in libavcodec) is as follows:
13257 + *
13258 + * @par
13259 + * For planar sample formats, each audio channel is in a separate data plane,
13260 + * and linesize is the buffer size, in bytes, for a single plane. All data
13261 + * planes must be the same size. For packed sample formats, only the first data
13262 + * plane is used, and samples for each channel are interleaved. In this case,
13263 + * linesize is the buffer size, in bytes, for the 1 plane.
13264 + *
13265 + */
13266 +enum AVSampleFormat {
13267 +    AV_SAMPLE_FMT_NONE = -1,
13268 +    AV_SAMPLE_FMT_U8,          ///< unsigned 8 bits
13269 +    AV_SAMPLE_FMT_S16,         ///< signed 16 bits
13270 +    AV_SAMPLE_FMT_S32,         ///< signed 32 bits
13271 +    AV_SAMPLE_FMT_FLT,         ///< float
13272 +    AV_SAMPLE_FMT_DBL,         ///< double
13273 +
13274 +    AV_SAMPLE_FMT_U8P,         ///< unsigned 8 bits, planar
13275 +    AV_SAMPLE_FMT_S16P,        ///< signed 16 bits, planar
13276 +    AV_SAMPLE_FMT_S32P,        ///< signed 32 bits, planar
13277 +    AV_SAMPLE_FMT_FLTP,        ///< float, planar
13278 +    AV_SAMPLE_FMT_DBLP,        ///< double, planar
13279 +    AV_SAMPLE_FMT_S64,         ///< signed 64 bits
13280 +    AV_SAMPLE_FMT_S64P,        ///< signed 64 bits, planar
13281 +
13282 +    AV_SAMPLE_FMT_NB           ///< Number of sample formats. DO NOT USE if linking dynamically
13283 +};
13284 +
13285 +/**
13286 + * Return the name of sample_fmt, or NULL if sample_fmt is not
13287 + * recognized.
13288 + */
13289 +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
13290 +
13291 +/**
13292 + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
13293 + * on error.
13294 + */
13295 +enum AVSampleFormat av_get_sample_fmt(const char *name);
13296 +
13297 +/**
13298 + * Return the planar<->packed alternative form of the given sample format, or
13299 + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
13300 + * requested planar/packed format, the format returned is the same as the
13301 + * input.
13302 + */
13303 +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
13304 +
13305 +/**
13306 + * Get the packed alternative form of the given sample format.
13307 + *
13308 + * If the passed sample_fmt is already in packed format, the format returned is
13309 + * the same as the input.
13310 + *
13311 + * @return  the packed alternative form of the given sample format or
13312 +            AV_SAMPLE_FMT_NONE on error.
13313 + */
13314 +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
13315 +
13316 +/**
13317 + * Get the planar alternative form of the given sample format.
13318 + *
13319 + * If the passed sample_fmt is already in planar format, the format returned is
13320 + * the same as the input.
13321 + *
13322 + * @return  the planar alternative form of the given sample format or
13323 +            AV_SAMPLE_FMT_NONE on error.
13324 + */
13325 +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
13326 +
13327 +/**
13328 + * Generate a string corresponding to the sample format with
13329 + * sample_fmt, or a header if sample_fmt is negative.
13330 + *
13331 + * @param buf the buffer where to write the string
13332 + * @param buf_size the size of buf
13333 + * @param sample_fmt the number of the sample format to print the
13334 + * corresponding info string, or a negative value to print the
13335 + * corresponding header.
13336 + * @return the pointer to the filled buffer or NULL if sample_fmt is
13337 + * unknown or in case of other errors
13338 + */
13339 +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
13340 +
13341 +/**
13342 + * Return number of bytes per sample.
13343 + *
13344 + * @param sample_fmt the sample format
13345 + * @return number of bytes per sample or zero if unknown for the given
13346 + * sample format
13347 + */
13348 +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
13349 +
13350 +/**
13351 + * Check if the sample format is planar.
13352 + *
13353 + * @param sample_fmt the sample format to inspect
13354 + * @return 1 if the sample format is planar, 0 if it is interleaved
13355 + */
13356 +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
13357 +
13358 +/**
13359 + * Get the required buffer size for the given audio parameters.
13360 + *
13361 + * @param[out] linesize calculated linesize, may be NULL
13362 + * @param nb_channels   the number of channels
13363 + * @param nb_samples    the number of samples in a single channel
13364 + * @param sample_fmt    the sample format
13365 + * @param align         buffer size alignment (0 = default, 1 = no alignment)
13366 + * @return              required buffer size, or negative error code on failure
13367 + */
13368 +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
13369 +                               enum AVSampleFormat sample_fmt, int align);
13370 +
13371 +/**
13372 + * @}
13373 + *
13374 + * @defgroup lavu_sampmanip Samples manipulation
13375 + *
13376 + * Functions that manipulate audio samples
13377 + * @{
13378 + */
13379 +
13380 +/**
13381 + * Fill plane data pointers and linesize for samples with sample
13382 + * format sample_fmt.
13383 + *
13384 + * The audio_data array is filled with the pointers to the samples data planes:
13385 + * for planar, set the start point of each channel's data within the buffer,
13386 + * for packed, set the start point of the entire buffer only.
13387 + *
13388 + * The value pointed to by linesize is set to the aligned size of each
13389 + * channel's data buffer for planar layout, or to the aligned size of the
13390 + * buffer for all channels for packed layout.
13391 + *
13392 + * The buffer in buf must be big enough to contain all the samples
13393 + * (use av_samples_get_buffer_size() to compute its minimum size),
13394 + * otherwise the audio_data pointers will point to invalid data.
13395 + *
13396 + * @see enum AVSampleFormat
13397 + * The documentation for AVSampleFormat describes the data layout.
13398 + *
13399 + * @param[out] audio_data  array to be filled with the pointer for each channel
13400 + * @param[out] linesize    calculated linesize, may be NULL
13401 + * @param buf              the pointer to a buffer containing the samples
13402 + * @param nb_channels      the number of channels
13403 + * @param nb_samples       the number of samples in a single channel
13404 + * @param sample_fmt       the sample format
13405 + * @param align            buffer size alignment (0 = default, 1 = no alignment)
13406 + * @return                 >=0 on success or a negative error code on failure
13407 + * @todo return minimum size in bytes required for the buffer in case
13408 + * of success at the next bump
13409 + */
13410 +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
13411 +                           const uint8_t *buf,
13412 +                           int nb_channels, int nb_samples,
13413 +                           enum AVSampleFormat sample_fmt, int align);
13414 +
13415 +/**
13416 + * Allocate a samples buffer for nb_samples samples, and fill data pointers and
13417 + * linesize accordingly.
13418 + * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
13419 + * Allocated data will be initialized to silence.
13420 + *
13421 + * @see enum AVSampleFormat
13422 + * The documentation for AVSampleFormat describes the data layout.
13423 + *
13424 + * @param[out] audio_data  array to be filled with the pointer for each channel
13425 + * @param[out] linesize    aligned size for audio buffer(s), may be NULL
13426 + * @param nb_channels      number of audio channels
13427 + * @param nb_samples       number of samples per channel
13428 + * @param align            buffer size alignment (0 = default, 1 = no alignment)
13429 + * @return                 >=0 on success or a negative error code on failure
13430 + * @todo return the size of the allocated buffer in case of success at the next bump
13431 + * @see av_samples_fill_arrays()
13432 + * @see av_samples_alloc_array_and_samples()
13433 + */
13434 +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
13435 +                     int nb_samples, enum AVSampleFormat sample_fmt, int align);
13436 +
13437 +/**
13438 + * Allocate a data pointers array, samples buffer for nb_samples
13439 + * samples, and fill data pointers and linesize accordingly.
13440 + *
13441 + * This is the same as av_samples_alloc(), but also allocates the data
13442 + * pointers array.
13443 + *
13444 + * @see av_samples_alloc()
13445 + */
13446 +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
13447 +                                       int nb_samples, enum AVSampleFormat sample_fmt, int align);
13448 +
13449 +/**
13450 + * Copy samples from src to dst.
13451 + *
13452 + * @param dst destination array of pointers to data planes
13453 + * @param src source array of pointers to data planes
13454 + * @param dst_offset offset in samples at which the data will be written to dst
13455 + * @param src_offset offset in samples at which the data will be read from src
13456 + * @param nb_samples number of samples to be copied
13457 + * @param nb_channels number of audio channels
13458 + * @param sample_fmt audio sample format
13459 + */
13460 +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
13461 +                    int src_offset, int nb_samples, int nb_channels,
13462 +                    enum AVSampleFormat sample_fmt);
13463 +
13464 +/**
13465 + * Fill an audio buffer with silence.
13466 + *
13467 + * @param audio_data  array of pointers to data planes
13468 + * @param offset      offset in samples at which to start filling
13469 + * @param nb_samples  number of samples to fill
13470 + * @param nb_channels number of audio channels
13471 + * @param sample_fmt  audio sample format
13472 + */
13473 +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
13474 +                           int nb_channels, enum AVSampleFormat sample_fmt);
13475 +
13476 +/**
13477 + * @}
13478 + * @}
13479 + */
13480 +#endif /* AVUTIL_SAMPLEFMT_H */
13481 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13482 new file mode 100644
13483 --- /dev/null
13484 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13485 @@ -0,0 +1,139 @@
13486 +/*
13487 + * copyright (c) 2003 Fabrice Bellard
13488 + *
13489 + * This file is part of FFmpeg.
13490 + *
13491 + * FFmpeg is free software; you can redistribute it and/or
13492 + * modify it under the terms of the GNU Lesser General Public
13493 + * License as published by the Free Software Foundation; either
13494 + * version 2.1 of the License, or (at your option) any later version.
13495 + *
13496 + * FFmpeg is distributed in the hope that it will be useful,
13497 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13498 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13499 + * Lesser General Public License for more details.
13500 + *
13501 + * You should have received a copy of the GNU Lesser General Public
13502 + * License along with FFmpeg; if not, write to the Free Software
13503 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13504 + */
13505 +
13506 +/**
13507 + * @file
13508 + * @ingroup lavu
13509 + * Libavutil version macros
13510 + */
13511 +
13512 +#ifndef AVUTIL_VERSION_H
13513 +#define AVUTIL_VERSION_H
13514 +
13515 +#include "macros.h"
13516 +
13517 +/**
13518 + * @addtogroup version_utils
13519 + *
13520 + * Useful to check and match library version in order to maintain
13521 + * backward compatibility.
13522 + *
13523 + * The FFmpeg libraries follow a versioning sheme very similar to
13524 + * Semantic Versioning (http://semver.org/)
13525 + * The difference is that the component called PATCH is called MICRO in FFmpeg
13526 + * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
13527 + * Also we do not increase MICRO for every bugfix or change in git master.
13528 + *
13529 + * Prior to FFmpeg 3.2 point releases did not change any lib version number to
13530 + * avoid aliassing different git master checkouts.
13531 + * Starting with FFmpeg 3.2, the released library versions will occupy
13532 + * a separate MAJOR.MINOR that is not used on the master development branch.
13533 + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
13534 + * for the release and master will continue at 55.12.100 after it. Each new
13535 + * point release will then bump the MICRO improving the usefulness of the lib
13536 + * versions.
13537 + *
13538 + * @{
13539 + */
13540 +
13541 +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
13542 +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
13543 +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
13544 +
13545 +/**
13546 + * Extract version components from the full ::AV_VERSION_INT int as returned
13547 + * by functions like ::avformat_version() and ::avcodec_version()
13548 + */
13549 +#define AV_VERSION_MAJOR(a) ((a) >> 16)
13550 +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
13551 +#define AV_VERSION_MICRO(a) ((a) & 0xFF)
13552 +
13553 +/**
13554 + * @}
13555 + */
13556 +
13557 +/**
13558 + * @defgroup lavu_ver Version and Build diagnostics
13559 + *
13560 + * Macros and function useful to check at compiletime and at runtime
13561 + * which version of libavutil is in use.
13562 + *
13563 + * @{
13564 + */
13565 +
13566 +#define LIBAVUTIL_VERSION_MAJOR  56
13567 +#define LIBAVUTIL_VERSION_MINOR  14
13568 +#define LIBAVUTIL_VERSION_MICRO 100
13569 +
13570 +#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
13571 +                                               LIBAVUTIL_VERSION_MINOR, \
13572 +                                               LIBAVUTIL_VERSION_MICRO)
13573 +#define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_MAJOR,     \
13574 +                                           LIBAVUTIL_VERSION_MINOR,     \
13575 +                                           LIBAVUTIL_VERSION_MICRO)
13576 +#define LIBAVUTIL_BUILD         LIBAVUTIL_VERSION_INT
13577 +
13578 +#define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
13579 +
13580 +/**
13581 + * @defgroup lavu_depr_guards Deprecation Guards
13582 + * FF_API_* defines may be placed below to indicate public API that will be
13583 + * dropped at a future version bump. The defines themselves are not part of
13584 + * the public API and may change, break or disappear at any time.
13585 + *
13586 + * @note, when bumping the major version it is recommended to manually
13587 + * disable each FF_API_* in its own commit instead of disabling them all
13588 + * at once through the bump. This improves the git bisect-ability of the change.
13589 + *
13590 + * @{
13591 + */
13592 +
13593 +#ifndef FF_API_VAAPI
13594 +#define FF_API_VAAPI                    (LIBAVUTIL_VERSION_MAJOR < 57)
13595 +#endif
13596 +#ifndef FF_API_FRAME_QP
13597 +#define FF_API_FRAME_QP                 (LIBAVUTIL_VERSION_MAJOR < 57)
13598 +#endif
13599 +#ifndef FF_API_PLUS1_MINUS1
13600 +#define FF_API_PLUS1_MINUS1             (LIBAVUTIL_VERSION_MAJOR < 57)
13601 +#endif
13602 +#ifndef FF_API_ERROR_FRAME
13603 +#define FF_API_ERROR_FRAME              (LIBAVUTIL_VERSION_MAJOR < 57)
13604 +#endif
13605 +#ifndef FF_API_PKT_PTS
13606 +#define FF_API_PKT_PTS                  (LIBAVUTIL_VERSION_MAJOR < 57)
13607 +#endif
13608 +#ifndef FF_API_CRYPTO_SIZE_T
13609 +#define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
13610 +#endif
13611 +#ifndef FF_API_FRAME_GET_SET
13612 +#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
13613 +#endif
13614 +#ifndef FF_API_PSEUDOPAL
13615 +#define FF_API_PSEUDOPAL                (LIBAVUTIL_VERSION_MAJOR < 57)
13616 +#endif
13617 +
13618 +
13619 +/**
13620 + * @}
13621 + * @}
13622 + */
13623 +
13624 +#endif /* AVUTIL_VERSION_H */
13625 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/moz.build b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13626 new file mode 100644
13627 --- /dev/null
13628 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13629 @@ -0,0 +1,25 @@
13630 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
13631 +# vim: set filetype=python:
13632 +# This Source Code Form is subject to the terms of the Mozilla Public
13633 +# License, v. 2.0. If a copy of the MPL was not distributed with this
13634 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
13635 +
13636 +UNIFIED_SOURCES += [
13637 +    '../FFmpegAudioDecoder.cpp',
13638 +    '../FFmpegDataDecoder.cpp',
13639 +    '../FFmpegDecoderModule.cpp',
13640 +    '../FFmpegVideoDecoder.cpp',
13641 +]
13642 +LOCAL_INCLUDES += [
13643 +    '..',
13644 +    'include',
13645 +]
13646 +
13647 +if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
13648 +  CXXFLAGS += [ '-Wno-deprecated-declarations' ]
13649 +if CONFIG['CC_TYPE'] == 'clang':
13650 +  CXXFLAGS += [
13651 +    '-Wno-unknown-attributes',
13652 +  ]
13653 +
13654 +FINAL_LIBRARY = 'xul'
13655 diff --git a/dom/media/platforms/ffmpeg/moz.build b/dom/media/platforms/ffmpeg/moz.build
13656 --- a/dom/media/platforms/ffmpeg/moz.build
13657 +++ b/dom/media/platforms/ffmpeg/moz.build
13658 @@ -8,15 +8,16 @@ EXPORTS += [
13659      'FFmpegRuntimeLinker.h',
13660  ]
13661  
13662  DIRS += [
13663      'libav53',
13664      'libav54',
13665      'libav55',
13666      'ffmpeg57',
13667 +    'ffmpeg58',
13668  ]
13669  
13670  UNIFIED_SOURCES += [
13671      'FFmpegRuntimeLinker.cpp',
13672  ]
13673  
13674  FINAL_LIBRARY = 'xul'
13675
This page took 5.136667 seconds and 3 git commands to generate.