View | Details | Raw Unified | Return to bug 228160
Collapse All | Expand All

(-)Makefile (-2 / +1 lines)
Lines 2-10 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	palemoon
4
PORTNAME=	palemoon
5
DISTVERSION=	27.9.0
5
DISTVERSION=	27.9.1
6
DISTVERSIONSUFFIX=_Release
6
DISTVERSIONSUFFIX=_Release
7
PORTREVISION=	1
8
CATEGORIES=	www ipv6
7
CATEGORIES=	www ipv6
9
8
10
MAINTAINER=	lichray@gmail.com
9
MAINTAINER=	lichray@gmail.com
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1524298267
1
TIMESTAMP = 1525897958
2
SHA256 (MoonchildProductions-Pale-Moon-27.9.0_Release_GH0.tar.gz) = d5186c1f002af2301ac20c085804c621c54d3f7fe2c1ab54a1acf9e0b185e8b3
2
SHA256 (MoonchildProductions-Pale-Moon-27.9.1_Release_GH0.tar.gz) = 581164f3067bfb25559f227d36e7780296c460923849c82edb05b3f074076b32
3
SIZE (MoonchildProductions-Pale-Moon-27.9.0_Release_GH0.tar.gz) = 175235763
3
SIZE (MoonchildProductions-Pale-Moon-27.9.1_Release_GH0.tar.gz) = 175356518
(-)files/patch-bug1435212 (-13657 lines)
Lines 1-13657 Link Here
1
commit abe6e049cdd3
2
Author: Jean-Yves Avenard <jyavenard@mozilla.com>
3
Date:   Thu Apr 19 10:19:15 2018 +0200
4
5
    Bug 1435212 - Add support for FFmpeg 4.0. r=bryce
6
    
7
    MozReview-Commit-ID: JlDFSUyGQu
8
    
9
    --HG--
10
    extra : rebase_source : 310135ac5453b01164910bd3bf50b6107dcbc710
11
---
12
 dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp   |    6 +
13
 dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp    |   13 +-
14
 dom/media/platforms/ffmpeg/FFmpegLibs.h            |    4 +-
15
 dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp |    4 +
16
 dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp  |    2 +-
17
 .../ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1       |  504 ++
18
 .../ffmpeg/ffmpeg58/include/libavcodec/avcodec.h   | 6146 ++++++++++++++++++++
19
 .../ffmpeg/ffmpeg58/include/libavcodec/avfft.h     |  118 +
20
 .../ffmpeg/ffmpeg58/include/libavcodec/vaapi.h     |   86 +
21
 .../ffmpeg/ffmpeg58/include/libavcodec/vdpau.h     |  176 +
22
 .../ffmpeg/ffmpeg58/include/libavcodec/version.h   |  137 +
23
 .../ffmpeg/ffmpeg58/include/libavutil/attributes.h |  167 +
24
 .../ffmpeg/ffmpeg58/include/libavutil/avconfig.h   |    6 +
25
 .../ffmpeg/ffmpeg58/include/libavutil/avutil.h     |  365 ++
26
 .../ffmpeg/ffmpeg58/include/libavutil/buffer.h     |  291 +
27
 .../ffmpeg58/include/libavutil/channel_layout.h    |  232 +
28
 .../ffmpeg/ffmpeg58/include/libavutil/common.h     |  560 ++
29
 .../ffmpeg/ffmpeg58/include/libavutil/cpu.h        |  130 +
30
 .../ffmpeg/ffmpeg58/include/libavutil/dict.h       |  200 +
31
 .../ffmpeg/ffmpeg58/include/libavutil/error.h      |  126 +
32
 .../ffmpeg/ffmpeg58/include/libavutil/frame.h      |  893 +++
33
 .../ffmpeg/ffmpeg58/include/libavutil/hwcontext.h  |  584 ++
34
 .../ffmpeg/ffmpeg58/include/libavutil/intfloat.h   |   77 +
35
 .../ffmpeg/ffmpeg58/include/libavutil/log.h        |  362 ++
36
 .../ffmpeg/ffmpeg58/include/libavutil/macros.h     |   50 +
37
 .../ffmpeg58/include/libavutil/mathematics.h       |  242 +
38
 .../ffmpeg/ffmpeg58/include/libavutil/mem.h        |  700 +++
39
 .../ffmpeg/ffmpeg58/include/libavutil/pixfmt.h     |  529 ++
40
 .../ffmpeg/ffmpeg58/include/libavutil/rational.h   |  214 +
41
 .../ffmpeg/ffmpeg58/include/libavutil/samplefmt.h  |  272 +
42
 .../ffmpeg/ffmpeg58/include/libavutil/version.h    |  139 +
43
 dom/media/platforms/ffmpeg/ffmpeg58/moz.build      |   25 +
44
 dom/media/platforms/ffmpeg/moz.build               |    1 +
45
 33 files changed, 13355 insertions(+), 6 deletions(-)
46
47
diff --git dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
48
index 4600ad6d247c..a9c7089fa880 100644
49
--- dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
50
+++ dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
51
@@ -77,15 +77,21 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
52
     mCodecContext->extradata_size = mExtraData->Length();
53
     // FFmpeg may use SIMD instructions to access the data which reads the
54
     // data in 32 bytes block. Must ensure we have enough data to read.
55
+#if LIBAVCODEC_VERSION_MAJOR >= 58
56
+    mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
57
+#else
58
     mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
59
+#endif
60
     mCodecContext->extradata = mExtraData->Elements();
61
   } else {
62
     mCodecContext->extradata_size = 0;
63
   }
64
 
65
+#if LIBAVCODEC_VERSION_MAJOR < 57
66
   if (codec->capabilities & CODEC_CAP_DR1) {
67
     mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
68
   }
69
+#endif
70
 
71
   if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
72
     mLib->avcodec_close(mCodecContext);
73
diff --git dom/media/platforms/ffmpeg/FFmpegFunctionList.h dom/media/platforms/ffmpeg/FFmpegFunctionList.h
74
index 6b8b38487d56..d08eee3fc8e8 100644
75
--- dom/media/platforms/ffmpeg/FFmpegFunctionList.h
76
+++ dom/media/platforms/ffmpeg/FFmpegFunctionList.h
77
@@ -31,8 +31,8 @@ AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
78
 #if defined(LIBAVCODEC_VERSION_MAJOR) || defined(LIBAVCODEC_ALLVERSION)
79
 #if LIBAVCODEC_VERSION_MAJOR >= 55 || defined(LIBAVCODEC_ALLVERSION)
80
 /* libavutil v55 and later only */
81
-AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
82
-AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
83
-AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
84
+AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
85
+AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
86
+AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
87
 #endif
88
 #endif
89
diff --git dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
90
index 6b8b38487d56..d08eee3fc8e8 100644
91
--- dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
92
+++ dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
93
@@ -22,12 +22,14 @@ enum {
94
   AV_FUNC_55 = 1 << 2,
95
   AV_FUNC_56 = 1 << 3,
96
   AV_FUNC_57 = 1 << 4,
97
+  AV_FUNC_58 = 1 << 5,
98
   AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
99
   AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
100
   AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
101
   AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
102
   AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
103
-  AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
104
+  AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
105
+  AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
106
   AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
107
 };
108
 
109
diff --git dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
110
index f671e6e61bc4..b7ab49329502 100644
111
--- dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
112
+++ dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
113
@@ -23,12 +23,15 @@ template <int V> class FFmpegDecoderModule (public)
114
 
115
 static const char* sLibs[] = {
116
 #if defined(XP_DARWIN)
117
+  "libavcodec.58.dylib",
118
   "libavcodec.57.dylib",
119
   "libavcodec.56.dylib",
120
   "libavcodec.55.dylib",
121
   "libavcodec.54.dylib",
122
   "libavcodec.53.dylib",
123
 #else
124
+  "libavcodec.so.58",
125
+  "libavcodec-ffmpeg.so.58",
126
   "libavcodec-ffmpeg.so.57",
127
   "libavcodec-ffmpeg.so.56",
128
   "libavcodec.so.57",
129
@@ -129,6 +132,15 @@ FFmpegRuntimeLinker::Bind(const char* aLibName)
130
       }
131
       version = AV_FUNC_57;
132
       break;
133
+    case 58:
134
+      if (micro < 100) {
135
+        // A micro version >= 100 indicates that it's FFmpeg (as opposed to LibAV).
136
+        // Due to current AVCodecContext binary incompatibility we can only
137
+        // support FFmpeg at this point.
138
+        return false;
139
+      }
140
+      version = AV_FUNC_58;
141
+      break;
142
     default:
143
       // Not supported at this stage.
144
       return false;
145
@@ -168,6 +180,7 @@ FFmpegRuntimeLinker::CreateDecoderModule()
146
     case 55:
147
     case 56: module = FFmpegDecoderModule<55>::Create(); break;
148
     case 57: module = FFmpegDecoderModule<57>::Create(); break;
149
+    case 58: module = FFmpegDecoderModule<58>::Create(); break;
150
     default: module = nullptr;
151
   }
152
   return module.forget();
153
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
154
new file mode 100644
155
index 000000000000..00b4fedfe7e7
156
--- /dev/null
157
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
158
@@ -0,0 +1,504 @@
159
+                  GNU LESSER GENERAL PUBLIC LICENSE
160
+                       Version 2.1, February 1999
161
+
162
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
163
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
164
+ Everyone is permitted to copy and distribute verbatim copies
165
+ of this license document, but changing it is not allowed.
166
+
167
+[This is the first released version of the Lesser GPL.  It also counts
168
+ as the successor of the GNU Library Public License, version 2, hence
169
+ the version number 2.1.]
170
+
171
+                            Preamble
172
+
173
+  The licenses for most software are designed to take away your
174
+freedom to share and change it.  By contrast, the GNU General Public
175
+Licenses are intended to guarantee your freedom to share and change
176
+free software--to make sure the software is free for all its users.
177
+
178
+  This license, the Lesser General Public License, applies to some
179
+specially designated software packages--typically libraries--of the
180
+Free Software Foundation and other authors who decide to use it.  You
181
+can use it too, but we suggest you first think carefully about whether
182
+this license or the ordinary General Public License is the better
183
+strategy to use in any particular case, based on the explanations below.
184
+
185
+  When we speak of free software, we are referring to freedom of use,
186
+not price.  Our General Public Licenses are designed to make sure that
187
+you have the freedom to distribute copies of free software (and charge
188
+for this service if you wish); that you receive source code or can get
189
+it if you want it; that you can change the software and use pieces of
190
+it in new free programs; and that you are informed that you can do
191
+these things.
192
+
193
+  To protect your rights, we need to make restrictions that forbid
194
+distributors to deny you these rights or to ask you to surrender these
195
+rights.  These restrictions translate to certain responsibilities for
196
+you if you distribute copies of the library or if you modify it.
197
+
198
+  For example, if you distribute copies of the library, whether gratis
199
+or for a fee, you must give the recipients all the rights that we gave
200
+you.  You must make sure that they, too, receive or can get the source
201
+code.  If you link other code with the library, you must provide
202
+complete object files to the recipients, so that they can relink them
203
+with the library after making changes to the library and recompiling
204
+it.  And you must show them these terms so they know their rights.
205
+
206
+  We protect your rights with a two-step method: (1) we copyright the
207
+library, and (2) we offer you this license, which gives you legal
208
+permission to copy, distribute and/or modify the library.
209
+
210
+  To protect each distributor, we want to make it very clear that
211
+there is no warranty for the free library.  Also, if the library is
212
+modified by someone else and passed on, the recipients should know
213
+that what they have is not the original version, so that the original
214
+author's reputation will not be affected by problems that might be
215
+introduced by others.
216
+
217
+  Finally, software patents pose a constant threat to the existence of
218
+any free program.  We wish to make sure that a company cannot
219
+effectively restrict the users of a free program by obtaining a
220
+restrictive license from a patent holder.  Therefore, we insist that
221
+any patent license obtained for a version of the library must be
222
+consistent with the full freedom of use specified in this license.
223
+
224
+  Most GNU software, including some libraries, is covered by the
225
+ordinary GNU General Public License.  This license, the GNU Lesser
226
+General Public License, applies to certain designated libraries, and
227
+is quite different from the ordinary General Public License.  We use
228
+this license for certain libraries in order to permit linking those
229
+libraries into non-free programs.
230
+
231
+  When a program is linked with a library, whether statically or using
232
+a shared library, the combination of the two is legally speaking a
233
+combined work, a derivative of the original library.  The ordinary
234
+General Public License therefore permits such linking only if the
235
+entire combination fits its criteria of freedom.  The Lesser General
236
+Public License permits more lax criteria for linking other code with
237
+the library.
238
+
239
+  We call this license the "Lesser" General Public License because it
240
+does Less to protect the user's freedom than the ordinary General
241
+Public License.  It also provides other free software developers Less
242
+of an advantage over competing non-free programs.  These disadvantages
243
+are the reason we use the ordinary General Public License for many
244
+libraries.  However, the Lesser license provides advantages in certain
245
+special circumstances.
246
+
247
+  For example, on rare occasions, there may be a special need to
248
+encourage the widest possible use of a certain library, so that it becomes
249
+a de-facto standard.  To achieve this, non-free programs must be
250
+allowed to use the library.  A more frequent case is that a free
251
+library does the same job as widely used non-free libraries.  In this
252
+case, there is little to gain by limiting the free library to free
253
+software only, so we use the Lesser General Public License.
254
+
255
+  In other cases, permission to use a particular library in non-free
256
+programs enables a greater number of people to use a large body of
257
+free software.  For example, permission to use the GNU C Library in
258
+non-free programs enables many more people to use the whole GNU
259
+operating system, as well as its variant, the GNU/Linux operating
260
+system.
261
+
262
+  Although the Lesser General Public License is Less protective of the
263
+users' freedom, it does ensure that the user of a program that is
264
+linked with the Library has the freedom and the wherewithal to run
265
+that program using a modified version of the Library.
266
+
267
+  The precise terms and conditions for copying, distribution and
268
+modification follow.  Pay close attention to the difference between a
269
+"work based on the library" and a "work that uses the library".  The
270
+former contains code derived from the library, whereas the latter must
271
+be combined with the library in order to run.
272
+
273
+                  GNU LESSER GENERAL PUBLIC LICENSE
274
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
275
+
276
+  0. This License Agreement applies to any software library or other
277
+program which contains a notice placed by the copyright holder or
278
+other authorized party saying it may be distributed under the terms of
279
+this Lesser General Public License (also called "this License").
280
+Each licensee is addressed as "you".
281
+
282
+  A "library" means a collection of software functions and/or data
283
+prepared so as to be conveniently linked with application programs
284
+(which use some of those functions and data) to form executables.
285
+
286
+  The "Library", below, refers to any such software library or work
287
+which has been distributed under these terms.  A "work based on the
288
+Library" means either the Library or any derivative work under
289
+copyright law: that is to say, a work containing the Library or a
290
+portion of it, either verbatim or with modifications and/or translated
291
+straightforwardly into another language.  (Hereinafter, translation is
292
+included without limitation in the term "modification".)
293
+
294
+  "Source code" for a work means the preferred form of the work for
295
+making modifications to it.  For a library, complete source code means
296
+all the source code for all modules it contains, plus any associated
297
+interface definition files, plus the scripts used to control compilation
298
+and installation of the library.
299
+
300
+  Activities other than copying, distribution and modification are not
301
+covered by this License; they are outside its scope.  The act of
302
+running a program using the Library is not restricted, and output from
303
+such a program is covered only if its contents constitute a work based
304
+on the Library (independent of the use of the Library in a tool for
305
+writing it).  Whether that is true depends on what the Library does
306
+and what the program that uses the Library does.
307
+
308
+  1. You may copy and distribute verbatim copies of the Library's
309
+complete source code as you receive it, in any medium, provided that
310
+you conspicuously and appropriately publish on each copy an
311
+appropriate copyright notice and disclaimer of warranty; keep intact
312
+all the notices that refer to this License and to the absence of any
313
+warranty; and distribute a copy of this License along with the
314
+Library.
315
+
316
+  You may charge a fee for the physical act of transferring a copy,
317
+and you may at your option offer warranty protection in exchange for a
318
+fee.
319
+
320
+  2. You may modify your copy or copies of the Library or any portion
321
+of it, thus forming a work based on the Library, and copy and
322
+distribute such modifications or work under the terms of Section 1
323
+above, provided that you also meet all of these conditions:
324
+
325
+    a) The modified work must itself be a software library.
326
+
327
+    b) You must cause the files modified to carry prominent notices
328
+    stating that you changed the files and the date of any change.
329
+
330
+    c) You must cause the whole of the work to be licensed at no
331
+    charge to all third parties under the terms of this License.
332
+
333
+    d) If a facility in the modified Library refers to a function or a
334
+    table of data to be supplied by an application program that uses
335
+    the facility, other than as an argument passed when the facility
336
+    is invoked, then you must make a good faith effort to ensure that,
337
+    in the event an application does not supply such function or
338
+    table, the facility still operates, and performs whatever part of
339
+    its purpose remains meaningful.
340
+
341
+    (For example, a function in a library to compute square roots has
342
+    a purpose that is entirely well-defined independent of the
343
+    application.  Therefore, Subsection 2d requires that any
344
+    application-supplied function or table used by this function must
345
+    be optional: if the application does not supply it, the square
346
+    root function must still compute square roots.)
347
+
348
+These requirements apply to the modified work as a whole.  If
349
+identifiable sections of that work are not derived from the Library,
350
+and can be reasonably considered independent and separate works in
351
+themselves, then this License, and its terms, do not apply to those
352
+sections when you distribute them as separate works.  But when you
353
+distribute the same sections as part of a whole which is a work based
354
+on the Library, the distribution of the whole must be on the terms of
355
+this License, whose permissions for other licensees extend to the
356
+entire whole, and thus to each and every part regardless of who wrote
357
+it.
358
+
359
+Thus, it is not the intent of this section to claim rights or contest
360
+your rights to work written entirely by you; rather, the intent is to
361
+exercise the right to control the distribution of derivative or
362
+collective works based on the Library.
363
+
364
+In addition, mere aggregation of another work not based on the Library
365
+with the Library (or with a work based on the Library) on a volume of
366
+a storage or distribution medium does not bring the other work under
367
+the scope of this License.
368
+
369
+  3. You may opt to apply the terms of the ordinary GNU General Public
370
+License instead of this License to a given copy of the Library.  To do
371
+this, you must alter all the notices that refer to this License, so
372
+that they refer to the ordinary GNU General Public License, version 2,
373
+instead of to this License.  (If a newer version than version 2 of the
374
+ordinary GNU General Public License has appeared, then you can specify
375
+that version instead if you wish.)  Do not make any other change in
376
+these notices.
377
+
378
+  Once this change is made in a given copy, it is irreversible for
379
+that copy, so the ordinary GNU General Public License applies to all
380
+subsequent copies and derivative works made from that copy.
381
+
382
+  This option is useful when you wish to copy part of the code of
383
+the Library into a program that is not a library.
384
+
385
+  4. You may copy and distribute the Library (or a portion or
386
+derivative of it, under Section 2) in object code or executable form
387
+under the terms of Sections 1 and 2 above provided that you accompany
388
+it with the complete corresponding machine-readable source code, which
389
+must be distributed under the terms of Sections 1 and 2 above on a
390
+medium customarily used for software interchange.
391
+
392
+  If distribution of object code is made by offering access to copy
393
+from a designated place, then offering equivalent access to copy the
394
+source code from the same place satisfies the requirement to
395
+distribute the source code, even though third parties are not
396
+compelled to copy the source along with the object code.
397
+
398
+  5. A program that contains no derivative of any portion of the
399
+Library, but is designed to work with the Library by being compiled or
400
+linked with it, is called a "work that uses the Library".  Such a
401
+work, in isolation, is not a derivative work of the Library, and
402
+therefore falls outside the scope of this License.
403
+
404
+  However, linking a "work that uses the Library" with the Library
405
+creates an executable that is a derivative of the Library (because it
406
+contains portions of the Library), rather than a "work that uses the
407
+library".  The executable is therefore covered by this License.
408
+Section 6 states terms for distribution of such executables.
409
+
410
+  When a "work that uses the Library" uses material from a header file
411
+that is part of the Library, the object code for the work may be a
412
+derivative work of the Library even though the source code is not.
413
+Whether this is true is especially significant if the work can be
414
+linked without the Library, or if the work is itself a library.  The
415
+threshold for this to be true is not precisely defined by law.
416
+
417
+  If such an object file uses only numerical parameters, data
418
+structure layouts and accessors, and small macros and small inline
419
+functions (ten lines or less in length), then the use of the object
420
+file is unrestricted, regardless of whether it is legally a derivative
421
+work.  (Executables containing this object code plus portions of the
422
+Library will still fall under Section 6.)
423
+
424
+  Otherwise, if the work is a derivative of the Library, you may
425
+distribute the object code for the work under the terms of Section 6.
426
+Any executables containing that work also fall under Section 6,
427
+whether or not they are linked directly with the Library itself.
428
+
429
+  6. As an exception to the Sections above, you may also combine or
430
+link a "work that uses the Library" with the Library to produce a
431
+work containing portions of the Library, and distribute that work
432
+under terms of your choice, provided that the terms permit
433
+modification of the work for the customer's own use and reverse
434
+engineering for debugging such modifications.
435
+
436
+  You must give prominent notice with each copy of the work that the
437
+Library is used in it and that the Library and its use are covered by
438
+this License.  You must supply a copy of this License.  If the work
439
+during execution displays copyright notices, you must include the
440
+copyright notice for the Library among them, as well as a reference
441
+directing the user to the copy of this License.  Also, you must do one
442
+of these things:
443
+
444
+    a) Accompany the work with the complete corresponding
445
+    machine-readable source code for the Library including whatever
446
+    changes were used in the work (which must be distributed under
447
+    Sections 1 and 2 above); and, if the work is an executable linked
448
+    with the Library, with the complete machine-readable "work that
449
+    uses the Library", as object code and/or source code, so that the
450
+    user can modify the Library and then relink to produce a modified
451
+    executable containing the modified Library.  (It is understood
452
+    that the user who changes the contents of definitions files in the
453
+    Library will not necessarily be able to recompile the application
454
+    to use the modified definitions.)
455
+
456
+    b) Use a suitable shared library mechanism for linking with the
457
+    Library.  A suitable mechanism is one that (1) uses at run time a
458
+    copy of the library already present on the user's computer system,
459
+    rather than copying library functions into the executable, and (2)
460
+    will operate properly with a modified version of the library, if
461
+    the user installs one, as long as the modified version is
462
+    interface-compatible with the version that the work was made with.
463
+
464
+    c) Accompany the work with a written offer, valid for at
465
+    least three years, to give the same user the materials
466
+    specified in Subsection 6a, above, for a charge no more
467
+    than the cost of performing this distribution.
468
+
469
+    d) If distribution of the work is made by offering access to copy
470
+    from a designated place, offer equivalent access to copy the above
471
+    specified materials from the same place.
472
+
473
+    e) Verify that the user has already received a copy of these
474
+    materials or that you have already sent this user a copy.
475
+
476
+  For an executable, the required form of the "work that uses the
477
+Library" must include any data and utility programs needed for
478
+reproducing the executable from it.  However, as a special exception,
479
+the materials to be distributed need not include anything that is
480
+normally distributed (in either source or binary form) with the major
481
+components (compiler, kernel, and so on) of the operating system on
482
+which the executable runs, unless that component itself accompanies
483
+the executable.
484
+
485
+  It may happen that this requirement contradicts the license
486
+restrictions of other proprietary libraries that do not normally
487
+accompany the operating system.  Such a contradiction means you cannot
488
+use both them and the Library together in an executable that you
489
+distribute.
490
+
491
+  7. You may place library facilities that are a work based on the
492
+Library side-by-side in a single library together with other library
493
+facilities not covered by this License, and distribute such a combined
494
+library, provided that the separate distribution of the work based on
495
+the Library and of the other library facilities is otherwise
496
+permitted, and provided that you do these two things:
497
+
498
+    a) Accompany the combined library with a copy of the same work
499
+    based on the Library, uncombined with any other library
500
+    facilities.  This must be distributed under the terms of the
501
+    Sections above.
502
+
503
+    b) Give prominent notice with the combined library of the fact
504
+    that part of it is a work based on the Library, and explaining
505
+    where to find the accompanying uncombined form of the same work.
506
+
507
+  8. You may not copy, modify, sublicense, link with, or distribute
508
+the Library except as expressly provided under this License.  Any
509
+attempt otherwise to copy, modify, sublicense, link with, or
510
+distribute the Library is void, and will automatically terminate your
511
+rights under this License.  However, parties who have received copies,
512
+or rights, from you under this License will not have their licenses
513
+terminated so long as such parties remain in full compliance.
514
+
515
+  9. You are not required to accept this License, since you have not
516
+signed it.  However, nothing else grants you permission to modify or
517
+distribute the Library or its derivative works.  These actions are
518
+prohibited by law if you do not accept this License.  Therefore, by
519
+modifying or distributing the Library (or any work based on the
520
+Library), you indicate your acceptance of this License to do so, and
521
+all its terms and conditions for copying, distributing or modifying
522
+the Library or works based on it.
523
+
524
+  10. Each time you redistribute the Library (or any work based on the
525
+Library), the recipient automatically receives a license from the
526
+original licensor to copy, distribute, link with or modify the Library
527
+subject to these terms and conditions.  You may not impose any further
528
+restrictions on the recipients' exercise of the rights granted herein.
529
+You are not responsible for enforcing compliance by third parties with
530
+this License.
531
+
532
+  11. If, as a consequence of a court judgment or allegation of patent
533
+infringement or for any other reason (not limited to patent issues),
534
+conditions are imposed on you (whether by court order, agreement or
535
+otherwise) that contradict the conditions of this License, they do not
536
+excuse you from the conditions of this License.  If you cannot
537
+distribute so as to satisfy simultaneously your obligations under this
538
+License and any other pertinent obligations, then as a consequence you
539
+may not distribute the Library at all.  For example, if a patent
540
+license would not permit royalty-free redistribution of the Library by
541
+all those who receive copies directly or indirectly through you, then
542
+the only way you could satisfy both it and this License would be to
543
+refrain entirely from distribution of the Library.
544
+
545
+If any portion of this section is held invalid or unenforceable under any
546
+particular circumstance, the balance of the section is intended to apply,
547
+and the section as a whole is intended to apply in other circumstances.
548
+
549
+It is not the purpose of this section to induce you to infringe any
550
+patents or other property right claims or to contest validity of any
551
+such claims; this section has the sole purpose of protecting the
552
+integrity of the free software distribution system which is
553
+implemented by public license practices.  Many people have made
554
+generous contributions to the wide range of software distributed
555
+through that system in reliance on consistent application of that
556
+system; it is up to the author/donor to decide if he or she is willing
557
+to distribute software through any other system and a licensee cannot
558
+impose that choice.
559
+
560
+This section is intended to make thoroughly clear what is believed to
561
+be a consequence of the rest of this License.
562
+
563
+  12. If the distribution and/or use of the Library is restricted in
564
+certain countries either by patents or by copyrighted interfaces, the
565
+original copyright holder who places the Library under this License may add
566
+an explicit geographical distribution limitation excluding those countries,
567
+so that distribution is permitted only in or among countries not thus
568
+excluded.  In such case, this License incorporates the limitation as if
569
+written in the body of this License.
570
+
571
+  13. The Free Software Foundation may publish revised and/or new
572
+versions of the Lesser General Public License from time to time.
573
+Such new versions will be similar in spirit to the present version,
574
+but may differ in detail to address new problems or concerns.
575
+
576
+Each version is given a distinguishing version number.  If the Library
577
+specifies a version number of this License which applies to it and
578
+"any later version", you have the option of following the terms and
579
+conditions either of that version or of any later version published by
580
+the Free Software Foundation.  If the Library does not specify a
581
+license version number, you may choose any version ever published by
582
+the Free Software Foundation.
583
+
584
+  14. If you wish to incorporate parts of the Library into other free
585
+programs whose distribution conditions are incompatible with these,
586
+write to the author to ask for permission.  For software which is
587
+copyrighted by the Free Software Foundation, write to the Free
588
+Software Foundation; we sometimes make exceptions for this.  Our
589
+decision will be guided by the two goals of preserving the free status
590
+of all derivatives of our free software and of promoting the sharing
591
+and reuse of software generally.
592
+
593
+                            NO WARRANTY
594
+
595
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
596
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
597
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
598
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
599
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
600
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
601
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
602
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
603
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
604
+
605
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
606
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
607
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
608
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
609
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
610
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
611
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
612
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
613
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
614
+DAMAGES.
615
+
616
+                     END OF TERMS AND CONDITIONS
617
+
618
+           How to Apply These Terms to Your New Libraries
619
+
620
+  If you develop a new library, and you want it to be of the greatest
621
+possible use to the public, we recommend making it free software that
622
+everyone can redistribute and change.  You can do so by permitting
623
+redistribution under these terms (or, alternatively, under the terms of the
624
+ordinary General Public License).
625
+
626
+  To apply these terms, attach the following notices to the library.  It is
627
+safest to attach them to the start of each source file to most effectively
628
+convey the exclusion of warranty; and each file should have at least the
629
+"copyright" line and a pointer to where the full notice is found.
630
+
631
+    <one line to give the library's name and a brief idea of what it does.>
632
+    Copyright (C) <year>  <name of author>
633
+
634
+    This library is free software; you can redistribute it and/or
635
+    modify it under the terms of the GNU Lesser General Public
636
+    License as published by the Free Software Foundation; either
637
+    version 2.1 of the License, or (at your option) any later version.
638
+
639
+    This library is distributed in the hope that it will be useful,
640
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
641
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
642
+    Lesser General Public License for more details.
643
+
644
+    You should have received a copy of the GNU Lesser General Public
645
+    License along with this library; if not, write to the Free Software
646
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
647
+
648
+Also add information on how to contact you by electronic and paper mail.
649
+
650
+You should also get your employer (if you work as a programmer) or your
651
+school, if any, to sign a "copyright disclaimer" for the library, if
652
+necessary.  Here is a sample; alter the names:
653
+
654
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
655
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
656
+
657
+  <signature of Ty Coon>, 1 April 1990
658
+  Ty Coon, President of Vice
659
+
660
+That's all there is to it!
661
+
662
+
663
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
664
new file mode 100644
665
index 000000000000..fb0c6fae70b3
666
--- /dev/null
667
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
668
@@ -0,0 +1,6146 @@
669
+/*
670
+ * copyright (c) 2001 Fabrice Bellard
671
+ *
672
+ * This file is part of FFmpeg.
673
+ *
674
+ * FFmpeg is free software; you can redistribute it and/or
675
+ * modify it under the terms of the GNU Lesser General Public
676
+ * License as published by the Free Software Foundation; either
677
+ * version 2.1 of the License, or (at your option) any later version.
678
+ *
679
+ * FFmpeg is distributed in the hope that it will be useful,
680
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
681
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
682
+ * Lesser General Public License for more details.
683
+ *
684
+ * You should have received a copy of the GNU Lesser General Public
685
+ * License along with FFmpeg; if not, write to the Free Software
686
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
687
+ */
688
+
689
+#ifndef AVCODEC_AVCODEC_H
690
+#define AVCODEC_AVCODEC_H
691
+
692
+/**
693
+ * @file
694
+ * @ingroup libavc
695
+ * Libavcodec external API header
696
+ */
697
+
698
+#include <errno.h>
699
+#include "libavutil/samplefmt.h"
700
+#include "libavutil/attributes.h"
701
+#include "libavutil/avutil.h"
702
+#include "libavutil/buffer.h"
703
+#include "libavutil/cpu.h"
704
+#include "libavutil/channel_layout.h"
705
+#include "libavutil/dict.h"
706
+#include "libavutil/frame.h"
707
+#include "libavutil/hwcontext.h"
708
+#include "libavutil/log.h"
709
+#include "libavutil/pixfmt.h"
710
+#include "libavutil/rational.h"
711
+
712
+#include "version.h"
713
+
714
+/**
715
+ * @defgroup libavc libavcodec
716
+ * Encoding/Decoding Library
717
+ *
718
+ * @{
719
+ *
720
+ * @defgroup lavc_decoding Decoding
721
+ * @{
722
+ * @}
723
+ *
724
+ * @defgroup lavc_encoding Encoding
725
+ * @{
726
+ * @}
727
+ *
728
+ * @defgroup lavc_codec Codecs
729
+ * @{
730
+ * @defgroup lavc_codec_native Native Codecs
731
+ * @{
732
+ * @}
733
+ * @defgroup lavc_codec_wrappers External library wrappers
734
+ * @{
735
+ * @}
736
+ * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
737
+ * @{
738
+ * @}
739
+ * @}
740
+ * @defgroup lavc_internal Internal
741
+ * @{
742
+ * @}
743
+ * @}
744
+ */
745
+
746
+/**
747
+ * @ingroup libavc
748
+ * @defgroup lavc_encdec send/receive encoding and decoding API overview
749
+ * @{
750
+ *
751
+ * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
752
+ * avcodec_receive_packet() functions provide an encode/decode API, which
753
+ * decouples input and output.
754
+ *
755
+ * The API is very similar for encoding/decoding and audio/video, and works as
756
+ * follows:
757
+ * - Set up and open the AVCodecContext as usual.
758
+ * - Send valid input:
759
+ *   - For decoding, call avcodec_send_packet() to give the decoder raw
760
+ *     compressed data in an AVPacket.
761
+ *   - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
762
+ *     containing uncompressed audio or video.
763
+ *   In both cases, it is recommended that AVPackets and AVFrames are
764
+ *   refcounted, or libavcodec might have to copy the input data. (libavformat
765
+ *   always returns refcounted AVPackets, and av_frame_get_buffer() allocates
766
+ *   refcounted AVFrames.)
767
+ * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
768
+ *   functions and process their output:
769
+ *   - For decoding, call avcodec_receive_frame(). On success, it will return
770
+ *     an AVFrame containing uncompressed audio or video data.
771
+ *   - For encoding, call avcodec_receive_packet(). On success, it will return
772
+ *     an AVPacket with a compressed frame.
773
+ *   Repeat this call until it returns AVERROR(EAGAIN) or an error. The
774
+ *   AVERROR(EAGAIN) return value means that new input data is required to
775
+ *   return new output. In this case, continue with sending input. For each
776
+ *   input frame/packet, the codec will typically return 1 output frame/packet,
777
+ *   but it can also be 0 or more than 1.
778
+ *
779
+ * At the beginning of decoding or encoding, the codec might accept multiple
780
+ * input frames/packets without returning a frame, until its internal buffers
781
+ * are filled. This situation is handled transparently if you follow the steps
782
+ * outlined above.
783
+ *
784
+ * In theory, sending input can result in EAGAIN - this should happen only if
785
+ * not all output was received. You can use this to structure alternative decode
786
+ * or encode loops other than the one suggested above. For example, you could
787
+ * try sending new input on each iteration, and try to receive output if that
788
+ * returns EAGAIN.
789
+ *
790
+ * End of stream situations. These require "flushing" (aka draining) the codec,
791
+ * as the codec might buffer multiple frames or packets internally for
792
+ * performance or out of necessity (consider B-frames).
793
+ * This is handled as follows:
794
+ * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
795
+ *   or avcodec_send_frame() (encoding) functions. This will enter draining
796
+ *   mode.
797
+ * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
798
+ *   (encoding) in a loop until AVERROR_EOF is returned. The functions will
799
+ *   not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
800
+ * - Before decoding can be resumed again, the codec has to be reset with
801
+ *   avcodec_flush_buffers().
802
+ *
803
+ * Using the API as outlined above is highly recommended. But it is also
804
+ * possible to call functions outside of this rigid schema. For example, you can
805
+ * call avcodec_send_packet() repeatedly without calling
806
+ * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
807
+ * until the codec's internal buffer has been filled up (which is typically of
808
+ * size 1 per output frame, after initial input), and then reject input with
809
+ * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
810
+ * read at least some output.
811
+ *
812
+ * Not all codecs will follow a rigid and predictable dataflow; the only
813
+ * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
814
+ * one end implies that a receive/send call on the other end will succeed, or
815
+ * at least will not fail with AVERROR(EAGAIN). In general, no codec will
816
+ * permit unlimited buffering of input or output.
817
+ *
818
+ * This API replaces the following legacy functions:
819
+ * - avcodec_decode_video2() and avcodec_decode_audio4():
820
+ *   Use avcodec_send_packet() to feed input to the decoder, then use
821
+ *   avcodec_receive_frame() to receive decoded frames after each packet.
822
+ *   Unlike with the old video decoding API, multiple frames might result from
823
+ *   a packet. For audio, splitting the input packet into frames by partially
824
+ *   decoding packets becomes transparent to the API user. You never need to
825
+ *   feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
826
+ *   no data was read from the packet).
827
+ *   Additionally, sending a flush/draining packet is required only once.
828
+ * - avcodec_encode_video2()/avcodec_encode_audio2():
829
+ *   Use avcodec_send_frame() to feed input to the encoder, then use
830
+ *   avcodec_receive_packet() to receive encoded packets.
831
+ *   Providing user-allocated buffers for avcodec_receive_packet() is not
832
+ *   possible.
833
+ * - The new API does not handle subtitles yet.
834
+ *
835
+ * Mixing new and old function calls on the same AVCodecContext is not allowed,
836
+ * and will result in undefined behavior.
837
+ *
838
+ * Some codecs might require using the new API; using the old API will return
839
+ * an error when calling it. All codecs support the new API.
840
+ *
841
+ * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
842
+ * would be an invalid state, which could put the codec user into an endless
843
+ * loop. The API has no concept of time either: it cannot happen that trying to
844
+ * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
845
+ * later accepts the packet (with no other receive/flush API calls involved).
846
+ * The API is a strict state machine, and the passage of time is not supposed
847
+ * to influence it. Some timing-dependent behavior might still be deemed
848
+ * acceptable in certain cases. But it must never result in both send/receive
849
+ * returning EAGAIN at the same time at any point. It must also absolutely be
850
+ * avoided that the current state is "unstable" and can "flip-flop" between
851
+ * the send/receive APIs allowing progress. For example, it's not allowed that
852
+ * the codec randomly decides that it actually wants to consume a packet now
853
+ * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
854
+ * avcodec_send_packet() call.
855
+ * @}
856
+ */
857
+
858
+/**
859
+ * @defgroup lavc_core Core functions/structures.
860
+ * @ingroup libavc
861
+ *
862
+ * Basic definitions, functions for querying libavcodec capabilities,
863
+ * allocating core structures, etc.
864
+ * @{
865
+ */
866
+
867
+
868
+/**
869
+ * Identify the syntax and semantics of the bitstream.
870
+ * The principle is roughly:
871
+ * Two decoders with the same ID can decode the same streams.
872
+ * Two encoders with the same ID can encode compatible streams.
873
+ * There may be slight deviations from the principle due to implementation
874
+ * details.
875
+ *
876
+ * If you add a codec ID to this list, add it so that
877
+ * 1. no value of an existing codec ID changes (that would break ABI),
878
+ * 2. it is as close as possible to similar codecs
879
+ *
880
+ * After adding new codec IDs, do not forget to add an entry to the codec
881
+ * descriptor list and bump libavcodec minor version.
882
+ */
883
+enum AVCodecID {
884
+    AV_CODEC_ID_NONE,
885
+
886
+    /* video codecs */
887
+    AV_CODEC_ID_MPEG1VIDEO,
888
+    AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
889
+    AV_CODEC_ID_H261,
890
+    AV_CODEC_ID_H263,
891
+    AV_CODEC_ID_RV10,
892
+    AV_CODEC_ID_RV20,
893
+    AV_CODEC_ID_MJPEG,
894
+    AV_CODEC_ID_MJPEGB,
895
+    AV_CODEC_ID_LJPEG,
896
+    AV_CODEC_ID_SP5X,
897
+    AV_CODEC_ID_JPEGLS,
898
+    AV_CODEC_ID_MPEG4,
899
+    AV_CODEC_ID_RAWVIDEO,
900
+    AV_CODEC_ID_MSMPEG4V1,
901
+    AV_CODEC_ID_MSMPEG4V2,
902
+    AV_CODEC_ID_MSMPEG4V3,
903
+    AV_CODEC_ID_WMV1,
904
+    AV_CODEC_ID_WMV2,
905
+    AV_CODEC_ID_H263P,
906
+    AV_CODEC_ID_H263I,
907
+    AV_CODEC_ID_FLV1,
908
+    AV_CODEC_ID_SVQ1,
909
+    AV_CODEC_ID_SVQ3,
910
+    AV_CODEC_ID_DVVIDEO,
911
+    AV_CODEC_ID_HUFFYUV,
912
+    AV_CODEC_ID_CYUV,
913
+    AV_CODEC_ID_H264,
914
+    AV_CODEC_ID_INDEO3,
915
+    AV_CODEC_ID_VP3,
916
+    AV_CODEC_ID_THEORA,
917
+    AV_CODEC_ID_ASV1,
918
+    AV_CODEC_ID_ASV2,
919
+    AV_CODEC_ID_FFV1,
920
+    AV_CODEC_ID_4XM,
921
+    AV_CODEC_ID_VCR1,
922
+    AV_CODEC_ID_CLJR,
923
+    AV_CODEC_ID_MDEC,
924
+    AV_CODEC_ID_ROQ,
925
+    AV_CODEC_ID_INTERPLAY_VIDEO,
926
+    AV_CODEC_ID_XAN_WC3,
927
+    AV_CODEC_ID_XAN_WC4,
928
+    AV_CODEC_ID_RPZA,
929
+    AV_CODEC_ID_CINEPAK,
930
+    AV_CODEC_ID_WS_VQA,
931
+    AV_CODEC_ID_MSRLE,
932
+    AV_CODEC_ID_MSVIDEO1,
933
+    AV_CODEC_ID_IDCIN,
934
+    AV_CODEC_ID_8BPS,
935
+    AV_CODEC_ID_SMC,
936
+    AV_CODEC_ID_FLIC,
937
+    AV_CODEC_ID_TRUEMOTION1,
938
+    AV_CODEC_ID_VMDVIDEO,
939
+    AV_CODEC_ID_MSZH,
940
+    AV_CODEC_ID_ZLIB,
941
+    AV_CODEC_ID_QTRLE,
942
+    AV_CODEC_ID_TSCC,
943
+    AV_CODEC_ID_ULTI,
944
+    AV_CODEC_ID_QDRAW,
945
+    AV_CODEC_ID_VIXL,
946
+    AV_CODEC_ID_QPEG,
947
+    AV_CODEC_ID_PNG,
948
+    AV_CODEC_ID_PPM,
949
+    AV_CODEC_ID_PBM,
950
+    AV_CODEC_ID_PGM,
951
+    AV_CODEC_ID_PGMYUV,
952
+    AV_CODEC_ID_PAM,
953
+    AV_CODEC_ID_FFVHUFF,
954
+    AV_CODEC_ID_RV30,
955
+    AV_CODEC_ID_RV40,
956
+    AV_CODEC_ID_VC1,
957
+    AV_CODEC_ID_WMV3,
958
+    AV_CODEC_ID_LOCO,
959
+    AV_CODEC_ID_WNV1,
960
+    AV_CODEC_ID_AASC,
961
+    AV_CODEC_ID_INDEO2,
962
+    AV_CODEC_ID_FRAPS,
963
+    AV_CODEC_ID_TRUEMOTION2,
964
+    AV_CODEC_ID_BMP,
965
+    AV_CODEC_ID_CSCD,
966
+    AV_CODEC_ID_MMVIDEO,
967
+    AV_CODEC_ID_ZMBV,
968
+    AV_CODEC_ID_AVS,
969
+    AV_CODEC_ID_SMACKVIDEO,
970
+    AV_CODEC_ID_NUV,
971
+    AV_CODEC_ID_KMVC,
972
+    AV_CODEC_ID_FLASHSV,
973
+    AV_CODEC_ID_CAVS,
974
+    AV_CODEC_ID_JPEG2000,
975
+    AV_CODEC_ID_VMNC,
976
+    AV_CODEC_ID_VP5,
977
+    AV_CODEC_ID_VP6,
978
+    AV_CODEC_ID_VP6F,
979
+    AV_CODEC_ID_TARGA,
980
+    AV_CODEC_ID_DSICINVIDEO,
981
+    AV_CODEC_ID_TIERTEXSEQVIDEO,
982
+    AV_CODEC_ID_TIFF,
983
+    AV_CODEC_ID_GIF,
984
+    AV_CODEC_ID_DXA,
985
+    AV_CODEC_ID_DNXHD,
986
+    AV_CODEC_ID_THP,
987
+    AV_CODEC_ID_SGI,
988
+    AV_CODEC_ID_C93,
989
+    AV_CODEC_ID_BETHSOFTVID,
990
+    AV_CODEC_ID_PTX,
991
+    AV_CODEC_ID_TXD,
992
+    AV_CODEC_ID_VP6A,
993
+    AV_CODEC_ID_AMV,
994
+    AV_CODEC_ID_VB,
995
+    AV_CODEC_ID_PCX,
996
+    AV_CODEC_ID_SUNRAST,
997
+    AV_CODEC_ID_INDEO4,
998
+    AV_CODEC_ID_INDEO5,
999
+    AV_CODEC_ID_MIMIC,
1000
+    AV_CODEC_ID_RL2,
1001
+    AV_CODEC_ID_ESCAPE124,
1002
+    AV_CODEC_ID_DIRAC,
1003
+    AV_CODEC_ID_BFI,
1004
+    AV_CODEC_ID_CMV,
1005
+    AV_CODEC_ID_MOTIONPIXELS,
1006
+    AV_CODEC_ID_TGV,
1007
+    AV_CODEC_ID_TGQ,
1008
+    AV_CODEC_ID_TQI,
1009
+    AV_CODEC_ID_AURA,
1010
+    AV_CODEC_ID_AURA2,
1011
+    AV_CODEC_ID_V210X,
1012
+    AV_CODEC_ID_TMV,
1013
+    AV_CODEC_ID_V210,
1014
+    AV_CODEC_ID_DPX,
1015
+    AV_CODEC_ID_MAD,
1016
+    AV_CODEC_ID_FRWU,
1017
+    AV_CODEC_ID_FLASHSV2,
1018
+    AV_CODEC_ID_CDGRAPHICS,
1019
+    AV_CODEC_ID_R210,
1020
+    AV_CODEC_ID_ANM,
1021
+    AV_CODEC_ID_BINKVIDEO,
1022
+    AV_CODEC_ID_IFF_ILBM,
1023
+#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1024
+    AV_CODEC_ID_KGV1,
1025
+    AV_CODEC_ID_YOP,
1026
+    AV_CODEC_ID_VP8,
1027
+    AV_CODEC_ID_PICTOR,
1028
+    AV_CODEC_ID_ANSI,
1029
+    AV_CODEC_ID_A64_MULTI,
1030
+    AV_CODEC_ID_A64_MULTI5,
1031
+    AV_CODEC_ID_R10K,
1032
+    AV_CODEC_ID_MXPEG,
1033
+    AV_CODEC_ID_LAGARITH,
1034
+    AV_CODEC_ID_PRORES,
1035
+    AV_CODEC_ID_JV,
1036
+    AV_CODEC_ID_DFA,
1037
+    AV_CODEC_ID_WMV3IMAGE,
1038
+    AV_CODEC_ID_VC1IMAGE,
1039
+    AV_CODEC_ID_UTVIDEO,
1040
+    AV_CODEC_ID_BMV_VIDEO,
1041
+    AV_CODEC_ID_VBLE,
1042
+    AV_CODEC_ID_DXTORY,
1043
+    AV_CODEC_ID_V410,
1044
+    AV_CODEC_ID_XWD,
1045
+    AV_CODEC_ID_CDXL,
1046
+    AV_CODEC_ID_XBM,
1047
+    AV_CODEC_ID_ZEROCODEC,
1048
+    AV_CODEC_ID_MSS1,
1049
+    AV_CODEC_ID_MSA1,
1050
+    AV_CODEC_ID_TSCC2,
1051
+    AV_CODEC_ID_MTS2,
1052
+    AV_CODEC_ID_CLLC,
1053
+    AV_CODEC_ID_MSS2,
1054
+    AV_CODEC_ID_VP9,
1055
+    AV_CODEC_ID_AIC,
1056
+    AV_CODEC_ID_ESCAPE130,
1057
+    AV_CODEC_ID_G2M,
1058
+    AV_CODEC_ID_WEBP,
1059
+    AV_CODEC_ID_HNM4_VIDEO,
1060
+    AV_CODEC_ID_HEVC,
1061
+#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1062
+    AV_CODEC_ID_FIC,
1063
+    AV_CODEC_ID_ALIAS_PIX,
1064
+    AV_CODEC_ID_BRENDER_PIX,
1065
+    AV_CODEC_ID_PAF_VIDEO,
1066
+    AV_CODEC_ID_EXR,
1067
+    AV_CODEC_ID_VP7,
1068
+    AV_CODEC_ID_SANM,
1069
+    AV_CODEC_ID_SGIRLE,
1070
+    AV_CODEC_ID_MVC1,
1071
+    AV_CODEC_ID_MVC2,
1072
+    AV_CODEC_ID_HQX,
1073
+    AV_CODEC_ID_TDSC,
1074
+    AV_CODEC_ID_HQ_HQA,
1075
+    AV_CODEC_ID_HAP,
1076
+    AV_CODEC_ID_DDS,
1077
+    AV_CODEC_ID_DXV,
1078
+    AV_CODEC_ID_SCREENPRESSO,
1079
+    AV_CODEC_ID_RSCC,
1080
+
1081
+    AV_CODEC_ID_Y41P = 0x8000,
1082
+    AV_CODEC_ID_AVRP,
1083
+    AV_CODEC_ID_012V,
1084
+    AV_CODEC_ID_AVUI,
1085
+    AV_CODEC_ID_AYUV,
1086
+    AV_CODEC_ID_TARGA_Y216,
1087
+    AV_CODEC_ID_V308,
1088
+    AV_CODEC_ID_V408,
1089
+    AV_CODEC_ID_YUV4,
1090
+    AV_CODEC_ID_AVRN,
1091
+    AV_CODEC_ID_CPIA,
1092
+    AV_CODEC_ID_XFACE,
1093
+    AV_CODEC_ID_SNOW,
1094
+    AV_CODEC_ID_SMVJPEG,
1095
+    AV_CODEC_ID_APNG,
1096
+    AV_CODEC_ID_DAALA,
1097
+    AV_CODEC_ID_CFHD,
1098
+    AV_CODEC_ID_TRUEMOTION2RT,
1099
+    AV_CODEC_ID_M101,
1100
+    AV_CODEC_ID_MAGICYUV,
1101
+    AV_CODEC_ID_SHEERVIDEO,
1102
+    AV_CODEC_ID_YLC,
1103
+    AV_CODEC_ID_PSD,
1104
+    AV_CODEC_ID_PIXLET,
1105
+    AV_CODEC_ID_SPEEDHQ,
1106
+    AV_CODEC_ID_FMVC,
1107
+    AV_CODEC_ID_SCPR,
1108
+    AV_CODEC_ID_CLEARVIDEO,
1109
+    AV_CODEC_ID_XPM,
1110
+    AV_CODEC_ID_AV1,
1111
+    AV_CODEC_ID_BITPACKED,
1112
+    AV_CODEC_ID_MSCC,
1113
+    AV_CODEC_ID_SRGC,
1114
+    AV_CODEC_ID_SVG,
1115
+    AV_CODEC_ID_GDV,
1116
+    AV_CODEC_ID_FITS,
1117
+
1118
+    /* various PCM "codecs" */
1119
+    AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
1120
+    AV_CODEC_ID_PCM_S16LE = 0x10000,
1121
+    AV_CODEC_ID_PCM_S16BE,
1122
+    AV_CODEC_ID_PCM_U16LE,
1123
+    AV_CODEC_ID_PCM_U16BE,
1124
+    AV_CODEC_ID_PCM_S8,
1125
+    AV_CODEC_ID_PCM_U8,
1126
+    AV_CODEC_ID_PCM_MULAW,
1127
+    AV_CODEC_ID_PCM_ALAW,
1128
+    AV_CODEC_ID_PCM_S32LE,
1129
+    AV_CODEC_ID_PCM_S32BE,
1130
+    AV_CODEC_ID_PCM_U32LE,
1131
+    AV_CODEC_ID_PCM_U32BE,
1132
+    AV_CODEC_ID_PCM_S24LE,
1133
+    AV_CODEC_ID_PCM_S24BE,
1134
+    AV_CODEC_ID_PCM_U24LE,
1135
+    AV_CODEC_ID_PCM_U24BE,
1136
+    AV_CODEC_ID_PCM_S24DAUD,
1137
+    AV_CODEC_ID_PCM_ZORK,
1138
+    AV_CODEC_ID_PCM_S16LE_PLANAR,
1139
+    AV_CODEC_ID_PCM_DVD,
1140
+    AV_CODEC_ID_PCM_F32BE,
1141
+    AV_CODEC_ID_PCM_F32LE,
1142
+    AV_CODEC_ID_PCM_F64BE,
1143
+    AV_CODEC_ID_PCM_F64LE,
1144
+    AV_CODEC_ID_PCM_BLURAY,
1145
+    AV_CODEC_ID_PCM_LXF,
1146
+    AV_CODEC_ID_S302M,
1147
+    AV_CODEC_ID_PCM_S8_PLANAR,
1148
+    AV_CODEC_ID_PCM_S24LE_PLANAR,
1149
+    AV_CODEC_ID_PCM_S32LE_PLANAR,
1150
+    AV_CODEC_ID_PCM_S16BE_PLANAR,
1151
+
1152
+    AV_CODEC_ID_PCM_S64LE = 0x10800,
1153
+    AV_CODEC_ID_PCM_S64BE,
1154
+    AV_CODEC_ID_PCM_F16LE,
1155
+    AV_CODEC_ID_PCM_F24LE,
1156
+
1157
+    /* various ADPCM codecs */
1158
+    AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
1159
+    AV_CODEC_ID_ADPCM_IMA_WAV,
1160
+    AV_CODEC_ID_ADPCM_IMA_DK3,
1161
+    AV_CODEC_ID_ADPCM_IMA_DK4,
1162
+    AV_CODEC_ID_ADPCM_IMA_WS,
1163
+    AV_CODEC_ID_ADPCM_IMA_SMJPEG,
1164
+    AV_CODEC_ID_ADPCM_MS,
1165
+    AV_CODEC_ID_ADPCM_4XM,
1166
+    AV_CODEC_ID_ADPCM_XA,
1167
+    AV_CODEC_ID_ADPCM_ADX,
1168
+    AV_CODEC_ID_ADPCM_EA,
1169
+    AV_CODEC_ID_ADPCM_G726,
1170
+    AV_CODEC_ID_ADPCM_CT,
1171
+    AV_CODEC_ID_ADPCM_SWF,
1172
+    AV_CODEC_ID_ADPCM_YAMAHA,
1173
+    AV_CODEC_ID_ADPCM_SBPRO_4,
1174
+    AV_CODEC_ID_ADPCM_SBPRO_3,
1175
+    AV_CODEC_ID_ADPCM_SBPRO_2,
1176
+    AV_CODEC_ID_ADPCM_THP,
1177
+    AV_CODEC_ID_ADPCM_IMA_AMV,
1178
+    AV_CODEC_ID_ADPCM_EA_R1,
1179
+    AV_CODEC_ID_ADPCM_EA_R3,
1180
+    AV_CODEC_ID_ADPCM_EA_R2,
1181
+    AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
1182
+    AV_CODEC_ID_ADPCM_IMA_EA_EACS,
1183
+    AV_CODEC_ID_ADPCM_EA_XAS,
1184
+    AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
1185
+    AV_CODEC_ID_ADPCM_IMA_ISS,
1186
+    AV_CODEC_ID_ADPCM_G722,
1187
+    AV_CODEC_ID_ADPCM_IMA_APC,
1188
+    AV_CODEC_ID_ADPCM_VIMA,
1189
+
1190
+    AV_CODEC_ID_ADPCM_AFC = 0x11800,
1191
+    AV_CODEC_ID_ADPCM_IMA_OKI,
1192
+    AV_CODEC_ID_ADPCM_DTK,
1193
+    AV_CODEC_ID_ADPCM_IMA_RAD,
1194
+    AV_CODEC_ID_ADPCM_G726LE,
1195
+    AV_CODEC_ID_ADPCM_THP_LE,
1196
+    AV_CODEC_ID_ADPCM_PSX,
1197
+    AV_CODEC_ID_ADPCM_AICA,
1198
+    AV_CODEC_ID_ADPCM_IMA_DAT4,
1199
+    AV_CODEC_ID_ADPCM_MTAF,
1200
+
1201
+    /* AMR */
1202
+    AV_CODEC_ID_AMR_NB = 0x12000,
1203
+    AV_CODEC_ID_AMR_WB,
1204
+
1205
+    /* RealAudio codecs*/
1206
+    AV_CODEC_ID_RA_144 = 0x13000,
1207
+    AV_CODEC_ID_RA_288,
1208
+
1209
+    /* various DPCM codecs */
1210
+    AV_CODEC_ID_ROQ_DPCM = 0x14000,
1211
+    AV_CODEC_ID_INTERPLAY_DPCM,
1212
+    AV_CODEC_ID_XAN_DPCM,
1213
+    AV_CODEC_ID_SOL_DPCM,
1214
+
1215
+    AV_CODEC_ID_SDX2_DPCM = 0x14800,
1216
+    AV_CODEC_ID_GREMLIN_DPCM,
1217
+
1218
+    /* audio codecs */
1219
+    AV_CODEC_ID_MP2 = 0x15000,
1220
+    AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
1221
+    AV_CODEC_ID_AAC,
1222
+    AV_CODEC_ID_AC3,
1223
+    AV_CODEC_ID_DTS,
1224
+    AV_CODEC_ID_VORBIS,
1225
+    AV_CODEC_ID_DVAUDIO,
1226
+    AV_CODEC_ID_WMAV1,
1227
+    AV_CODEC_ID_WMAV2,
1228
+    AV_CODEC_ID_MACE3,
1229
+    AV_CODEC_ID_MACE6,
1230
+    AV_CODEC_ID_VMDAUDIO,
1231
+    AV_CODEC_ID_FLAC,
1232
+    AV_CODEC_ID_MP3ADU,
1233
+    AV_CODEC_ID_MP3ON4,
1234
+    AV_CODEC_ID_SHORTEN,
1235
+    AV_CODEC_ID_ALAC,
1236
+    AV_CODEC_ID_WESTWOOD_SND1,
1237
+    AV_CODEC_ID_GSM, ///< as in Berlin toast format
1238
+    AV_CODEC_ID_QDM2,
1239
+    AV_CODEC_ID_COOK,
1240
+    AV_CODEC_ID_TRUESPEECH,
1241
+    AV_CODEC_ID_TTA,
1242
+    AV_CODEC_ID_SMACKAUDIO,
1243
+    AV_CODEC_ID_QCELP,
1244
+    AV_CODEC_ID_WAVPACK,
1245
+    AV_CODEC_ID_DSICINAUDIO,
1246
+    AV_CODEC_ID_IMC,
1247
+    AV_CODEC_ID_MUSEPACK7,
1248
+    AV_CODEC_ID_MLP,
1249
+    AV_CODEC_ID_GSM_MS, /* as found in WAV */
1250
+    AV_CODEC_ID_ATRAC3,
1251
+    AV_CODEC_ID_APE,
1252
+    AV_CODEC_ID_NELLYMOSER,
1253
+    AV_CODEC_ID_MUSEPACK8,
1254
+    AV_CODEC_ID_SPEEX,
1255
+    AV_CODEC_ID_WMAVOICE,
1256
+    AV_CODEC_ID_WMAPRO,
1257
+    AV_CODEC_ID_WMALOSSLESS,
1258
+    AV_CODEC_ID_ATRAC3P,
1259
+    AV_CODEC_ID_EAC3,
1260
+    AV_CODEC_ID_SIPR,
1261
+    AV_CODEC_ID_MP1,
1262
+    AV_CODEC_ID_TWINVQ,
1263
+    AV_CODEC_ID_TRUEHD,
1264
+    AV_CODEC_ID_MP4ALS,
1265
+    AV_CODEC_ID_ATRAC1,
1266
+    AV_CODEC_ID_BINKAUDIO_RDFT,
1267
+    AV_CODEC_ID_BINKAUDIO_DCT,
1268
+    AV_CODEC_ID_AAC_LATM,
1269
+    AV_CODEC_ID_QDMC,
1270
+    AV_CODEC_ID_CELT,
1271
+    AV_CODEC_ID_G723_1,
1272
+    AV_CODEC_ID_G729,
1273
+    AV_CODEC_ID_8SVX_EXP,
1274
+    AV_CODEC_ID_8SVX_FIB,
1275
+    AV_CODEC_ID_BMV_AUDIO,
1276
+    AV_CODEC_ID_RALF,
1277
+    AV_CODEC_ID_IAC,
1278
+    AV_CODEC_ID_ILBC,
1279
+    AV_CODEC_ID_OPUS,
1280
+    AV_CODEC_ID_COMFORT_NOISE,
1281
+    AV_CODEC_ID_TAK,
1282
+    AV_CODEC_ID_METASOUND,
1283
+    AV_CODEC_ID_PAF_AUDIO,
1284
+    AV_CODEC_ID_ON2AVC,
1285
+    AV_CODEC_ID_DSS_SP,
1286
+    AV_CODEC_ID_CODEC2,
1287
+
1288
+    AV_CODEC_ID_FFWAVESYNTH = 0x15800,
1289
+    AV_CODEC_ID_SONIC,
1290
+    AV_CODEC_ID_SONIC_LS,
1291
+    AV_CODEC_ID_EVRC,
1292
+    AV_CODEC_ID_SMV,
1293
+    AV_CODEC_ID_DSD_LSBF,
1294
+    AV_CODEC_ID_DSD_MSBF,
1295
+    AV_CODEC_ID_DSD_LSBF_PLANAR,
1296
+    AV_CODEC_ID_DSD_MSBF_PLANAR,
1297
+    AV_CODEC_ID_4GV,
1298
+    AV_CODEC_ID_INTERPLAY_ACM,
1299
+    AV_CODEC_ID_XMA1,
1300
+    AV_CODEC_ID_XMA2,
1301
+    AV_CODEC_ID_DST,
1302
+    AV_CODEC_ID_ATRAC3AL,
1303
+    AV_CODEC_ID_ATRAC3PAL,
1304
+    AV_CODEC_ID_DOLBY_E,
1305
+    AV_CODEC_ID_APTX,
1306
+    AV_CODEC_ID_APTX_HD,
1307
+    AV_CODEC_ID_SBC,
1308
+
1309
+    /* subtitle codecs */
1310
+    AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
1311
+    AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
1312
+    AV_CODEC_ID_DVB_SUBTITLE,
1313
+    AV_CODEC_ID_TEXT,  ///< raw UTF-8 text
1314
+    AV_CODEC_ID_XSUB,
1315
+    AV_CODEC_ID_SSA,
1316
+    AV_CODEC_ID_MOV_TEXT,
1317
+    AV_CODEC_ID_HDMV_PGS_SUBTITLE,
1318
+    AV_CODEC_ID_DVB_TELETEXT,
1319
+    AV_CODEC_ID_SRT,
1320
+
1321
+    AV_CODEC_ID_MICRODVD   = 0x17800,
1322
+    AV_CODEC_ID_EIA_608,
1323
+    AV_CODEC_ID_JACOSUB,
1324
+    AV_CODEC_ID_SAMI,
1325
+    AV_CODEC_ID_REALTEXT,
1326
+    AV_CODEC_ID_STL,
1327
+    AV_CODEC_ID_SUBVIEWER1,
1328
+    AV_CODEC_ID_SUBVIEWER,
1329
+    AV_CODEC_ID_SUBRIP,
1330
+    AV_CODEC_ID_WEBVTT,
1331
+    AV_CODEC_ID_MPL2,
1332
+    AV_CODEC_ID_VPLAYER,
1333
+    AV_CODEC_ID_PJS,
1334
+    AV_CODEC_ID_ASS,
1335
+    AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
1336
+
1337
+    /* other specific kind of codecs (generally used for attachments) */
1338
+    AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
1339
+    AV_CODEC_ID_TTF = 0x18000,
1340
+
1341
+    AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
1342
+    AV_CODEC_ID_BINTEXT    = 0x18800,
1343
+    AV_CODEC_ID_XBIN,
1344
+    AV_CODEC_ID_IDF,
1345
+    AV_CODEC_ID_OTF,
1346
+    AV_CODEC_ID_SMPTE_KLV,
1347
+    AV_CODEC_ID_DVD_NAV,
1348
+    AV_CODEC_ID_TIMED_ID3,
1349
+    AV_CODEC_ID_BIN_DATA,
1350
+
1351
+
1352
+    AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
1353
+
1354
+    AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
1355
+                                * stream (only used by libavformat) */
1356
+    AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
1357
+                                * stream (only used by libavformat) */
1358
+    AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
1359
+    AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
1360
+};
1361
+
1362
+/**
1363
+ * This struct describes the properties of a single codec described by an
1364
+ * AVCodecID.
1365
+ * @see avcodec_descriptor_get()
1366
+ */
1367
+typedef struct AVCodecDescriptor {
1368
+    enum AVCodecID     id;
1369
+    enum AVMediaType type;
1370
+    /**
1371
+     * Name of the codec described by this descriptor. It is non-empty and
1372
+     * unique for each codec descriptor. It should contain alphanumeric
1373
+     * characters and '_' only.
1374
+     */
1375
+    const char      *name;
1376
+    /**
1377
+     * A more descriptive name for this codec. May be NULL.
1378
+     */
1379
+    const char *long_name;
1380
+    /**
1381
+     * Codec properties, a combination of AV_CODEC_PROP_* flags.
1382
+     */
1383
+    int             props;
1384
+    /**
1385
+     * MIME type(s) associated with the codec.
1386
+     * May be NULL; if not, a NULL-terminated array of MIME types.
1387
+     * The first item is always non-NULL and is the preferred MIME type.
1388
+     */
1389
+    const char *const *mime_types;
1390
+    /**
1391
+     * If non-NULL, an array of profiles recognized for this codec.
1392
+     * Terminated with FF_PROFILE_UNKNOWN.
1393
+     */
1394
+    const struct AVProfile *profiles;
1395
+} AVCodecDescriptor;
1396
+
1397
+/**
1398
+ * Codec uses only intra compression.
1399
+ * Video and audio codecs only.
1400
+ */
1401
+#define AV_CODEC_PROP_INTRA_ONLY    (1 << 0)
1402
+/**
1403
+ * Codec supports lossy compression. Audio and video codecs only.
1404
+ * @note a codec may support both lossy and lossless
1405
+ * compression modes
1406
+ */
1407
+#define AV_CODEC_PROP_LOSSY         (1 << 1)
1408
+/**
1409
+ * Codec supports lossless compression. Audio and video codecs only.
1410
+ */
1411
+#define AV_CODEC_PROP_LOSSLESS      (1 << 2)
1412
+/**
1413
+ * Codec supports frame reordering. That is, the coded order (the order in which
1414
+ * the encoded packets are output by the encoders / stored / input to the
1415
+ * decoders) may be different from the presentation order of the corresponding
1416
+ * frames.
1417
+ *
1418
+ * For codecs that do not have this property set, PTS and DTS should always be
1419
+ * equal.
1420
+ */
1421
+#define AV_CODEC_PROP_REORDER       (1 << 3)
1422
+/**
1423
+ * Subtitle codec is bitmap based
1424
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
1425
+ */
1426
+#define AV_CODEC_PROP_BITMAP_SUB    (1 << 16)
1427
+/**
1428
+ * Subtitle codec is text based.
1429
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
1430
+ */
1431
+#define AV_CODEC_PROP_TEXT_SUB      (1 << 17)
1432
+
1433
+/**
1434
+ * @ingroup lavc_decoding
1435
+ * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
1436
+ * This is mainly needed because some optimized bitstream readers read
1437
+ * 32 or 64 bit at once and could read over the end.<br>
1438
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged
1439
+ * MPEG bitstreams could cause overread and segfault.
1440
+ */
1441
+#define AV_INPUT_BUFFER_PADDING_SIZE 64
1442
+
1443
+/**
1444
+ * @ingroup lavc_encoding
1445
+ * minimum encoding buffer size
1446
+ * Used to avoid some checks during header writing.
1447
+ */
1448
+#define AV_INPUT_BUFFER_MIN_SIZE 16384
1449
+
1450
+/**
1451
+ * @ingroup lavc_decoding
1452
+ */
1453
+enum AVDiscard{
1454
+    /* We leave some space between them for extensions (drop some
1455
+     * keyframes for intra-only or drop just some bidir frames). */
1456
+    AVDISCARD_NONE    =-16, ///< discard nothing
1457
+    AVDISCARD_DEFAULT =  0, ///< discard useless packets like 0 size packets in avi
1458
+    AVDISCARD_NONREF  =  8, ///< discard all non reference
1459
+    AVDISCARD_BIDIR   = 16, ///< discard all bidirectional frames
1460
+    AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
1461
+    AVDISCARD_NONKEY  = 32, ///< discard all frames except keyframes
1462
+    AVDISCARD_ALL     = 48, ///< discard all
1463
+};
1464
+
1465
+enum AVAudioServiceType {
1466
+    AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
1467
+    AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
1468
+    AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
1469
+    AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
1470
+    AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
1471
+    AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
1472
+    AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
1473
+    AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
1474
+    AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
1475
+    AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
1476
+};
1477
+
1478
+/**
1479
+ * @ingroup lavc_encoding
1480
+ */
1481
+typedef struct RcOverride{
1482
+    int start_frame;
1483
+    int end_frame;
1484
+    int qscale; // If this is 0 then quality_factor will be used instead.
1485
+    float quality_factor;
1486
+} RcOverride;
1487
+
1488
+/* encoding support
1489
+   These flags can be passed in AVCodecContext.flags before initialization.
1490
+   Note: Not everything is supported yet.
1491
+*/
1492
+
1493
+/**
1494
+ * Allow decoders to produce frames with data planes that are not aligned
1495
+ * to CPU requirements (e.g. due to cropping).
1496
+ */
1497
+#define AV_CODEC_FLAG_UNALIGNED       (1 <<  0)
1498
+/**
1499
+ * Use fixed qscale.
1500
+ */
1501
+#define AV_CODEC_FLAG_QSCALE          (1 <<  1)
1502
+/**
1503
+ * 4 MV per MB allowed / advanced prediction for H.263.
1504
+ */
1505
+#define AV_CODEC_FLAG_4MV             (1 <<  2)
1506
+/**
1507
+ * Output even those frames that might be corrupted.
1508
+ */
1509
+#define AV_CODEC_FLAG_OUTPUT_CORRUPT  (1 <<  3)
1510
+/**
1511
+ * Use qpel MC.
1512
+ */
1513
+#define AV_CODEC_FLAG_QPEL            (1 <<  4)
1514
+/**
1515
+ * Use internal 2pass ratecontrol in first pass mode.
1516
+ */
1517
+#define AV_CODEC_FLAG_PASS1           (1 <<  9)
1518
+/**
1519
+ * Use internal 2pass ratecontrol in second pass mode.
1520
+ */
1521
+#define AV_CODEC_FLAG_PASS2           (1 << 10)
1522
+/**
1523
+ * loop filter.
1524
+ */
1525
+#define AV_CODEC_FLAG_LOOP_FILTER     (1 << 11)
1526
+/**
1527
+ * Only decode/encode grayscale.
1528
+ */
1529
+#define AV_CODEC_FLAG_GRAY            (1 << 13)
1530
+/**
1531
+ * error[?] variables will be set during encoding.
1532
+ */
1533
+#define AV_CODEC_FLAG_PSNR            (1 << 15)
1534
+/**
1535
+ * Input bitstream might be truncated at a random location
1536
+ * instead of only at frame boundaries.
1537
+ */
1538
+#define AV_CODEC_FLAG_TRUNCATED       (1 << 16)
1539
+/**
1540
+ * Use interlaced DCT.
1541
+ */
1542
+#define AV_CODEC_FLAG_INTERLACED_DCT  (1 << 18)
1543
+/**
1544
+ * Force low delay.
1545
+ */
1546
+#define AV_CODEC_FLAG_LOW_DELAY       (1 << 19)
1547
+/**
1548
+ * Place global headers in extradata instead of every keyframe.
1549
+ */
1550
+#define AV_CODEC_FLAG_GLOBAL_HEADER   (1 << 22)
1551
+/**
1552
+ * Use only bitexact stuff (except (I)DCT).
1553
+ */
1554
+#define AV_CODEC_FLAG_BITEXACT        (1 << 23)
1555
+/* Fx : Flag for H.263+ extra options */
1556
+/**
1557
+ * H.263 advanced intra coding / MPEG-4 AC prediction
1558
+ */
1559
+#define AV_CODEC_FLAG_AC_PRED         (1 << 24)
1560
+/**
1561
+ * interlaced motion estimation
1562
+ */
1563
+#define AV_CODEC_FLAG_INTERLACED_ME   (1 << 29)
1564
+#define AV_CODEC_FLAG_CLOSED_GOP      (1U << 31)
1565
+
1566
+/**
1567
+ * Allow non spec compliant speedup tricks.
1568
+ */
1569
+#define AV_CODEC_FLAG2_FAST           (1 <<  0)
1570
+/**
1571
+ * Skip bitstream encoding.
1572
+ */
1573
+#define AV_CODEC_FLAG2_NO_OUTPUT      (1 <<  2)
1574
+/**
1575
+ * Place global headers at every keyframe instead of in extradata.
1576
+ */
1577
+#define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
1578
+
1579
+/**
1580
+ * timecode is in drop frame format. DEPRECATED!!!!
1581
+ */
1582
+#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
1583
+
1584
+/**
1585
+ * Input bitstream might be truncated at a packet boundaries
1586
+ * instead of only at frame boundaries.
1587
+ */
1588
+#define AV_CODEC_FLAG2_CHUNKS         (1 << 15)
1589
+/**
1590
+ * Discard cropping information from SPS.
1591
+ */
1592
+#define AV_CODEC_FLAG2_IGNORE_CROP    (1 << 16)
1593
+
1594
+/**
1595
+ * Show all frames before the first keyframe
1596
+ */
1597
+#define AV_CODEC_FLAG2_SHOW_ALL       (1 << 22)
1598
+/**
1599
+ * Export motion vectors through frame side data
1600
+ */
1601
+#define AV_CODEC_FLAG2_EXPORT_MVS     (1 << 28)
1602
+/**
1603
+ * Do not skip samples and export skip information as frame side data
1604
+ */
1605
+#define AV_CODEC_FLAG2_SKIP_MANUAL    (1 << 29)
1606
+/**
1607
+ * Do not reset ASS ReadOrder field on flush (subtitles decoding)
1608
+ */
1609
+#define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
1610
+
1611
+/* Unsupported options :
1612
+ *              Syntax Arithmetic coding (SAC)
1613
+ *              Reference Picture Selection
1614
+ *              Independent Segment Decoding */
1615
+/* /Fx */
1616
+/* codec capabilities */
1617
+
1618
+/**
1619
+ * Decoder can use draw_horiz_band callback.
1620
+ */
1621
+#define AV_CODEC_CAP_DRAW_HORIZ_BAND     (1 <<  0)
1622
+/**
1623
+ * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1624
+ * If not set, it might not use get_buffer() at all or use operations that
1625
+ * assume the buffer was allocated by avcodec_default_get_buffer.
1626
+ */
1627
+#define AV_CODEC_CAP_DR1                 (1 <<  1)
1628
+#define AV_CODEC_CAP_TRUNCATED           (1 <<  3)
1629
+/**
1630
+ * Encoder or decoder requires flushing with NULL input at the end in order to
1631
+ * give the complete and correct output.
1632
+ *
1633
+ * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1634
+ *       with NULL data. The user can still send NULL data to the public encode
1635
+ *       or decode function, but libavcodec will not pass it along to the codec
1636
+ *       unless this flag is set.
1637
+ *
1638
+ * Decoders:
1639
+ * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1640
+ * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1641
+ * returns frames.
1642
+ *
1643
+ * Encoders:
1644
+ * The encoder needs to be fed with NULL data at the end of encoding until the
1645
+ * encoder no longer returns data.
1646
+ *
1647
+ * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1648
+ *       flag also means that the encoder must set the pts and duration for
1649
+ *       each output packet. If this flag is not set, the pts and duration will
1650
+ *       be determined by libavcodec from the input frame.
1651
+ */
1652
+#define AV_CODEC_CAP_DELAY               (1 <<  5)
1653
+/**
1654
+ * Codec can be fed a final frame with a smaller size.
1655
+ * This can be used to prevent truncation of the last audio samples.
1656
+ */
1657
+#define AV_CODEC_CAP_SMALL_LAST_FRAME    (1 <<  6)
1658
+
1659
+/**
1660
+ * Codec can output multiple frames per AVPacket
1661
+ * Normally demuxers return one frame at a time, demuxers which do not do
1662
+ * are connected to a parser to split what they return into proper frames.
1663
+ * This flag is reserved to the very rare category of codecs which have a
1664
+ * bitstream that cannot be split into frames without timeconsuming
1665
+ * operations like full decoding. Demuxers carrying such bitstreams thus
1666
+ * may return multiple frames in a packet. This has many disadvantages like
1667
+ * prohibiting stream copy in many cases thus it should only be considered
1668
+ * as a last resort.
1669
+ */
1670
+#define AV_CODEC_CAP_SUBFRAMES           (1 <<  8)
1671
+/**
1672
+ * Codec is experimental and is thus avoided in favor of non experimental
1673
+ * encoders
1674
+ */
1675
+#define AV_CODEC_CAP_EXPERIMENTAL        (1 <<  9)
1676
+/**
1677
+ * Codec should fill in channel configuration and samplerate instead of container
1678
+ */
1679
+#define AV_CODEC_CAP_CHANNEL_CONF        (1 << 10)
1680
+/**
1681
+ * Codec supports frame-level multithreading.
1682
+ */
1683
+#define AV_CODEC_CAP_FRAME_THREADS       (1 << 12)
1684
+/**
1685
+ * Codec supports slice-based (or partition-based) multithreading.
1686
+ */
1687
+#define AV_CODEC_CAP_SLICE_THREADS       (1 << 13)
1688
+/**
1689
+ * Codec supports changed parameters at any point.
1690
+ */
1691
+#define AV_CODEC_CAP_PARAM_CHANGE        (1 << 14)
1692
+/**
1693
+ * Codec supports avctx->thread_count == 0 (auto).
1694
+ */
1695
+#define AV_CODEC_CAP_AUTO_THREADS        (1 << 15)
1696
+/**
1697
+ * Audio encoder supports receiving a different number of samples in each call.
1698
+ */
1699
+#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
1700
+/**
1701
+ * Decoder is not a preferred choice for probing.
1702
+ * This indicates that the decoder is not a good choice for probing.
1703
+ * It could for example be an expensive to spin up hardware decoder,
1704
+ * or it could simply not provide a lot of useful information about
1705
+ * the stream.
1706
+ * A decoder marked with this flag should only be used as last resort
1707
+ * choice for probing.
1708
+ */
1709
+#define AV_CODEC_CAP_AVOID_PROBING       (1 << 17)
1710
+/**
1711
+ * Codec is intra only.
1712
+ */
1713
+#define AV_CODEC_CAP_INTRA_ONLY       0x40000000
1714
+/**
1715
+ * Codec is lossless.
1716
+ */
1717
+#define AV_CODEC_CAP_LOSSLESS         0x80000000
1718
+
1719
+/**
1720
+ * Codec is backed by a hardware implementation. Typically used to
1721
+ * identify a non-hwaccel hardware decoder. For information about hwaccels, use
1722
+ * avcodec_get_hw_config() instead.
1723
+ */
1724
+#define AV_CODEC_CAP_HARDWARE            (1 << 18)
1725
+
1726
+/**
1727
+ * Codec is potentially backed by a hardware implementation, but not
1728
+ * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
1729
+ * implementation provides some sort of internal fallback.
1730
+ */
1731
+#define AV_CODEC_CAP_HYBRID              (1 << 19)
1732
+
1733
+/**
1734
+ * Pan Scan area.
1735
+ * This specifies the area which should be displayed.
1736
+ * Note there may be multiple such areas for one frame.
1737
+ */
1738
+typedef struct AVPanScan {
1739
+    /**
1740
+     * id
1741
+     * - encoding: Set by user.
1742
+     * - decoding: Set by libavcodec.
1743
+     */
1744
+    int id;
1745
+
1746
+    /**
1747
+     * width and height in 1/16 pel
1748
+     * - encoding: Set by user.
1749
+     * - decoding: Set by libavcodec.
1750
+     */
1751
+    int width;
1752
+    int height;
1753
+
1754
+    /**
1755
+     * position of the top left corner in 1/16 pel for up to 3 fields/frames
1756
+     * - encoding: Set by user.
1757
+     * - decoding: Set by libavcodec.
1758
+     */
1759
+    int16_t position[3][2];
1760
+} AVPanScan;
1761
+
1762
+/**
1763
+ * This structure describes the bitrate properties of an encoded bitstream. It
1764
+ * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1765
+ * parameters for H.264/HEVC.
1766
+ */
1767
+typedef struct AVCPBProperties {
1768
+    /**
1769
+     * Maximum bitrate of the stream, in bits per second.
1770
+     * Zero if unknown or unspecified.
1771
+     */
1772
+    int max_bitrate;
1773
+    /**
1774
+     * Minimum bitrate of the stream, in bits per second.
1775
+     * Zero if unknown or unspecified.
1776
+     */
1777
+    int min_bitrate;
1778
+    /**
1779
+     * Average bitrate of the stream, in bits per second.
1780
+     * Zero if unknown or unspecified.
1781
+     */
1782
+    int avg_bitrate;
1783
+
1784
+    /**
1785
+     * The size of the buffer to which the ratecontrol is applied, in bits.
1786
+     * Zero if unknown or unspecified.
1787
+     */
1788
+    int buffer_size;
1789
+
1790
+    /**
1791
+     * The delay between the time the packet this structure is associated with
1792
+     * is received and the time when it should be decoded, in periods of a 27MHz
1793
+     * clock.
1794
+     *
1795
+     * UINT64_MAX when unknown or unspecified.
1796
+     */
1797
+    uint64_t vbv_delay;
1798
+} AVCPBProperties;
1799
+
1800
+/**
1801
+ * The decoder will keep a reference to the frame and may reuse it later.
1802
+ */
1803
+#define AV_GET_BUFFER_FLAG_REF (1 << 0)
1804
+
1805
+/**
1806
+ * @defgroup lavc_packet AVPacket
1807
+ *
1808
+ * Types and functions for working with AVPacket.
1809
+ * @{
1810
+ */
1811
+enum AVPacketSideDataType {
1812
+    /**
1813
+     * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1814
+     * bytes worth of palette. This side data signals that a new palette is
1815
+     * present.
1816
+     */
1817
+    AV_PKT_DATA_PALETTE,
1818
+
1819
+    /**
1820
+     * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1821
+     * that the extradata buffer was changed and the receiving side should
1822
+     * act upon it appropriately. The new extradata is embedded in the side
1823
+     * data buffer and should be immediately used for processing the current
1824
+     * frame or packet.
1825
+     */
1826
+    AV_PKT_DATA_NEW_EXTRADATA,
1827
+
1828
+    /**
1829
+     * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1830
+     * @code
1831
+     * u32le param_flags
1832
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1833
+     *     s32le channel_count
1834
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1835
+     *     u64le channel_layout
1836
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1837
+     *     s32le sample_rate
1838
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1839
+     *     s32le width
1840
+     *     s32le height
1841
+     * @endcode
1842
+     */
1843
+    AV_PKT_DATA_PARAM_CHANGE,
1844
+
1845
+    /**
1846
+     * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1847
+     * structures with info about macroblocks relevant to splitting the
1848
+     * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1849
+     * That is, it does not necessarily contain info about all macroblocks,
1850
+     * as long as the distance between macroblocks in the info is smaller
1851
+     * than the target payload size.
1852
+     * Each MB info structure is 12 bytes, and is laid out as follows:
1853
+     * @code
1854
+     * u32le bit offset from the start of the packet
1855
+     * u8    current quantizer at the start of the macroblock
1856
+     * u8    GOB number
1857
+     * u16le macroblock address within the GOB
1858
+     * u8    horizontal MV predictor
1859
+     * u8    vertical MV predictor
1860
+     * u8    horizontal MV predictor for block number 3
1861
+     * u8    vertical MV predictor for block number 3
1862
+     * @endcode
1863
+     */
1864
+    AV_PKT_DATA_H263_MB_INFO,
1865
+
1866
+    /**
1867
+     * This side data should be associated with an audio stream and contains
1868
+     * ReplayGain information in form of the AVReplayGain struct.
1869
+     */
1870
+    AV_PKT_DATA_REPLAYGAIN,
1871
+
1872
+    /**
1873
+     * This side data contains a 3x3 transformation matrix describing an affine
1874
+     * transformation that needs to be applied to the decoded video frames for
1875
+     * correct presentation.
1876
+     *
1877
+     * See libavutil/display.h for a detailed description of the data.
1878
+     */
1879
+    AV_PKT_DATA_DISPLAYMATRIX,
1880
+
1881
+    /**
1882
+     * This side data should be associated with a video stream and contains
1883
+     * Stereoscopic 3D information in form of the AVStereo3D struct.
1884
+     */
1885
+    AV_PKT_DATA_STEREO3D,
1886
+
1887
+    /**
1888
+     * This side data should be associated with an audio stream and corresponds
1889
+     * to enum AVAudioServiceType.
1890
+     */
1891
+    AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1892
+
1893
+    /**
1894
+     * This side data contains quality related information from the encoder.
1895
+     * @code
1896
+     * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1897
+     * u8    picture type
1898
+     * u8    error count
1899
+     * u16   reserved
1900
+     * u64le[error count] sum of squared differences between encoder in and output
1901
+     * @endcode
1902
+     */
1903
+    AV_PKT_DATA_QUALITY_STATS,
1904
+
1905
+    /**
1906
+     * This side data contains an integer value representing the stream index
1907
+     * of a "fallback" track.  A fallback track indicates an alternate
1908
+     * track to use when the current track can not be decoded for some reason.
1909
+     * e.g. no decoder available for codec.
1910
+     */
1911
+    AV_PKT_DATA_FALLBACK_TRACK,
1912
+
1913
+    /**
1914
+     * This side data corresponds to the AVCPBProperties struct.
1915
+     */
1916
+    AV_PKT_DATA_CPB_PROPERTIES,
1917
+
1918
+    /**
1919
+     * Recommmends skipping the specified number of samples
1920
+     * @code
1921
+     * u32le number of samples to skip from start of this packet
1922
+     * u32le number of samples to skip from end of this packet
1923
+     * u8    reason for start skip
1924
+     * u8    reason for end   skip (0=padding silence, 1=convergence)
1925
+     * @endcode
1926
+     */
1927
+    AV_PKT_DATA_SKIP_SAMPLES,
1928
+
1929
+    /**
1930
+     * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1931
+     * the packet may contain "dual mono" audio specific to Japanese DTV
1932
+     * and if it is true, recommends only the selected channel to be used.
1933
+     * @code
1934
+     * u8    selected channels (0=mail/left, 1=sub/right, 2=both)
1935
+     * @endcode
1936
+     */
1937
+    AV_PKT_DATA_JP_DUALMONO,
1938
+
1939
+    /**
1940
+     * A list of zero terminated key/value strings. There is no end marker for
1941
+     * the list, so it is required to rely on the side data size to stop.
1942
+     */
1943
+    AV_PKT_DATA_STRINGS_METADATA,
1944
+
1945
+    /**
1946
+     * Subtitle event position
1947
+     * @code
1948
+     * u32le x1
1949
+     * u32le y1
1950
+     * u32le x2
1951
+     * u32le y2
1952
+     * @endcode
1953
+     */
1954
+    AV_PKT_DATA_SUBTITLE_POSITION,
1955
+
1956
+    /**
1957
+     * Data found in BlockAdditional element of matroska container. There is
1958
+     * no end marker for the data, so it is required to rely on the side data
1959
+     * size to recognize the end. 8 byte id (as found in BlockAddId) followed
1960
+     * by data.
1961
+     */
1962
+    AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
1963
+
1964
+    /**
1965
+     * The optional first identifier line of a WebVTT cue.
1966
+     */
1967
+    AV_PKT_DATA_WEBVTT_IDENTIFIER,
1968
+
1969
+    /**
1970
+     * The optional settings (rendering instructions) that immediately
1971
+     * follow the timestamp specifier of a WebVTT cue.
1972
+     */
1973
+    AV_PKT_DATA_WEBVTT_SETTINGS,
1974
+
1975
+    /**
1976
+     * A list of zero terminated key/value strings. There is no end marker for
1977
+     * the list, so it is required to rely on the side data size to stop. This
1978
+     * side data includes updated metadata which appeared in the stream.
1979
+     */
1980
+    AV_PKT_DATA_METADATA_UPDATE,
1981
+
1982
+    /**
1983
+     * MPEGTS stream ID, this is required to pass the stream ID
1984
+     * information from the demuxer to the corresponding muxer.
1985
+     */
1986
+    AV_PKT_DATA_MPEGTS_STREAM_ID,
1987
+
1988
+    /**
1989
+     * Mastering display metadata (based on SMPTE-2086:2014). This metadata
1990
+     * should be associated with a video stream and contains data in the form
1991
+     * of the AVMasteringDisplayMetadata struct.
1992
+     */
1993
+    AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
1994
+
1995
+    /**
1996
+     * This side data should be associated with a video stream and corresponds
1997
+     * to the AVSphericalMapping structure.
1998
+     */
1999
+    AV_PKT_DATA_SPHERICAL,
2000
+
2001
+    /**
2002
+     * Content light level (based on CTA-861.3). This metadata should be
2003
+     * associated with a video stream and contains data in the form of the
2004
+     * AVContentLightMetadata struct.
2005
+     */
2006
+    AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2007
+
2008
+    /**
2009
+     * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
2010
+     * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
2011
+     * The number of bytes of CC data is AVPacketSideData.size.
2012
+     */
2013
+    AV_PKT_DATA_A53_CC,
2014
+
2015
+    /**
2016
+     * This side data is encryption initialization data.
2017
+     * The format is not part of ABI, use av_encryption_init_info_* methods to
2018
+     * access.
2019
+     */
2020
+    AV_PKT_DATA_ENCRYPTION_INIT_INFO,
2021
+
2022
+    /**
2023
+     * This side data contains encryption info for how to decrypt the packet.
2024
+     * The format is not part of ABI, use av_encryption_info_* methods to access.
2025
+     */
2026
+    AV_PKT_DATA_ENCRYPTION_INFO,
2027
+
2028
+    /**
2029
+     * The number of side data types.
2030
+     * This is not part of the public API/ABI in the sense that it may
2031
+     * change when new side data types are added.
2032
+     * This must stay the last enum value.
2033
+     * If its value becomes huge, some code using it
2034
+     * needs to be updated as it assumes it to be smaller than other limits.
2035
+     */
2036
+    AV_PKT_DATA_NB
2037
+};
2038
+
2039
+#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
2040
+
2041
+typedef struct AVPacketSideData {
2042
+    uint8_t *data;
2043
+    int      size;
2044
+    enum AVPacketSideDataType type;
2045
+} AVPacketSideData;
2046
+
2047
+/**
2048
+ * This structure stores compressed data. It is typically exported by demuxers
2049
+ * and then passed as input to decoders, or received as output from encoders and
2050
+ * then passed to muxers.
2051
+ *
2052
+ * For video, it should typically contain one compressed frame. For audio it may
2053
+ * contain several compressed frames. Encoders are allowed to output empty
2054
+ * packets, with no compressed data, containing only side data
2055
+ * (e.g. to update some stream parameters at the end of encoding).
2056
+ *
2057
+ * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
2058
+ * ABI. Thus it may be allocated on stack and no new fields can be added to it
2059
+ * without libavcodec and libavformat major bump.
2060
+ *
2061
+ * The semantics of data ownership depends on the buf field.
2062
+ * If it is set, the packet data is dynamically allocated and is
2063
+ * valid indefinitely until a call to av_packet_unref() reduces the
2064
+ * reference count to 0.
2065
+ *
2066
+ * If the buf field is not set av_packet_ref() would make a copy instead
2067
+ * of increasing the reference count.
2068
+ *
2069
+ * The side data is always allocated with av_malloc(), copied by
2070
+ * av_packet_ref() and freed by av_packet_unref().
2071
+ *
2072
+ * @see av_packet_ref
2073
+ * @see av_packet_unref
2074
+ */
2075
+typedef struct AVPacket {
2076
+    /**
2077
+     * A reference to the reference-counted buffer where the packet data is
2078
+     * stored.
2079
+     * May be NULL, then the packet data is not reference-counted.
2080
+     */
2081
+    AVBufferRef *buf;
2082
+    /**
2083
+     * Presentation timestamp in AVStream->time_base units; the time at which
2084
+     * the decompressed packet will be presented to the user.
2085
+     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2086
+     * pts MUST be larger or equal to dts as presentation cannot happen before
2087
+     * decompression, unless one wants to view hex dumps. Some formats misuse
2088
+     * the terms dts and pts/cts to mean something different. Such timestamps
2089
+     * must be converted to true pts/dts before they are stored in AVPacket.
2090
+     */
2091
+    int64_t pts;
2092
+    /**
2093
+     * Decompression timestamp in AVStream->time_base units; the time at which
2094
+     * the packet is decompressed.
2095
+     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2096
+     */
2097
+    int64_t dts;
2098
+    uint8_t *data;
2099
+    int   size;
2100
+    int   stream_index;
2101
+    /**
2102
+     * A combination of AV_PKT_FLAG values
2103
+     */
2104
+    int   flags;
2105
+    /**
2106
+     * Additional packet data that can be provided by the container.
2107
+     * Packet can contain several types of side information.
2108
+     */
2109
+    AVPacketSideData *side_data;
2110
+    int side_data_elems;
2111
+
2112
+    /**
2113
+     * Duration of this packet in AVStream->time_base units, 0 if unknown.
2114
+     * Equals next_pts - this_pts in presentation order.
2115
+     */
2116
+    int64_t duration;
2117
+
2118
+    int64_t pos;                            ///< byte position in stream, -1 if unknown
2119
+
2120
+#if FF_API_CONVERGENCE_DURATION
2121
+    /**
2122
+     * @deprecated Same as the duration field, but as int64_t. This was required
2123
+     * for Matroska subtitles, whose duration values could overflow when the
2124
+     * duration field was still an int.
2125
+     */
2126
+    attribute_deprecated
2127
+    int64_t convergence_duration;
2128
+#endif
2129
+} AVPacket;
2130
+#define AV_PKT_FLAG_KEY     0x0001 ///< The packet contains a keyframe
2131
+#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
2132
+/**
2133
+ * Flag is used to discard packets which are required to maintain valid
2134
+ * decoder state but are not required for output and should be dropped
2135
+ * after decoding.
2136
+ **/
2137
+#define AV_PKT_FLAG_DISCARD   0x0004
2138
+/**
2139
+ * The packet comes from a trusted source.
2140
+ *
2141
+ * Otherwise-unsafe constructs such as arbitrary pointers to data
2142
+ * outside the packet may be followed.
2143
+ */
2144
+#define AV_PKT_FLAG_TRUSTED   0x0008
2145
+/**
2146
+ * Flag is used to indicate packets that contain frames that can
2147
+ * be discarded by the decoder.  I.e. Non-reference frames.
2148
+ */
2149
+#define AV_PKT_FLAG_DISPOSABLE 0x0010
2150
+
2151
+
2152
+enum AVSideDataParamChangeFlags {
2153
+    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
2154
+    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2155
+    AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
2156
+    AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
2157
+};
2158
+/**
2159
+ * @}
2160
+ */
2161
+
2162
+struct AVCodecInternal;
2163
+
2164
+enum AVFieldOrder {
2165
+    AV_FIELD_UNKNOWN,
2166
+    AV_FIELD_PROGRESSIVE,
2167
+    AV_FIELD_TT,          //< Top coded_first, top displayed first
2168
+    AV_FIELD_BB,          //< Bottom coded first, bottom displayed first
2169
+    AV_FIELD_TB,          //< Top coded first, bottom displayed first
2170
+    AV_FIELD_BT,          //< Bottom coded first, top displayed first
2171
+};
2172
+
2173
+/**
2174
+ * main external API structure.
2175
+ * New fields can be added to the end with minor version bumps.
2176
+ * Removal, reordering and changes to existing fields require a major
2177
+ * version bump.
2178
+ * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
2179
+ * applications.
2180
+ * The name string for AVOptions options matches the associated command line
2181
+ * parameter name and can be found in libavcodec/options_table.h
2182
+ * The AVOption/command line parameter names differ in some cases from the C
2183
+ * structure field names for historic reasons or brevity.
2184
+ * sizeof(AVCodecContext) must not be used outside libav*.
2185
+ */
2186
+typedef struct AVCodecContext {
2187
+    /**
2188
+     * information on struct for av_log
2189
+     * - set by avcodec_alloc_context3
2190
+     */
2191
+    const AVClass *av_class;
2192
+    int log_level_offset;
2193
+
2194
+    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
2195
+    const struct AVCodec  *codec;
2196
+    enum AVCodecID     codec_id; /* see AV_CODEC_ID_xxx */
2197
+
2198
+    /**
2199
+     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2200
+     * This is used to work around some encoder bugs.
2201
+     * A demuxer should set this to what is stored in the field used to identify the codec.
2202
+     * If there are multiple such fields in a container then the demuxer should choose the one
2203
+     * which maximizes the information about the used codec.
2204
+     * If the codec tag field in a container is larger than 32 bits then the demuxer should
2205
+     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
2206
+     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
2207
+     * first.
2208
+     * - encoding: Set by user, if not then the default based on codec_id will be used.
2209
+     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2210
+     */
2211
+    unsigned int codec_tag;
2212
+
2213
+    void *priv_data;
2214
+
2215
+    /**
2216
+     * Private context used for internal data.
2217
+     *
2218
+     * Unlike priv_data, this is not codec-specific. It is used in general
2219
+     * libavcodec functions.
2220
+     */
2221
+    struct AVCodecInternal *internal;
2222
+
2223
+    /**
2224
+     * Private data of the user, can be used to carry app specific stuff.
2225
+     * - encoding: Set by user.
2226
+     * - decoding: Set by user.
2227
+     */
2228
+    void *opaque;
2229
+
2230
+    /**
2231
+     * the average bitrate
2232
+     * - encoding: Set by user; unused for constant quantizer encoding.
2233
+     * - decoding: Set by user, may be overwritten by libavcodec
2234
+     *             if this info is available in the stream
2235
+     */
2236
+    int64_t bit_rate;
2237
+
2238
+    /**
2239
+     * number of bits the bitstream is allowed to diverge from the reference.
2240
+     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
2241
+     * - encoding: Set by user; unused for constant quantizer encoding.
2242
+     * - decoding: unused
2243
+     */
2244
+    int bit_rate_tolerance;
2245
+
2246
+    /**
2247
+     * Global quality for codecs which cannot change it per frame.
2248
+     * This should be proportional to MPEG-1/2/4 qscale.
2249
+     * - encoding: Set by user.
2250
+     * - decoding: unused
2251
+     */
2252
+    int global_quality;
2253
+
2254
+    /**
2255
+     * - encoding: Set by user.
2256
+     * - decoding: unused
2257
+     */
2258
+    int compression_level;
2259
+#define FF_COMPRESSION_DEFAULT -1
2260
+
2261
+    /**
2262
+     * AV_CODEC_FLAG_*.
2263
+     * - encoding: Set by user.
2264
+     * - decoding: Set by user.
2265
+     */
2266
+    int flags;
2267
+
2268
+    /**
2269
+     * AV_CODEC_FLAG2_*
2270
+     * - encoding: Set by user.
2271
+     * - decoding: Set by user.
2272
+     */
2273
+    int flags2;
2274
+
2275
+    /**
2276
+     * some codecs need / can use extradata like Huffman tables.
2277
+     * MJPEG: Huffman tables
2278
+     * rv10: additional flags
2279
+     * MPEG-4: global headers (they can be in the bitstream or here)
2280
+     * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
2281
+     * than extradata_size to avoid problems if it is read with the bitstream reader.
2282
+     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
2283
+     * - encoding: Set/allocated/freed by libavcodec.
2284
+     * - decoding: Set/allocated/freed by user.
2285
+     */
2286
+    uint8_t *extradata;
2287
+    int extradata_size;
2288
+
2289
+    /**
2290
+     * This is the fundamental unit of time (in seconds) in terms
2291
+     * of which frame timestamps are represented. For fixed-fps content,
2292
+     * timebase should be 1/framerate and timestamp increments should be
2293
+     * identically 1.
2294
+     * This often, but not always is the inverse of the frame rate or field rate
2295
+     * for video. 1/time_base is not the average frame rate if the frame rate is not
2296
+     * constant.
2297
+     *
2298
+     * Like containers, elementary streams also can store timestamps, 1/time_base
2299
+     * is the unit in which these timestamps are specified.
2300
+     * As example of such codec time base see ISO/IEC 14496-2:2001(E)
2301
+     * vop_time_increment_resolution and fixed_vop_rate
2302
+     * (fixed_vop_rate == 0 implies that it is different from the framerate)
2303
+     *
2304
+     * - encoding: MUST be set by user.
2305
+     * - decoding: the use of this field for decoding is deprecated.
2306
+     *             Use framerate instead.
2307
+     */
2308
+    AVRational time_base;
2309
+
2310
+    /**
2311
+     * For some codecs, the time base is closer to the field rate than the frame rate.
2312
+     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2313
+     * if no telecine is used ...
2314
+     *
2315
+     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2316
+     */
2317
+    int ticks_per_frame;
2318
+
2319
+    /**
2320
+     * Codec delay.
2321
+     *
2322
+     * Encoding: Number of frames delay there will be from the encoder input to
2323
+     *           the decoder output. (we assume the decoder matches the spec)
2324
+     * Decoding: Number of frames delay in addition to what a standard decoder
2325
+     *           as specified in the spec would produce.
2326
+     *
2327
+     * Video:
2328
+     *   Number of frames the decoded output will be delayed relative to the
2329
+     *   encoded input.
2330
+     *
2331
+     * Audio:
2332
+     *   For encoding, this field is unused (see initial_padding).
2333
+     *
2334
+     *   For decoding, this is the number of samples the decoder needs to
2335
+     *   output before the decoder's output is valid. When seeking, you should
2336
+     *   start decoding this many samples prior to your desired seek point.
2337
+     *
2338
+     * - encoding: Set by libavcodec.
2339
+     * - decoding: Set by libavcodec.
2340
+     */
2341
+    int delay;
2342
+
2343
+
2344
+    /* video only */
2345
+    /**
2346
+     * picture width / height.
2347
+     *
2348
+     * @note Those fields may not match the values of the last
2349
+     * AVFrame output by avcodec_decode_video2 due frame
2350
+     * reordering.
2351
+     *
2352
+     * - encoding: MUST be set by user.
2353
+     * - decoding: May be set by the user before opening the decoder if known e.g.
2354
+     *             from the container. Some decoders will require the dimensions
2355
+     *             to be set by the caller. During decoding, the decoder may
2356
+     *             overwrite those values as required while parsing the data.
2357
+     */
2358
+    int width, height;
2359
+
2360
+    /**
2361
+     * Bitstream width / height, may be different from width/height e.g. when
2362
+     * the decoded frame is cropped before being output or lowres is enabled.
2363
+     *
2364
+     * @note Those field may not match the value of the last
2365
+     * AVFrame output by avcodec_receive_frame() due frame
2366
+     * reordering.
2367
+     *
2368
+     * - encoding: unused
2369
+     * - decoding: May be set by the user before opening the decoder if known
2370
+     *             e.g. from the container. During decoding, the decoder may
2371
+     *             overwrite those values as required while parsing the data.
2372
+     */
2373
+    int coded_width, coded_height;
2374
+
2375
+    /**
2376
+     * the number of pictures in a group of pictures, or 0 for intra_only
2377
+     * - encoding: Set by user.
2378
+     * - decoding: unused
2379
+     */
2380
+    int gop_size;
2381
+
2382
+    /**
2383
+     * Pixel format, see AV_PIX_FMT_xxx.
2384
+     * May be set by the demuxer if known from headers.
2385
+     * May be overridden by the decoder if it knows better.
2386
+     *
2387
+     * @note This field may not match the value of the last
2388
+     * AVFrame output by avcodec_receive_frame() due frame
2389
+     * reordering.
2390
+     *
2391
+     * - encoding: Set by user.
2392
+     * - decoding: Set by user if known, overridden by libavcodec while
2393
+     *             parsing the data.
2394
+     */
2395
+    enum AVPixelFormat pix_fmt;
2396
+
2397
+    /**
2398
+     * If non NULL, 'draw_horiz_band' is called by the libavcodec
2399
+     * decoder to draw a horizontal band. It improves cache usage. Not
2400
+     * all codecs can do that. You must check the codec capabilities
2401
+     * beforehand.
2402
+     * When multithreading is used, it may be called from multiple threads
2403
+     * at the same time; threads might draw different parts of the same AVFrame,
2404
+     * or multiple AVFrames, and there is no guarantee that slices will be drawn
2405
+     * in order.
2406
+     * The function is also used by hardware acceleration APIs.
2407
+     * It is called at least once during frame decoding to pass
2408
+     * the data needed for hardware render.
2409
+     * In that mode instead of pixel data, AVFrame points to
2410
+     * a structure specific to the acceleration API. The application
2411
+     * reads the structure and can change some fields to indicate progress
2412
+     * or mark state.
2413
+     * - encoding: unused
2414
+     * - decoding: Set by user.
2415
+     * @param height the height of the slice
2416
+     * @param y the y position of the slice
2417
+     * @param type 1->top field, 2->bottom field, 3->frame
2418
+     * @param offset offset into the AVFrame.data from which the slice should be read
2419
+     */
2420
+    void (*draw_horiz_band)(struct AVCodecContext *s,
2421
+                            const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2422
+                            int y, int type, int height);
2423
+
2424
+    /**
2425
+     * callback to negotiate the pixelFormat
2426
+     * @param fmt is the list of formats which are supported by the codec,
2427
+     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2428
+     * The first is always the native one.
2429
+     * @note The callback may be called again immediately if initialization for
2430
+     * the selected (hardware-accelerated) pixel format failed.
2431
+     * @warning Behavior is undefined if the callback returns a value not
2432
+     * in the fmt list of formats.
2433
+     * @return the chosen format
2434
+     * - encoding: unused
2435
+     * - decoding: Set by user, if not set the native format will be chosen.
2436
+     */
2437
+    enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2438
+
2439
+    /**
2440
+     * maximum number of B-frames between non-B-frames
2441
+     * Note: The output will be delayed by max_b_frames+1 relative to the input.
2442
+     * - encoding: Set by user.
2443
+     * - decoding: unused
2444
+     */
2445
+    int max_b_frames;
2446
+
2447
+    /**
2448
+     * qscale factor between IP and B-frames
2449
+     * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
2450
+     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2451
+     * - encoding: Set by user.
2452
+     * - decoding: unused
2453
+     */
2454
+    float b_quant_factor;
2455
+
2456
+#if FF_API_PRIVATE_OPT
2457
+    /** @deprecated use encoder private options instead */
2458
+    attribute_deprecated
2459
+    int b_frame_strategy;
2460
+#endif
2461
+
2462
+    /**
2463
+     * qscale offset between IP and B-frames
2464
+     * - encoding: Set by user.
2465
+     * - decoding: unused
2466
+     */
2467
+    float b_quant_offset;
2468
+
2469
+    /**
2470
+     * Size of the frame reordering buffer in the decoder.
2471
+     * For MPEG-2 it is 1 IPB or 0 low delay IP.
2472
+     * - encoding: Set by libavcodec.
2473
+     * - decoding: Set by libavcodec.
2474
+     */
2475
+    int has_b_frames;
2476
+
2477
+#if FF_API_PRIVATE_OPT
2478
+    /** @deprecated use encoder private options instead */
2479
+    attribute_deprecated
2480
+    int mpeg_quant;
2481
+#endif
2482
+
2483
+    /**
2484
+     * qscale factor between P- and I-frames
2485
+     * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
2486
+     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2487
+     * - encoding: Set by user.
2488
+     * - decoding: unused
2489
+     */
2490
+    float i_quant_factor;
2491
+
2492
+    /**
2493
+     * qscale offset between P and I-frames
2494
+     * - encoding: Set by user.
2495
+     * - decoding: unused
2496
+     */
2497
+    float i_quant_offset;
2498
+
2499
+    /**
2500
+     * luminance masking (0-> disabled)
2501
+     * - encoding: Set by user.
2502
+     * - decoding: unused
2503
+     */
2504
+    float lumi_masking;
2505
+
2506
+    /**
2507
+     * temporary complexity masking (0-> disabled)
2508
+     * - encoding: Set by user.
2509
+     * - decoding: unused
2510
+     */
2511
+    float temporal_cplx_masking;
2512
+
2513
+    /**
2514
+     * spatial complexity masking (0-> disabled)
2515
+     * - encoding: Set by user.
2516
+     * - decoding: unused
2517
+     */
2518
+    float spatial_cplx_masking;
2519
+
2520
+    /**
2521
+     * p block masking (0-> disabled)
2522
+     * - encoding: Set by user.
2523
+     * - decoding: unused
2524
+     */
2525
+    float p_masking;
2526
+
2527
+    /**
2528
+     * darkness masking (0-> disabled)
2529
+     * - encoding: Set by user.
2530
+     * - decoding: unused
2531
+     */
2532
+    float dark_masking;
2533
+
2534
+    /**
2535
+     * slice count
2536
+     * - encoding: Set by libavcodec.
2537
+     * - decoding: Set by user (or 0).
2538
+     */
2539
+    int slice_count;
2540
+
2541
+#if FF_API_PRIVATE_OPT
2542
+    /** @deprecated use encoder private options instead */
2543
+    attribute_deprecated
2544
+     int prediction_method;
2545
+#define FF_PRED_LEFT   0
2546
+#define FF_PRED_PLANE  1
2547
+#define FF_PRED_MEDIAN 2
2548
+#endif
2549
+
2550
+    /**
2551
+     * slice offsets in the frame in bytes
2552
+     * - encoding: Set/allocated by libavcodec.
2553
+     * - decoding: Set/allocated by user (or NULL).
2554
+     */
2555
+    int *slice_offset;
2556
+
2557
+    /**
2558
+     * sample aspect ratio (0 if unknown)
2559
+     * That is the width of a pixel divided by the height of the pixel.
2560
+     * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
2561
+     * - encoding: Set by user.
2562
+     * - decoding: Set by libavcodec.
2563
+     */
2564
+    AVRational sample_aspect_ratio;
2565
+
2566
+    /**
2567
+     * motion estimation comparison function
2568
+     * - encoding: Set by user.
2569
+     * - decoding: unused
2570
+     */
2571
+    int me_cmp;
2572
+    /**
2573
+     * subpixel motion estimation comparison function
2574
+     * - encoding: Set by user.
2575
+     * - decoding: unused
2576
+     */
2577
+    int me_sub_cmp;
2578
+    /**
2579
+     * macroblock comparison function (not supported yet)
2580
+     * - encoding: Set by user.
2581
+     * - decoding: unused
2582
+     */
2583
+    int mb_cmp;
2584
+    /**
2585
+     * interlaced DCT comparison function
2586
+     * - encoding: Set by user.
2587
+     * - decoding: unused
2588
+     */
2589
+    int ildct_cmp;
2590
+#define FF_CMP_SAD          0
2591
+#define FF_CMP_SSE          1
2592
+#define FF_CMP_SATD         2
2593
+#define FF_CMP_DCT          3
2594
+#define FF_CMP_PSNR         4
2595
+#define FF_CMP_BIT          5
2596
+#define FF_CMP_RD           6
2597
+#define FF_CMP_ZERO         7
2598
+#define FF_CMP_VSAD         8
2599
+#define FF_CMP_VSSE         9
2600
+#define FF_CMP_NSSE         10
2601
+#define FF_CMP_W53          11
2602
+#define FF_CMP_W97          12
2603
+#define FF_CMP_DCTMAX       13
2604
+#define FF_CMP_DCT264       14
2605
+#define FF_CMP_MEDIAN_SAD   15
2606
+#define FF_CMP_CHROMA       256
2607
+
2608
+    /**
2609
+     * ME diamond size & shape
2610
+     * - encoding: Set by user.
2611
+     * - decoding: unused
2612
+     */
2613
+    int dia_size;
2614
+
2615
+    /**
2616
+     * amount of previous MV predictors (2a+1 x 2a+1 square)
2617
+     * - encoding: Set by user.
2618
+     * - decoding: unused
2619
+     */
2620
+    int last_predictor_count;
2621
+
2622
+#if FF_API_PRIVATE_OPT
2623
+    /** @deprecated use encoder private options instead */
2624
+    attribute_deprecated
2625
+    int pre_me;
2626
+#endif
2627
+
2628
+    /**
2629
+     * motion estimation prepass comparison function
2630
+     * - encoding: Set by user.
2631
+     * - decoding: unused
2632
+     */
2633
+    int me_pre_cmp;
2634
+
2635
+    /**
2636
+     * ME prepass diamond size & shape
2637
+     * - encoding: Set by user.
2638
+     * - decoding: unused
2639
+     */
2640
+    int pre_dia_size;
2641
+
2642
+    /**
2643
+     * subpel ME quality
2644
+     * - encoding: Set by user.
2645
+     * - decoding: unused
2646
+     */
2647
+    int me_subpel_quality;
2648
+
2649
+    /**
2650
+     * maximum motion estimation search range in subpel units
2651
+     * If 0 then no limit.
2652
+     *
2653
+     * - encoding: Set by user.
2654
+     * - decoding: unused
2655
+     */
2656
+    int me_range;
2657
+
2658
+    /**
2659
+     * slice flags
2660
+     * - encoding: unused
2661
+     * - decoding: Set by user.
2662
+     */
2663
+    int slice_flags;
2664
+#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
2665
+#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
2666
+#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2667
+
2668
+    /**
2669
+     * macroblock decision mode
2670
+     * - encoding: Set by user.
2671
+     * - decoding: unused
2672
+     */
2673
+    int mb_decision;
2674
+#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
2675
+#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
2676
+#define FF_MB_DECISION_RD     2        ///< rate distortion
2677
+
2678
+    /**
2679
+     * custom intra quantization matrix
2680
+     * - encoding: Set by user, can be NULL.
2681
+     * - decoding: Set by libavcodec.
2682
+     */
2683
+    uint16_t *intra_matrix;
2684
+
2685
+    /**
2686
+     * custom inter quantization matrix
2687
+     * - encoding: Set by user, can be NULL.
2688
+     * - decoding: Set by libavcodec.
2689
+     */
2690
+    uint16_t *inter_matrix;
2691
+
2692
+#if FF_API_PRIVATE_OPT
2693
+    /** @deprecated use encoder private options instead */
2694
+    attribute_deprecated
2695
+    int scenechange_threshold;
2696
+
2697
+    /** @deprecated use encoder private options instead */
2698
+    attribute_deprecated
2699
+    int noise_reduction;
2700
+#endif
2701
+
2702
+    /**
2703
+     * precision of the intra DC coefficient - 8
2704
+     * - encoding: Set by user.
2705
+     * - decoding: Set by libavcodec
2706
+     */
2707
+    int intra_dc_precision;
2708
+
2709
+    /**
2710
+     * Number of macroblock rows at the top which are skipped.
2711
+     * - encoding: unused
2712
+     * - decoding: Set by user.
2713
+     */
2714
+    int skip_top;
2715
+
2716
+    /**
2717
+     * Number of macroblock rows at the bottom which are skipped.
2718
+     * - encoding: unused
2719
+     * - decoding: Set by user.
2720
+     */
2721
+    int skip_bottom;
2722
+
2723
+    /**
2724
+     * minimum MB Lagrange multiplier
2725
+     * - encoding: Set by user.
2726
+     * - decoding: unused
2727
+     */
2728
+    int mb_lmin;
2729
+
2730
+    /**
2731
+     * maximum MB Lagrange multiplier
2732
+     * - encoding: Set by user.
2733
+     * - decoding: unused
2734
+     */
2735
+    int mb_lmax;
2736
+
2737
+#if FF_API_PRIVATE_OPT
2738
+    /**
2739
+     * @deprecated use encoder private options instead
2740
+     */
2741
+    attribute_deprecated
2742
+    int me_penalty_compensation;
2743
+#endif
2744
+
2745
+    /**
2746
+     * - encoding: Set by user.
2747
+     * - decoding: unused
2748
+     */
2749
+    int bidir_refine;
2750
+
2751
+#if FF_API_PRIVATE_OPT
2752
+    /** @deprecated use encoder private options instead */
2753
+    attribute_deprecated
2754
+    int brd_scale;
2755
+#endif
2756
+
2757
+    /**
2758
+     * minimum GOP size
2759
+     * - encoding: Set by user.
2760
+     * - decoding: unused
2761
+     */
2762
+    int keyint_min;
2763
+
2764
+    /**
2765
+     * number of reference frames
2766
+     * - encoding: Set by user.
2767
+     * - decoding: Set by lavc.
2768
+     */
2769
+    int refs;
2770
+
2771
+#if FF_API_PRIVATE_OPT
2772
+    /** @deprecated use encoder private options instead */
2773
+    attribute_deprecated
2774
+    int chromaoffset;
2775
+#endif
2776
+
2777
+    /**
2778
+     * Note: Value depends upon the compare function used for fullpel ME.
2779
+     * - encoding: Set by user.
2780
+     * - decoding: unused
2781
+     */
2782
+    int mv0_threshold;
2783
+
2784
+#if FF_API_PRIVATE_OPT
2785
+    /** @deprecated use encoder private options instead */
2786
+    attribute_deprecated
2787
+    int b_sensitivity;
2788
+#endif
2789
+
2790
+    /**
2791
+     * Chromaticity coordinates of the source primaries.
2792
+     * - encoding: Set by user
2793
+     * - decoding: Set by libavcodec
2794
+     */
2795
+    enum AVColorPrimaries color_primaries;
2796
+
2797
+    /**
2798
+     * Color Transfer Characteristic.
2799
+     * - encoding: Set by user
2800
+     * - decoding: Set by libavcodec
2801
+     */
2802
+    enum AVColorTransferCharacteristic color_trc;
2803
+
2804
+    /**
2805
+     * YUV colorspace type.
2806
+     * - encoding: Set by user
2807
+     * - decoding: Set by libavcodec
2808
+     */
2809
+    enum AVColorSpace colorspace;
2810
+
2811
+    /**
2812
+     * MPEG vs JPEG YUV range.
2813
+     * - encoding: Set by user
2814
+     * - decoding: Set by libavcodec
2815
+     */
2816
+    enum AVColorRange color_range;
2817
+
2818
+    /**
2819
+     * This defines the location of chroma samples.
2820
+     * - encoding: Set by user
2821
+     * - decoding: Set by libavcodec
2822
+     */
2823
+    enum AVChromaLocation chroma_sample_location;
2824
+
2825
+    /**
2826
+     * Number of slices.
2827
+     * Indicates number of picture subdivisions. Used for parallelized
2828
+     * decoding.
2829
+     * - encoding: Set by user
2830
+     * - decoding: unused
2831
+     */
2832
+    int slices;
2833
+
2834
+    /** Field order
2835
+     * - encoding: set by libavcodec
2836
+     * - decoding: Set by user.
2837
+     */
2838
+    enum AVFieldOrder field_order;
2839
+
2840
+    /* audio only */
2841
+    int sample_rate; ///< samples per second
2842
+    int channels;    ///< number of audio channels
2843
+
2844
+    /**
2845
+     * audio sample format
2846
+     * - encoding: Set by user.
2847
+     * - decoding: Set by libavcodec.
2848
+     */
2849
+    enum AVSampleFormat sample_fmt;  ///< sample format
2850
+
2851
+    /* The following data should not be initialized. */
2852
+    /**
2853
+     * Number of samples per channel in an audio frame.
2854
+     *
2855
+     * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2856
+     *   except the last must contain exactly frame_size samples per channel.
2857
+     *   May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2858
+     *   frame size is not restricted.
2859
+     * - decoding: may be set by some decoders to indicate constant frame size
2860
+     */
2861
+    int frame_size;
2862
+
2863
+    /**
2864
+     * Frame counter, set by libavcodec.
2865
+     *
2866
+     * - decoding: total number of frames returned from the decoder so far.
2867
+     * - encoding: total number of frames passed to the encoder so far.
2868
+     *
2869
+     *   @note the counter is not incremented if encoding/decoding resulted in
2870
+     *   an error.
2871
+     */
2872
+    int frame_number;
2873
+
2874
+    /**
2875
+     * number of bytes per packet if constant and known or 0
2876
+     * Used by some WAV based audio codecs.
2877
+     */
2878
+    int block_align;
2879
+
2880
+    /**
2881
+     * Audio cutoff bandwidth (0 means "automatic")
2882
+     * - encoding: Set by user.
2883
+     * - decoding: unused
2884
+     */
2885
+    int cutoff;
2886
+
2887
+    /**
2888
+     * Audio channel layout.
2889
+     * - encoding: set by user.
2890
+     * - decoding: set by user, may be overwritten by libavcodec.
2891
+     */
2892
+    uint64_t channel_layout;
2893
+
2894
+    /**
2895
+     * Request decoder to use this channel layout if it can (0 for default)
2896
+     * - encoding: unused
2897
+     * - decoding: Set by user.
2898
+     */
2899
+    uint64_t request_channel_layout;
2900
+
2901
+    /**
2902
+     * Type of service that the audio stream conveys.
2903
+     * - encoding: Set by user.
2904
+     * - decoding: Set by libavcodec.
2905
+     */
2906
+    enum AVAudioServiceType audio_service_type;
2907
+
2908
+    /**
2909
+     * desired sample format
2910
+     * - encoding: Not used.
2911
+     * - decoding: Set by user.
2912
+     * Decoder will decode to this format if it can.
2913
+     */
2914
+    enum AVSampleFormat request_sample_fmt;
2915
+
2916
+    /**
2917
+     * This callback is called at the beginning of each frame to get data
2918
+     * buffer(s) for it. There may be one contiguous buffer for all the data or
2919
+     * there may be a buffer per each data plane or anything in between. What
2920
+     * this means is, you may set however many entries in buf[] you feel necessary.
2921
+     * Each buffer must be reference-counted using the AVBuffer API (see description
2922
+     * of buf[] below).
2923
+     *
2924
+     * The following fields will be set in the frame before this callback is
2925
+     * called:
2926
+     * - format
2927
+     * - width, height (video only)
2928
+     * - sample_rate, channel_layout, nb_samples (audio only)
2929
+     * Their values may differ from the corresponding values in
2930
+     * AVCodecContext. This callback must use the frame values, not the codec
2931
+     * context values, to calculate the required buffer size.
2932
+     *
2933
+     * This callback must fill the following fields in the frame:
2934
+     * - data[]
2935
+     * - linesize[]
2936
+     * - extended_data:
2937
+     *   * if the data is planar audio with more than 8 channels, then this
2938
+     *     callback must allocate and fill extended_data to contain all pointers
2939
+     *     to all data planes. data[] must hold as many pointers as it can.
2940
+     *     extended_data must be allocated with av_malloc() and will be freed in
2941
+     *     av_frame_unref().
2942
+     *   * otherwise extended_data must point to data
2943
+     * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2944
+     *   the frame's data and extended_data pointers must be contained in these. That
2945
+     *   is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2946
+     *   AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2947
+     *   and av_buffer_ref().
2948
+     * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2949
+     *   this callback and filled with the extra buffers if there are more
2950
+     *   buffers than buf[] can hold. extended_buf will be freed in
2951
+     *   av_frame_unref().
2952
+     *
2953
+     * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
2954
+     * avcodec_default_get_buffer2() instead of providing buffers allocated by
2955
+     * some other means.
2956
+     *
2957
+     * Each data plane must be aligned to the maximum required by the target
2958
+     * CPU.
2959
+     *
2960
+     * @see avcodec_default_get_buffer2()
2961
+     *
2962
+     * Video:
2963
+     *
2964
+     * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2965
+     * (read and/or written to if it is writable) later by libavcodec.
2966
+     *
2967
+     * avcodec_align_dimensions2() should be used to find the required width and
2968
+     * height, as they normally need to be rounded up to the next multiple of 16.
2969
+     *
2970
+     * Some decoders do not support linesizes changing between frames.
2971
+     *
2972
+     * If frame multithreading is used and thread_safe_callbacks is set,
2973
+     * this callback may be called from a different thread, but not from more
2974
+     * than one at once. Does not need to be reentrant.
2975
+     *
2976
+     * @see avcodec_align_dimensions2()
2977
+     *
2978
+     * Audio:
2979
+     *
2980
+     * Decoders request a buffer of a particular size by setting
2981
+     * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
2982
+     * however, utilize only part of the buffer by setting AVFrame.nb_samples
2983
+     * to a smaller value in the output frame.
2984
+     *
2985
+     * As a convenience, av_samples_get_buffer_size() and
2986
+     * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
2987
+     * functions to find the required data size and to fill data pointers and
2988
+     * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2989
+     * since all planes must be the same size.
2990
+     *
2991
+     * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2992
+     *
2993
+     * - encoding: unused
2994
+     * - decoding: Set by libavcodec, user can override.
2995
+     */
2996
+    int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
2997
+
2998
+    /**
2999
+     * If non-zero, the decoded audio and video frames returned from
3000
+     * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
3001
+     * and are valid indefinitely. The caller must free them with
3002
+     * av_frame_unref() when they are not needed anymore.
3003
+     * Otherwise, the decoded frames must not be freed by the caller and are
3004
+     * only valid until the next decode call.
3005
+     *
3006
+     * This is always automatically enabled if avcodec_receive_frame() is used.
3007
+     *
3008
+     * - encoding: unused
3009
+     * - decoding: set by the caller before avcodec_open2().
3010
+     */
3011
+    attribute_deprecated
3012
+    int refcounted_frames;
3013
+
3014
+    /* - encoding parameters */
3015
+    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
3016
+    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
3017
+
3018
+    /**
3019
+     * minimum quantizer
3020
+     * - encoding: Set by user.
3021
+     * - decoding: unused
3022
+     */
3023
+    int qmin;
3024
+
3025
+    /**
3026
+     * maximum quantizer
3027
+     * - encoding: Set by user.
3028
+     * - decoding: unused
3029
+     */
3030
+    int qmax;
3031
+
3032
+    /**
3033
+     * maximum quantizer difference between frames
3034
+     * - encoding: Set by user.
3035
+     * - decoding: unused
3036
+     */
3037
+    int max_qdiff;
3038
+
3039
+    /**
3040
+     * decoder bitstream buffer size
3041
+     * - encoding: Set by user.
3042
+     * - decoding: unused
3043
+     */
3044
+    int rc_buffer_size;
3045
+
3046
+    /**
3047
+     * ratecontrol override, see RcOverride
3048
+     * - encoding: Allocated/set/freed by user.
3049
+     * - decoding: unused
3050
+     */
3051
+    int rc_override_count;
3052
+    RcOverride *rc_override;
3053
+
3054
+    /**
3055
+     * maximum bitrate
3056
+     * - encoding: Set by user.
3057
+     * - decoding: Set by user, may be overwritten by libavcodec.
3058
+     */
3059
+    int64_t rc_max_rate;
3060
+
3061
+    /**
3062
+     * minimum bitrate
3063
+     * - encoding: Set by user.
3064
+     * - decoding: unused
3065
+     */
3066
+    int64_t rc_min_rate;
3067
+
3068
+    /**
3069
+     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
3070
+     * - encoding: Set by user.
3071
+     * - decoding: unused.
3072
+     */
3073
+    float rc_max_available_vbv_use;
3074
+
3075
+    /**
3076
+     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
3077
+     * - encoding: Set by user.
3078
+     * - decoding: unused.
3079
+     */
3080
+    float rc_min_vbv_overflow_use;
3081
+
3082
+    /**
3083
+     * Number of bits which should be loaded into the rc buffer before decoding starts.
3084
+     * - encoding: Set by user.
3085
+     * - decoding: unused
3086
+     */
3087
+    int rc_initial_buffer_occupancy;
3088
+
3089
+#if FF_API_CODER_TYPE
3090
+#define FF_CODER_TYPE_VLC       0
3091
+#define FF_CODER_TYPE_AC        1
3092
+#define FF_CODER_TYPE_RAW       2
3093
+#define FF_CODER_TYPE_RLE       3
3094
+    /**
3095
+     * @deprecated use encoder private options instead
3096
+     */
3097
+    attribute_deprecated
3098
+    int coder_type;
3099
+#endif /* FF_API_CODER_TYPE */
3100
+
3101
+#if FF_API_PRIVATE_OPT
3102
+    /** @deprecated use encoder private options instead */
3103
+    attribute_deprecated
3104
+    int context_model;
3105
+#endif
3106
+
3107
+#if FF_API_PRIVATE_OPT
3108
+    /** @deprecated use encoder private options instead */
3109
+    attribute_deprecated
3110
+    int frame_skip_threshold;
3111
+
3112
+    /** @deprecated use encoder private options instead */
3113
+    attribute_deprecated
3114
+    int frame_skip_factor;
3115
+
3116
+    /** @deprecated use encoder private options instead */
3117
+    attribute_deprecated
3118
+    int frame_skip_exp;
3119
+
3120
+    /** @deprecated use encoder private options instead */
3121
+    attribute_deprecated
3122
+    int frame_skip_cmp;
3123
+#endif /* FF_API_PRIVATE_OPT */
3124
+
3125
+    /**
3126
+     * trellis RD quantization
3127
+     * - encoding: Set by user.
3128
+     * - decoding: unused
3129
+     */
3130
+    int trellis;
3131
+
3132
+#if FF_API_PRIVATE_OPT
3133
+    /** @deprecated use encoder private options instead */
3134
+    attribute_deprecated
3135
+    int min_prediction_order;
3136
+
3137
+    /** @deprecated use encoder private options instead */
3138
+    attribute_deprecated
3139
+    int max_prediction_order;
3140
+
3141
+    /** @deprecated use encoder private options instead */
3142
+    attribute_deprecated
3143
+    int64_t timecode_frame_start;
3144
+#endif
3145
+
3146
+#if FF_API_RTP_CALLBACK
3147
+    /**
3148
+     * @deprecated unused
3149
+     */
3150
+    /* The RTP callback: This function is called    */
3151
+    /* every time the encoder has a packet to send. */
3152
+    /* It depends on the encoder if the data starts */
3153
+    /* with a Start Code (it should). H.263 does.   */
3154
+    /* mb_nb contains the number of macroblocks     */
3155
+    /* encoded in the RTP payload.                  */
3156
+    attribute_deprecated
3157
+    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3158
+#endif
3159
+
3160
+#if FF_API_PRIVATE_OPT
3161
+    /** @deprecated use encoder private options instead */
3162
+    attribute_deprecated
3163
+    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
3164
+                            /* do its best to deliver a chunk with size     */
3165
+                            /* below rtp_payload_size, the chunk will start */
3166
+                            /* with a start code on some codecs like H.263. */
3167
+                            /* This doesn't take account of any particular  */
3168
+                            /* headers inside the transmitted RTP payload.  */
3169
+#endif
3170
+
3171
+#if FF_API_STAT_BITS
3172
+    /* statistics, used for 2-pass encoding */
3173
+    attribute_deprecated
3174
+    int mv_bits;
3175
+    attribute_deprecated
3176
+    int header_bits;
3177
+    attribute_deprecated
3178
+    int i_tex_bits;
3179
+    attribute_deprecated
3180
+    int p_tex_bits;
3181
+    attribute_deprecated
3182
+    int i_count;
3183
+    attribute_deprecated
3184
+    int p_count;
3185
+    attribute_deprecated
3186
+    int skip_count;
3187
+    attribute_deprecated
3188
+    int misc_bits;
3189
+
3190
+    /** @deprecated this field is unused */
3191
+    attribute_deprecated
3192
+    int frame_bits;
3193
+#endif
3194
+
3195
+    /**
3196
+     * pass1 encoding statistics output buffer
3197
+     * - encoding: Set by libavcodec.
3198
+     * - decoding: unused
3199
+     */
3200
+    char *stats_out;
3201
+
3202
+    /**
3203
+     * pass2 encoding statistics input buffer
3204
+     * Concatenated stuff from stats_out of pass1 should be placed here.
3205
+     * - encoding: Allocated/set/freed by user.
3206
+     * - decoding: unused
3207
+     */
3208
+    char *stats_in;
3209
+
3210
+    /**
3211
+     * Work around bugs in encoders which sometimes cannot be detected automatically.
3212
+     * - encoding: Set by user
3213
+     * - decoding: Set by user
3214
+     */
3215
+    int workaround_bugs;
3216
+#define FF_BUG_AUTODETECT       1  ///< autodetection
3217
+#define FF_BUG_XVID_ILACE       4
3218
+#define FF_BUG_UMP4             8
3219
+#define FF_BUG_NO_PADDING       16
3220
+#define FF_BUG_AMV              32
3221
+#define FF_BUG_QPEL_CHROMA      64
3222
+#define FF_BUG_STD_QPEL         128
3223
+#define FF_BUG_QPEL_CHROMA2     256
3224
+#define FF_BUG_DIRECT_BLOCKSIZE 512
3225
+#define FF_BUG_EDGE             1024
3226
+#define FF_BUG_HPEL_CHROMA      2048
3227
+#define FF_BUG_DC_CLIP          4096
3228
+#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
3229
+#define FF_BUG_TRUNCATED       16384
3230
+#define FF_BUG_IEDGE           32768
3231
+
3232
+    /**
3233
+     * strictly follow the standard (MPEG-4, ...).
3234
+     * - encoding: Set by user.
3235
+     * - decoding: Set by user.
3236
+     * Setting this to STRICT or higher means the encoder and decoder will
3237
+     * generally do stupid things, whereas setting it to unofficial or lower
3238
+     * will mean the encoder might produce output that is not supported by all
3239
+     * spec-compliant decoders. Decoders don't differentiate between normal,
3240
+     * unofficial and experimental (that is, they always try to decode things
3241
+     * when they can) unless they are explicitly asked to behave stupidly
3242
+     * (=strictly conform to the specs)
3243
+     */
3244
+    int strict_std_compliance;
3245
+#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
3246
+#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
3247
+#define FF_COMPLIANCE_NORMAL        0
3248
+#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
3249
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
3250
+
3251
+    /**
3252
+     * error concealment flags
3253
+     * - encoding: unused
3254
+     * - decoding: Set by user.
3255
+     */
3256
+    int error_concealment;
3257
+#define FF_EC_GUESS_MVS   1
3258
+#define FF_EC_DEBLOCK     2
3259
+#define FF_EC_FAVOR_INTER 256
3260
+
3261
+    /**
3262
+     * debug
3263
+     * - encoding: Set by user.
3264
+     * - decoding: Set by user.
3265
+     */
3266
+    int debug;
3267
+#define FF_DEBUG_PICT_INFO   1
3268
+#define FF_DEBUG_RC          2
3269
+#define FF_DEBUG_BITSTREAM   4
3270
+#define FF_DEBUG_MB_TYPE     8
3271
+#define FF_DEBUG_QP          16
3272
+#if FF_API_DEBUG_MV
3273
+/**
3274
+ * @deprecated this option does nothing
3275
+ */
3276
+#define FF_DEBUG_MV          32
3277
+#endif
3278
+#define FF_DEBUG_DCT_COEFF   0x00000040
3279
+#define FF_DEBUG_SKIP        0x00000080
3280
+#define FF_DEBUG_STARTCODE   0x00000100
3281
+#define FF_DEBUG_ER          0x00000400
3282
+#define FF_DEBUG_MMCO        0x00000800
3283
+#define FF_DEBUG_BUGS        0x00001000
3284
+#if FF_API_DEBUG_MV
3285
+#define FF_DEBUG_VIS_QP      0x00002000
3286
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
3287
+#endif
3288
+#define FF_DEBUG_BUFFERS     0x00008000
3289
+#define FF_DEBUG_THREADS     0x00010000
3290
+#define FF_DEBUG_GREEN_MD    0x00800000
3291
+#define FF_DEBUG_NOMC        0x01000000
3292
+
3293
+#if FF_API_DEBUG_MV
3294
+    /**
3295
+     * debug
3296
+     * - encoding: Set by user.
3297
+     * - decoding: Set by user.
3298
+     */
3299
+    int debug_mv;
3300
+#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 // visualize forward predicted MVs of P-frames
3301
+#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 // visualize forward predicted MVs of B-frames
3302
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
3303
+#endif
3304
+
3305
+    /**
3306
+     * Error recognition; may misdetect some more or less valid parts as errors.
3307
+     * - encoding: unused
3308
+     * - decoding: Set by user.
3309
+     */
3310
+    int err_recognition;
3311
+
3312
+/**
3313
+ * Verify checksums embedded in the bitstream (could be of either encoded or
3314
+ * decoded data, depending on the codec) and print an error message on mismatch.
3315
+ * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
3316
+ * decoder returning an error.
3317
+ */
3318
+#define AV_EF_CRCCHECK  (1<<0)
3319
+#define AV_EF_BITSTREAM (1<<1)          ///< detect bitstream specification deviations
3320
+#define AV_EF_BUFFER    (1<<2)          ///< detect improper bitstream length
3321
+#define AV_EF_EXPLODE   (1<<3)          ///< abort decoding on minor error detection
3322
+
3323
+#define AV_EF_IGNORE_ERR (1<<15)        ///< ignore errors and continue
3324
+#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
3325
+#define AV_EF_COMPLIANT  (1<<17)        ///< consider all spec non compliances as errors
3326
+#define AV_EF_AGGRESSIVE (1<<18)        ///< consider things that a sane encoder should not do as an error
3327
+
3328
+
3329
+    /**
3330
+     * opaque 64-bit number (generally a PTS) that will be reordered and
3331
+     * output in AVFrame.reordered_opaque
3332
+     * - encoding: unused
3333
+     * - decoding: Set by user.
3334
+     */
3335
+    int64_t reordered_opaque;
3336
+
3337
+    /**
3338
+     * Hardware accelerator in use
3339
+     * - encoding: unused.
3340
+     * - decoding: Set by libavcodec
3341
+     */
3342
+    const struct AVHWAccel *hwaccel;
3343
+
3344
+    /**
3345
+     * Hardware accelerator context.
3346
+     * For some hardware accelerators, a global context needs to be
3347
+     * provided by the user. In that case, this holds display-dependent
3348
+     * data FFmpeg cannot instantiate itself. Please refer to the
3349
+     * FFmpeg HW accelerator documentation to know how to fill this
3350
+     * is. e.g. for VA API, this is a struct vaapi_context.
3351
+     * - encoding: unused
3352
+     * - decoding: Set by user
3353
+     */
3354
+    void *hwaccel_context;
3355
+
3356
+    /**
3357
+     * error
3358
+     * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
3359
+     * - decoding: unused
3360
+     */
3361
+    uint64_t error[AV_NUM_DATA_POINTERS];
3362
+
3363
+    /**
3364
+     * DCT algorithm, see FF_DCT_* below
3365
+     * - encoding: Set by user.
3366
+     * - decoding: unused
3367
+     */
3368
+    int dct_algo;
3369
+#define FF_DCT_AUTO    0
3370
+#define FF_DCT_FASTINT 1
3371
+#define FF_DCT_INT     2
3372
+#define FF_DCT_MMX     3
3373
+#define FF_DCT_ALTIVEC 5
3374
+#define FF_DCT_FAAN    6
3375
+
3376
+    /**
3377
+     * IDCT algorithm, see FF_IDCT_* below.
3378
+     * - encoding: Set by user.
3379
+     * - decoding: Set by user.
3380
+     */
3381
+    int idct_algo;
3382
+#define FF_IDCT_AUTO          0
3383
+#define FF_IDCT_INT           1
3384
+#define FF_IDCT_SIMPLE        2
3385
+#define FF_IDCT_SIMPLEMMX     3
3386
+#define FF_IDCT_ARM           7
3387
+#define FF_IDCT_ALTIVEC       8
3388
+#define FF_IDCT_SIMPLEARM     10
3389
+#define FF_IDCT_XVID          14
3390
+#define FF_IDCT_SIMPLEARMV5TE 16
3391
+#define FF_IDCT_SIMPLEARMV6   17
3392
+#define FF_IDCT_FAAN          20
3393
+#define FF_IDCT_SIMPLENEON    22
3394
+#define FF_IDCT_NONE          24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
3395
+#define FF_IDCT_SIMPLEAUTO    128
3396
+
3397
+    /**
3398
+     * bits per sample/pixel from the demuxer (needed for huffyuv).
3399
+     * - encoding: Set by libavcodec.
3400
+     * - decoding: Set by user.
3401
+     */
3402
+     int bits_per_coded_sample;
3403
+
3404
+    /**
3405
+     * Bits per sample/pixel of internal libavcodec pixel/sample format.
3406
+     * - encoding: set by user.
3407
+     * - decoding: set by libavcodec.
3408
+     */
3409
+    int bits_per_raw_sample;
3410
+
3411
+#if FF_API_LOWRES
3412
+    /**
3413
+     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3414
+     * - encoding: unused
3415
+     * - decoding: Set by user.
3416
+     */
3417
+     int lowres;
3418
+#endif
3419
+
3420
+#if FF_API_CODED_FRAME
3421
+    /**
3422
+     * the picture in the bitstream
3423
+     * - encoding: Set by libavcodec.
3424
+     * - decoding: unused
3425
+     *
3426
+     * @deprecated use the quality factor packet side data instead
3427
+     */
3428
+    attribute_deprecated AVFrame *coded_frame;
3429
+#endif
3430
+
3431
+    /**
3432
+     * thread count
3433
+     * is used to decide how many independent tasks should be passed to execute()
3434
+     * - encoding: Set by user.
3435
+     * - decoding: Set by user.
3436
+     */
3437
+    int thread_count;
3438
+
3439
+    /**
3440
+     * Which multithreading methods to use.
3441
+     * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
3442
+     * so clients which cannot provide future frames should not use it.
3443
+     *
3444
+     * - encoding: Set by user, otherwise the default is used.
3445
+     * - decoding: Set by user, otherwise the default is used.
3446
+     */
3447
+    int thread_type;
3448
+#define FF_THREAD_FRAME   1 ///< Decode more than one frame at once
3449
+#define FF_THREAD_SLICE   2 ///< Decode more than one part of a single frame at once
3450
+
3451
+    /**
3452
+     * Which multithreading methods are in use by the codec.
3453
+     * - encoding: Set by libavcodec.
3454
+     * - decoding: Set by libavcodec.
3455
+     */
3456
+    int active_thread_type;
3457
+
3458
+    /**
3459
+     * Set by the client if its custom get_buffer() callback can be called
3460
+     * synchronously from another thread, which allows faster multithreaded decoding.
3461
+     * draw_horiz_band() will be called from other threads regardless of this setting.
3462
+     * Ignored if the default get_buffer() is used.
3463
+     * - encoding: Set by user.
3464
+     * - decoding: Set by user.
3465
+     */
3466
+    int thread_safe_callbacks;
3467
+
3468
+    /**
3469
+     * The codec may call this to execute several independent things.
3470
+     * It will return only after finishing all tasks.
3471
+     * The user may replace this with some multithreaded implementation,
3472
+     * the default implementation will execute the parts serially.
3473
+     * @param count the number of things to execute
3474
+     * - encoding: Set by libavcodec, user can override.
3475
+     * - decoding: Set by libavcodec, user can override.
3476
+     */
3477
+    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3478
+
3479
+    /**
3480
+     * The codec may call this to execute several independent things.
3481
+     * It will return only after finishing all tasks.
3482
+     * The user may replace this with some multithreaded implementation,
3483
+     * the default implementation will execute the parts serially.
3484
+     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
3485
+     * @param c context passed also to func
3486
+     * @param count the number of things to execute
3487
+     * @param arg2 argument passed unchanged to func
3488
+     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
3489
+     * @param func function that will be called count times, with jobnr from 0 to count-1.
3490
+     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
3491
+     *             two instances of func executing at the same time will have the same threadnr.
3492
+     * @return always 0 currently, but code should handle a future improvement where when any call to func
3493
+     *         returns < 0 no further calls to func may be done and < 0 is returned.
3494
+     * - encoding: Set by libavcodec, user can override.
3495
+     * - decoding: Set by libavcodec, user can override.
3496
+     */
3497
+    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3498
+
3499
+    /**
3500
+     * noise vs. sse weight for the nsse comparison function
3501
+     * - encoding: Set by user.
3502
+     * - decoding: unused
3503
+     */
3504
+     int nsse_weight;
3505
+
3506
+    /**
3507
+     * profile
3508
+     * - encoding: Set by user.
3509
+     * - decoding: Set by libavcodec.
3510
+     */
3511
+     int profile;
3512
+#define FF_PROFILE_UNKNOWN -99
3513
+#define FF_PROFILE_RESERVED -100
3514
+
3515
+#define FF_PROFILE_AAC_MAIN 0
3516
+#define FF_PROFILE_AAC_LOW  1
3517
+#define FF_PROFILE_AAC_SSR  2
3518
+#define FF_PROFILE_AAC_LTP  3
3519
+#define FF_PROFILE_AAC_HE   4
3520
+#define FF_PROFILE_AAC_HE_V2 28
3521
+#define FF_PROFILE_AAC_LD   22
3522
+#define FF_PROFILE_AAC_ELD  38
3523
+#define FF_PROFILE_MPEG2_AAC_LOW 128
3524
+#define FF_PROFILE_MPEG2_AAC_HE  131
3525
+
3526
+#define FF_PROFILE_DNXHD         0
3527
+#define FF_PROFILE_DNXHR_LB      1
3528
+#define FF_PROFILE_DNXHR_SQ      2
3529
+#define FF_PROFILE_DNXHR_HQ      3
3530
+#define FF_PROFILE_DNXHR_HQX     4
3531
+#define FF_PROFILE_DNXHR_444     5
3532
+
3533
+#define FF_PROFILE_DTS         20
3534
+#define FF_PROFILE_DTS_ES      30
3535
+#define FF_PROFILE_DTS_96_24   40
3536
+#define FF_PROFILE_DTS_HD_HRA  50
3537
+#define FF_PROFILE_DTS_HD_MA   60
3538
+#define FF_PROFILE_DTS_EXPRESS 70
3539
+
3540
+#define FF_PROFILE_MPEG2_422    0
3541
+#define FF_PROFILE_MPEG2_HIGH   1
3542
+#define FF_PROFILE_MPEG2_SS     2
3543
+#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
3544
+#define FF_PROFILE_MPEG2_MAIN   4
3545
+#define FF_PROFILE_MPEG2_SIMPLE 5
3546
+
3547
+#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
3548
+#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
3549
+
3550
+#define FF_PROFILE_H264_BASELINE             66
3551
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3552
+#define FF_PROFILE_H264_MAIN                 77
3553
+#define FF_PROFILE_H264_EXTENDED             88
3554
+#define FF_PROFILE_H264_HIGH                 100
3555
+#define FF_PROFILE_H264_HIGH_10              110
3556
+#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
3557
+#define FF_PROFILE_H264_MULTIVIEW_HIGH       118
3558
+#define FF_PROFILE_H264_HIGH_422             122
3559
+#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
3560
+#define FF_PROFILE_H264_STEREO_HIGH          128
3561
+#define FF_PROFILE_H264_HIGH_444             144
3562
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
3563
+#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
3564
+#define FF_PROFILE_H264_CAVLC_444            44
3565
+
3566
+#define FF_PROFILE_VC1_SIMPLE   0
3567
+#define FF_PROFILE_VC1_MAIN     1
3568
+#define FF_PROFILE_VC1_COMPLEX  2
3569
+#define FF_PROFILE_VC1_ADVANCED 3
3570
+
3571
+#define FF_PROFILE_MPEG4_SIMPLE                     0
3572
+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
3573
+#define FF_PROFILE_MPEG4_CORE                       2
3574
+#define FF_PROFILE_MPEG4_MAIN                       3
3575
+#define FF_PROFILE_MPEG4_N_BIT                      4
3576
+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
3577
+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
3578
+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
3579
+#define FF_PROFILE_MPEG4_HYBRID                     8
3580
+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
3581
+#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
3582
+#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
3583
+#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
3584
+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3585
+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
3586
+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
3587
+
3588
+#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0   1
3589
+#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1   2
3590
+#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION  32768
3591
+#define FF_PROFILE_JPEG2000_DCINEMA_2K              3
3592
+#define FF_PROFILE_JPEG2000_DCINEMA_4K              4
3593
+
3594
+#define FF_PROFILE_VP9_0                            0
3595
+#define FF_PROFILE_VP9_1                            1
3596
+#define FF_PROFILE_VP9_2                            2
3597
+#define FF_PROFILE_VP9_3                            3
3598
+
3599
+#define FF_PROFILE_HEVC_MAIN                        1
3600
+#define FF_PROFILE_HEVC_MAIN_10                     2
3601
+#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
3602
+#define FF_PROFILE_HEVC_REXT                        4
3603
+
3604
+#define FF_PROFILE_AV1_MAIN                         0
3605
+#define FF_PROFILE_AV1_HIGH                         1
3606
+#define FF_PROFILE_AV1_PROFESSIONAL                 2
3607
+
3608
+#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT            0xc0
3609
+#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
3610
+#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT         0xc2
3611
+#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS                0xc3
3612
+#define FF_PROFILE_MJPEG_JPEG_LS                         0xf7
3613
+
3614
+#define FF_PROFILE_SBC_MSBC                         1
3615
+
3616
+    /**
3617
+     * level
3618
+     * - encoding: Set by user.
3619
+     * - decoding: Set by libavcodec.
3620
+     */
3621
+     int level;
3622
+#define FF_LEVEL_UNKNOWN -99
3623
+
3624
+    /**
3625
+     * Skip loop filtering for selected frames.
3626
+     * - encoding: unused
3627
+     * - decoding: Set by user.
3628
+     */
3629
+    enum AVDiscard skip_loop_filter;
3630
+
3631
+    /**
3632
+     * Skip IDCT/dequantization for selected frames.
3633
+     * - encoding: unused
3634
+     * - decoding: Set by user.
3635
+     */
3636
+    enum AVDiscard skip_idct;
3637
+
3638
+    /**
3639
+     * Skip decoding for selected frames.
3640
+     * - encoding: unused
3641
+     * - decoding: Set by user.
3642
+     */
3643
+    enum AVDiscard skip_frame;
3644
+
3645
+    /**
3646
+     * Header containing style information for text subtitles.
3647
+     * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3648
+     * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3649
+     * the Format line following. It shouldn't include any Dialogue line.
3650
+     * - encoding: Set/allocated/freed by user (before avcodec_open2())
3651
+     * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3652
+     */
3653
+    uint8_t *subtitle_header;
3654
+    int subtitle_header_size;
3655
+
3656
+#if FF_API_VBV_DELAY
3657
+    /**
3658
+     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3659
+     * Used for compliant TS muxing.
3660
+     * - encoding: Set by libavcodec.
3661
+     * - decoding: unused.
3662
+     * @deprecated this value is now exported as a part of
3663
+     * AV_PKT_DATA_CPB_PROPERTIES packet side data
3664
+     */
3665
+    attribute_deprecated
3666
+    uint64_t vbv_delay;
3667
+#endif
3668
+
3669
+#if FF_API_SIDEDATA_ONLY_PKT
3670
+    /**
3671
+     * Encoding only and set by default. Allow encoders to output packets
3672
+     * that do not contain any encoded data, only side data.
3673
+     *
3674
+     * Some encoders need to output such packets, e.g. to update some stream
3675
+     * parameters at the end of encoding.
3676
+     *
3677
+     * @deprecated this field disables the default behaviour and
3678
+     *             it is kept only for compatibility.
3679
+     */
3680
+    attribute_deprecated
3681
+    int side_data_only_packets;
3682
+#endif
3683
+
3684
+    /**
3685
+     * Audio only. The number of "priming" samples (padding) inserted by the
3686
+     * encoder at the beginning of the audio. I.e. this number of leading
3687
+     * decoded samples must be discarded by the caller to get the original audio
3688
+     * without leading padding.
3689
+     *
3690
+     * - decoding: unused
3691
+     * - encoding: Set by libavcodec. The timestamps on the output packets are
3692
+     *             adjusted by the encoder so that they always refer to the
3693
+     *             first sample of the data actually contained in the packet,
3694
+     *             including any added padding.  E.g. if the timebase is
3695
+     *             1/samplerate and the timestamp of the first input sample is
3696
+     *             0, the timestamp of the first output packet will be
3697
+     *             -initial_padding.
3698
+     */
3699
+    int initial_padding;
3700
+
3701
+    /**
3702
+     * - decoding: For codecs that store a framerate value in the compressed
3703
+     *             bitstream, the decoder may export it here. { 0, 1} when
3704
+     *             unknown.
3705
+     * - encoding: May be used to signal the framerate of CFR content to an
3706
+     *             encoder.
3707
+     */
3708
+    AVRational framerate;
3709
+
3710
+    /**
3711
+     * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3712
+     * - encoding: unused.
3713
+     * - decoding: Set by libavcodec before calling get_format()
3714
+     */
3715
+    enum AVPixelFormat sw_pix_fmt;
3716
+
3717
+    /**
3718
+     * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3719
+     * - encoding unused.
3720
+     * - decoding set by user.
3721
+     */
3722
+    AVRational pkt_timebase;
3723
+
3724
+    /**
3725
+     * AVCodecDescriptor
3726
+     * - encoding: unused.
3727
+     * - decoding: set by libavcodec.
3728
+     */
3729
+    const AVCodecDescriptor *codec_descriptor;
3730
+
3731
+#if !FF_API_LOWRES
3732
+    /**
3733
+     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3734
+     * - encoding: unused
3735
+     * - decoding: Set by user.
3736
+     */
3737
+     int lowres;
3738
+#endif
3739
+
3740
+    /**
3741
+     * Current statistics for PTS correction.
3742
+     * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3743
+     * - encoding: unused
3744
+     */
3745
+    int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3746
+    int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3747
+    int64_t pts_correction_last_pts;       /// PTS of the last frame
3748
+    int64_t pts_correction_last_dts;       /// DTS of the last frame
3749
+
3750
+    /**
3751
+     * Character encoding of the input subtitles file.
3752
+     * - decoding: set by user
3753
+     * - encoding: unused
3754
+     */
3755
+    char *sub_charenc;
3756
+
3757
+    /**
3758
+     * Subtitles character encoding mode. Formats or codecs might be adjusting
3759
+     * this setting (if they are doing the conversion themselves for instance).
3760
+     * - decoding: set by libavcodec
3761
+     * - encoding: unused
3762
+     */
3763
+    int sub_charenc_mode;
3764
+#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)
3765
+#define FF_SUB_CHARENC_MODE_AUTOMATIC    0  ///< libavcodec will select the mode itself
3766
+#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
3767
+#define FF_SUB_CHARENC_MODE_IGNORE       2  ///< neither convert the subtitles, nor check them for valid UTF-8
3768
+
3769
+    /**
3770
+     * Skip processing alpha if supported by codec.
3771
+     * Note that if the format uses pre-multiplied alpha (common with VP6,
3772
+     * and recommended due to better video quality/compression)
3773
+     * the image will look as if alpha-blended onto a black background.
3774
+     * However for formats that do not use pre-multiplied alpha
3775
+     * there might be serious artefacts (though e.g. libswscale currently
3776
+     * assumes pre-multiplied alpha anyway).
3777
+     *
3778
+     * - decoding: set by user
3779
+     * - encoding: unused
3780
+     */
3781
+    int skip_alpha;
3782
+
3783
+    /**
3784
+     * Number of samples to skip after a discontinuity
3785
+     * - decoding: unused
3786
+     * - encoding: set by libavcodec
3787
+     */
3788
+    int seek_preroll;
3789
+
3790
+#if !FF_API_DEBUG_MV
3791
+    /**
3792
+     * debug motion vectors
3793
+     * - encoding: Set by user.
3794
+     * - decoding: Set by user.
3795
+     */
3796
+    int debug_mv;
3797
+#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
3798
+#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
3799
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3800
+#endif
3801
+
3802
+    /**
3803
+     * custom intra quantization matrix
3804
+     * - encoding: Set by user, can be NULL.
3805
+     * - decoding: unused.
3806
+     */
3807
+    uint16_t *chroma_intra_matrix;
3808
+
3809
+    /**
3810
+     * dump format separator.
3811
+     * can be ", " or "\n      " or anything else
3812
+     * - encoding: Set by user.
3813
+     * - decoding: Set by user.
3814
+     */
3815
+    uint8_t *dump_separator;
3816
+
3817
+    /**
3818
+     * ',' separated list of allowed decoders.
3819
+     * If NULL then all are allowed
3820
+     * - encoding: unused
3821
+     * - decoding: set by user
3822
+     */
3823
+    char *codec_whitelist;
3824
+
3825
+    /**
3826
+     * Properties of the stream that gets decoded
3827
+     * - encoding: unused
3828
+     * - decoding: set by libavcodec
3829
+     */
3830
+    unsigned properties;
3831
+#define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
3832
+#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3833
+
3834
+    /**
3835
+     * Additional data associated with the entire coded stream.
3836
+     *
3837
+     * - decoding: unused
3838
+     * - encoding: may be set by libavcodec after avcodec_open2().
3839
+     */
3840
+    AVPacketSideData *coded_side_data;
3841
+    int            nb_coded_side_data;
3842
+
3843
+    /**
3844
+     * A reference to the AVHWFramesContext describing the input (for encoding)
3845
+     * or output (decoding) frames. The reference is set by the caller and
3846
+     * afterwards owned (and freed) by libavcodec - it should never be read by
3847
+     * the caller after being set.
3848
+     *
3849
+     * - decoding: This field should be set by the caller from the get_format()
3850
+     *             callback. The previous reference (if any) will always be
3851
+     *             unreffed by libavcodec before the get_format() call.
3852
+     *
3853
+     *             If the default get_buffer2() is used with a hwaccel pixel
3854
+     *             format, then this AVHWFramesContext will be used for
3855
+     *             allocating the frame buffers.
3856
+     *
3857
+     * - encoding: For hardware encoders configured to use a hwaccel pixel
3858
+     *             format, this field should be set by the caller to a reference
3859
+     *             to the AVHWFramesContext describing input frames.
3860
+     *             AVHWFramesContext.format must be equal to
3861
+     *             AVCodecContext.pix_fmt.
3862
+     *
3863
+     *             This field should be set before avcodec_open2() is called.
3864
+     */
3865
+    AVBufferRef *hw_frames_ctx;
3866
+
3867
+    /**
3868
+     * Control the form of AVSubtitle.rects[N]->ass
3869
+     * - decoding: set by user
3870
+     * - encoding: unused
3871
+     */
3872
+    int sub_text_format;
3873
+#define FF_SUB_TEXT_FMT_ASS              0
3874
+#if FF_API_ASS_TIMING
3875
+#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3876
+#endif
3877
+
3878
+    /**
3879
+     * Audio only. The amount of padding (in samples) appended by the encoder to
3880
+     * the end of the audio. I.e. this number of decoded samples must be
3881
+     * discarded by the caller from the end of the stream to get the original
3882
+     * audio without any trailing padding.
3883
+     *
3884
+     * - decoding: unused
3885
+     * - encoding: unused
3886
+     */
3887
+    int trailing_padding;
3888
+
3889
+    /**
3890
+     * The number of pixels per image to maximally accept.
3891
+     *
3892
+     * - decoding: set by user
3893
+     * - encoding: set by user
3894
+     */
3895
+    int64_t max_pixels;
3896
+
3897
+    /**
3898
+     * A reference to the AVHWDeviceContext describing the device which will
3899
+     * be used by a hardware encoder/decoder.  The reference is set by the
3900
+     * caller and afterwards owned (and freed) by libavcodec.
3901
+     *
3902
+     * This should be used if either the codec device does not require
3903
+     * hardware frames or any that are used are to be allocated internally by
3904
+     * libavcodec.  If the user wishes to supply any of the frames used as
3905
+     * encoder input or decoder output then hw_frames_ctx should be used
3906
+     * instead.  When hw_frames_ctx is set in get_format() for a decoder, this
3907
+     * field will be ignored while decoding the associated stream segment, but
3908
+     * may again be used on a following one after another get_format() call.
3909
+     *
3910
+     * For both encoders and decoders this field should be set before
3911
+     * avcodec_open2() is called and must not be written to thereafter.
3912
+     *
3913
+     * Note that some decoders may require this field to be set initially in
3914
+     * order to support hw_frames_ctx at all - in that case, all frames
3915
+     * contexts used must be created on the same device.
3916
+     */
3917
+    AVBufferRef *hw_device_ctx;
3918
+
3919
+    /**
3920
+     * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
3921
+     * decoding (if active).
3922
+     * - encoding: unused
3923
+     * - decoding: Set by user (either before avcodec_open2(), or in the
3924
+     *             AVCodecContext.get_format callback)
3925
+     */
3926
+    int hwaccel_flags;
3927
+
3928
+    /**
3929
+     * Video decoding only. Certain video codecs support cropping, meaning that
3930
+     * only a sub-rectangle of the decoded frame is intended for display.  This
3931
+     * option controls how cropping is handled by libavcodec.
3932
+     *
3933
+     * When set to 1 (the default), libavcodec will apply cropping internally.
3934
+     * I.e. it will modify the output frame width/height fields and offset the
3935
+     * data pointers (only by as much as possible while preserving alignment, or
3936
+     * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3937
+     * the frames output by the decoder refer only to the cropped area. The
3938
+     * crop_* fields of the output frames will be zero.
3939
+     *
3940
+     * When set to 0, the width/height fields of the output frames will be set
3941
+     * to the coded dimensions and the crop_* fields will describe the cropping
3942
+     * rectangle. Applying the cropping is left to the caller.
3943
+     *
3944
+     * @warning When hardware acceleration with opaque output frames is used,
3945
+     * libavcodec is unable to apply cropping from the top/left border.
3946
+     *
3947
+     * @note when this option is set to zero, the width/height fields of the
3948
+     * AVCodecContext and output AVFrames have different meanings. The codec
3949
+     * context fields store display dimensions (with the coded dimensions in
3950
+     * coded_width/height), while the frame fields store the coded dimensions
3951
+     * (with the display dimensions being determined by the crop_* fields).
3952
+     */
3953
+    int apply_cropping;
3954
+
3955
+    /*
3956
+     * Video decoding only.  Sets the number of extra hardware frames which
3957
+     * the decoder will allocate for use by the caller.  This must be set
3958
+     * before avcodec_open2() is called.
3959
+     *
3960
+     * Some hardware decoders require all frames that they will use for
3961
+     * output to be defined in advance before decoding starts.  For such
3962
+     * decoders, the hardware frame pool must therefore be of a fixed size.
3963
+     * The extra frames set here are on top of any number that the decoder
3964
+     * needs internally in order to operate normally (for example, frames
3965
+     * used as reference pictures).
3966
+     */
3967
+    int extra_hw_frames;
3968
+} AVCodecContext;
3969
+
3970
+#if FF_API_CODEC_GET_SET
3971
+/**
3972
+ * Accessors for some AVCodecContext fields. These used to be provided for ABI
3973
+ * compatibility, and do not need to be used anymore.
3974
+ */
3975
+attribute_deprecated
3976
+AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
3977
+attribute_deprecated
3978
+void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
3979
+
3980
+attribute_deprecated
3981
+const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
3982
+attribute_deprecated
3983
+void                     av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
3984
+
3985
+attribute_deprecated
3986
+unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
3987
+
3988
+#if FF_API_LOWRES
3989
+attribute_deprecated
3990
+int  av_codec_get_lowres(const AVCodecContext *avctx);
3991
+attribute_deprecated
3992
+void av_codec_set_lowres(AVCodecContext *avctx, int val);
3993
+#endif
3994
+
3995
+attribute_deprecated
3996
+int  av_codec_get_seek_preroll(const AVCodecContext *avctx);
3997
+attribute_deprecated
3998
+void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
3999
+
4000
+attribute_deprecated
4001
+uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
4002
+attribute_deprecated
4003
+void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
4004
+#endif
4005
+
4006
+/**
4007
+ * AVProfile.
4008
+ */
4009
+typedef struct AVProfile {
4010
+    int profile;
4011
+    const char *name; ///< short name for the profile
4012
+} AVProfile;
4013
+
4014
+enum {
4015
+    /**
4016
+     * The codec supports this format via the hw_device_ctx interface.
4017
+     *
4018
+     * When selecting this format, AVCodecContext.hw_device_ctx should
4019
+     * have been set to a device of the specified type before calling
4020
+     * avcodec_open2().
4021
+     */
4022
+    AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
4023
+    /**
4024
+     * The codec supports this format via the hw_frames_ctx interface.
4025
+     *
4026
+     * When selecting this format for a decoder,
4027
+     * AVCodecContext.hw_frames_ctx should be set to a suitable frames
4028
+     * context inside the get_format() callback.  The frames context
4029
+     * must have been created on a device of the specified type.
4030
+     */
4031
+    AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
4032
+    /**
4033
+     * The codec supports this format by some internal method.
4034
+     *
4035
+     * This format can be selected without any additional configuration -
4036
+     * no device or frames context is required.
4037
+     */
4038
+    AV_CODEC_HW_CONFIG_METHOD_INTERNAL      = 0x04,
4039
+    /**
4040
+     * The codec supports this format by some ad-hoc method.
4041
+     *
4042
+     * Additional settings and/or function calls are required.  See the
4043
+     * codec-specific documentation for details.  (Methods requiring
4044
+     * this sort of configuration are deprecated and others should be
4045
+     * used in preference.)
4046
+     */
4047
+    AV_CODEC_HW_CONFIG_METHOD_AD_HOC        = 0x08,
4048
+};
4049
+
4050
+typedef struct AVCodecHWConfig {
4051
+    /**
4052
+     * A hardware pixel format which the codec can use.
4053
+     */
4054
+    enum AVPixelFormat pix_fmt;
4055
+    /**
4056
+     * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
4057
+     * setup methods which can be used with this configuration.
4058
+     */
4059
+    int methods;
4060
+    /**
4061
+     * The device type associated with the configuration.
4062
+     *
4063
+     * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
4064
+     * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
4065
+     */
4066
+    enum AVHWDeviceType device_type;
4067
+} AVCodecHWConfig;
4068
+
4069
+typedef struct AVCodecDefault AVCodecDefault;
4070
+
4071
+struct AVSubtitle;
4072
+
4073
+/**
4074
+ * AVCodec.
4075
+ */
4076
+typedef struct AVCodec {
4077
+    /**
4078
+     * Name of the codec implementation.
4079
+     * The name is globally unique among encoders and among decoders (but an
4080
+     * encoder and a decoder can share the same name).
4081
+     * This is the primary way to find a codec from the user perspective.
4082
+     */
4083
+    const char *name;
4084
+    /**
4085
+     * Descriptive name for the codec, meant to be more human readable than name.
4086
+     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
4087
+     */
4088
+    const char *long_name;
4089
+    enum AVMediaType type;
4090
+    enum AVCodecID id;
4091
+    /**
4092
+     * Codec capabilities.
4093
+     * see AV_CODEC_CAP_*
4094
+     */
4095
+    int capabilities;
4096
+    const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
4097
+    const enum AVPixelFormat *pix_fmts;     ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
4098
+    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
4099
+    const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
4100
+    const uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
4101
+    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
4102
+    const AVClass *priv_class;              ///< AVClass for the private context
4103
+    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
4104
+
4105
+    /**
4106
+     * Group name of the codec implementation.
4107
+     * This is a short symbolic name of the wrapper backing this codec. A
4108
+     * wrapper uses some kind of external implementation for the codec, such
4109
+     * as an external library, or a codec implementation provided by the OS or
4110
+     * the hardware.
4111
+     * If this field is NULL, this is a builtin, libavcodec native codec.
4112
+     * If non-NULL, this will be the suffix in AVCodec.name in most cases
4113
+     * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
4114
+     */
4115
+    const char *wrapper_name;
4116
+
4117
+    /*****************************************************************
4118
+     * No fields below this line are part of the public API. They
4119
+     * may not be used outside of libavcodec and can be changed and
4120
+     * removed at will.
4121
+     * New public fields should be added right above.
4122
+     *****************************************************************
4123
+     */
4124
+    int priv_data_size;
4125
+    struct AVCodec *next;
4126
+    /**
4127
+     * @name Frame-level threading support functions
4128
+     * @{
4129
+     */
4130
+    /**
4131
+     * If defined, called on thread contexts when they are created.
4132
+     * If the codec allocates writable tables in init(), re-allocate them here.
4133
+     * priv_data will be set to a copy of the original.
4134
+     */
4135
+    int (*init_thread_copy)(AVCodecContext *);
4136
+    /**
4137
+     * Copy necessary context variables from a previous thread context to the current one.
4138
+     * If not defined, the next thread will start automatically; otherwise, the codec
4139
+     * must call ff_thread_finish_setup().
4140
+     *
4141
+     * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
4142
+     */
4143
+    int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
4144
+    /** @} */
4145
+
4146
+    /**
4147
+     * Private codec-specific defaults.
4148
+     */
4149
+    const AVCodecDefault *defaults;
4150
+
4151
+    /**
4152
+     * Initialize codec static data, called from avcodec_register().
4153
+     *
4154
+     * This is not intended for time consuming operations as it is
4155
+     * run for every codec regardless of that codec being used.
4156
+     */
4157
+    void (*init_static_data)(struct AVCodec *codec);
4158
+
4159
+    int (*init)(AVCodecContext *);
4160
+    int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
4161
+                      const struct AVSubtitle *sub);
4162
+    /**
4163
+     * Encode data to an AVPacket.
4164
+     *
4165
+     * @param      avctx          codec context
4166
+     * @param      avpkt          output AVPacket (may contain a user-provided buffer)
4167
+     * @param[in]  frame          AVFrame containing the raw data to be encoded
4168
+     * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
4169
+     *                            non-empty packet was returned in avpkt.
4170
+     * @return 0 on success, negative error code on failure
4171
+     */
4172
+    int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
4173
+                   int *got_packet_ptr);
4174
+    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
4175
+    int (*close)(AVCodecContext *);
4176
+    /**
4177
+     * Encode API with decoupled packet/frame dataflow. The API is the
4178
+     * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
4179
+     * that:
4180
+     * - never called if the codec is closed or the wrong type,
4181
+     * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
4182
+     * - only one drain frame is ever passed down,
4183
+     */
4184
+    int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
4185
+    int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
4186
+
4187
+    /**
4188
+     * Decode API with decoupled packet/frame dataflow. This function is called
4189
+     * to get one output frame. It should call ff_decode_get_packet() to obtain
4190
+     * input data.
4191
+     */
4192
+    int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
4193
+    /**
4194
+     * Flush buffers.
4195
+     * Will be called when seeking
4196
+     */
4197
+    void (*flush)(AVCodecContext *);
4198
+    /**
4199
+     * Internal codec capabilities.
4200
+     * See FF_CODEC_CAP_* in internal.h
4201
+     */
4202
+    int caps_internal;
4203
+
4204
+    /**
4205
+     * Decoding only, a comma-separated list of bitstream filters to apply to
4206
+     * packets before decoding.
4207
+     */
4208
+    const char *bsfs;
4209
+
4210
+    /**
4211
+     * Array of pointers to hardware configurations supported by the codec,
4212
+     * or NULL if no hardware supported.  The array is terminated by a NULL
4213
+     * pointer.
4214
+     *
4215
+     * The user can only access this field via avcodec_get_hw_config().
4216
+     */
4217
+    const struct AVCodecHWConfigInternal **hw_configs;
4218
+} AVCodec;
4219
+
4220
+#if FF_API_CODEC_GET_SET
4221
+attribute_deprecated
4222
+int av_codec_get_max_lowres(const AVCodec *codec);
4223
+#endif
4224
+
4225
+struct MpegEncContext;
4226
+
4227
+/**
4228
+ * Retrieve supported hardware configurations for a codec.
4229
+ *
4230
+ * Values of index from zero to some maximum return the indexed configuration
4231
+ * descriptor; all other values return NULL.  If the codec does not support
4232
+ * any hardware configurations then it will always return NULL.
4233
+ */
4234
+const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
4235
+
4236
+/**
4237
+ * @defgroup lavc_hwaccel AVHWAccel
4238
+ *
4239
+ * @note  Nothing in this structure should be accessed by the user.  At some
4240
+ *        point in future it will not be externally visible at all.
4241
+ *
4242
+ * @{
4243
+ */
4244
+typedef struct AVHWAccel {
4245
+    /**
4246
+     * Name of the hardware accelerated codec.
4247
+     * The name is globally unique among encoders and among decoders (but an
4248
+     * encoder and a decoder can share the same name).
4249
+     */
4250
+    const char *name;
4251
+
4252
+    /**
4253
+     * Type of codec implemented by the hardware accelerator.
4254
+     *
4255
+     * See AVMEDIA_TYPE_xxx
4256
+     */
4257
+    enum AVMediaType type;
4258
+
4259
+    /**
4260
+     * Codec implemented by the hardware accelerator.
4261
+     *
4262
+     * See AV_CODEC_ID_xxx
4263
+     */
4264
+    enum AVCodecID id;
4265
+
4266
+    /**
4267
+     * Supported pixel format.
4268
+     *
4269
+     * Only hardware accelerated formats are supported here.
4270
+     */
4271
+    enum AVPixelFormat pix_fmt;
4272
+
4273
+    /**
4274
+     * Hardware accelerated codec capabilities.
4275
+     * see AV_HWACCEL_CODEC_CAP_*
4276
+     */
4277
+    int capabilities;
4278
+
4279
+    /*****************************************************************
4280
+     * No fields below this line are part of the public API. They
4281
+     * may not be used outside of libavcodec and can be changed and
4282
+     * removed at will.
4283
+     * New public fields should be added right above.
4284
+     *****************************************************************
4285
+     */
4286
+
4287
+    /**
4288
+     * Allocate a custom buffer
4289
+     */
4290
+    int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
4291
+
4292
+    /**
4293
+     * Called at the beginning of each frame or field picture.
4294
+     *
4295
+     * Meaningful frame information (codec specific) is guaranteed to
4296
+     * be parsed at this point. This function is mandatory.
4297
+     *
4298
+     * Note that buf can be NULL along with buf_size set to 0.
4299
+     * Otherwise, this means the whole frame is available at this point.
4300
+     *
4301
+     * @param avctx the codec context
4302
+     * @param buf the frame data buffer base
4303
+     * @param buf_size the size of the frame in bytes
4304
+     * @return zero if successful, a negative value otherwise
4305
+     */
4306
+    int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4307
+
4308
+    /**
4309
+     * Callback for parameter data (SPS/PPS/VPS etc).
4310
+     *
4311
+     * Useful for hardware decoders which keep persistent state about the
4312
+     * video parameters, and need to receive any changes to update that state.
4313
+     *
4314
+     * @param avctx the codec context
4315
+     * @param type the nal unit type
4316
+     * @param buf the nal unit data buffer
4317
+     * @param buf_size the size of the nal unit in bytes
4318
+     * @return zero if successful, a negative value otherwise
4319
+     */
4320
+    int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
4321
+
4322
+    /**
4323
+     * Callback for each slice.
4324
+     *
4325
+     * Meaningful slice information (codec specific) is guaranteed to
4326
+     * be parsed at this point. This function is mandatory.
4327
+     * The only exception is XvMC, that works on MB level.
4328
+     *
4329
+     * @param avctx the codec context
4330
+     * @param buf the slice data buffer base
4331
+     * @param buf_size the size of the slice in bytes
4332
+     * @return zero if successful, a negative value otherwise
4333
+     */
4334
+    int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4335
+
4336
+    /**
4337
+     * Called at the end of each frame or field picture.
4338
+     *
4339
+     * The whole picture is parsed at this point and can now be sent
4340
+     * to the hardware accelerator. This function is mandatory.
4341
+     *
4342
+     * @param avctx the codec context
4343
+     * @return zero if successful, a negative value otherwise
4344
+     */
4345
+    int (*end_frame)(AVCodecContext *avctx);
4346
+
4347
+    /**
4348
+     * Size of per-frame hardware accelerator private data.
4349
+     *
4350
+     * Private data is allocated with av_mallocz() before
4351
+     * AVCodecContext.get_buffer() and deallocated after
4352
+     * AVCodecContext.release_buffer().
4353
+     */
4354
+    int frame_priv_data_size;
4355
+
4356
+    /**
4357
+     * Called for every Macroblock in a slice.
4358
+     *
4359
+     * XvMC uses it to replace the ff_mpv_reconstruct_mb().
4360
+     * Instead of decoding to raw picture, MB parameters are
4361
+     * stored in an array provided by the video driver.
4362
+     *
4363
+     * @param s the mpeg context
4364
+     */
4365
+    void (*decode_mb)(struct MpegEncContext *s);
4366
+
4367
+    /**
4368
+     * Initialize the hwaccel private data.
4369
+     *
4370
+     * This will be called from ff_get_format(), after hwaccel and
4371
+     * hwaccel_context are set and the hwaccel private data in AVCodecInternal
4372
+     * is allocated.
4373
+     */
4374
+    int (*init)(AVCodecContext *avctx);
4375
+
4376
+    /**
4377
+     * Uninitialize the hwaccel private data.
4378
+     *
4379
+     * This will be called from get_format() or avcodec_close(), after hwaccel
4380
+     * and hwaccel_context are already uninitialized.
4381
+     */
4382
+    int (*uninit)(AVCodecContext *avctx);
4383
+
4384
+    /**
4385
+     * Size of the private data to allocate in
4386
+     * AVCodecInternal.hwaccel_priv_data.
4387
+     */
4388
+    int priv_data_size;
4389
+
4390
+    /**
4391
+     * Internal hwaccel capabilities.
4392
+     */
4393
+    int caps_internal;
4394
+
4395
+    /**
4396
+     * Fill the given hw_frames context with current codec parameters. Called
4397
+     * from get_format. Refer to avcodec_get_hw_frames_parameters() for
4398
+     * details.
4399
+     *
4400
+     * This CAN be called before AVHWAccel.init is called, and you must assume
4401
+     * that avctx->hwaccel_priv_data is invalid.
4402
+     */
4403
+    int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
4404
+} AVHWAccel;
4405
+
4406
+/**
4407
+ * HWAccel is experimental and is thus avoided in favor of non experimental
4408
+ * codecs
4409
+ */
4410
+#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
4411
+
4412
+/**
4413
+ * Hardware acceleration should be used for decoding even if the codec level
4414
+ * used is unknown or higher than the maximum supported level reported by the
4415
+ * hardware driver.
4416
+ *
4417
+ * It's generally a good idea to pass this flag unless you have a specific
4418
+ * reason not to, as hardware tends to under-report supported levels.
4419
+ */
4420
+#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
4421
+
4422
+/**
4423
+ * Hardware acceleration can output YUV pixel formats with a different chroma
4424
+ * sampling than 4:2:0 and/or other than 8 bits per component.
4425
+ */
4426
+#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
4427
+
4428
+/**
4429
+ * Hardware acceleration should still be attempted for decoding when the
4430
+ * codec profile does not match the reported capabilities of the hardware.
4431
+ *
4432
+ * For example, this can be used to try to decode baseline profile H.264
4433
+ * streams in hardware - it will often succeed, because many streams marked
4434
+ * as baseline profile actually conform to constrained baseline profile.
4435
+ *
4436
+ * @warning If the stream is actually not supported then the behaviour is
4437
+ *          undefined, and may include returning entirely incorrect output
4438
+ *          while indicating success.
4439
+ */
4440
+#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
4441
+
4442
+/**
4443
+ * @}
4444
+ */
4445
+
4446
+#if FF_API_AVPICTURE
4447
+/**
4448
+ * @defgroup lavc_picture AVPicture
4449
+ *
4450
+ * Functions for working with AVPicture
4451
+ * @{
4452
+ */
4453
+
4454
+/**
4455
+ * Picture data structure.
4456
+ *
4457
+ * Up to four components can be stored into it, the last component is
4458
+ * alpha.
4459
+ * @deprecated use AVFrame or imgutils functions instead
4460
+ */
4461
+typedef struct AVPicture {
4462
+    attribute_deprecated
4463
+    uint8_t *data[AV_NUM_DATA_POINTERS];    ///< pointers to the image data planes
4464
+    attribute_deprecated
4465
+    int linesize[AV_NUM_DATA_POINTERS];     ///< number of bytes per line
4466
+} AVPicture;
4467
+
4468
+/**
4469
+ * @}
4470
+ */
4471
+#endif
4472
+
4473
+enum AVSubtitleType {
4474
+    SUBTITLE_NONE,
4475
+
4476
+    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
4477
+
4478
+    /**
4479
+     * Plain text, the text field must be set by the decoder and is
4480
+     * authoritative. ass and pict fields may contain approximations.
4481
+     */
4482
+    SUBTITLE_TEXT,
4483
+
4484
+    /**
4485
+     * Formatted text, the ass field must be set by the decoder and is
4486
+     * authoritative. pict and text fields may contain approximations.
4487
+     */
4488
+    SUBTITLE_ASS,
4489
+};
4490
+
4491
+#define AV_SUBTITLE_FLAG_FORCED 0x00000001
4492
+
4493
+typedef struct AVSubtitleRect {
4494
+    int x;         ///< top left corner  of pict, undefined when pict is not set
4495
+    int y;         ///< top left corner  of pict, undefined when pict is not set
4496
+    int w;         ///< width            of pict, undefined when pict is not set
4497
+    int h;         ///< height           of pict, undefined when pict is not set
4498
+    int nb_colors; ///< number of colors in pict, undefined when pict is not set
4499
+
4500
+#if FF_API_AVPICTURE
4501
+    /**
4502
+     * @deprecated unused
4503
+     */
4504
+    attribute_deprecated
4505
+    AVPicture pict;
4506
+#endif
4507
+    /**
4508
+     * data+linesize for the bitmap of this subtitle.
4509
+     * Can be set for text/ass as well once they are rendered.
4510
+     */
4511
+    uint8_t *data[4];
4512
+    int linesize[4];
4513
+
4514
+    enum AVSubtitleType type;
4515
+
4516
+    char *text;                     ///< 0 terminated plain UTF-8 text
4517
+
4518
+    /**
4519
+     * 0 terminated ASS/SSA compatible event line.
4520
+     * The presentation of this is unaffected by the other values in this
4521
+     * struct.
4522
+     */
4523
+    char *ass;
4524
+
4525
+    int flags;
4526
+} AVSubtitleRect;
4527
+
4528
+typedef struct AVSubtitle {
4529
+    uint16_t format; /* 0 = graphics */
4530
+    uint32_t start_display_time; /* relative to packet pts, in ms */
4531
+    uint32_t end_display_time; /* relative to packet pts, in ms */
4532
+    unsigned num_rects;
4533
+    AVSubtitleRect **rects;
4534
+    int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
4535
+} AVSubtitle;
4536
+
4537
+/**
4538
+ * This struct describes the properties of an encoded stream.
4539
+ *
4540
+ * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
4541
+ * be allocated with avcodec_parameters_alloc() and freed with
4542
+ * avcodec_parameters_free().
4543
+ */
4544
+typedef struct AVCodecParameters {
4545
+    /**
4546
+     * General type of the encoded data.
4547
+     */
4548
+    enum AVMediaType codec_type;
4549
+    /**
4550
+     * Specific type of the encoded data (the codec used).
4551
+     */
4552
+    enum AVCodecID   codec_id;
4553
+    /**
4554
+     * Additional information about the codec (corresponds to the AVI FOURCC).
4555
+     */
4556
+    uint32_t         codec_tag;
4557
+
4558
+    /**
4559
+     * Extra binary data needed for initializing the decoder, codec-dependent.
4560
+     *
4561
+     * Must be allocated with av_malloc() and will be freed by
4562
+     * avcodec_parameters_free(). The allocated size of extradata must be at
4563
+     * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
4564
+     * bytes zeroed.
4565
+     */
4566
+    uint8_t *extradata;
4567
+    /**
4568
+     * Size of the extradata content in bytes.
4569
+     */
4570
+    int      extradata_size;
4571
+
4572
+    /**
4573
+     * - video: the pixel format, the value corresponds to enum AVPixelFormat.
4574
+     * - audio: the sample format, the value corresponds to enum AVSampleFormat.
4575
+     */
4576
+    int format;
4577
+
4578
+    /**
4579
+     * The average bitrate of the encoded data (in bits per second).
4580
+     */
4581
+    int64_t bit_rate;
4582
+
4583
+    /**
4584
+     * The number of bits per sample in the codedwords.
4585
+     *
4586
+     * This is basically the bitrate per sample. It is mandatory for a bunch of
4587
+     * formats to actually decode them. It's the number of bits for one sample in
4588
+     * the actual coded bitstream.
4589
+     *
4590
+     * This could be for example 4 for ADPCM
4591
+     * For PCM formats this matches bits_per_raw_sample
4592
+     * Can be 0
4593
+     */
4594
+    int bits_per_coded_sample;
4595
+
4596
+    /**
4597
+     * This is the number of valid bits in each output sample. If the
4598
+     * sample format has more bits, the least significant bits are additional
4599
+     * padding bits, which are always 0. Use right shifts to reduce the sample
4600
+     * to its actual size. For example, audio formats with 24 bit samples will
4601
+     * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
4602
+     * To get the original sample use "(int32_t)sample >> 8"."
4603
+     *
4604
+     * For ADPCM this might be 12 or 16 or similar
4605
+     * Can be 0
4606
+     */
4607
+    int bits_per_raw_sample;
4608
+
4609
+    /**
4610
+     * Codec-specific bitstream restrictions that the stream conforms to.
4611
+     */
4612
+    int profile;
4613
+    int level;
4614
+
4615
+    /**
4616
+     * Video only. The dimensions of the video frame in pixels.
4617
+     */
4618
+    int width;
4619
+    int height;
4620
+
4621
+    /**
4622
+     * Video only. The aspect ratio (width / height) which a single pixel
4623
+     * should have when displayed.
4624
+     *
4625
+     * When the aspect ratio is unknown / undefined, the numerator should be
4626
+     * set to 0 (the denominator may have any value).
4627
+     */
4628
+    AVRational sample_aspect_ratio;
4629
+
4630
+    /**
4631
+     * Video only. The order of the fields in interlaced video.
4632
+     */
4633
+    enum AVFieldOrder                  field_order;
4634
+
4635
+    /**
4636
+     * Video only. Additional colorspace characteristics.
4637
+     */
4638
+    enum AVColorRange                  color_range;
4639
+    enum AVColorPrimaries              color_primaries;
4640
+    enum AVColorTransferCharacteristic color_trc;
4641
+    enum AVColorSpace                  color_space;
4642
+    enum AVChromaLocation              chroma_location;
4643
+
4644
+    /**
4645
+     * Video only. Number of delayed frames.
4646
+     */
4647
+    int video_delay;
4648
+
4649
+    /**
4650
+     * Audio only. The channel layout bitmask. May be 0 if the channel layout is
4651
+     * unknown or unspecified, otherwise the number of bits set must be equal to
4652
+     * the channels field.
4653
+     */
4654
+    uint64_t channel_layout;
4655
+    /**
4656
+     * Audio only. The number of audio channels.
4657
+     */
4658
+    int      channels;
4659
+    /**
4660
+     * Audio only. The number of audio samples per second.
4661
+     */
4662
+    int      sample_rate;
4663
+    /**
4664
+     * Audio only. The number of bytes per coded audio frame, required by some
4665
+     * formats.
4666
+     *
4667
+     * Corresponds to nBlockAlign in WAVEFORMATEX.
4668
+     */
4669
+    int      block_align;
4670
+    /**
4671
+     * Audio only. Audio frame size, if known. Required by some formats to be static.
4672
+     */
4673
+    int      frame_size;
4674
+
4675
+    /**
4676
+     * Audio only. The amount of padding (in samples) inserted by the encoder at
4677
+     * the beginning of the audio. I.e. this number of leading decoded samples
4678
+     * must be discarded by the caller to get the original audio without leading
4679
+     * padding.
4680
+     */
4681
+    int initial_padding;
4682
+    /**
4683
+     * Audio only. The amount of padding (in samples) appended by the encoder to
4684
+     * the end of the audio. I.e. this number of decoded samples must be
4685
+     * discarded by the caller from the end of the stream to get the original
4686
+     * audio without any trailing padding.
4687
+     */
4688
+    int trailing_padding;
4689
+    /**
4690
+     * Audio only. Number of samples to skip after a discontinuity.
4691
+     */
4692
+    int seek_preroll;
4693
+} AVCodecParameters;
4694
+
4695
+/**
4696
+ * Iterate over all registered codecs.
4697
+ *
4698
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
4699
+ *               point to NULL to start the iteration.
4700
+ *
4701
+ * @return the next registered codec or NULL when the iteration is
4702
+ *         finished
4703
+ */
4704
+const AVCodec *av_codec_iterate(void **opaque);
4705
+
4706
+#if FF_API_NEXT
4707
+/**
4708
+ * If c is NULL, returns the first registered codec,
4709
+ * if c is non-NULL, returns the next registered codec after c,
4710
+ * or NULL if c is the last one.
4711
+ */
4712
+attribute_deprecated
4713
+AVCodec *av_codec_next(const AVCodec *c);
4714
+#endif
4715
+
4716
+/**
4717
+ * Return the LIBAVCODEC_VERSION_INT constant.
4718
+ */
4719
+unsigned avcodec_version(void);
4720
+
4721
+/**
4722
+ * Return the libavcodec build-time configuration.
4723
+ */
4724
+const char *avcodec_configuration(void);
4725
+
4726
+/**
4727
+ * Return the libavcodec license.
4728
+ */
4729
+const char *avcodec_license(void);
4730
+
4731
+#if FF_API_NEXT
4732
+/**
4733
+ * Register the codec codec and initialize libavcodec.
4734
+ *
4735
+ * @warning either this function or avcodec_register_all() must be called
4736
+ * before any other libavcodec functions.
4737
+ *
4738
+ * @see avcodec_register_all()
4739
+ */
4740
+attribute_deprecated
4741
+void avcodec_register(AVCodec *codec);
4742
+
4743
+/**
4744
+ * Register all the codecs, parsers and bitstream filters which were enabled at
4745
+ * configuration time. If you do not call this function you can select exactly
4746
+ * which formats you want to support, by using the individual registration
4747
+ * functions.
4748
+ *
4749
+ * @see avcodec_register
4750
+ * @see av_register_codec_parser
4751
+ * @see av_register_bitstream_filter
4752
+ */
4753
+attribute_deprecated
4754
+void avcodec_register_all(void);
4755
+#endif
4756
+
4757
+/**
4758
+ * Allocate an AVCodecContext and set its fields to default values. The
4759
+ * resulting struct should be freed with avcodec_free_context().
4760
+ *
4761
+ * @param codec if non-NULL, allocate private data and initialize defaults
4762
+ *              for the given codec. It is illegal to then call avcodec_open2()
4763
+ *              with a different codec.
4764
+ *              If NULL, then the codec-specific defaults won't be initialized,
4765
+ *              which may result in suboptimal default settings (this is
4766
+ *              important mainly for encoders, e.g. libx264).
4767
+ *
4768
+ * @return An AVCodecContext filled with default values or NULL on failure.
4769
+ */
4770
+AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
4771
+
4772
+/**
4773
+ * Free the codec context and everything associated with it and write NULL to
4774
+ * the provided pointer.
4775
+ */
4776
+void avcodec_free_context(AVCodecContext **avctx);
4777
+
4778
+#if FF_API_GET_CONTEXT_DEFAULTS
4779
+/**
4780
+ * @deprecated This function should not be used, as closing and opening a codec
4781
+ * context multiple time is not supported. A new codec context should be
4782
+ * allocated for each new use.
4783
+ */
4784
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
4785
+#endif
4786
+
4787
+/**
4788
+ * Get the AVClass for AVCodecContext. It can be used in combination with
4789
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4790
+ *
4791
+ * @see av_opt_find().
4792
+ */
4793
+const AVClass *avcodec_get_class(void);
4794
+
4795
+#if FF_API_COPY_CONTEXT
4796
+/**
4797
+ * Get the AVClass for AVFrame. It can be used in combination with
4798
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4799
+ *
4800
+ * @see av_opt_find().
4801
+ */
4802
+const AVClass *avcodec_get_frame_class(void);
4803
+
4804
+/**
4805
+ * Get the AVClass for AVSubtitleRect. It can be used in combination with
4806
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4807
+ *
4808
+ * @see av_opt_find().
4809
+ */
4810
+const AVClass *avcodec_get_subtitle_rect_class(void);
4811
+
4812
+/**
4813
+ * Copy the settings of the source AVCodecContext into the destination
4814
+ * AVCodecContext. The resulting destination codec context will be
4815
+ * unopened, i.e. you are required to call avcodec_open2() before you
4816
+ * can use this AVCodecContext to decode/encode video/audio data.
4817
+ *
4818
+ * @param dest target codec context, should be initialized with
4819
+ *             avcodec_alloc_context3(NULL), but otherwise uninitialized
4820
+ * @param src source codec context
4821
+ * @return AVERROR() on error (e.g. memory allocation error), 0 on success
4822
+ *
4823
+ * @deprecated The semantics of this function are ill-defined and it should not
4824
+ * be used. If you need to transfer the stream parameters from one codec context
4825
+ * to another, use an intermediate AVCodecParameters instance and the
4826
+ * avcodec_parameters_from_context() / avcodec_parameters_to_context()
4827
+ * functions.
4828
+ */
4829
+attribute_deprecated
4830
+int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
4831
+#endif
4832
+
4833
+/**
4834
+ * Allocate a new AVCodecParameters and set its fields to default values
4835
+ * (unknown/invalid/0). The returned struct must be freed with
4836
+ * avcodec_parameters_free().
4837
+ */
4838
+AVCodecParameters *avcodec_parameters_alloc(void);
4839
+
4840
+/**
4841
+ * Free an AVCodecParameters instance and everything associated with it and
4842
+ * write NULL to the supplied pointer.
4843
+ */
4844
+void avcodec_parameters_free(AVCodecParameters **par);
4845
+
4846
+/**
4847
+ * Copy the contents of src to dst. Any allocated fields in dst are freed and
4848
+ * replaced with newly allocated duplicates of the corresponding fields in src.
4849
+ *
4850
+ * @return >= 0 on success, a negative AVERROR code on failure.
4851
+ */
4852
+int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
4853
+
4854
+/**
4855
+ * Fill the parameters struct based on the values from the supplied codec
4856
+ * context. Any allocated fields in par are freed and replaced with duplicates
4857
+ * of the corresponding fields in codec.
4858
+ *
4859
+ * @return >= 0 on success, a negative AVERROR code on failure
4860
+ */
4861
+int avcodec_parameters_from_context(AVCodecParameters *par,
4862
+                                    const AVCodecContext *codec);
4863
+
4864
+/**
4865
+ * Fill the codec context based on the values from the supplied codec
4866
+ * parameters. Any allocated fields in codec that have a corresponding field in
4867
+ * par are freed and replaced with duplicates of the corresponding field in par.
4868
+ * Fields in codec that do not have a counterpart in par are not touched.
4869
+ *
4870
+ * @return >= 0 on success, a negative AVERROR code on failure.
4871
+ */
4872
+int avcodec_parameters_to_context(AVCodecContext *codec,
4873
+                                  const AVCodecParameters *par);
4874
+
4875
+/**
4876
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
4877
+ * function the context has to be allocated with avcodec_alloc_context3().
4878
+ *
4879
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
4880
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
4881
+ * retrieving a codec.
4882
+ *
4883
+ * @warning This function is not thread safe!
4884
+ *
4885
+ * @note Always call this function before using decoding routines (such as
4886
+ * @ref avcodec_receive_frame()).
4887
+ *
4888
+ * @code
4889
+ * avcodec_register_all();
4890
+ * av_dict_set(&opts, "b", "2.5M", 0);
4891
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
4892
+ * if (!codec)
4893
+ *     exit(1);
4894
+ *
4895
+ * context = avcodec_alloc_context3(codec);
4896
+ *
4897
+ * if (avcodec_open2(context, codec, opts) < 0)
4898
+ *     exit(1);
4899
+ * @endcode
4900
+ *
4901
+ * @param avctx The context to initialize.
4902
+ * @param codec The codec to open this context for. If a non-NULL codec has been
4903
+ *              previously passed to avcodec_alloc_context3() or
4904
+ *              for this context, then this parameter MUST be either NULL or
4905
+ *              equal to the previously passed codec.
4906
+ * @param options A dictionary filled with AVCodecContext and codec-private options.
4907
+ *                On return this object will be filled with options that were not found.
4908
+ *
4909
+ * @return zero on success, a negative value on error
4910
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
4911
+ *      av_dict_set(), av_opt_find().
4912
+ */
4913
+int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
4914
+
4915
+/**
4916
+ * Close a given AVCodecContext and free all the data associated with it
4917
+ * (but not the AVCodecContext itself).
4918
+ *
4919
+ * Calling this function on an AVCodecContext that hasn't been opened will free
4920
+ * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
4921
+ * codec. Subsequent calls will do nothing.
4922
+ *
4923
+ * @note Do not use this function. Use avcodec_free_context() to destroy a
4924
+ * codec context (either open or closed). Opening and closing a codec context
4925
+ * multiple times is not supported anymore -- use multiple codec contexts
4926
+ * instead.
4927
+ */
4928
+int avcodec_close(AVCodecContext *avctx);
4929
+
4930
+/**
4931
+ * Free all allocated data in the given subtitle struct.
4932
+ *
4933
+ * @param sub AVSubtitle to free.
4934
+ */
4935
+void avsubtitle_free(AVSubtitle *sub);
4936
+
4937
+/**
4938
+ * @}
4939
+ */
4940
+
4941
+/**
4942
+ * @addtogroup lavc_packet
4943
+ * @{
4944
+ */
4945
+
4946
+/**
4947
+ * Allocate an AVPacket and set its fields to default values.  The resulting
4948
+ * struct must be freed using av_packet_free().
4949
+ *
4950
+ * @return An AVPacket filled with default values or NULL on failure.
4951
+ *
4952
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
4953
+ * must be allocated through other means such as av_new_packet.
4954
+ *
4955
+ * @see av_new_packet
4956
+ */
4957
+AVPacket *av_packet_alloc(void);
4958
+
4959
+/**
4960
+ * Create a new packet that references the same data as src.
4961
+ *
4962
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
4963
+ *
4964
+ * @return newly created AVPacket on success, NULL on error.
4965
+ *
4966
+ * @see av_packet_alloc
4967
+ * @see av_packet_ref
4968
+ */
4969
+AVPacket *av_packet_clone(const AVPacket *src);
4970
+
4971
+/**
4972
+ * Free the packet, if the packet is reference counted, it will be
4973
+ * unreferenced first.
4974
+ *
4975
+ * @param pkt packet to be freed. The pointer will be set to NULL.
4976
+ * @note passing NULL is a no-op.
4977
+ */
4978
+void av_packet_free(AVPacket **pkt);
4979
+
4980
+/**
4981
+ * Initialize optional fields of a packet with default values.
4982
+ *
4983
+ * Note, this does not touch the data and size members, which have to be
4984
+ * initialized separately.
4985
+ *
4986
+ * @param pkt packet
4987
+ */
4988
+void av_init_packet(AVPacket *pkt);
4989
+
4990
+/**
4991
+ * Allocate the payload of a packet and initialize its fields with
4992
+ * default values.
4993
+ *
4994
+ * @param pkt packet
4995
+ * @param size wanted payload size
4996
+ * @return 0 if OK, AVERROR_xxx otherwise
4997
+ */
4998
+int av_new_packet(AVPacket *pkt, int size);
4999
+
5000
+/**
5001
+ * Reduce packet size, correctly zeroing padding
5002
+ *
5003
+ * @param pkt packet
5004
+ * @param size new size
5005
+ */
5006
+void av_shrink_packet(AVPacket *pkt, int size);
5007
+
5008
+/**
5009
+ * Increase packet size, correctly zeroing padding
5010
+ *
5011
+ * @param pkt packet
5012
+ * @param grow_by number of bytes by which to increase the size of the packet
5013
+ */
5014
+int av_grow_packet(AVPacket *pkt, int grow_by);
5015
+
5016
+/**
5017
+ * Initialize a reference-counted packet from av_malloc()ed data.
5018
+ *
5019
+ * @param pkt packet to be initialized. This function will set the data, size,
5020
+ *        buf and destruct fields, all others are left untouched.
5021
+ * @param data Data allocated by av_malloc() to be used as packet data. If this
5022
+ *        function returns successfully, the data is owned by the underlying AVBuffer.
5023
+ *        The caller may not access the data through other means.
5024
+ * @param size size of data in bytes, without the padding. I.e. the full buffer
5025
+ *        size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
5026
+ *
5027
+ * @return 0 on success, a negative AVERROR on error
5028
+ */
5029
+int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
5030
+
5031
+#if FF_API_AVPACKET_OLD_API
5032
+/**
5033
+ * @warning This is a hack - the packet memory allocation stuff is broken. The
5034
+ * packet is allocated if it was not really allocated.
5035
+ *
5036
+ * @deprecated Use av_packet_ref or av_packet_make_refcounted
5037
+ */
5038
+attribute_deprecated
5039
+int av_dup_packet(AVPacket *pkt);
5040
+/**
5041
+ * Copy packet, including contents
5042
+ *
5043
+ * @return 0 on success, negative AVERROR on fail
5044
+ *
5045
+ * @deprecated Use av_packet_ref
5046
+ */
5047
+attribute_deprecated
5048
+int av_copy_packet(AVPacket *dst, const AVPacket *src);
5049
+
5050
+/**
5051
+ * Copy packet side data
5052
+ *
5053
+ * @return 0 on success, negative AVERROR on fail
5054
+ *
5055
+ * @deprecated Use av_packet_copy_props
5056
+ */
5057
+attribute_deprecated
5058
+int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
5059
+
5060
+/**
5061
+ * Free a packet.
5062
+ *
5063
+ * @deprecated Use av_packet_unref
5064
+ *
5065
+ * @param pkt packet to free
5066
+ */
5067
+attribute_deprecated
5068
+void av_free_packet(AVPacket *pkt);
5069
+#endif
5070
+/**
5071
+ * Allocate new information of a packet.
5072
+ *
5073
+ * @param pkt packet
5074
+ * @param type side information type
5075
+ * @param size side information size
5076
+ * @return pointer to fresh allocated data or NULL otherwise
5077
+ */
5078
+uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5079
+                                 int size);
5080
+
5081
+/**
5082
+ * Wrap an existing array as a packet side data.
5083
+ *
5084
+ * @param pkt packet
5085
+ * @param type side information type
5086
+ * @param data the side data array. It must be allocated with the av_malloc()
5087
+ *             family of functions. The ownership of the data is transferred to
5088
+ *             pkt.
5089
+ * @param size side information size
5090
+ * @return a non-negative number on success, a negative AVERROR code on
5091
+ *         failure. On failure, the packet is unchanged and the data remains
5092
+ *         owned by the caller.
5093
+ */
5094
+int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5095
+                            uint8_t *data, size_t size);
5096
+
5097
+/**
5098
+ * Shrink the already allocated side data buffer
5099
+ *
5100
+ * @param pkt packet
5101
+ * @param type side information type
5102
+ * @param size new side information size
5103
+ * @return 0 on success, < 0 on failure
5104
+ */
5105
+int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5106
+                               int size);
5107
+
5108
+/**
5109
+ * Get side information from packet.
5110
+ *
5111
+ * @param pkt packet
5112
+ * @param type desired side information type
5113
+ * @param size pointer for side information size to store (optional)
5114
+ * @return pointer to data if present or NULL otherwise
5115
+ */
5116
+uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
5117
+                                 int *size);
5118
+
5119
+#if FF_API_MERGE_SD_API
5120
+attribute_deprecated
5121
+int av_packet_merge_side_data(AVPacket *pkt);
5122
+
5123
+attribute_deprecated
5124
+int av_packet_split_side_data(AVPacket *pkt);
5125
+#endif
5126
+
5127
+const char *av_packet_side_data_name(enum AVPacketSideDataType type);
5128
+
5129
+/**
5130
+ * Pack a dictionary for use in side_data.
5131
+ *
5132
+ * @param dict The dictionary to pack.
5133
+ * @param size pointer to store the size of the returned data
5134
+ * @return pointer to data if successful, NULL otherwise
5135
+ */
5136
+uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
5137
+/**
5138
+ * Unpack a dictionary from side_data.
5139
+ *
5140
+ * @param data data from side_data
5141
+ * @param size size of the data
5142
+ * @param dict the metadata storage dictionary
5143
+ * @return 0 on success, < 0 on failure
5144
+ */
5145
+int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
5146
+
5147
+
5148
+/**
5149
+ * Convenience function to free all the side data stored.
5150
+ * All the other fields stay untouched.
5151
+ *
5152
+ * @param pkt packet
5153
+ */
5154
+void av_packet_free_side_data(AVPacket *pkt);
5155
+
5156
+/**
5157
+ * Setup a new reference to the data described by a given packet
5158
+ *
5159
+ * If src is reference-counted, setup dst as a new reference to the
5160
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
5161
+ * data from src into it.
5162
+ *
5163
+ * All the other fields are copied from src.
5164
+ *
5165
+ * @see av_packet_unref
5166
+ *
5167
+ * @param dst Destination packet
5168
+ * @param src Source packet
5169
+ *
5170
+ * @return 0 on success, a negative AVERROR on error.
5171
+ */
5172
+int av_packet_ref(AVPacket *dst, const AVPacket *src);
5173
+
5174
+/**
5175
+ * Wipe the packet.
5176
+ *
5177
+ * Unreference the buffer referenced by the packet and reset the
5178
+ * remaining packet fields to their default values.
5179
+ *
5180
+ * @param pkt The packet to be unreferenced.
5181
+ */
5182
+void av_packet_unref(AVPacket *pkt);
5183
+
5184
+/**
5185
+ * Move every field in src to dst and reset src.
5186
+ *
5187
+ * @see av_packet_unref
5188
+ *
5189
+ * @param src Source packet, will be reset
5190
+ * @param dst Destination packet
5191
+ */
5192
+void av_packet_move_ref(AVPacket *dst, AVPacket *src);
5193
+
5194
+/**
5195
+ * Copy only "properties" fields from src to dst.
5196
+ *
5197
+ * Properties for the purpose of this function are all the fields
5198
+ * beside those related to the packet data (buf, data, size)
5199
+ *
5200
+ * @param dst Destination packet
5201
+ * @param src Source packet
5202
+ *
5203
+ * @return 0 on success AVERROR on failure.
5204
+ */
5205
+int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
5206
+
5207
+/**
5208
+ * Ensure the data described by a given packet is reference counted.
5209
+ *
5210
+ * @note This function does not ensure that the reference will be writable.
5211
+ *       Use av_packet_make_writable instead for that purpose.
5212
+ *
5213
+ * @see av_packet_ref
5214
+ * @see av_packet_make_writable
5215
+ *
5216
+ * @param pkt packet whose data should be made reference counted.
5217
+ *
5218
+ * @return 0 on success, a negative AVERROR on error. On failure, the
5219
+ *         packet is unchanged.
5220
+ */
5221
+int av_packet_make_refcounted(AVPacket *pkt);
5222
+
5223
+/**
5224
+ * Create a writable reference for the data described by a given packet,
5225
+ * avoiding data copy if possible.
5226
+ *
5227
+ * @param pkt Packet whose data should be made writable.
5228
+ *
5229
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
5230
+ *         packet is unchanged.
5231
+ */
5232
+int av_packet_make_writable(AVPacket *pkt);
5233
+
5234
+/**
5235
+ * Convert valid timing fields (timestamps / durations) in a packet from one
5236
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
5237
+ * ignored.
5238
+ *
5239
+ * @param pkt packet on which the conversion will be performed
5240
+ * @param tb_src source timebase, in which the timing fields in pkt are
5241
+ *               expressed
5242
+ * @param tb_dst destination timebase, to which the timing fields will be
5243
+ *               converted
5244
+ */
5245
+void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
5246
+
5247
+/**
5248
+ * @}
5249
+ */
5250
+
5251
+/**
5252
+ * @addtogroup lavc_decoding
5253
+ * @{
5254
+ */
5255
+
5256
+/**
5257
+ * Find a registered decoder with a matching codec ID.
5258
+ *
5259
+ * @param id AVCodecID of the requested decoder
5260
+ * @return A decoder if one was found, NULL otherwise.
5261
+ */
5262
+AVCodec *avcodec_find_decoder(enum AVCodecID id);
5263
+
5264
+/**
5265
+ * Find a registered decoder with the specified name.
5266
+ *
5267
+ * @param name name of the requested decoder
5268
+ * @return A decoder if one was found, NULL otherwise.
5269
+ */
5270
+AVCodec *avcodec_find_decoder_by_name(const char *name);
5271
+
5272
+/**
5273
+ * The default callback for AVCodecContext.get_buffer2(). It is made public so
5274
+ * it can be called by custom get_buffer2() implementations for decoders without
5275
+ * AV_CODEC_CAP_DR1 set.
5276
+ */
5277
+int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
5278
+
5279
+/**
5280
+ * Modify width and height values so that they will result in a memory
5281
+ * buffer that is acceptable for the codec if you do not use any horizontal
5282
+ * padding.
5283
+ *
5284
+ * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5285
+ */
5286
+void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
5287
+
5288
+/**
5289
+ * Modify width and height values so that they will result in a memory
5290
+ * buffer that is acceptable for the codec if you also ensure that all
5291
+ * line sizes are a multiple of the respective linesize_align[i].
5292
+ *
5293
+ * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5294
+ */
5295
+void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
5296
+                               int linesize_align[AV_NUM_DATA_POINTERS]);
5297
+
5298
+/**
5299
+ * Converts AVChromaLocation to swscale x/y chroma position.
5300
+ *
5301
+ * The positions represent the chroma (0,0) position in a coordinates system
5302
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5303
+ *
5304
+ * @param xpos  horizontal chroma sample position
5305
+ * @param ypos  vertical   chroma sample position
5306
+ */
5307
+int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
5308
+
5309
+/**
5310
+ * Converts swscale x/y chroma position to AVChromaLocation.
5311
+ *
5312
+ * The positions represent the chroma (0,0) position in a coordinates system
5313
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5314
+ *
5315
+ * @param xpos  horizontal chroma sample position
5316
+ * @param ypos  vertical   chroma sample position
5317
+ */
5318
+enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
5319
+
5320
+/**
5321
+ * Decode the audio frame of size avpkt->size from avpkt->data into frame.
5322
+ *
5323
+ * Some decoders may support multiple frames in a single AVPacket. Such
5324
+ * decoders would then just decode the first frame and the return value would be
5325
+ * less than the packet size. In this case, avcodec_decode_audio4 has to be
5326
+ * called again with an AVPacket containing the remaining data in order to
5327
+ * decode the second frame, etc...  Even if no frames are returned, the packet
5328
+ * needs to be fed to the decoder with remaining data until it is completely
5329
+ * consumed or an error occurs.
5330
+ *
5331
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5332
+ * and output. This means that for some packets they will not immediately
5333
+ * produce decoded output and need to be flushed at the end of decoding to get
5334
+ * all the decoded data. Flushing is done by calling this function with packets
5335
+ * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5336
+ * returning samples. It is safe to flush even those decoders that are not
5337
+ * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
5338
+ *
5339
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5340
+ *          larger than the actual read bytes because some optimized bitstream
5341
+ *          readers read 32 or 64 bits at once and could read over the end.
5342
+ *
5343
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5344
+ * before packets may be fed to the decoder.
5345
+ *
5346
+ * @param      avctx the codec context
5347
+ * @param[out] frame The AVFrame in which to store decoded audio samples.
5348
+ *                   The decoder will allocate a buffer for the decoded frame by
5349
+ *                   calling the AVCodecContext.get_buffer2() callback.
5350
+ *                   When AVCodecContext.refcounted_frames is set to 1, the frame is
5351
+ *                   reference counted and the returned reference belongs to the
5352
+ *                   caller. The caller must release the frame using av_frame_unref()
5353
+ *                   when the frame is no longer needed. The caller may safely write
5354
+ *                   to the frame if av_frame_is_writable() returns 1.
5355
+ *                   When AVCodecContext.refcounted_frames is set to 0, the returned
5356
+ *                   reference belongs to the decoder and is valid only until the
5357
+ *                   next call to this function or until closing or flushing the
5358
+ *                   decoder. The caller may not write to it.
5359
+ * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
5360
+ *                           non-zero. Note that this field being set to zero
5361
+ *                           does not mean that an error has occurred. For
5362
+ *                           decoders with AV_CODEC_CAP_DELAY set, no given decode
5363
+ *                           call is guaranteed to produce a frame.
5364
+ * @param[in]  avpkt The input AVPacket containing the input buffer.
5365
+ *                   At least avpkt->data and avpkt->size should be set. Some
5366
+ *                   decoders might also require additional fields to be set.
5367
+ * @return A negative error code is returned if an error occurred during
5368
+ *         decoding, otherwise the number of bytes consumed from the input
5369
+ *         AVPacket is returned.
5370
+ *
5371
+* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5372
+ */
5373
+attribute_deprecated
5374
+int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
5375
+                          int *got_frame_ptr, const AVPacket *avpkt);
5376
+
5377
+/**
5378
+ * Decode the video frame of size avpkt->size from avpkt->data into picture.
5379
+ * Some decoders may support multiple frames in a single AVPacket, such
5380
+ * decoders would then just decode the first frame.
5381
+ *
5382
+ * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
5383
+ * the actual read bytes because some optimized bitstream readers read 32 or 64
5384
+ * bits at once and could read over the end.
5385
+ *
5386
+ * @warning The end of the input buffer buf should be set to 0 to ensure that
5387
+ * no overreading happens for damaged MPEG streams.
5388
+ *
5389
+ * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
5390
+ * between input and output, these need to be fed with avpkt->data=NULL,
5391
+ * avpkt->size=0 at the end to return the remaining frames.
5392
+ *
5393
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5394
+ * before packets may be fed to the decoder.
5395
+ *
5396
+ * @param avctx the codec context
5397
+ * @param[out] picture The AVFrame in which the decoded video frame will be stored.
5398
+ *             Use av_frame_alloc() to get an AVFrame. The codec will
5399
+ *             allocate memory for the actual bitmap by calling the
5400
+ *             AVCodecContext.get_buffer2() callback.
5401
+ *             When AVCodecContext.refcounted_frames is set to 1, the frame is
5402
+ *             reference counted and the returned reference belongs to the
5403
+ *             caller. The caller must release the frame using av_frame_unref()
5404
+ *             when the frame is no longer needed. The caller may safely write
5405
+ *             to the frame if av_frame_is_writable() returns 1.
5406
+ *             When AVCodecContext.refcounted_frames is set to 0, the returned
5407
+ *             reference belongs to the decoder and is valid only until the
5408
+ *             next call to this function or until closing or flushing the
5409
+ *             decoder. The caller may not write to it.
5410
+ *
5411
+ * @param[in] avpkt The input AVPacket containing the input buffer.
5412
+ *            You can create such packet with av_init_packet() and by then setting
5413
+ *            data and size, some decoders might in addition need other fields like
5414
+ *            flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
5415
+ *            fields possible.
5416
+ * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
5417
+ * @return On error a negative value is returned, otherwise the number of bytes
5418
+ * used or zero if no frame could be decompressed.
5419
+ *
5420
+ * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5421
+ */
5422
+attribute_deprecated
5423
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
5424
+                         int *got_picture_ptr,
5425
+                         const AVPacket *avpkt);
5426
+
5427
+/**
5428
+ * Decode a subtitle message.
5429
+ * Return a negative value on error, otherwise return the number of bytes used.
5430
+ * If no subtitle could be decompressed, got_sub_ptr is zero.
5431
+ * Otherwise, the subtitle is stored in *sub.
5432
+ * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
5433
+ * simplicity, because the performance difference is expect to be negligible
5434
+ * and reusing a get_buffer written for video codecs would probably perform badly
5435
+ * due to a potentially very different allocation pattern.
5436
+ *
5437
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5438
+ * and output. This means that for some packets they will not immediately
5439
+ * produce decoded output and need to be flushed at the end of decoding to get
5440
+ * all the decoded data. Flushing is done by calling this function with packets
5441
+ * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5442
+ * returning subtitles. It is safe to flush even those decoders that are not
5443
+ * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
5444
+ *
5445
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5446
+ * before packets may be fed to the decoder.
5447
+ *
5448
+ * @param avctx the codec context
5449
+ * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
5450
+ *                 must be freed with avsubtitle_free if *got_sub_ptr is set.
5451
+ * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
5452
+ * @param[in] avpkt The input AVPacket containing the input buffer.
5453
+ */
5454
+int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
5455
+                            int *got_sub_ptr,
5456
+                            AVPacket *avpkt);
5457
+
5458
+/**
5459
+ * Supply raw packet data as input to a decoder.
5460
+ *
5461
+ * Internally, this call will copy relevant AVCodecContext fields, which can
5462
+ * influence decoding per-packet, and apply them when the packet is actually
5463
+ * decoded. (For example AVCodecContext.skip_frame, which might direct the
5464
+ * decoder to drop the frame contained by the packet sent with this function.)
5465
+ *
5466
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5467
+ *          larger than the actual read bytes because some optimized bitstream
5468
+ *          readers read 32 or 64 bits at once and could read over the end.
5469
+ *
5470
+ * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
5471
+ *          on the same AVCodecContext. It will return unexpected results now
5472
+ *          or in future libavcodec versions.
5473
+ *
5474
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5475
+ *       before packets may be fed to the decoder.
5476
+ *
5477
+ * @param avctx codec context
5478
+ * @param[in] avpkt The input AVPacket. Usually, this will be a single video
5479
+ *                  frame, or several complete audio frames.
5480
+ *                  Ownership of the packet remains with the caller, and the
5481
+ *                  decoder will not write to the packet. The decoder may create
5482
+ *                  a reference to the packet data (or copy it if the packet is
5483
+ *                  not reference-counted).
5484
+ *                  Unlike with older APIs, the packet is always fully consumed,
5485
+ *                  and if it contains multiple frames (e.g. some audio codecs),
5486
+ *                  will require you to call avcodec_receive_frame() multiple
5487
+ *                  times afterwards before you can send a new packet.
5488
+ *                  It can be NULL (or an AVPacket with data set to NULL and
5489
+ *                  size set to 0); in this case, it is considered a flush
5490
+ *                  packet, which signals the end of the stream. Sending the
5491
+ *                  first flush packet will return success. Subsequent ones are
5492
+ *                  unnecessary and will return AVERROR_EOF. If the decoder
5493
+ *                  still has frames buffered, it will return them after sending
5494
+ *                  a flush packet.
5495
+ *
5496
+ * @return 0 on success, otherwise negative error code:
5497
+ *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5498
+ *                         must read output with avcodec_receive_frame() (once
5499
+ *                         all output is read, the packet should be resent, and
5500
+ *                         the call will not fail with EAGAIN).
5501
+ *      AVERROR_EOF:       the decoder has been flushed, and no new packets can
5502
+ *                         be sent to it (also returned if more than 1 flush
5503
+ *                         packet is sent)
5504
+ *      AVERROR(EINVAL):   codec not opened, it is an encoder, or requires flush
5505
+ *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5506
+ *      other errors: legitimate decoding errors
5507
+ */
5508
+int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
5509
+
5510
+/**
5511
+ * Return decoded output data from a decoder.
5512
+ *
5513
+ * @param avctx codec context
5514
+ * @param frame This will be set to a reference-counted video or audio
5515
+ *              frame (depending on the decoder type) allocated by the
5516
+ *              decoder. Note that the function will always call
5517
+ *              av_frame_unref(frame) before doing anything else.
5518
+ *
5519
+ * @return
5520
+ *      0:                 success, a frame was returned
5521
+ *      AVERROR(EAGAIN):   output is not available in this state - user must try
5522
+ *                         to send new input
5523
+ *      AVERROR_EOF:       the decoder has been fully flushed, and there will be
5524
+ *                         no more output frames
5525
+ *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5526
+ *      other negative values: legitimate decoding errors
5527
+ */
5528
+int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
5529
+
5530
+/**
5531
+ * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
5532
+ * to retrieve buffered output packets.
5533
+ *
5534
+ * @param avctx     codec context
5535
+ * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
5536
+ *                  Ownership of the frame remains with the caller, and the
5537
+ *                  encoder will not write to the frame. The encoder may create
5538
+ *                  a reference to the frame data (or copy it if the frame is
5539
+ *                  not reference-counted).
5540
+ *                  It can be NULL, in which case it is considered a flush
5541
+ *                  packet.  This signals the end of the stream. If the encoder
5542
+ *                  still has packets buffered, it will return them after this
5543
+ *                  call. Once flushing mode has been entered, additional flush
5544
+ *                  packets are ignored, and sending frames will return
5545
+ *                  AVERROR_EOF.
5546
+ *
5547
+ *                  For audio:
5548
+ *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
5549
+ *                  can have any number of samples.
5550
+ *                  If it is not set, frame->nb_samples must be equal to
5551
+ *                  avctx->frame_size for all frames except the last.
5552
+ *                  The final frame may be smaller than avctx->frame_size.
5553
+ * @return 0 on success, otherwise negative error code:
5554
+ *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5555
+ *                         must read output with avcodec_receive_packet() (once
5556
+ *                         all output is read, the packet should be resent, and
5557
+ *                         the call will not fail with EAGAIN).
5558
+ *      AVERROR_EOF:       the encoder has been flushed, and no new frames can
5559
+ *                         be sent to it
5560
+ *      AVERROR(EINVAL):   codec not opened, refcounted_frames not set, it is a
5561
+ *                         decoder, or requires flush
5562
+ *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5563
+ *      other errors: legitimate decoding errors
5564
+ */
5565
+int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
5566
+
5567
+/**
5568
+ * Read encoded data from the encoder.
5569
+ *
5570
+ * @param avctx codec context
5571
+ * @param avpkt This will be set to a reference-counted packet allocated by the
5572
+ *              encoder. Note that the function will always call
5573
+ *              av_frame_unref(frame) before doing anything else.
5574
+ * @return 0 on success, otherwise negative error code:
5575
+ *      AVERROR(EAGAIN):   output is not available in the current state - user
5576
+ *                         must try to send input
5577
+ *      AVERROR_EOF:       the encoder has been fully flushed, and there will be
5578
+ *                         no more output packets
5579
+ *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5580
+ *      other errors: legitimate decoding errors
5581
+ */
5582
+int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
5583
+
5584
+/**
5585
+ * Create and return a AVHWFramesContext with values adequate for hardware
5586
+ * decoding. This is meant to get called from the get_format callback, and is
5587
+ * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
5588
+ * This API is for decoding with certain hardware acceleration modes/APIs only.
5589
+ *
5590
+ * The returned AVHWFramesContext is not initialized. The caller must do this
5591
+ * with av_hwframe_ctx_init().
5592
+ *
5593
+ * Calling this function is not a requirement, but makes it simpler to avoid
5594
+ * codec or hardware API specific details when manually allocating frames.
5595
+ *
5596
+ * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
5597
+ * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
5598
+ * it unnecessary to call this function or having to care about
5599
+ * AVHWFramesContext initialization at all.
5600
+ *
5601
+ * There are a number of requirements for calling this function:
5602
+ *
5603
+ * - It must be called from get_format with the same avctx parameter that was
5604
+ *   passed to get_format. Calling it outside of get_format is not allowed, and
5605
+ *   can trigger undefined behavior.
5606
+ * - The function is not always supported (see description of return values).
5607
+ *   Even if this function returns successfully, hwaccel initialization could
5608
+ *   fail later. (The degree to which implementations check whether the stream
5609
+ *   is actually supported varies. Some do this check only after the user's
5610
+ *   get_format callback returns.)
5611
+ * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
5612
+ *   user decides to use a AVHWFramesContext prepared with this API function,
5613
+ *   the user must return the same hw_pix_fmt from get_format.
5614
+ * - The device_ref passed to this function must support the given hw_pix_fmt.
5615
+ * - After calling this API function, it is the user's responsibility to
5616
+ *   initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
5617
+ *   and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
5618
+ *   before returning from get_format (this is implied by the normal
5619
+ *   AVCodecContext.hw_frames_ctx API rules).
5620
+ * - The AVHWFramesContext parameters may change every time time get_format is
5621
+ *   called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
5622
+ *   you are inherently required to go through this process again on every
5623
+ *   get_format call.
5624
+ * - It is perfectly possible to call this function without actually using
5625
+ *   the resulting AVHWFramesContext. One use-case might be trying to reuse a
5626
+ *   previously initialized AVHWFramesContext, and calling this API function
5627
+ *   only to test whether the required frame parameters have changed.
5628
+ * - Fields that use dynamically allocated values of any kind must not be set
5629
+ *   by the user unless setting them is explicitly allowed by the documentation.
5630
+ *   If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
5631
+ *   the new free callback must call the potentially set previous free callback.
5632
+ *   This API call may set any dynamically allocated fields, including the free
5633
+ *   callback.
5634
+ *
5635
+ * The function will set at least the following fields on AVHWFramesContext
5636
+ * (potentially more, depending on hwaccel API):
5637
+ *
5638
+ * - All fields set by av_hwframe_ctx_alloc().
5639
+ * - Set the format field to hw_pix_fmt.
5640
+ * - Set the sw_format field to the most suited and most versatile format. (An
5641
+ *   implication is that this will prefer generic formats over opaque formats
5642
+ *   with arbitrary restrictions, if possible.)
5643
+ * - Set the width/height fields to the coded frame size, rounded up to the
5644
+ *   API-specific minimum alignment.
5645
+ * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
5646
+ *   field to the number of maximum reference surfaces possible with the codec,
5647
+ *   plus 1 surface for the user to work (meaning the user can safely reference
5648
+ *   at most 1 decoded surface at a time), plus additional buffering introduced
5649
+ *   by frame threading. If the hwaccel does not require pre-allocation, the
5650
+ *   field is left to 0, and the decoder will allocate new surfaces on demand
5651
+ *   during decoding.
5652
+ * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
5653
+ *   hardware API.
5654
+ *
5655
+ * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
5656
+ * with basic frame parameters set.
5657
+ *
5658
+ * The function is stateless, and does not change the AVCodecContext or the
5659
+ * device_ref AVHWDeviceContext.
5660
+ *
5661
+ * @param avctx The context which is currently calling get_format, and which
5662
+ *              implicitly contains all state needed for filling the returned
5663
+ *              AVHWFramesContext properly.
5664
+ * @param device_ref A reference to the AVHWDeviceContext describing the device
5665
+ *                   which will be used by the hardware decoder.
5666
+ * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
5667
+ * @param out_frames_ref On success, set to a reference to an _uninitialized_
5668
+ *                       AVHWFramesContext, created from the given device_ref.
5669
+ *                       Fields will be set to values required for decoding.
5670
+ *                       Not changed if an error is returned.
5671
+ * @return zero on success, a negative value on error. The following error codes
5672
+ *         have special semantics:
5673
+ *      AVERROR(ENOENT): the decoder does not support this functionality. Setup
5674
+ *                       is always manual, or it is a decoder which does not
5675
+ *                       support setting AVCodecContext.hw_frames_ctx at all,
5676
+ *                       or it is a software format.
5677
+ *      AVERROR(EINVAL): it is known that hardware decoding is not supported for
5678
+ *                       this configuration, or the device_ref is not supported
5679
+ *                       for the hwaccel referenced by hw_pix_fmt.
5680
+ */
5681
+int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
5682
+                                     AVBufferRef *device_ref,
5683
+                                     enum AVPixelFormat hw_pix_fmt,
5684
+                                     AVBufferRef **out_frames_ref);
5685
+
5686
+
5687
+
5688
+/**
5689
+ * @defgroup lavc_parsing Frame parsing
5690
+ * @{
5691
+ */
5692
+
5693
+enum AVPictureStructure {
5694
+    AV_PICTURE_STRUCTURE_UNKNOWN,      //< unknown
5695
+    AV_PICTURE_STRUCTURE_TOP_FIELD,    //< coded as top field
5696
+    AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
5697
+    AV_PICTURE_STRUCTURE_FRAME,        //< coded as frame
5698
+};
5699
+
5700
+typedef struct AVCodecParserContext {
5701
+    void *priv_data;
5702
+    struct AVCodecParser *parser;
5703
+    int64_t frame_offset; /* offset of the current frame */
5704
+    int64_t cur_offset; /* current offset
5705
+                           (incremented by each av_parser_parse()) */
5706
+    int64_t next_frame_offset; /* offset of the next frame */
5707
+    /* video info */
5708
+    int pict_type; /* XXX: Put it back in AVCodecContext. */
5709
+    /**
5710
+     * This field is used for proper frame duration computation in lavf.
5711
+     * It signals, how much longer the frame duration of the current frame
5712
+     * is compared to normal frame duration.
5713
+     *
5714
+     * frame_duration = (1 + repeat_pict) * time_base
5715
+     *
5716
+     * It is used by codecs like H.264 to display telecined material.
5717
+     */
5718
+    int repeat_pict; /* XXX: Put it back in AVCodecContext. */
5719
+    int64_t pts;     /* pts of the current frame */
5720
+    int64_t dts;     /* dts of the current frame */
5721
+
5722
+    /* private data */
5723
+    int64_t last_pts;
5724
+    int64_t last_dts;
5725
+    int fetch_timestamp;
5726
+
5727
+#define AV_PARSER_PTS_NB 4
5728
+    int cur_frame_start_index;
5729
+    int64_t cur_frame_offset[AV_PARSER_PTS_NB];
5730
+    int64_t cur_frame_pts[AV_PARSER_PTS_NB];
5731
+    int64_t cur_frame_dts[AV_PARSER_PTS_NB];
5732
+
5733
+    int flags;
5734
+#define PARSER_FLAG_COMPLETE_FRAMES           0x0001
5735
+#define PARSER_FLAG_ONCE                      0x0002
5736
+/// Set if the parser has a valid file offset
5737
+#define PARSER_FLAG_FETCHED_OFFSET            0x0004
5738
+#define PARSER_FLAG_USE_CODEC_TS              0x1000
5739
+
5740
+    int64_t offset;      ///< byte offset from starting packet start
5741
+    int64_t cur_frame_end[AV_PARSER_PTS_NB];
5742
+
5743
+    /**
5744
+     * Set by parser to 1 for key frames and 0 for non-key frames.
5745
+     * It is initialized to -1, so if the parser doesn't set this flag,
5746
+     * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
5747
+     * will be used.
5748
+     */
5749
+    int key_frame;
5750
+
5751
+#if FF_API_CONVERGENCE_DURATION
5752
+    /**
5753
+     * @deprecated unused
5754
+     */
5755
+    attribute_deprecated
5756
+    int64_t convergence_duration;
5757
+#endif
5758
+
5759
+    // Timestamp generation support:
5760
+    /**
5761
+     * Synchronization point for start of timestamp generation.
5762
+     *
5763
+     * Set to >0 for sync point, 0 for no sync point and <0 for undefined
5764
+     * (default).
5765
+     *
5766
+     * For example, this corresponds to presence of H.264 buffering period
5767
+     * SEI message.
5768
+     */
5769
+    int dts_sync_point;
5770
+
5771
+    /**
5772
+     * Offset of the current timestamp against last timestamp sync point in
5773
+     * units of AVCodecContext.time_base.
5774
+     *
5775
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5776
+     * contain a valid timestamp offset.
5777
+     *
5778
+     * Note that the timestamp of sync point has usually a nonzero
5779
+     * dts_ref_dts_delta, which refers to the previous sync point. Offset of
5780
+     * the next frame after timestamp sync point will be usually 1.
5781
+     *
5782
+     * For example, this corresponds to H.264 cpb_removal_delay.
5783
+     */
5784
+    int dts_ref_dts_delta;
5785
+
5786
+    /**
5787
+     * Presentation delay of current frame in units of AVCodecContext.time_base.
5788
+     *
5789
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5790
+     * contain valid non-negative timestamp delta (presentation time of a frame
5791
+     * must not lie in the past).
5792
+     *
5793
+     * This delay represents the difference between decoding and presentation
5794
+     * time of the frame.
5795
+     *
5796
+     * For example, this corresponds to H.264 dpb_output_delay.
5797
+     */
5798
+    int pts_dts_delta;
5799
+
5800
+    /**
5801
+     * Position of the packet in file.
5802
+     *
5803
+     * Analogous to cur_frame_pts/dts
5804
+     */
5805
+    int64_t cur_frame_pos[AV_PARSER_PTS_NB];
5806
+
5807
+    /**
5808
+     * Byte position of currently parsed frame in stream.
5809
+     */
5810
+    int64_t pos;
5811
+
5812
+    /**
5813
+     * Previous frame byte position.
5814
+     */
5815
+    int64_t last_pos;
5816
+
5817
+    /**
5818
+     * Duration of the current frame.
5819
+     * For audio, this is in units of 1 / AVCodecContext.sample_rate.
5820
+     * For all other types, this is in units of AVCodecContext.time_base.
5821
+     */
5822
+    int duration;
5823
+
5824
+    enum AVFieldOrder field_order;
5825
+
5826
+    /**
5827
+     * Indicate whether a picture is coded as a frame, top field or bottom field.
5828
+     *
5829
+     * For example, H.264 field_pic_flag equal to 0 corresponds to
5830
+     * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
5831
+     * equal to 1 and bottom_field_flag equal to 0 corresponds to
5832
+     * AV_PICTURE_STRUCTURE_TOP_FIELD.
5833
+     */
5834
+    enum AVPictureStructure picture_structure;
5835
+
5836
+    /**
5837
+     * Picture number incremented in presentation or output order.
5838
+     * This field may be reinitialized at the first picture of a new sequence.
5839
+     *
5840
+     * For example, this corresponds to H.264 PicOrderCnt.
5841
+     */
5842
+    int output_picture_number;
5843
+
5844
+    /**
5845
+     * Dimensions of the decoded video intended for presentation.
5846
+     */
5847
+    int width;
5848
+    int height;
5849
+
5850
+    /**
5851
+     * Dimensions of the coded video.
5852
+     */
5853
+    int coded_width;
5854
+    int coded_height;
5855
+
5856
+    /**
5857
+     * The format of the coded data, corresponds to enum AVPixelFormat for video
5858
+     * and for enum AVSampleFormat for audio.
5859
+     *
5860
+     * Note that a decoder can have considerable freedom in how exactly it
5861
+     * decodes the data, so the format reported here might be different from the
5862
+     * one returned by a decoder.
5863
+     */
5864
+    int format;
5865
+} AVCodecParserContext;
5866
+
5867
+typedef struct AVCodecParser {
5868
+    int codec_ids[5]; /* several codec IDs are permitted */
5869
+    int priv_data_size;
5870
+    int (*parser_init)(AVCodecParserContext *s);
5871
+    /* This callback never returns an error, a negative value means that
5872
+     * the frame start was in a previous packet. */
5873
+    int (*parser_parse)(AVCodecParserContext *s,
5874
+                        AVCodecContext *avctx,
5875
+                        const uint8_t **poutbuf, int *poutbuf_size,
5876
+                        const uint8_t *buf, int buf_size);
5877
+    void (*parser_close)(AVCodecParserContext *s);
5878
+    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
5879
+    struct AVCodecParser *next;
5880
+} AVCodecParser;
5881
+
5882
+/**
5883
+ * Iterate over all registered codec parsers.
5884
+ *
5885
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
5886
+ *               point to NULL to start the iteration.
5887
+ *
5888
+ * @return the next registered codec parser or NULL when the iteration is
5889
+ *         finished
5890
+ */
5891
+const AVCodecParser *av_parser_iterate(void **opaque);
5892
+
5893
+attribute_deprecated
5894
+AVCodecParser *av_parser_next(const AVCodecParser *c);
5895
+
5896
+attribute_deprecated
5897
+void av_register_codec_parser(AVCodecParser *parser);
5898
+AVCodecParserContext *av_parser_init(int codec_id);
5899
+
5900
+/**
5901
+ * Parse a packet.
5902
+ *
5903
+ * @param s             parser context.
5904
+ * @param avctx         codec context.
5905
+ * @param poutbuf       set to pointer to parsed buffer or NULL if not yet finished.
5906
+ * @param poutbuf_size  set to size of parsed buffer or zero if not yet finished.
5907
+ * @param buf           input buffer.
5908
+ * @param buf_size      buffer size in bytes without the padding. I.e. the full buffer
5909
+                        size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
5910
+                        To signal EOF, this should be 0 (so that the last frame
5911
+                        can be output).
5912
+ * @param pts           input presentation timestamp.
5913
+ * @param dts           input decoding timestamp.
5914
+ * @param pos           input byte position in stream.
5915
+ * @return the number of bytes of the input bitstream used.
5916
+ *
5917
+ * Example:
5918
+ * @code
5919
+ *   while(in_len){
5920
+ *       len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
5921
+ *                                        in_data, in_len,
5922
+ *                                        pts, dts, pos);
5923
+ *       in_data += len;
5924
+ *       in_len  -= len;
5925
+ *
5926
+ *       if(size)
5927
+ *          decode_frame(data, size);
5928
+ *   }
5929
+ * @endcode
5930
+ */
5931
+int av_parser_parse2(AVCodecParserContext *s,
5932
+                     AVCodecContext *avctx,
5933
+                     uint8_t **poutbuf, int *poutbuf_size,
5934
+                     const uint8_t *buf, int buf_size,
5935
+                     int64_t pts, int64_t dts,
5936
+                     int64_t pos);
5937
+
5938
+/**
5939
+ * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
5940
+ * @deprecated use AVBitStreamFilter
5941
+ */
5942
+int av_parser_change(AVCodecParserContext *s,
5943
+                     AVCodecContext *avctx,
5944
+                     uint8_t **poutbuf, int *poutbuf_size,
5945
+                     const uint8_t *buf, int buf_size, int keyframe);
5946
+void av_parser_close(AVCodecParserContext *s);
5947
+
5948
+/**
5949
+ * @}
5950
+ * @}
5951
+ */
5952
+
5953
+/**
5954
+ * @addtogroup lavc_encoding
5955
+ * @{
5956
+ */
5957
+
5958
+/**
5959
+ * Find a registered encoder with a matching codec ID.
5960
+ *
5961
+ * @param id AVCodecID of the requested encoder
5962
+ * @return An encoder if one was found, NULL otherwise.
5963
+ */
5964
+AVCodec *avcodec_find_encoder(enum AVCodecID id);
5965
+
5966
+/**
5967
+ * Find a registered encoder with the specified name.
5968
+ *
5969
+ * @param name name of the requested encoder
5970
+ * @return An encoder if one was found, NULL otherwise.
5971
+ */
5972
+AVCodec *avcodec_find_encoder_by_name(const char *name);
5973
+
5974
+/**
5975
+ * Encode a frame of audio.
5976
+ *
5977
+ * Takes input samples from frame and writes the next output packet, if
5978
+ * available, to avpkt. The output packet does not necessarily contain data for
5979
+ * the most recent frame, as encoders can delay, split, and combine input frames
5980
+ * internally as needed.
5981
+ *
5982
+ * @param avctx     codec context
5983
+ * @param avpkt     output AVPacket.
5984
+ *                  The user can supply an output buffer by setting
5985
+ *                  avpkt->data and avpkt->size prior to calling the
5986
+ *                  function, but if the size of the user-provided data is not
5987
+ *                  large enough, encoding will fail. If avpkt->data and
5988
+ *                  avpkt->size are set, avpkt->destruct must also be set. All
5989
+ *                  other AVPacket fields will be reset by the encoder using
5990
+ *                  av_init_packet(). If avpkt->data is NULL, the encoder will
5991
+ *                  allocate it. The encoder will set avpkt->size to the size
5992
+ *                  of the output packet.
5993
+ *
5994
+ *                  If this function fails or produces no output, avpkt will be
5995
+ *                  freed using av_packet_unref().
5996
+ * @param[in] frame AVFrame containing the raw audio data to be encoded.
5997
+ *                  May be NULL when flushing an encoder that has the
5998
+ *                  AV_CODEC_CAP_DELAY capability set.
5999
+ *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
6000
+ *                  can have any number of samples.
6001
+ *                  If it is not set, frame->nb_samples must be equal to
6002
+ *                  avctx->frame_size for all frames except the last.
6003
+ *                  The final frame may be smaller than avctx->frame_size.
6004
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6005
+ *                            output packet is non-empty, and to 0 if it is
6006
+ *                            empty. If the function returns an error, the
6007
+ *                            packet can be assumed to be invalid, and the
6008
+ *                            value of got_packet_ptr is undefined and should
6009
+ *                            not be used.
6010
+ * @return          0 on success, negative error code on failure
6011
+ *
6012
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6013
+ */
6014
+attribute_deprecated
6015
+int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
6016
+                          const AVFrame *frame, int *got_packet_ptr);
6017
+
6018
+/**
6019
+ * Encode a frame of video.
6020
+ *
6021
+ * Takes input raw video data from frame and writes the next output packet, if
6022
+ * available, to avpkt. The output packet does not necessarily contain data for
6023
+ * the most recent frame, as encoders can delay and reorder input frames
6024
+ * internally as needed.
6025
+ *
6026
+ * @param avctx     codec context
6027
+ * @param avpkt     output AVPacket.
6028
+ *                  The user can supply an output buffer by setting
6029
+ *                  avpkt->data and avpkt->size prior to calling the
6030
+ *                  function, but if the size of the user-provided data is not
6031
+ *                  large enough, encoding will fail. All other AVPacket fields
6032
+ *                  will be reset by the encoder using av_init_packet(). If
6033
+ *                  avpkt->data is NULL, the encoder will allocate it.
6034
+ *                  The encoder will set avpkt->size to the size of the
6035
+ *                  output packet. The returned data (if any) belongs to the
6036
+ *                  caller, he is responsible for freeing it.
6037
+ *
6038
+ *                  If this function fails or produces no output, avpkt will be
6039
+ *                  freed using av_packet_unref().
6040
+ * @param[in] frame AVFrame containing the raw video data to be encoded.
6041
+ *                  May be NULL when flushing an encoder that has the
6042
+ *                  AV_CODEC_CAP_DELAY capability set.
6043
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6044
+ *                            output packet is non-empty, and to 0 if it is
6045
+ *                            empty. If the function returns an error, the
6046
+ *                            packet can be assumed to be invalid, and the
6047
+ *                            value of got_packet_ptr is undefined and should
6048
+ *                            not be used.
6049
+ * @return          0 on success, negative error code on failure
6050
+ *
6051
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6052
+ */
6053
+attribute_deprecated
6054
+int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
6055
+                          const AVFrame *frame, int *got_packet_ptr);
6056
+
6057
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
6058
+                            const AVSubtitle *sub);
6059
+
6060
+
6061
+/**
6062
+ * @}
6063
+ */
6064
+
6065
+#if FF_API_AVPICTURE
6066
+/**
6067
+ * @addtogroup lavc_picture
6068
+ * @{
6069
+ */
6070
+
6071
+/**
6072
+ * @deprecated unused
6073
+ */
6074
+attribute_deprecated
6075
+int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
6076
+
6077
+/**
6078
+ * @deprecated unused
6079
+ */
6080
+attribute_deprecated
6081
+void avpicture_free(AVPicture *picture);
6082
+
6083
+/**
6084
+ * @deprecated use av_image_fill_arrays() instead.
6085
+ */
6086
+attribute_deprecated
6087
+int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
6088
+                   enum AVPixelFormat pix_fmt, int width, int height);
6089
+
6090
+/**
6091
+ * @deprecated use av_image_copy_to_buffer() instead.
6092
+ */
6093
+attribute_deprecated
6094
+int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
6095
+                     int width, int height,
6096
+                     unsigned char *dest, int dest_size);
6097
+
6098
+/**
6099
+ * @deprecated use av_image_get_buffer_size() instead.
6100
+ */
6101
+attribute_deprecated
6102
+int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
6103
+
6104
+/**
6105
+ * @deprecated av_image_copy() instead.
6106
+ */
6107
+attribute_deprecated
6108
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
6109
+                     enum AVPixelFormat pix_fmt, int width, int height);
6110
+
6111
+/**
6112
+ * @deprecated unused
6113
+ */
6114
+attribute_deprecated
6115
+int av_picture_crop(AVPicture *dst, const AVPicture *src,
6116
+                    enum AVPixelFormat pix_fmt, int top_band, int left_band);
6117
+
6118
+/**
6119
+ * @deprecated unused
6120
+ */
6121
+attribute_deprecated
6122
+int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
6123
+            int padtop, int padbottom, int padleft, int padright, int *color);
6124
+
6125
+/**
6126
+ * @}
6127
+ */
6128
+#endif
6129
+
6130
+/**
6131
+ * @defgroup lavc_misc Utility functions
6132
+ * @ingroup libavc
6133
+ *
6134
+ * Miscellaneous utility functions related to both encoding and decoding
6135
+ * (or neither).
6136
+ * @{
6137
+ */
6138
+
6139
+/**
6140
+ * @defgroup lavc_misc_pixfmt Pixel formats
6141
+ *
6142
+ * Functions for working with pixel formats.
6143
+ * @{
6144
+ */
6145
+
6146
+#if FF_API_GETCHROMA
6147
+/**
6148
+ * @deprecated Use av_pix_fmt_get_chroma_sub_sample
6149
+ */
6150
+
6151
+attribute_deprecated
6152
+void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
6153
+#endif
6154
+
6155
+/**
6156
+ * Return a value representing the fourCC code associated to the
6157
+ * pixel format pix_fmt, or 0 if no associated fourCC code can be
6158
+ * found.
6159
+ */
6160
+unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
6161
+
6162
+/**
6163
+ * @deprecated see av_get_pix_fmt_loss()
6164
+ */
6165
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
6166
+                             int has_alpha);
6167
+
6168
+/**
6169
+ * Find the best pixel format to convert to given a certain source pixel
6170
+ * format.  When converting from one pixel format to another, information loss
6171
+ * may occur.  For example, when converting from RGB24 to GRAY, the color
6172
+ * information will be lost. Similarly, other losses occur when converting from
6173
+ * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
6174
+ * the given pixel formats should be used to suffer the least amount of loss.
6175
+ * The pixel formats from which it chooses one, are determined by the
6176
+ * pix_fmt_list parameter.
6177
+ *
6178
+ *
6179
+ * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
6180
+ * @param[in] src_pix_fmt source pixel format
6181
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
6182
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
6183
+ * @return The best pixel format to convert to or -1 if none was found.
6184
+ */
6185
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
6186
+                                            enum AVPixelFormat src_pix_fmt,
6187
+                                            int has_alpha, int *loss_ptr);
6188
+
6189
+/**
6190
+ * @deprecated see av_find_best_pix_fmt_of_2()
6191
+ */
6192
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6193
+                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6194
+
6195
+attribute_deprecated
6196
+enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6197
+                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6198
+
6199
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
6200
+
6201
+/**
6202
+ * @}
6203
+ */
6204
+
6205
+#if FF_API_TAG_STRING
6206
+/**
6207
+ * Put a string representing the codec tag codec_tag in buf.
6208
+ *
6209
+ * @param buf       buffer to place codec tag in
6210
+ * @param buf_size size in bytes of buf
6211
+ * @param codec_tag codec tag to assign
6212
+ * @return the length of the string that would have been generated if
6213
+ * enough space had been available, excluding the trailing null
6214
+ *
6215
+ * @deprecated see av_fourcc_make_string() and av_fourcc2str().
6216
+ */
6217
+attribute_deprecated
6218
+size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
6219
+#endif
6220
+
6221
+void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
6222
+
6223
+/**
6224
+ * Return a name for the specified profile, if available.
6225
+ *
6226
+ * @param codec the codec that is searched for the given profile
6227
+ * @param profile the profile value for which a name is requested
6228
+ * @return A name for the profile if found, NULL otherwise.
6229
+ */
6230
+const char *av_get_profile_name(const AVCodec *codec, int profile);
6231
+
6232
+/**
6233
+ * Return a name for the specified profile, if available.
6234
+ *
6235
+ * @param codec_id the ID of the codec to which the requested profile belongs
6236
+ * @param profile the profile value for which a name is requested
6237
+ * @return A name for the profile if found, NULL otherwise.
6238
+ *
6239
+ * @note unlike av_get_profile_name(), which searches a list of profiles
6240
+ *       supported by a specific decoder or encoder implementation, this
6241
+ *       function searches the list of profiles from the AVCodecDescriptor
6242
+ */
6243
+const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
6244
+
6245
+int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
6246
+int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
6247
+//FIXME func typedef
6248
+
6249
+/**
6250
+ * Fill AVFrame audio data and linesize pointers.
6251
+ *
6252
+ * The buffer buf must be a preallocated buffer with a size big enough
6253
+ * to contain the specified samples amount. The filled AVFrame data
6254
+ * pointers will point to this buffer.
6255
+ *
6256
+ * AVFrame extended_data channel pointers are allocated if necessary for
6257
+ * planar audio.
6258
+ *
6259
+ * @param frame       the AVFrame
6260
+ *                    frame->nb_samples must be set prior to calling the
6261
+ *                    function. This function fills in frame->data,
6262
+ *                    frame->extended_data, frame->linesize[0].
6263
+ * @param nb_channels channel count
6264
+ * @param sample_fmt  sample format
6265
+ * @param buf         buffer to use for frame data
6266
+ * @param buf_size    size of buffer
6267
+ * @param align       plane size sample alignment (0 = default)
6268
+ * @return            >=0 on success, negative error code on failure
6269
+ * @todo return the size in bytes required to store the samples in
6270
+ * case of success, at the next libavutil bump
6271
+ */
6272
+int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
6273
+                             enum AVSampleFormat sample_fmt, const uint8_t *buf,
6274
+                             int buf_size, int align);
6275
+
6276
+/**
6277
+ * Reset the internal decoder state / flush internal buffers. Should be called
6278
+ * e.g. when seeking or when switching to a different stream.
6279
+ *
6280
+ * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
6281
+ * this invalidates the frames previously returned from the decoder. When
6282
+ * refcounted frames are used, the decoder just releases any references it might
6283
+ * keep internally, but the caller's reference remains valid.
6284
+ */
6285
+void avcodec_flush_buffers(AVCodecContext *avctx);
6286
+
6287
+/**
6288
+ * Return codec bits per sample.
6289
+ *
6290
+ * @param[in] codec_id the codec
6291
+ * @return Number of bits per sample or zero if unknown for the given codec.
6292
+ */
6293
+int av_get_bits_per_sample(enum AVCodecID codec_id);
6294
+
6295
+/**
6296
+ * Return the PCM codec associated with a sample format.
6297
+ * @param be  endianness, 0 for little, 1 for big,
6298
+ *            -1 (or anything else) for native
6299
+ * @return  AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
6300
+ */
6301
+enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
6302
+
6303
+/**
6304
+ * Return codec bits per sample.
6305
+ * Only return non-zero if the bits per sample is exactly correct, not an
6306
+ * approximation.
6307
+ *
6308
+ * @param[in] codec_id the codec
6309
+ * @return Number of bits per sample or zero if unknown for the given codec.
6310
+ */
6311
+int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
6312
+
6313
+/**
6314
+ * Return audio frame duration.
6315
+ *
6316
+ * @param avctx        codec context
6317
+ * @param frame_bytes  size of the frame, or 0 if unknown
6318
+ * @return             frame duration, in samples, if known. 0 if not able to
6319
+ *                     determine.
6320
+ */
6321
+int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
6322
+
6323
+/**
6324
+ * This function is the same as av_get_audio_frame_duration(), except it works
6325
+ * with AVCodecParameters instead of an AVCodecContext.
6326
+ */
6327
+int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
6328
+
6329
+#if FF_API_OLD_BSF
6330
+typedef struct AVBitStreamFilterContext {
6331
+    void *priv_data;
6332
+    const struct AVBitStreamFilter *filter;
6333
+    AVCodecParserContext *parser;
6334
+    struct AVBitStreamFilterContext *next;
6335
+    /**
6336
+     * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
6337
+     * Not for access by library users.
6338
+     */
6339
+    char *args;
6340
+} AVBitStreamFilterContext;
6341
+#endif
6342
+
6343
+typedef struct AVBSFInternal AVBSFInternal;
6344
+
6345
+/**
6346
+ * The bitstream filter state.
6347
+ *
6348
+ * This struct must be allocated with av_bsf_alloc() and freed with
6349
+ * av_bsf_free().
6350
+ *
6351
+ * The fields in the struct will only be changed (by the caller or by the
6352
+ * filter) as described in their documentation, and are to be considered
6353
+ * immutable otherwise.
6354
+ */
6355
+typedef struct AVBSFContext {
6356
+    /**
6357
+     * A class for logging and AVOptions
6358
+     */
6359
+    const AVClass *av_class;
6360
+
6361
+    /**
6362
+     * The bitstream filter this context is an instance of.
6363
+     */
6364
+    const struct AVBitStreamFilter *filter;
6365
+
6366
+    /**
6367
+     * Opaque libavcodec internal data. Must not be touched by the caller in any
6368
+     * way.
6369
+     */
6370
+    AVBSFInternal *internal;
6371
+
6372
+    /**
6373
+     * Opaque filter-specific private data. If filter->priv_class is non-NULL,
6374
+     * this is an AVOptions-enabled struct.
6375
+     */
6376
+    void *priv_data;
6377
+
6378
+    /**
6379
+     * Parameters of the input stream. This field is allocated in
6380
+     * av_bsf_alloc(), it needs to be filled by the caller before
6381
+     * av_bsf_init().
6382
+     */
6383
+    AVCodecParameters *par_in;
6384
+
6385
+    /**
6386
+     * Parameters of the output stream. This field is allocated in
6387
+     * av_bsf_alloc(), it is set by the filter in av_bsf_init().
6388
+     */
6389
+    AVCodecParameters *par_out;
6390
+
6391
+    /**
6392
+     * The timebase used for the timestamps of the input packets. Set by the
6393
+     * caller before av_bsf_init().
6394
+     */
6395
+    AVRational time_base_in;
6396
+
6397
+    /**
6398
+     * The timebase used for the timestamps of the output packets. Set by the
6399
+     * filter in av_bsf_init().
6400
+     */
6401
+    AVRational time_base_out;
6402
+} AVBSFContext;
6403
+
6404
+typedef struct AVBitStreamFilter {
6405
+    const char *name;
6406
+
6407
+    /**
6408
+     * A list of codec ids supported by the filter, terminated by
6409
+     * AV_CODEC_ID_NONE.
6410
+     * May be NULL, in that case the bitstream filter works with any codec id.
6411
+     */
6412
+    const enum AVCodecID *codec_ids;
6413
+
6414
+    /**
6415
+     * A class for the private data, used to declare bitstream filter private
6416
+     * AVOptions. This field is NULL for bitstream filters that do not declare
6417
+     * any options.
6418
+     *
6419
+     * If this field is non-NULL, the first member of the filter private data
6420
+     * must be a pointer to AVClass, which will be set by libavcodec generic
6421
+     * code to this class.
6422
+     */
6423
+    const AVClass *priv_class;
6424
+
6425
+    /*****************************************************************
6426
+     * No fields below this line are part of the public API. They
6427
+     * may not be used outside of libavcodec and can be changed and
6428
+     * removed at will.
6429
+     * New public fields should be added right above.
6430
+     *****************************************************************
6431
+     */
6432
+
6433
+    int priv_data_size;
6434
+    int (*init)(AVBSFContext *ctx);
6435
+    int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
6436
+    void (*close)(AVBSFContext *ctx);
6437
+} AVBitStreamFilter;
6438
+
6439
+#if FF_API_OLD_BSF
6440
+/**
6441
+ * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6442
+ * is deprecated. Use the new bitstream filtering API (using AVBSFContext).
6443
+ */
6444
+attribute_deprecated
6445
+void av_register_bitstream_filter(AVBitStreamFilter *bsf);
6446
+/**
6447
+ * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6448
+ * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init()
6449
+ * from the new bitstream filtering API (using AVBSFContext).
6450
+ */
6451
+attribute_deprecated
6452
+AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
6453
+/**
6454
+ * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6455
+ * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the
6456
+ * new bitstream filtering API (using AVBSFContext).
6457
+ */
6458
+attribute_deprecated
6459
+int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
6460
+                               AVCodecContext *avctx, const char *args,
6461
+                               uint8_t **poutbuf, int *poutbuf_size,
6462
+                               const uint8_t *buf, int buf_size, int keyframe);
6463
+/**
6464
+ * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6465
+ * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using
6466
+ * AVBSFContext).
6467
+ */
6468
+attribute_deprecated
6469
+void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
6470
+/**
6471
+ * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6472
+ * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using
6473
+ * AVBSFContext).
6474
+ */
6475
+attribute_deprecated
6476
+const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
6477
+#endif
6478
+
6479
+/**
6480
+ * @return a bitstream filter with the specified name or NULL if no such
6481
+ *         bitstream filter exists.
6482
+ */
6483
+const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
6484
+
6485
+/**
6486
+ * Iterate over all registered bitstream filters.
6487
+ *
6488
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
6489
+ *               point to NULL to start the iteration.
6490
+ *
6491
+ * @return the next registered bitstream filter or NULL when the iteration is
6492
+ *         finished
6493
+ */
6494
+const AVBitStreamFilter *av_bsf_iterate(void **opaque);
6495
+#if FF_API_NEXT
6496
+attribute_deprecated
6497
+const AVBitStreamFilter *av_bsf_next(void **opaque);
6498
+#endif
6499
+
6500
+/**
6501
+ * Allocate a context for a given bitstream filter. The caller must fill in the
6502
+ * context parameters as described in the documentation and then call
6503
+ * av_bsf_init() before sending any data to the filter.
6504
+ *
6505
+ * @param filter the filter for which to allocate an instance.
6506
+ * @param ctx a pointer into which the pointer to the newly-allocated context
6507
+ *            will be written. It must be freed with av_bsf_free() after the
6508
+ *            filtering is done.
6509
+ *
6510
+ * @return 0 on success, a negative AVERROR code on failure
6511
+ */
6512
+int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
6513
+
6514
+/**
6515
+ * Prepare the filter for use, after all the parameters and options have been
6516
+ * set.
6517
+ */
6518
+int av_bsf_init(AVBSFContext *ctx);
6519
+
6520
+/**
6521
+ * Submit a packet for filtering.
6522
+ *
6523
+ * After sending each packet, the filter must be completely drained by calling
6524
+ * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
6525
+ * AVERROR_EOF.
6526
+ *
6527
+ * @param pkt the packet to filter. The bitstream filter will take ownership of
6528
+ * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
6529
+ * This parameter may be NULL, which signals the end of the stream (i.e. no more
6530
+ * packets will be sent). That will cause the filter to output any packets it
6531
+ * may have buffered internally.
6532
+ *
6533
+ * @return 0 on success, a negative AVERROR on error.
6534
+ */
6535
+int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
6536
+
6537
+/**
6538
+ * Retrieve a filtered packet.
6539
+ *
6540
+ * @param[out] pkt this struct will be filled with the contents of the filtered
6541
+ *                 packet. It is owned by the caller and must be freed using
6542
+ *                 av_packet_unref() when it is no longer needed.
6543
+ *                 This parameter should be "clean" (i.e. freshly allocated
6544
+ *                 with av_packet_alloc() or unreffed with av_packet_unref())
6545
+ *                 when this function is called. If this function returns
6546
+ *                 successfully, the contents of pkt will be completely
6547
+ *                 overwritten by the returned data. On failure, pkt is not
6548
+ *                 touched.
6549
+ *
6550
+ * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the
6551
+ * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there
6552
+ * will be no further output from the filter. Another negative AVERROR value if
6553
+ * an error occurs.
6554
+ *
6555
+ * @note one input packet may result in several output packets, so after sending
6556
+ * a packet with av_bsf_send_packet(), this function needs to be called
6557
+ * repeatedly until it stops returning 0. It is also possible for a filter to
6558
+ * output fewer packets than were sent to it, so this function may return
6559
+ * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
6560
+ */
6561
+int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
6562
+
6563
+/**
6564
+ * Free a bitstream filter context and everything associated with it; write NULL
6565
+ * into the supplied pointer.
6566
+ */
6567
+void av_bsf_free(AVBSFContext **ctx);
6568
+
6569
+/**
6570
+ * Get the AVClass for AVBSFContext. It can be used in combination with
6571
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
6572
+ *
6573
+ * @see av_opt_find().
6574
+ */
6575
+const AVClass *av_bsf_get_class(void);
6576
+
6577
+/**
6578
+ * Structure for chain/list of bitstream filters.
6579
+ * Empty list can be allocated by av_bsf_list_alloc().
6580
+ */
6581
+typedef struct AVBSFList AVBSFList;
6582
+
6583
+/**
6584
+ * Allocate empty list of bitstream filters.
6585
+ * The list must be later freed by av_bsf_list_free()
6586
+ * or finalized by av_bsf_list_finalize().
6587
+ *
6588
+ * @return Pointer to @ref AVBSFList on success, NULL in case of failure
6589
+ */
6590
+AVBSFList *av_bsf_list_alloc(void);
6591
+
6592
+/**
6593
+ * Free list of bitstream filters.
6594
+ *
6595
+ * @param lst Pointer to pointer returned by av_bsf_list_alloc()
6596
+ */
6597
+void av_bsf_list_free(AVBSFList **lst);
6598
+
6599
+/**
6600
+ * Append bitstream filter to the list of bitstream filters.
6601
+ *
6602
+ * @param lst List to append to
6603
+ * @param bsf Filter context to be appended
6604
+ *
6605
+ * @return >=0 on success, negative AVERROR in case of failure
6606
+ */
6607
+int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
6608
+
6609
+/**
6610
+ * Construct new bitstream filter context given it's name and options
6611
+ * and append it to the list of bitstream filters.
6612
+ *
6613
+ * @param lst      List to append to
6614
+ * @param bsf_name Name of the bitstream filter
6615
+ * @param options  Options for the bitstream filter, can be set to NULL
6616
+ *
6617
+ * @return >=0 on success, negative AVERROR in case of failure
6618
+ */
6619
+int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
6620
+/**
6621
+ * Finalize list of bitstream filters.
6622
+ *
6623
+ * This function will transform @ref AVBSFList to single @ref AVBSFContext,
6624
+ * so the whole chain of bitstream filters can be treated as single filter
6625
+ * freshly allocated by av_bsf_alloc().
6626
+ * If the call is successful, @ref AVBSFList structure is freed and lst
6627
+ * will be set to NULL. In case of failure, caller is responsible for
6628
+ * freeing the structure by av_bsf_list_free()
6629
+ *
6630
+ * @param      lst Filter list structure to be transformed
6631
+ * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6632
+ *                 representing the chain of bitstream filters
6633
+ *
6634
+ * @return >=0 on success, negative AVERROR in case of failure
6635
+ */
6636
+int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
6637
+
6638
+/**
6639
+ * Parse string describing list of bitstream filters and create single
6640
+ * @ref AVBSFContext describing the whole chain of bitstream filters.
6641
+ * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
6642
+ * allocated by av_bsf_alloc().
6643
+ *
6644
+ * @param      str String describing chain of bitstream filters in format
6645
+ *                 `bsf1[=opt1=val1:opt2=val2][,bsf2]`
6646
+ * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6647
+ *                 representing the chain of bitstream filters
6648
+ *
6649
+ * @return >=0 on success, negative AVERROR in case of failure
6650
+ */
6651
+int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
6652
+
6653
+/**
6654
+ * Get null/pass-through bitstream filter.
6655
+ *
6656
+ * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
6657
+ *
6658
+ * @return
6659
+ */
6660
+int av_bsf_get_null_filter(AVBSFContext **bsf);
6661
+
6662
+/* memory */
6663
+
6664
+/**
6665
+ * Same behaviour av_fast_malloc but the buffer has additional
6666
+ * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
6667
+ *
6668
+ * In addition the whole buffer will initially and after resizes
6669
+ * be 0-initialized so that no uninitialized data will ever appear.
6670
+ */
6671
+void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
6672
+
6673
+/**
6674
+ * Same behaviour av_fast_padded_malloc except that buffer will always
6675
+ * be 0-initialized after call.
6676
+ */
6677
+void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
6678
+
6679
+/**
6680
+ * Encode extradata length to a buffer. Used by xiph codecs.
6681
+ *
6682
+ * @param s buffer to write to; must be at least (v/255+1) bytes long
6683
+ * @param v size of extradata in bytes
6684
+ * @return number of bytes written to the buffer.
6685
+ */
6686
+unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
6687
+
6688
+#if FF_API_USER_VISIBLE_AVHWACCEL
6689
+/**
6690
+ * Register the hardware accelerator hwaccel.
6691
+ *
6692
+ * @deprecated  This function doesn't do anything.
6693
+ */
6694
+attribute_deprecated
6695
+void av_register_hwaccel(AVHWAccel *hwaccel);
6696
+
6697
+/**
6698
+ * If hwaccel is NULL, returns the first registered hardware accelerator,
6699
+ * if hwaccel is non-NULL, returns the next registered hardware accelerator
6700
+ * after hwaccel, or NULL if hwaccel is the last one.
6701
+ *
6702
+ * @deprecated  AVHWaccel structures contain no user-serviceable parts, so
6703
+ *              this function should not be used.
6704
+ */
6705
+attribute_deprecated
6706
+AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
6707
+#endif
6708
+
6709
+#if FF_API_LOCKMGR
6710
+/**
6711
+ * Lock operation used by lockmgr
6712
+ *
6713
+ * @deprecated Deprecated together with av_lockmgr_register().
6714
+ */
6715
+enum AVLockOp {
6716
+  AV_LOCK_CREATE,  ///< Create a mutex
6717
+  AV_LOCK_OBTAIN,  ///< Lock the mutex
6718
+  AV_LOCK_RELEASE, ///< Unlock the mutex
6719
+  AV_LOCK_DESTROY, ///< Free mutex resources
6720
+};
6721
+
6722
+/**
6723
+ * Register a user provided lock manager supporting the operations
6724
+ * specified by AVLockOp. The "mutex" argument to the function points
6725
+ * to a (void *) where the lockmgr should store/get a pointer to a user
6726
+ * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
6727
+ * value left by the last call for all other ops. If the lock manager is
6728
+ * unable to perform the op then it should leave the mutex in the same
6729
+ * state as when it was called and return a non-zero value. However,
6730
+ * when called with AV_LOCK_DESTROY the mutex will always be assumed to
6731
+ * have been successfully destroyed. If av_lockmgr_register succeeds
6732
+ * it will return a non-negative value, if it fails it will return a
6733
+ * negative value and destroy all mutex and unregister all callbacks.
6734
+ * av_lockmgr_register is not thread-safe, it must be called from a
6735
+ * single thread before any calls which make use of locking are used.
6736
+ *
6737
+ * @param cb User defined callback. av_lockmgr_register invokes calls
6738
+ *           to this callback and the previously registered callback.
6739
+ *           The callback will be used to create more than one mutex
6740
+ *           each of which must be backed by its own underlying locking
6741
+ *           mechanism (i.e. do not use a single static object to
6742
+ *           implement your lock manager). If cb is set to NULL the
6743
+ *           lockmgr will be unregistered.
6744
+ *
6745
+ * @deprecated This function does nothing, and always returns 0. Be sure to
6746
+ *             build with thread support to get basic thread safety.
6747
+ */
6748
+attribute_deprecated
6749
+int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
6750
+#endif
6751
+
6752
+/**
6753
+ * Get the type of the given codec.
6754
+ */
6755
+enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
6756
+
6757
+/**
6758
+ * Get the name of a codec.
6759
+ * @return  a static string identifying the codec; never NULL
6760
+ */
6761
+const char *avcodec_get_name(enum AVCodecID id);
6762
+
6763
+/**
6764
+ * @return a positive value if s is open (i.e. avcodec_open2() was called on it
6765
+ * with no corresponding avcodec_close()), 0 otherwise.
6766
+ */
6767
+int avcodec_is_open(AVCodecContext *s);
6768
+
6769
+/**
6770
+ * @return a non-zero number if codec is an encoder, zero otherwise
6771
+ */
6772
+int av_codec_is_encoder(const AVCodec *codec);
6773
+
6774
+/**
6775
+ * @return a non-zero number if codec is a decoder, zero otherwise
6776
+ */
6777
+int av_codec_is_decoder(const AVCodec *codec);
6778
+
6779
+/**
6780
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
6781
+ */
6782
+const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
6783
+
6784
+/**
6785
+ * Iterate over all codec descriptors known to libavcodec.
6786
+ *
6787
+ * @param prev previous descriptor. NULL to get the first descriptor.
6788
+ *
6789
+ * @return next descriptor or NULL after the last descriptor
6790
+ */
6791
+const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
6792
+
6793
+/**
6794
+ * @return codec descriptor with the given name or NULL if no such descriptor
6795
+ *         exists.
6796
+ */
6797
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
6798
+
6799
+/**
6800
+ * Allocate a CPB properties structure and initialize its fields to default
6801
+ * values.
6802
+ *
6803
+ * @param size if non-NULL, the size of the allocated struct will be written
6804
+ *             here. This is useful for embedding it in side data.
6805
+ *
6806
+ * @return the newly allocated struct or NULL on failure
6807
+ */
6808
+AVCPBProperties *av_cpb_properties_alloc(size_t *size);
6809
+
6810
+/**
6811
+ * @}
6812
+ */
6813
+
6814
+#endif /* AVCODEC_AVCODEC_H */
6815
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6816
new file mode 100644
6817
index 000000000000..0c0f9b8d8dae
6818
--- /dev/null
6819
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6820
@@ -0,0 +1,118 @@
6821
+/*
6822
+ * This file is part of FFmpeg.
6823
+ *
6824
+ * FFmpeg is free software; you can redistribute it and/or
6825
+ * modify it under the terms of the GNU Lesser General Public
6826
+ * License as published by the Free Software Foundation; either
6827
+ * version 2.1 of the License, or (at your option) any later version.
6828
+ *
6829
+ * FFmpeg is distributed in the hope that it will be useful,
6830
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6831
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6832
+ * Lesser General Public License for more details.
6833
+ *
6834
+ * You should have received a copy of the GNU Lesser General Public
6835
+ * License along with FFmpeg; if not, write to the Free Software
6836
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6837
+ */
6838
+
6839
+#ifndef AVCODEC_AVFFT_H
6840
+#define AVCODEC_AVFFT_H
6841
+
6842
+/**
6843
+ * @file
6844
+ * @ingroup lavc_fft
6845
+ * FFT functions
6846
+ */
6847
+
6848
+/**
6849
+ * @defgroup lavc_fft FFT functions
6850
+ * @ingroup lavc_misc
6851
+ *
6852
+ * @{
6853
+ */
6854
+
6855
+typedef float FFTSample;
6856
+
6857
+typedef struct FFTComplex {
6858
+    FFTSample re, im;
6859
+} FFTComplex;
6860
+
6861
+typedef struct FFTContext FFTContext;
6862
+
6863
+/**
6864
+ * Set up a complex FFT.
6865
+ * @param nbits           log2 of the length of the input array
6866
+ * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
6867
+ */
6868
+FFTContext *av_fft_init(int nbits, int inverse);
6869
+
6870
+/**
6871
+ * Do the permutation needed BEFORE calling ff_fft_calc().
6872
+ */
6873
+void av_fft_permute(FFTContext *s, FFTComplex *z);
6874
+
6875
+/**
6876
+ * Do a complex FFT with the parameters defined in av_fft_init(). The
6877
+ * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
6878
+ */
6879
+void av_fft_calc(FFTContext *s, FFTComplex *z);
6880
+
6881
+void av_fft_end(FFTContext *s);
6882
+
6883
+FFTContext *av_mdct_init(int nbits, int inverse, double scale);
6884
+void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6885
+void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
6886
+void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6887
+void av_mdct_end(FFTContext *s);
6888
+
6889
+/* Real Discrete Fourier Transform */
6890
+
6891
+enum RDFTransformType {
6892
+    DFT_R2C,
6893
+    IDFT_C2R,
6894
+    IDFT_R2C,
6895
+    DFT_C2R,
6896
+};
6897
+
6898
+typedef struct RDFTContext RDFTContext;
6899
+
6900
+/**
6901
+ * Set up a real FFT.
6902
+ * @param nbits           log2 of the length of the input array
6903
+ * @param trans           the type of transform
6904
+ */
6905
+RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
6906
+void av_rdft_calc(RDFTContext *s, FFTSample *data);
6907
+void av_rdft_end(RDFTContext *s);
6908
+
6909
+/* Discrete Cosine Transform */
6910
+
6911
+typedef struct DCTContext DCTContext;
6912
+
6913
+enum DCTTransformType {
6914
+    DCT_II = 0,
6915
+    DCT_III,
6916
+    DCT_I,
6917
+    DST_I,
6918
+};
6919
+
6920
+/**
6921
+ * Set up DCT.
6922
+ *
6923
+ * @param nbits           size of the input array:
6924
+ *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
6925
+ *                        (1 << nbits) + 1 for DCT-I
6926
+ * @param type            the type of transform
6927
+ *
6928
+ * @note the first element of the input of DST-I is ignored
6929
+ */
6930
+DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
6931
+void av_dct_calc(DCTContext *s, FFTSample *data);
6932
+void av_dct_end (DCTContext *s);
6933
+
6934
+/**
6935
+ * @}
6936
+ */
6937
+
6938
+#endif /* AVCODEC_AVFFT_H */
6939
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6940
new file mode 100644
6941
index 000000000000..2cf7da5889ab
6942
--- /dev/null
6943
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6944
@@ -0,0 +1,86 @@
6945
+/*
6946
+ * Video Acceleration API (shared data between FFmpeg and the video player)
6947
+ * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
6948
+ *
6949
+ * Copyright (C) 2008-2009 Splitted-Desktop Systems
6950
+ *
6951
+ * This file is part of FFmpeg.
6952
+ *
6953
+ * FFmpeg is free software; you can redistribute it and/or
6954
+ * modify it under the terms of the GNU Lesser General Public
6955
+ * License as published by the Free Software Foundation; either
6956
+ * version 2.1 of the License, or (at your option) any later version.
6957
+ *
6958
+ * FFmpeg is distributed in the hope that it will be useful,
6959
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6960
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6961
+ * Lesser General Public License for more details.
6962
+ *
6963
+ * You should have received a copy of the GNU Lesser General Public
6964
+ * License along with FFmpeg; if not, write to the Free Software
6965
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6966
+ */
6967
+
6968
+#ifndef AVCODEC_VAAPI_H
6969
+#define AVCODEC_VAAPI_H
6970
+
6971
+/**
6972
+ * @file
6973
+ * @ingroup lavc_codec_hwaccel_vaapi
6974
+ * Public libavcodec VA API header.
6975
+ */
6976
+
6977
+#include <stdint.h>
6978
+#include "libavutil/attributes.h"
6979
+#include "version.h"
6980
+
6981
+#if FF_API_STRUCT_VAAPI_CONTEXT
6982
+
6983
+/**
6984
+ * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
6985
+ * @ingroup lavc_codec_hwaccel
6986
+ * @{
6987
+ */
6988
+
6989
+/**
6990
+ * This structure is used to share data between the FFmpeg library and
6991
+ * the client video application.
6992
+ * This shall be zero-allocated and available as
6993
+ * AVCodecContext.hwaccel_context. All user members can be set once
6994
+ * during initialization or through each AVCodecContext.get_buffer()
6995
+ * function call. In any case, they must be valid prior to calling
6996
+ * decoding functions.
6997
+ *
6998
+ * Deprecated: use AVCodecContext.hw_frames_ctx instead.
6999
+ */
7000
+struct attribute_deprecated vaapi_context {
7001
+    /**
7002
+     * Window system dependent data
7003
+     *
7004
+     * - encoding: unused
7005
+     * - decoding: Set by user
7006
+     */
7007
+    void *display;
7008
+
7009
+    /**
7010
+     * Configuration ID
7011
+     *
7012
+     * - encoding: unused
7013
+     * - decoding: Set by user
7014
+     */
7015
+    uint32_t config_id;
7016
+
7017
+    /**
7018
+     * Context ID (video decode pipeline)
7019
+     *
7020
+     * - encoding: unused
7021
+     * - decoding: Set by user
7022
+     */
7023
+    uint32_t context_id;
7024
+};
7025
+
7026
+/* @} */
7027
+
7028
+#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
7029
+
7030
+#endif /* AVCODEC_VAAPI_H */
7031
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7032
new file mode 100644
7033
index 000000000000..4d9994336911
7034
--- /dev/null
7035
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7036
@@ -0,0 +1,176 @@
7037
+/*
7038
+ * The Video Decode and Presentation API for UNIX (VDPAU) is used for
7039
+ * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
7040
+ *
7041
+ * Copyright (C) 2008 NVIDIA
7042
+ *
7043
+ * This file is part of FFmpeg.
7044
+ *
7045
+ * FFmpeg is free software; you can redistribute it and/or
7046
+ * modify it under the terms of the GNU Lesser General Public
7047
+ * License as published by the Free Software Foundation; either
7048
+ * version 2.1 of the License, or (at your option) any later version.
7049
+ *
7050
+ * FFmpeg is distributed in the hope that it will be useful,
7051
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7052
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7053
+ * Lesser General Public License for more details.
7054
+ *
7055
+ * You should have received a copy of the GNU Lesser General Public
7056
+ * License along with FFmpeg; if not, write to the Free Software
7057
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7058
+ */
7059
+
7060
+#ifndef AVCODEC_VDPAU_H
7061
+#define AVCODEC_VDPAU_H
7062
+
7063
+/**
7064
+ * @file
7065
+ * @ingroup lavc_codec_hwaccel_vdpau
7066
+ * Public libavcodec VDPAU header.
7067
+ */
7068
+
7069
+
7070
+/**
7071
+ * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
7072
+ * @ingroup lavc_codec_hwaccel
7073
+ *
7074
+ * VDPAU hardware acceleration has two modules
7075
+ * - VDPAU decoding
7076
+ * - VDPAU presentation
7077
+ *
7078
+ * The VDPAU decoding module parses all headers using FFmpeg
7079
+ * parsing mechanisms and uses VDPAU for the actual decoding.
7080
+ *
7081
+ * As per the current implementation, the actual decoding
7082
+ * and rendering (API calls) are done as part of the VDPAU
7083
+ * presentation (vo_vdpau.c) module.
7084
+ *
7085
+ * @{
7086
+ */
7087
+
7088
+#include <vdpau/vdpau.h>
7089
+
7090
+#include "libavutil/avconfig.h"
7091
+#include "libavutil/attributes.h"
7092
+
7093
+#include "avcodec.h"
7094
+#include "version.h"
7095
+
7096
+struct AVCodecContext;
7097
+struct AVFrame;
7098
+
7099
+typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
7100
+                               const VdpPictureInfo *, uint32_t,
7101
+                               const VdpBitstreamBuffer *);
7102
+
7103
+/**
7104
+ * This structure is used to share data between the libavcodec library and
7105
+ * the client video application.
7106
+ * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
7107
+ * function and make it available as
7108
+ * AVCodecContext.hwaccel_context. Members can be set by the user once
7109
+ * during initialization or through each AVCodecContext.get_buffer()
7110
+ * function call. In any case, they must be valid prior to calling
7111
+ * decoding functions.
7112
+ *
7113
+ * The size of this structure is not a part of the public ABI and must not
7114
+ * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
7115
+ * AVVDPAUContext.
7116
+ */
7117
+typedef struct AVVDPAUContext {
7118
+    /**
7119
+     * VDPAU decoder handle
7120
+     *
7121
+     * Set by user.
7122
+     */
7123
+    VdpDecoder decoder;
7124
+
7125
+    /**
7126
+     * VDPAU decoder render callback
7127
+     *
7128
+     * Set by the user.
7129
+     */
7130
+    VdpDecoderRender *render;
7131
+
7132
+    AVVDPAU_Render2 render2;
7133
+} AVVDPAUContext;
7134
+
7135
+/**
7136
+ * @brief allocation function for AVVDPAUContext
7137
+ *
7138
+ * Allows extending the struct without breaking API/ABI
7139
+ */
7140
+AVVDPAUContext *av_alloc_vdpaucontext(void);
7141
+
7142
+AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
7143
+void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
7144
+
7145
+/**
7146
+ * Associate a VDPAU device with a codec context for hardware acceleration.
7147
+ * This function is meant to be called from the get_format() codec callback,
7148
+ * or earlier. It can also be called after avcodec_flush_buffers() to change
7149
+ * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
7150
+ * display preemption).
7151
+ *
7152
+ * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
7153
+ * successfully.
7154
+ *
7155
+ * @param avctx decoding context whose get_format() callback is invoked
7156
+ * @param device VDPAU device handle to use for hardware acceleration
7157
+ * @param get_proc_address VDPAU device driver
7158
+ * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
7159
+ *
7160
+ * @return 0 on success, an AVERROR code on failure.
7161
+ */
7162
+int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
7163
+                          VdpGetProcAddress *get_proc_address, unsigned flags);
7164
+
7165
+/**
7166
+ * Gets the parameters to create an adequate VDPAU video surface for the codec
7167
+ * context using VDPAU hardware decoding acceleration.
7168
+ *
7169
+ * @note Behavior is undefined if the context was not successfully bound to a
7170
+ * VDPAU device using av_vdpau_bind_context().
7171
+ *
7172
+ * @param avctx the codec context being used for decoding the stream
7173
+ * @param type storage space for the VDPAU video surface chroma type
7174
+ *              (or NULL to ignore)
7175
+ * @param width storage space for the VDPAU video surface pixel width
7176
+ *              (or NULL to ignore)
7177
+ * @param height storage space for the VDPAU video surface pixel height
7178
+ *              (or NULL to ignore)
7179
+ *
7180
+ * @return 0 on success, a negative AVERROR code on failure.
7181
+ */
7182
+int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
7183
+                                    uint32_t *width, uint32_t *height);
7184
+
7185
+/**
7186
+ * Allocate an AVVDPAUContext.
7187
+ *
7188
+ * @return Newly-allocated AVVDPAUContext or NULL on failure.
7189
+ */
7190
+AVVDPAUContext *av_vdpau_alloc_context(void);
7191
+
7192
+#if FF_API_VDPAU_PROFILE
7193
+/**
7194
+ * Get a decoder profile that should be used for initializing a VDPAU decoder.
7195
+ * Should be called from the AVCodecContext.get_format() callback.
7196
+ *
7197
+ * @deprecated Use av_vdpau_bind_context() instead.
7198
+ *
7199
+ * @param avctx the codec context being used for decoding the stream
7200
+ * @param profile a pointer into which the result will be written on success.
7201
+ *                The contents of profile are undefined if this function returns
7202
+ *                an error.
7203
+ *
7204
+ * @return 0 on success (non-negative), a negative AVERROR on failure.
7205
+ */
7206
+attribute_deprecated
7207
+int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
7208
+#endif
7209
+
7210
+/* @}*/
7211
+
7212
+#endif /* AVCODEC_VDPAU_H */
7213
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7214
new file mode 100644
7215
index 000000000000..6895f1a461e3
7216
--- /dev/null
7217
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7218
@@ -0,0 +1,137 @@
7219
+/*
7220
+ * This file is part of FFmpeg.
7221
+ *
7222
+ * FFmpeg is free software; you can redistribute it and/or
7223
+ * modify it under the terms of the GNU Lesser General Public
7224
+ * License as published by the Free Software Foundation; either
7225
+ * version 2.1 of the License, or (at your option) any later version.
7226
+ *
7227
+ * FFmpeg is distributed in the hope that it will be useful,
7228
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7229
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7230
+ * Lesser General Public License for more details.
7231
+ *
7232
+ * You should have received a copy of the GNU Lesser General Public
7233
+ * License along with FFmpeg; if not, write to the Free Software
7234
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7235
+ */
7236
+
7237
+#ifndef AVCODEC_VERSION_H
7238
+#define AVCODEC_VERSION_H
7239
+
7240
+/**
7241
+ * @file
7242
+ * @ingroup libavc
7243
+ * Libavcodec version macros.
7244
+ */
7245
+
7246
+#include "libavutil/version.h"
7247
+
7248
+#define LIBAVCODEC_VERSION_MAJOR  58
7249
+#define LIBAVCODEC_VERSION_MINOR  18
7250
+#define LIBAVCODEC_VERSION_MICRO 100
7251
+
7252
+#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
7253
+                                               LIBAVCODEC_VERSION_MINOR, \
7254
+                                               LIBAVCODEC_VERSION_MICRO)
7255
+#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
7256
+                                           LIBAVCODEC_VERSION_MINOR,    \
7257
+                                           LIBAVCODEC_VERSION_MICRO)
7258
+#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
7259
+
7260
+#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
7261
+
7262
+/**
7263
+ * FF_API_* defines may be placed below to indicate public API that will be
7264
+ * dropped at a future version bump. The defines themselves are not part of
7265
+ * the public API and may change, break or disappear at any time.
7266
+ *
7267
+ * @note, when bumping the major version it is recommended to manually
7268
+ * disable each FF_API_* in its own commit instead of disabling them all
7269
+ * at once through the bump. This improves the git bisect-ability of the change.
7270
+ */
7271
+
7272
+#ifndef FF_API_LOWRES
7273
+#define FF_API_LOWRES            (LIBAVCODEC_VERSION_MAJOR < 59)
7274
+#endif
7275
+#ifndef FF_API_DEBUG_MV
7276
+#define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 58)
7277
+#endif
7278
+#ifndef FF_API_AVCTX_TIMEBASE
7279
+#define FF_API_AVCTX_TIMEBASE    (LIBAVCODEC_VERSION_MAJOR < 59)
7280
+#endif
7281
+#ifndef FF_API_CODED_FRAME
7282
+#define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
7283
+#endif
7284
+#ifndef FF_API_SIDEDATA_ONLY_PKT
7285
+#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
7286
+#endif
7287
+#ifndef FF_API_VDPAU_PROFILE
7288
+#define FF_API_VDPAU_PROFILE     (LIBAVCODEC_VERSION_MAJOR < 59)
7289
+#endif
7290
+#ifndef FF_API_CONVERGENCE_DURATION
7291
+#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
7292
+#endif
7293
+#ifndef FF_API_AVPICTURE
7294
+#define FF_API_AVPICTURE         (LIBAVCODEC_VERSION_MAJOR < 59)
7295
+#endif
7296
+#ifndef FF_API_AVPACKET_OLD_API
7297
+#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7298
+#endif
7299
+#ifndef FF_API_RTP_CALLBACK
7300
+#define FF_API_RTP_CALLBACK      (LIBAVCODEC_VERSION_MAJOR < 59)
7301
+#endif
7302
+#ifndef FF_API_VBV_DELAY
7303
+#define FF_API_VBV_DELAY         (LIBAVCODEC_VERSION_MAJOR < 59)
7304
+#endif
7305
+#ifndef FF_API_CODER_TYPE
7306
+#define FF_API_CODER_TYPE        (LIBAVCODEC_VERSION_MAJOR < 59)
7307
+#endif
7308
+#ifndef FF_API_STAT_BITS
7309
+#define FF_API_STAT_BITS         (LIBAVCODEC_VERSION_MAJOR < 59)
7310
+#endif
7311
+#ifndef FF_API_PRIVATE_OPT
7312
+#define FF_API_PRIVATE_OPT      (LIBAVCODEC_VERSION_MAJOR < 59)
7313
+#endif
7314
+#ifndef FF_API_ASS_TIMING
7315
+#define FF_API_ASS_TIMING       (LIBAVCODEC_VERSION_MAJOR < 59)
7316
+#endif
7317
+#ifndef FF_API_OLD_BSF
7318
+#define FF_API_OLD_BSF          (LIBAVCODEC_VERSION_MAJOR < 59)
7319
+#endif
7320
+#ifndef FF_API_COPY_CONTEXT
7321
+#define FF_API_COPY_CONTEXT     (LIBAVCODEC_VERSION_MAJOR < 59)
7322
+#endif
7323
+#ifndef FF_API_GET_CONTEXT_DEFAULTS
7324
+#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
7325
+#endif
7326
+#ifndef FF_API_NVENC_OLD_NAME
7327
+#define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
7328
+#endif
7329
+#ifndef FF_API_STRUCT_VAAPI_CONTEXT
7330
+#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7331
+#endif
7332
+#ifndef FF_API_MERGE_SD_API
7333
+#define FF_API_MERGE_SD_API      (LIBAVCODEC_VERSION_MAJOR < 59)
7334
+#endif
7335
+#ifndef FF_API_TAG_STRING
7336
+#define FF_API_TAG_STRING        (LIBAVCODEC_VERSION_MAJOR < 59)
7337
+#endif
7338
+#ifndef FF_API_GETCHROMA
7339
+#define FF_API_GETCHROMA         (LIBAVCODEC_VERSION_MAJOR < 59)
7340
+#endif
7341
+#ifndef FF_API_CODEC_GET_SET
7342
+#define FF_API_CODEC_GET_SET     (LIBAVCODEC_VERSION_MAJOR < 59)
7343
+#endif
7344
+#ifndef FF_API_USER_VISIBLE_AVHWACCEL
7345
+#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
7346
+#endif
7347
+#ifndef FF_API_LOCKMGR
7348
+#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
7349
+#endif
7350
+#ifndef FF_API_NEXT
7351
+#define FF_API_NEXT              (LIBAVCODEC_VERSION_MAJOR < 59)
7352
+#endif
7353
+
7354
+
7355
+#endif /* AVCODEC_VERSION_H */
7356
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7357
new file mode 100644
7358
index 000000000000..ced108aa2c75
7359
--- /dev/null
7360
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7361
@@ -0,0 +1,167 @@
7362
+/*
7363
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7364
+ *
7365
+ * This file is part of FFmpeg.
7366
+ *
7367
+ * FFmpeg is free software; you can redistribute it and/or
7368
+ * modify it under the terms of the GNU Lesser General Public
7369
+ * License as published by the Free Software Foundation; either
7370
+ * version 2.1 of the License, or (at your option) any later version.
7371
+ *
7372
+ * FFmpeg is distributed in the hope that it will be useful,
7373
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7374
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7375
+ * Lesser General Public License for more details.
7376
+ *
7377
+ * You should have received a copy of the GNU Lesser General Public
7378
+ * License along with FFmpeg; if not, write to the Free Software
7379
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7380
+ */
7381
+
7382
+/**
7383
+ * @file
7384
+ * Macro definitions for various function/variable attributes
7385
+ */
7386
+
7387
+#ifndef AVUTIL_ATTRIBUTES_H
7388
+#define AVUTIL_ATTRIBUTES_H
7389
+
7390
+#ifdef __GNUC__
7391
+#    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
7392
+#    define AV_GCC_VERSION_AT_MOST(x,y)  (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
7393
+#else
7394
+#    define AV_GCC_VERSION_AT_LEAST(x,y) 0
7395
+#    define AV_GCC_VERSION_AT_MOST(x,y)  0
7396
+#endif
7397
+
7398
+#ifndef av_always_inline
7399
+#if AV_GCC_VERSION_AT_LEAST(3,1)
7400
+#    define av_always_inline __attribute__((always_inline)) inline
7401
+#elif defined(_MSC_VER)
7402
+#    define av_always_inline __forceinline
7403
+#else
7404
+#    define av_always_inline inline
7405
+#endif
7406
+#endif
7407
+
7408
+#ifndef av_extern_inline
7409
+#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
7410
+#    define av_extern_inline extern inline
7411
+#else
7412
+#    define av_extern_inline inline
7413
+#endif
7414
+#endif
7415
+
7416
+#if AV_GCC_VERSION_AT_LEAST(3,4)
7417
+#    define av_warn_unused_result __attribute__((warn_unused_result))
7418
+#else
7419
+#    define av_warn_unused_result
7420
+#endif
7421
+
7422
+#if AV_GCC_VERSION_AT_LEAST(3,1)
7423
+#    define av_noinline __attribute__((noinline))
7424
+#elif defined(_MSC_VER)
7425
+#    define av_noinline __declspec(noinline)
7426
+#else
7427
+#    define av_noinline
7428
+#endif
7429
+
7430
+#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7431
+#    define av_pure __attribute__((pure))
7432
+#else
7433
+#    define av_pure
7434
+#endif
7435
+
7436
+#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
7437
+#    define av_const __attribute__((const))
7438
+#else
7439
+#    define av_const
7440
+#endif
7441
+
7442
+#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
7443
+#    define av_cold __attribute__((cold))
7444
+#else
7445
+#    define av_cold
7446
+#endif
7447
+
7448
+#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
7449
+#    define av_flatten __attribute__((flatten))
7450
+#else
7451
+#    define av_flatten
7452
+#endif
7453
+
7454
+#if AV_GCC_VERSION_AT_LEAST(3,1)
7455
+#    define attribute_deprecated __attribute__((deprecated))
7456
+#elif defined(_MSC_VER)
7457
+#    define attribute_deprecated __declspec(deprecated)
7458
+#else
7459
+#    define attribute_deprecated
7460
+#endif
7461
+
7462
+/**
7463
+ * Disable warnings about deprecated features
7464
+ * This is useful for sections of code kept for backward compatibility and
7465
+ * scheduled for removal.
7466
+ */
7467
+#ifndef AV_NOWARN_DEPRECATED
7468
+#if AV_GCC_VERSION_AT_LEAST(4,6)
7469
+#    define AV_NOWARN_DEPRECATED(code) \
7470
+        _Pragma("GCC diagnostic push") \
7471
+        _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
7472
+        code \
7473
+        _Pragma("GCC diagnostic pop")
7474
+#elif defined(_MSC_VER)
7475
+#    define AV_NOWARN_DEPRECATED(code) \
7476
+        __pragma(warning(push)) \
7477
+        __pragma(warning(disable : 4996)) \
7478
+        code; \
7479
+        __pragma(warning(pop))
7480
+#else
7481
+#    define AV_NOWARN_DEPRECATED(code) code
7482
+#endif
7483
+#endif
7484
+
7485
+#if defined(__GNUC__) || defined(__clang__)
7486
+#    define av_unused __attribute__((unused))
7487
+#else
7488
+#    define av_unused
7489
+#endif
7490
+
7491
+/**
7492
+ * Mark a variable as used and prevent the compiler from optimizing it
7493
+ * away.  This is useful for variables accessed only from inline
7494
+ * assembler without the compiler being aware.
7495
+ */
7496
+#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7497
+#    define av_used __attribute__((used))
7498
+#else
7499
+#    define av_used
7500
+#endif
7501
+
7502
+#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
7503
+#   define av_alias __attribute__((may_alias))
7504
+#else
7505
+#   define av_alias
7506
+#endif
7507
+
7508
+#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
7509
+#    define av_uninit(x) x=x
7510
+#else
7511
+#    define av_uninit(x) x
7512
+#endif
7513
+
7514
+#if defined(__GNUC__) || defined(__clang__)
7515
+#    define av_builtin_constant_p __builtin_constant_p
7516
+#    define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
7517
+#else
7518
+#    define av_builtin_constant_p(x) 0
7519
+#    define av_printf_format(fmtpos, attrpos)
7520
+#endif
7521
+
7522
+#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
7523
+#    define av_noreturn __attribute__((noreturn))
7524
+#else
7525
+#    define av_noreturn
7526
+#endif
7527
+
7528
+#endif /* AVUTIL_ATTRIBUTES_H */
7529
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7530
new file mode 100644
7531
index 000000000000..c289fbb551c1
7532
--- /dev/null
7533
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7534
@@ -0,0 +1,6 @@
7535
+/* Generated by ffmpeg configure */
7536
+#ifndef AVUTIL_AVCONFIG_H
7537
+#define AVUTIL_AVCONFIG_H
7538
+#define AV_HAVE_BIGENDIAN 0
7539
+#define AV_HAVE_FAST_UNALIGNED 1
7540
+#endif /* AVUTIL_AVCONFIG_H */
7541
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7542
new file mode 100644
7543
index 000000000000..4d633156d14d
7544
--- /dev/null
7545
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7546
@@ -0,0 +1,365 @@
7547
+/*
7548
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7549
+ *
7550
+ * This file is part of FFmpeg.
7551
+ *
7552
+ * FFmpeg is free software; you can redistribute it and/or
7553
+ * modify it under the terms of the GNU Lesser General Public
7554
+ * License as published by the Free Software Foundation; either
7555
+ * version 2.1 of the License, or (at your option) any later version.
7556
+ *
7557
+ * FFmpeg is distributed in the hope that it will be useful,
7558
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7559
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7560
+ * Lesser General Public License for more details.
7561
+ *
7562
+ * You should have received a copy of the GNU Lesser General Public
7563
+ * License along with FFmpeg; if not, write to the Free Software
7564
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7565
+ */
7566
+
7567
+#ifndef AVUTIL_AVUTIL_H
7568
+#define AVUTIL_AVUTIL_H
7569
+
7570
+/**
7571
+ * @file
7572
+ * @ingroup lavu
7573
+ * Convenience header that includes @ref lavu "libavutil"'s core.
7574
+ */
7575
+
7576
+/**
7577
+ * @mainpage
7578
+ *
7579
+ * @section ffmpeg_intro Introduction
7580
+ *
7581
+ * This document describes the usage of the different libraries
7582
+ * provided by FFmpeg.
7583
+ *
7584
+ * @li @ref libavc "libavcodec" encoding/decoding library
7585
+ * @li @ref lavfi "libavfilter" graph-based frame editing library
7586
+ * @li @ref libavf "libavformat" I/O and muxing/demuxing library
7587
+ * @li @ref lavd "libavdevice" special devices muxing/demuxing library
7588
+ * @li @ref lavu "libavutil" common utility library
7589
+ * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
7590
+ * @li @ref lpp  "libpostproc" post processing library
7591
+ * @li @ref libsws "libswscale" color conversion and scaling library
7592
+ *
7593
+ * @section ffmpeg_versioning Versioning and compatibility
7594
+ *
7595
+ * Each of the FFmpeg libraries contains a version.h header, which defines a
7596
+ * major, minor and micro version number with the
7597
+ * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
7598
+ * number is incremented with backward incompatible changes - e.g. removing
7599
+ * parts of the public API, reordering public struct members, etc. The minor
7600
+ * version number is incremented for backward compatible API changes or major
7601
+ * new features - e.g. adding a new public function or a new decoder. The micro
7602
+ * version number is incremented for smaller changes that a calling program
7603
+ * might still want to check for - e.g. changing behavior in a previously
7604
+ * unspecified situation.
7605
+ *
7606
+ * FFmpeg guarantees backward API and ABI compatibility for each library as long
7607
+ * as its major version number is unchanged. This means that no public symbols
7608
+ * will be removed or renamed. Types and names of the public struct members and
7609
+ * values of public macros and enums will remain the same (unless they were
7610
+ * explicitly declared as not part of the public API). Documented behavior will
7611
+ * not change.
7612
+ *
7613
+ * In other words, any correct program that works with a given FFmpeg snapshot
7614
+ * should work just as well without any changes with any later snapshot with the
7615
+ * same major versions. This applies to both rebuilding the program against new
7616
+ * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
7617
+ * links against.
7618
+ *
7619
+ * However, new public symbols may be added and new members may be appended to
7620
+ * public structs whose size is not part of public ABI (most public structs in
7621
+ * FFmpeg). New macros and enum values may be added. Behavior in undocumented
7622
+ * situations may change slightly (and be documented). All those are accompanied
7623
+ * by an entry in doc/APIchanges and incrementing either the minor or micro
7624
+ * version number.
7625
+ */
7626
+
7627
+/**
7628
+ * @defgroup lavu libavutil
7629
+ * Common code shared across all FFmpeg libraries.
7630
+ *
7631
+ * @note
7632
+ * libavutil is designed to be modular. In most cases, in order to use the
7633
+ * functions provided by one component of libavutil you must explicitly include
7634
+ * the specific header containing that feature. If you are only using
7635
+ * media-related components, you could simply include libavutil/avutil.h, which
7636
+ * brings in most of the "core" components.
7637
+ *
7638
+ * @{
7639
+ *
7640
+ * @defgroup lavu_crypto Crypto and Hashing
7641
+ *
7642
+ * @{
7643
+ * @}
7644
+ *
7645
+ * @defgroup lavu_math Mathematics
7646
+ * @{
7647
+ *
7648
+ * @}
7649
+ *
7650
+ * @defgroup lavu_string String Manipulation
7651
+ *
7652
+ * @{
7653
+ *
7654
+ * @}
7655
+ *
7656
+ * @defgroup lavu_mem Memory Management
7657
+ *
7658
+ * @{
7659
+ *
7660
+ * @}
7661
+ *
7662
+ * @defgroup lavu_data Data Structures
7663
+ * @{
7664
+ *
7665
+ * @}
7666
+ *
7667
+ * @defgroup lavu_video Video related
7668
+ *
7669
+ * @{
7670
+ *
7671
+ * @}
7672
+ *
7673
+ * @defgroup lavu_audio Audio related
7674
+ *
7675
+ * @{
7676
+ *
7677
+ * @}
7678
+ *
7679
+ * @defgroup lavu_error Error Codes
7680
+ *
7681
+ * @{
7682
+ *
7683
+ * @}
7684
+ *
7685
+ * @defgroup lavu_log Logging Facility
7686
+ *
7687
+ * @{
7688
+ *
7689
+ * @}
7690
+ *
7691
+ * @defgroup lavu_misc Other
7692
+ *
7693
+ * @{
7694
+ *
7695
+ * @defgroup preproc_misc Preprocessor String Macros
7696
+ *
7697
+ * @{
7698
+ *
7699
+ * @}
7700
+ *
7701
+ * @defgroup version_utils Library Version Macros
7702
+ *
7703
+ * @{
7704
+ *
7705
+ * @}
7706
+ */
7707
+
7708
+
7709
+/**
7710
+ * @addtogroup lavu_ver
7711
+ * @{
7712
+ */
7713
+
7714
+/**
7715
+ * Return the LIBAVUTIL_VERSION_INT constant.
7716
+ */
7717
+unsigned avutil_version(void);
7718
+
7719
+/**
7720
+ * Return an informative version string. This usually is the actual release
7721
+ * version number or a git commit description. This string has no fixed format
7722
+ * and can change any time. It should never be parsed by code.
7723
+ */
7724
+const char *av_version_info(void);
7725
+
7726
+/**
7727
+ * Return the libavutil build-time configuration.
7728
+ */
7729
+const char *avutil_configuration(void);
7730
+
7731
+/**
7732
+ * Return the libavutil license.
7733
+ */
7734
+const char *avutil_license(void);
7735
+
7736
+/**
7737
+ * @}
7738
+ */
7739
+
7740
+/**
7741
+ * @addtogroup lavu_media Media Type
7742
+ * @brief Media Type
7743
+ */
7744
+
7745
+enum AVMediaType {
7746
+    AVMEDIA_TYPE_UNKNOWN = -1,  ///< Usually treated as AVMEDIA_TYPE_DATA
7747
+    AVMEDIA_TYPE_VIDEO,
7748
+    AVMEDIA_TYPE_AUDIO,
7749
+    AVMEDIA_TYPE_DATA,          ///< Opaque data information usually continuous
7750
+    AVMEDIA_TYPE_SUBTITLE,
7751
+    AVMEDIA_TYPE_ATTACHMENT,    ///< Opaque data information usually sparse
7752
+    AVMEDIA_TYPE_NB
7753
+};
7754
+
7755
+/**
7756
+ * Return a string describing the media_type enum, NULL if media_type
7757
+ * is unknown.
7758
+ */
7759
+const char *av_get_media_type_string(enum AVMediaType media_type);
7760
+
7761
+/**
7762
+ * @defgroup lavu_const Constants
7763
+ * @{
7764
+ *
7765
+ * @defgroup lavu_enc Encoding specific
7766
+ *
7767
+ * @note those definition should move to avcodec
7768
+ * @{
7769
+ */
7770
+
7771
+#define FF_LAMBDA_SHIFT 7
7772
+#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
7773
+#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
7774
+#define FF_LAMBDA_MAX (256*128-1)
7775
+
7776
+#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
7777
+
7778
+/**
7779
+ * @}
7780
+ * @defgroup lavu_time Timestamp specific
7781
+ *
7782
+ * FFmpeg internal timebase and timestamp definitions
7783
+ *
7784
+ * @{
7785
+ */
7786
+
7787
+/**
7788
+ * @brief Undefined timestamp value
7789
+ *
7790
+ * Usually reported by demuxer that work on containers that do not provide
7791
+ * either pts or dts.
7792
+ */
7793
+
7794
+#define AV_NOPTS_VALUE          ((int64_t)UINT64_C(0x8000000000000000))
7795
+
7796
+/**
7797
+ * Internal time base represented as integer
7798
+ */
7799
+
7800
+#define AV_TIME_BASE            1000000
7801
+
7802
+/**
7803
+ * Internal time base represented as fractional value
7804
+ */
7805
+
7806
+#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
7807
+
7808
+/**
7809
+ * @}
7810
+ * @}
7811
+ * @defgroup lavu_picture Image related
7812
+ *
7813
+ * AVPicture types, pixel formats and basic image planes manipulation.
7814
+ *
7815
+ * @{
7816
+ */
7817
+
7818
+enum AVPictureType {
7819
+    AV_PICTURE_TYPE_NONE = 0, ///< Undefined
7820
+    AV_PICTURE_TYPE_I,     ///< Intra
7821
+    AV_PICTURE_TYPE_P,     ///< Predicted
7822
+    AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
7823
+    AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG-4
7824
+    AV_PICTURE_TYPE_SI,    ///< Switching Intra
7825
+    AV_PICTURE_TYPE_SP,    ///< Switching Predicted
7826
+    AV_PICTURE_TYPE_BI,    ///< BI type
7827
+};
7828
+
7829
+/**
7830
+ * Return a single letter to describe the given picture type
7831
+ * pict_type.
7832
+ *
7833
+ * @param[in] pict_type the picture type @return a single character
7834
+ * representing the picture type, '?' if pict_type is unknown
7835
+ */
7836
+char av_get_picture_type_char(enum AVPictureType pict_type);
7837
+
7838
+/**
7839
+ * @}
7840
+ */
7841
+
7842
+#include "common.h"
7843
+#include "error.h"
7844
+#include "rational.h"
7845
+#include "version.h"
7846
+#include "macros.h"
7847
+#include "mathematics.h"
7848
+#include "log.h"
7849
+#include "pixfmt.h"
7850
+
7851
+/**
7852
+ * Return x default pointer in case p is NULL.
7853
+ */
7854
+static inline void *av_x_if_null(const void *p, const void *x)
7855
+{
7856
+    return (void *)(intptr_t)(p ? p : x);
7857
+}
7858
+
7859
+/**
7860
+ * Compute the length of an integer list.
7861
+ *
7862
+ * @param elsize  size in bytes of each list element (only 1, 2, 4 or 8)
7863
+ * @param term    list terminator (usually 0 or -1)
7864
+ * @param list    pointer to the list
7865
+ * @return  length of the list, in elements, not counting the terminator
7866
+ */
7867
+unsigned av_int_list_length_for_size(unsigned elsize,
7868
+                                     const void *list, uint64_t term) av_pure;
7869
+
7870
+/**
7871
+ * Compute the length of an integer list.
7872
+ *
7873
+ * @param term  list terminator (usually 0 or -1)
7874
+ * @param list  pointer to the list
7875
+ * @return  length of the list, in elements, not counting the terminator
7876
+ */
7877
+#define av_int_list_length(list, term) \
7878
+    av_int_list_length_for_size(sizeof(*(list)), list, term)
7879
+
7880
+/**
7881
+ * Open a file using a UTF-8 filename.
7882
+ * The API of this function matches POSIX fopen(), errors are returned through
7883
+ * errno.
7884
+ */
7885
+FILE *av_fopen_utf8(const char *path, const char *mode);
7886
+
7887
+/**
7888
+ * Return the fractional representation of the internal time base.
7889
+ */
7890
+AVRational av_get_time_base_q(void);
7891
+
7892
+#define AV_FOURCC_MAX_STRING_SIZE 32
7893
+
7894
+#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
7895
+
7896
+/**
7897
+ * Fill the provided buffer with a string containing a FourCC (four-character
7898
+ * code) representation.
7899
+ *
7900
+ * @param buf    a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
7901
+ * @param fourcc the fourcc to represent
7902
+ * @return the buffer in input
7903
+ */
7904
+char *av_fourcc_make_string(char *buf, uint32_t fourcc);
7905
+
7906
+/**
7907
+ * @}
7908
+ * @}
7909
+ */
7910
+
7911
+#endif /* AVUTIL_AVUTIL_H */
7912
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7913
new file mode 100644
7914
index 000000000000..73b6bd0b148e
7915
--- /dev/null
7916
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7917
@@ -0,0 +1,291 @@
7918
+/*
7919
+ * This file is part of FFmpeg.
7920
+ *
7921
+ * FFmpeg is free software; you can redistribute it and/or
7922
+ * modify it under the terms of the GNU Lesser General Public
7923
+ * License as published by the Free Software Foundation; either
7924
+ * version 2.1 of the License, or (at your option) any later version.
7925
+ *
7926
+ * FFmpeg is distributed in the hope that it will be useful,
7927
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7928
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7929
+ * Lesser General Public License for more details.
7930
+ *
7931
+ * You should have received a copy of the GNU Lesser General Public
7932
+ * License along with FFmpeg; if not, write to the Free Software
7933
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7934
+ */
7935
+
7936
+/**
7937
+ * @file
7938
+ * @ingroup lavu_buffer
7939
+ * refcounted data buffer API
7940
+ */
7941
+
7942
+#ifndef AVUTIL_BUFFER_H
7943
+#define AVUTIL_BUFFER_H
7944
+
7945
+#include <stdint.h>
7946
+
7947
+/**
7948
+ * @defgroup lavu_buffer AVBuffer
7949
+ * @ingroup lavu_data
7950
+ *
7951
+ * @{
7952
+ * AVBuffer is an API for reference-counted data buffers.
7953
+ *
7954
+ * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
7955
+ * represents the data buffer itself; it is opaque and not meant to be accessed
7956
+ * by the caller directly, but only through AVBufferRef. However, the caller may
7957
+ * e.g. compare two AVBuffer pointers to check whether two different references
7958
+ * are describing the same data buffer. AVBufferRef represents a single
7959
+ * reference to an AVBuffer and it is the object that may be manipulated by the
7960
+ * caller directly.
7961
+ *
7962
+ * There are two functions provided for creating a new AVBuffer with a single
7963
+ * reference -- av_buffer_alloc() to just allocate a new buffer, and
7964
+ * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
7965
+ * reference, additional references may be created with av_buffer_ref().
7966
+ * Use av_buffer_unref() to free a reference (this will automatically free the
7967
+ * data once all the references are freed).
7968
+ *
7969
+ * The convention throughout this API and the rest of FFmpeg is such that the
7970
+ * buffer is considered writable if there exists only one reference to it (and
7971
+ * it has not been marked as read-only). The av_buffer_is_writable() function is
7972
+ * provided to check whether this is true and av_buffer_make_writable() will
7973
+ * automatically create a new writable buffer when necessary.
7974
+ * Of course nothing prevents the calling code from violating this convention,
7975
+ * however that is safe only when all the existing references are under its
7976
+ * control.
7977
+ *
7978
+ * @note Referencing and unreferencing the buffers is thread-safe and thus
7979
+ * may be done from multiple threads simultaneously without any need for
7980
+ * additional locking.
7981
+ *
7982
+ * @note Two different references to the same buffer can point to different
7983
+ * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
7984
+ */
7985
+
7986
+/**
7987
+ * A reference counted buffer type. It is opaque and is meant to be used through
7988
+ * references (AVBufferRef).
7989
+ */
7990
+typedef struct AVBuffer AVBuffer;
7991
+
7992
+/**
7993
+ * A reference to a data buffer.
7994
+ *
7995
+ * The size of this struct is not a part of the public ABI and it is not meant
7996
+ * to be allocated directly.
7997
+ */
7998
+typedef struct AVBufferRef {
7999
+    AVBuffer *buffer;
8000
+
8001
+    /**
8002
+     * The data buffer. It is considered writable if and only if
8003
+     * this is the only reference to the buffer, in which case
8004
+     * av_buffer_is_writable() returns 1.
8005
+     */
8006
+    uint8_t *data;
8007
+    /**
8008
+     * Size of data in bytes.
8009
+     */
8010
+    int      size;
8011
+} AVBufferRef;
8012
+
8013
+/**
8014
+ * Allocate an AVBuffer of the given size using av_malloc().
8015
+ *
8016
+ * @return an AVBufferRef of given size or NULL when out of memory
8017
+ */
8018
+AVBufferRef *av_buffer_alloc(int size);
8019
+
8020
+/**
8021
+ * Same as av_buffer_alloc(), except the returned buffer will be initialized
8022
+ * to zero.
8023
+ */
8024
+AVBufferRef *av_buffer_allocz(int size);
8025
+
8026
+/**
8027
+ * Always treat the buffer as read-only, even when it has only one
8028
+ * reference.
8029
+ */
8030
+#define AV_BUFFER_FLAG_READONLY (1 << 0)
8031
+
8032
+/**
8033
+ * Create an AVBuffer from an existing array.
8034
+ *
8035
+ * If this function is successful, data is owned by the AVBuffer. The caller may
8036
+ * only access data through the returned AVBufferRef and references derived from
8037
+ * it.
8038
+ * If this function fails, data is left untouched.
8039
+ * @param data   data array
8040
+ * @param size   size of data in bytes
8041
+ * @param free   a callback for freeing this buffer's data
8042
+ * @param opaque parameter to be got for processing or passed to free
8043
+ * @param flags  a combination of AV_BUFFER_FLAG_*
8044
+ *
8045
+ * @return an AVBufferRef referring to data on success, NULL on failure.
8046
+ */
8047
+AVBufferRef *av_buffer_create(uint8_t *data, int size,
8048
+                              void (*free)(void *opaque, uint8_t *data),
8049
+                              void *opaque, int flags);
8050
+
8051
+/**
8052
+ * Default free callback, which calls av_free() on the buffer data.
8053
+ * This function is meant to be passed to av_buffer_create(), not called
8054
+ * directly.
8055
+ */
8056
+void av_buffer_default_free(void *opaque, uint8_t *data);
8057
+
8058
+/**
8059
+ * Create a new reference to an AVBuffer.
8060
+ *
8061
+ * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
8062
+ * failure.
8063
+ */
8064
+AVBufferRef *av_buffer_ref(AVBufferRef *buf);
8065
+
8066
+/**
8067
+ * Free a given reference and automatically free the buffer if there are no more
8068
+ * references to it.
8069
+ *
8070
+ * @param buf the reference to be freed. The pointer is set to NULL on return.
8071
+ */
8072
+void av_buffer_unref(AVBufferRef **buf);
8073
+
8074
+/**
8075
+ * @return 1 if the caller may write to the data referred to by buf (which is
8076
+ * true if and only if buf is the only reference to the underlying AVBuffer).
8077
+ * Return 0 otherwise.
8078
+ * A positive answer is valid until av_buffer_ref() is called on buf.
8079
+ */
8080
+int av_buffer_is_writable(const AVBufferRef *buf);
8081
+
8082
+/**
8083
+ * @return the opaque parameter set by av_buffer_create.
8084
+ */
8085
+void *av_buffer_get_opaque(const AVBufferRef *buf);
8086
+
8087
+int av_buffer_get_ref_count(const AVBufferRef *buf);
8088
+
8089
+/**
8090
+ * Create a writable reference from a given buffer reference, avoiding data copy
8091
+ * if possible.
8092
+ *
8093
+ * @param buf buffer reference to make writable. On success, buf is either left
8094
+ *            untouched, or it is unreferenced and a new writable AVBufferRef is
8095
+ *            written in its place. On failure, buf is left untouched.
8096
+ * @return 0 on success, a negative AVERROR on failure.
8097
+ */
8098
+int av_buffer_make_writable(AVBufferRef **buf);
8099
+
8100
+/**
8101
+ * Reallocate a given buffer.
8102
+ *
8103
+ * @param buf  a buffer reference to reallocate. On success, buf will be
8104
+ *             unreferenced and a new reference with the required size will be
8105
+ *             written in its place. On failure buf will be left untouched. *buf
8106
+ *             may be NULL, then a new buffer is allocated.
8107
+ * @param size required new buffer size.
8108
+ * @return 0 on success, a negative AVERROR on failure.
8109
+ *
8110
+ * @note the buffer is actually reallocated with av_realloc() only if it was
8111
+ * initially allocated through av_buffer_realloc(NULL) and there is only one
8112
+ * reference to it (i.e. the one passed to this function). In all other cases
8113
+ * a new buffer is allocated and the data is copied.
8114
+ */
8115
+int av_buffer_realloc(AVBufferRef **buf, int size);
8116
+
8117
+/**
8118
+ * @}
8119
+ */
8120
+
8121
+/**
8122
+ * @defgroup lavu_bufferpool AVBufferPool
8123
+ * @ingroup lavu_data
8124
+ *
8125
+ * @{
8126
+ * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
8127
+ *
8128
+ * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
8129
+ * meant to solve this in cases when the caller needs a set of buffers of the
8130
+ * same size (the most obvious use case being buffers for raw video or audio
8131
+ * frames).
8132
+ *
8133
+ * At the beginning, the user must call av_buffer_pool_init() to create the
8134
+ * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
8135
+ * get a reference to a new buffer, similar to av_buffer_alloc(). This new
8136
+ * reference works in all aspects the same way as the one created by
8137
+ * av_buffer_alloc(). However, when the last reference to this buffer is
8138
+ * unreferenced, it is returned to the pool instead of being freed and will be
8139
+ * reused for subsequent av_buffer_pool_get() calls.
8140
+ *
8141
+ * When the caller is done with the pool and no longer needs to allocate any new
8142
+ * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
8143
+ * Once all the buffers are released, it will automatically be freed.
8144
+ *
8145
+ * Allocating and releasing buffers with this API is thread-safe as long as
8146
+ * either the default alloc callback is used, or the user-supplied one is
8147
+ * thread-safe.
8148
+ */
8149
+
8150
+/**
8151
+ * The buffer pool. This structure is opaque and not meant to be accessed
8152
+ * directly. It is allocated with av_buffer_pool_init() and freed with
8153
+ * av_buffer_pool_uninit().
8154
+ */
8155
+typedef struct AVBufferPool AVBufferPool;
8156
+
8157
+/**
8158
+ * Allocate and initialize a buffer pool.
8159
+ *
8160
+ * @param size size of each buffer in this pool
8161
+ * @param alloc a function that will be used to allocate new buffers when the
8162
+ * pool is empty. May be NULL, then the default allocator will be used
8163
+ * (av_buffer_alloc()).
8164
+ * @return newly created buffer pool on success, NULL on error.
8165
+ */
8166
+AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
8167
+
8168
+/**
8169
+ * Allocate and initialize a buffer pool with a more complex allocator.
8170
+ *
8171
+ * @param size size of each buffer in this pool
8172
+ * @param opaque arbitrary user data used by the allocator
8173
+ * @param alloc a function that will be used to allocate new buffers when the
8174
+ *              pool is empty.
8175
+ * @param pool_free a function that will be called immediately before the pool
8176
+ *                  is freed. I.e. after av_buffer_pool_uninit() is called
8177
+ *                  by the caller and all the frames are returned to the pool
8178
+ *                  and freed. It is intended to uninitialize the user opaque
8179
+ *                  data.
8180
+ * @return newly created buffer pool on success, NULL on error.
8181
+ */
8182
+AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
8183
+                                   AVBufferRef* (*alloc)(void *opaque, int size),
8184
+                                   void (*pool_free)(void *opaque));
8185
+
8186
+/**
8187
+ * Mark the pool as being available for freeing. It will actually be freed only
8188
+ * once all the allocated buffers associated with the pool are released. Thus it
8189
+ * is safe to call this function while some of the allocated buffers are still
8190
+ * in use.
8191
+ *
8192
+ * @param pool pointer to the pool to be freed. It will be set to NULL.
8193
+ */
8194
+void av_buffer_pool_uninit(AVBufferPool **pool);
8195
+
8196
+/**
8197
+ * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
8198
+ * This function may be called simultaneously from multiple threads.
8199
+ *
8200
+ * @return a reference to the new buffer on success, NULL on error.
8201
+ */
8202
+AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
8203
+
8204
+/**
8205
+ * @}
8206
+ */
8207
+
8208
+#endif /* AVUTIL_BUFFER_H */
8209
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8210
new file mode 100644
8211
index 000000000000..50bb8f03c586
8212
--- /dev/null
8213
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8214
@@ -0,0 +1,232 @@
8215
+/*
8216
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8217
+ * Copyright (c) 2008 Peter Ross
8218
+ *
8219
+ * This file is part of FFmpeg.
8220
+ *
8221
+ * FFmpeg is free software; you can redistribute it and/or
8222
+ * modify it under the terms of the GNU Lesser General Public
8223
+ * License as published by the Free Software Foundation; either
8224
+ * version 2.1 of the License, or (at your option) any later version.
8225
+ *
8226
+ * FFmpeg is distributed in the hope that it will be useful,
8227
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
8228
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8229
+ * Lesser General Public License for more details.
8230
+ *
8231
+ * You should have received a copy of the GNU Lesser General Public
8232
+ * License along with FFmpeg; if not, write to the Free Software
8233
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8234
+ */
8235
+
8236
+#ifndef AVUTIL_CHANNEL_LAYOUT_H
8237
+#define AVUTIL_CHANNEL_LAYOUT_H
8238
+
8239
+#include <stdint.h>
8240
+
8241
+/**
8242
+ * @file
8243
+ * audio channel layout utility functions
8244
+ */
8245
+
8246
+/**
8247
+ * @addtogroup lavu_audio
8248
+ * @{
8249
+ */
8250
+
8251
+/**
8252
+ * @defgroup channel_masks Audio channel masks
8253
+ *
8254
+ * A channel layout is a 64-bits integer with a bit set for every channel.
8255
+ * The number of bits set must be equal to the number of channels.
8256
+ * The value 0 means that the channel layout is not known.
8257
+ * @note this data structure is not powerful enough to handle channels
8258
+ * combinations that have the same channel multiple times, such as
8259
+ * dual-mono.
8260
+ *
8261
+ * @{
8262
+ */
8263
+#define AV_CH_FRONT_LEFT             0x00000001
8264
+#define AV_CH_FRONT_RIGHT            0x00000002
8265
+#define AV_CH_FRONT_CENTER           0x00000004
8266
+#define AV_CH_LOW_FREQUENCY          0x00000008
8267
+#define AV_CH_BACK_LEFT              0x00000010
8268
+#define AV_CH_BACK_RIGHT             0x00000020
8269
+#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
8270
+#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
8271
+#define AV_CH_BACK_CENTER            0x00000100
8272
+#define AV_CH_SIDE_LEFT              0x00000200
8273
+#define AV_CH_SIDE_RIGHT             0x00000400
8274
+#define AV_CH_TOP_CENTER             0x00000800
8275
+#define AV_CH_TOP_FRONT_LEFT         0x00001000
8276
+#define AV_CH_TOP_FRONT_CENTER       0x00002000
8277
+#define AV_CH_TOP_FRONT_RIGHT        0x00004000
8278
+#define AV_CH_TOP_BACK_LEFT          0x00008000
8279
+#define AV_CH_TOP_BACK_CENTER        0x00010000
8280
+#define AV_CH_TOP_BACK_RIGHT         0x00020000
8281
+#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
8282
+#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
8283
+#define AV_CH_WIDE_LEFT              0x0000000080000000ULL
8284
+#define AV_CH_WIDE_RIGHT             0x0000000100000000ULL
8285
+#define AV_CH_SURROUND_DIRECT_LEFT   0x0000000200000000ULL
8286
+#define AV_CH_SURROUND_DIRECT_RIGHT  0x0000000400000000ULL
8287
+#define AV_CH_LOW_FREQUENCY_2        0x0000000800000000ULL
8288
+
8289
+/** Channel mask value used for AVCodecContext.request_channel_layout
8290
+    to indicate that the user requests the channel order of the decoder output
8291
+    to be the native codec channel order. */
8292
+#define AV_CH_LAYOUT_NATIVE          0x8000000000000000ULL
8293
+
8294
+/**
8295
+ * @}
8296
+ * @defgroup channel_mask_c Audio channel layouts
8297
+ * @{
8298
+ * */
8299
+#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
8300
+#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
8301
+#define AV_CH_LAYOUT_2POINT1           (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
8302
+#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
8303
+#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
8304
+#define AV_CH_LAYOUT_3POINT1           (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
8305
+#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
8306
+#define AV_CH_LAYOUT_4POINT1           (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
8307
+#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8308
+#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8309
+#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8310
+#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
8311
+#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8312
+#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
8313
+#define AV_CH_LAYOUT_6POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
8314
+#define AV_CH_LAYOUT_6POINT0_FRONT     (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8315
+#define AV_CH_LAYOUT_HEXAGONAL         (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
8316
+#define AV_CH_LAYOUT_6POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
8317
+#define AV_CH_LAYOUT_6POINT1_BACK      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
8318
+#define AV_CH_LAYOUT_6POINT1_FRONT     (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
8319
+#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8320
+#define AV_CH_LAYOUT_7POINT0_FRONT     (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8321
+#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8322
+#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8323
+#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8324
+#define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
8325
+#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)
8326
+#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
8327
+
8328
+enum AVMatrixEncoding {
8329
+    AV_MATRIX_ENCODING_NONE,
8330
+    AV_MATRIX_ENCODING_DOLBY,
8331
+    AV_MATRIX_ENCODING_DPLII,
8332
+    AV_MATRIX_ENCODING_DPLIIX,
8333
+    AV_MATRIX_ENCODING_DPLIIZ,
8334
+    AV_MATRIX_ENCODING_DOLBYEX,
8335
+    AV_MATRIX_ENCODING_DOLBYHEADPHONE,
8336
+    AV_MATRIX_ENCODING_NB
8337
+};
8338
+
8339
+/**
8340
+ * Return a channel layout id that matches name, or 0 if no match is found.
8341
+ *
8342
+ * name can be one or several of the following notations,
8343
+ * separated by '+' or '|':
8344
+ * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
8345
+ *   5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
8346
+ * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
8347
+ *   SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
8348
+ * - a number of channels, in decimal, followed by 'c', yielding
8349
+ *   the default channel layout for that number of channels (@see
8350
+ *   av_get_default_channel_layout);
8351
+ * - a channel layout mask, in hexadecimal starting with "0x" (see the
8352
+ *   AV_CH_* macros).
8353
+ *
8354
+ * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
8355
+ */
8356
+uint64_t av_get_channel_layout(const char *name);
8357
+
8358
+/**
8359
+ * Return a channel layout and the number of channels based on the specified name.
8360
+ *
8361
+ * This function is similar to (@see av_get_channel_layout), but can also parse
8362
+ * unknown channel layout specifications.
8363
+ *
8364
+ * @param[in]  name             channel layout specification string
8365
+ * @param[out] channel_layout   parsed channel layout (0 if unknown)
8366
+ * @param[out] nb_channels      number of channels
8367
+ *
8368
+ * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
8369
+ */
8370
+int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
8371
+
8372
+/**
8373
+ * Return a description of a channel layout.
8374
+ * If nb_channels is <= 0, it is guessed from the channel_layout.
8375
+ *
8376
+ * @param buf put here the string containing the channel layout
8377
+ * @param buf_size size in bytes of the buffer
8378
+ */
8379
+void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
8380
+
8381
+struct AVBPrint;
8382
+/**
8383
+ * Append a description of a channel layout to a bprint buffer.
8384
+ */
8385
+void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
8386
+
8387
+/**
8388
+ * Return the number of channels in the channel layout.
8389
+ */
8390
+int av_get_channel_layout_nb_channels(uint64_t channel_layout);
8391
+
8392
+/**
8393
+ * Return default channel layout for a given number of channels.
8394
+ */
8395
+int64_t av_get_default_channel_layout(int nb_channels);
8396
+
8397
+/**
8398
+ * Get the index of a channel in channel_layout.
8399
+ *
8400
+ * @param channel a channel layout describing exactly one channel which must be
8401
+ *                present in channel_layout.
8402
+ *
8403
+ * @return index of channel in channel_layout on success, a negative AVERROR
8404
+ *         on error.
8405
+ */
8406
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
8407
+                                        uint64_t channel);
8408
+
8409
+/**
8410
+ * Get the channel with the given index in channel_layout.
8411
+ */
8412
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
8413
+
8414
+/**
8415
+ * Get the name of a given channel.
8416
+ *
8417
+ * @return channel name on success, NULL on error.
8418
+ */
8419
+const char *av_get_channel_name(uint64_t channel);
8420
+
8421
+/**
8422
+ * Get the description of a given channel.
8423
+ *
8424
+ * @param channel  a channel layout with a single channel
8425
+ * @return  channel description on success, NULL on error
8426
+ */
8427
+const char *av_get_channel_description(uint64_t channel);
8428
+
8429
+/**
8430
+ * Get the value and name of a standard channel layout.
8431
+ *
8432
+ * @param[in]  index   index in an internal list, starting at 0
8433
+ * @param[out] layout  channel layout mask
8434
+ * @param[out] name    name of the layout
8435
+ * @return  0  if the layout exists,
8436
+ *          <0 if index is beyond the limits
8437
+ */
8438
+int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
8439
+                                   const char **name);
8440
+
8441
+/**
8442
+ * @}
8443
+ * @}
8444
+ */
8445
+
8446
+#endif /* AVUTIL_CHANNEL_LAYOUT_H */
8447
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8448
new file mode 100644
8449
index 000000000000..0fffa67714e8
8450
--- /dev/null
8451
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8452
@@ -0,0 +1,560 @@
8453
+/*
8454
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8455
+ *
8456
+ * This file is part of FFmpeg.
8457
+ *
8458
+ * FFmpeg is free software; you can redistribute it and/or
8459
+ * modify it under the terms of the GNU Lesser General Public
8460
+ * License as published by the Free Software Foundation; either
8461
+ * version 2.1 of the License, or (at your option) any later version.
8462
+ *
8463
+ * FFmpeg is distributed in the hope that it will be useful,
8464
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
8465
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8466
+ * Lesser General Public License for more details.
8467
+ *
8468
+ * You should have received a copy of the GNU Lesser General Public
8469
+ * License along with FFmpeg; if not, write to the Free Software
8470
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8471
+ */
8472
+
8473
+/**
8474
+ * @file
8475
+ * common internal and external API header
8476
+ */
8477
+
8478
+#ifndef AVUTIL_COMMON_H
8479
+#define AVUTIL_COMMON_H
8480
+
8481
+#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
8482
+#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
8483
+#endif
8484
+
8485
+#include <errno.h>
8486
+#include <inttypes.h>
8487
+#include <limits.h>
8488
+#include <math.h>
8489
+#include <stdint.h>
8490
+#include <stdio.h>
8491
+#include <stdlib.h>
8492
+#include <string.h>
8493
+
8494
+#include "attributes.h"
8495
+#include "macros.h"
8496
+#include "version.h"
8497
+#include "libavutil/avconfig.h"
8498
+
8499
+#if AV_HAVE_BIGENDIAN
8500
+#   define AV_NE(be, le) (be)
8501
+#else
8502
+#   define AV_NE(be, le) (le)
8503
+#endif
8504
+
8505
+//rounded division & shift
8506
+#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
8507
+/* assume b>0 */
8508
+#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
8509
+/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
8510
+#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
8511
+                                                       : ((a) + (1<<(b)) - 1) >> (b))
8512
+/* Backwards compat. */
8513
+#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
8514
+
8515
+#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
8516
+#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
8517
+
8518
+/**
8519
+ * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
8520
+ * are not representable as absolute values of their type. This is the same
8521
+ * as with *abs()
8522
+ * @see FFNABS()
8523
+ */
8524
+#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
8525
+#define FFSIGN(a) ((a) > 0 ? 1 : -1)
8526
+
8527
+/**
8528
+ * Negative Absolute value.
8529
+ * this works for all integers of all types.
8530
+ * As with many macros, this evaluates its argument twice, it thus must not have
8531
+ * a sideeffect, that is FFNABS(x++) has undefined behavior.
8532
+ */
8533
+#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
8534
+
8535
+/**
8536
+ * Comparator.
8537
+ * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
8538
+ * if x == y. This is useful for instance in a qsort comparator callback.
8539
+ * Furthermore, compilers are able to optimize this to branchless code, and
8540
+ * there is no risk of overflow with signed types.
8541
+ * As with many macros, this evaluates its argument multiple times, it thus
8542
+ * must not have a side-effect.
8543
+ */
8544
+#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
8545
+
8546
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
8547
+#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
8548
+#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
8549
+#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
8550
+
8551
+#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
8552
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
8553
+
8554
+/* misc math functions */
8555
+
8556
+#ifdef HAVE_AV_CONFIG_H
8557
+#   include "config.h"
8558
+#   include "intmath.h"
8559
+#endif
8560
+
8561
+/* Pull in unguarded fallback defines at the end of this file. */
8562
+#include "common.h"
8563
+
8564
+#ifndef av_log2
8565
+av_const int av_log2(unsigned v);
8566
+#endif
8567
+
8568
+#ifndef av_log2_16bit
8569
+av_const int av_log2_16bit(unsigned v);
8570
+#endif
8571
+
8572
+/**
8573
+ * Clip a signed integer value into the amin-amax range.
8574
+ * @param a value to clip
8575
+ * @param amin minimum value of the clip range
8576
+ * @param amax maximum value of the clip range
8577
+ * @return clipped value
8578
+ */
8579
+static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
8580
+{
8581
+#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8582
+    if (amin > amax) abort();
8583
+#endif
8584
+    if      (a < amin) return amin;
8585
+    else if (a > amax) return amax;
8586
+    else               return a;
8587
+}
8588
+
8589
+/**
8590
+ * Clip a signed 64bit integer value into the amin-amax range.
8591
+ * @param a value to clip
8592
+ * @param amin minimum value of the clip range
8593
+ * @param amax maximum value of the clip range
8594
+ * @return clipped value
8595
+ */
8596
+static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
8597
+{
8598
+#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8599
+    if (amin > amax) abort();
8600
+#endif
8601
+    if      (a < amin) return amin;
8602
+    else if (a > amax) return amax;
8603
+    else               return a;
8604
+}
8605
+
8606
+/**
8607
+ * Clip a signed integer value into the 0-255 range.
8608
+ * @param a value to clip
8609
+ * @return clipped value
8610
+ */
8611
+static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
8612
+{
8613
+    if (a&(~0xFF)) return (~a)>>31;
8614
+    else           return a;
8615
+}
8616
+
8617
+/**
8618
+ * Clip a signed integer value into the -128,127 range.
8619
+ * @param a value to clip
8620
+ * @return clipped value
8621
+ */
8622
+static av_always_inline av_const int8_t av_clip_int8_c(int a)
8623
+{
8624
+    if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
8625
+    else                  return a;
8626
+}
8627
+
8628
+/**
8629
+ * Clip a signed integer value into the 0-65535 range.
8630
+ * @param a value to clip
8631
+ * @return clipped value
8632
+ */
8633
+static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
8634
+{
8635
+    if (a&(~0xFFFF)) return (~a)>>31;
8636
+    else             return a;
8637
+}
8638
+
8639
+/**
8640
+ * Clip a signed integer value into the -32768,32767 range.
8641
+ * @param a value to clip
8642
+ * @return clipped value
8643
+ */
8644
+static av_always_inline av_const int16_t av_clip_int16_c(int a)
8645
+{
8646
+    if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
8647
+    else                      return a;
8648
+}
8649
+
8650
+/**
8651
+ * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
8652
+ * @param a value to clip
8653
+ * @return clipped value
8654
+ */
8655
+static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
8656
+{
8657
+    if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
8658
+    else                                         return (int32_t)a;
8659
+}
8660
+
8661
+/**
8662
+ * Clip a signed integer into the -(2^p),(2^p-1) range.
8663
+ * @param  a value to clip
8664
+ * @param  p bit position to clip at
8665
+ * @return clipped value
8666
+ */
8667
+static av_always_inline av_const int av_clip_intp2_c(int a, int p)
8668
+{
8669
+    if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
8670
+        return (a >> 31) ^ ((1 << p) - 1);
8671
+    else
8672
+        return a;
8673
+}
8674
+
8675
+/**
8676
+ * Clip a signed integer to an unsigned power of two range.
8677
+ * @param  a value to clip
8678
+ * @param  p bit position to clip at
8679
+ * @return clipped value
8680
+ */
8681
+static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
8682
+{
8683
+    if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
8684
+    else                   return  a;
8685
+}
8686
+
8687
+/**
8688
+ * Clear high bits from an unsigned integer starting with specific bit position
8689
+ * @param  a value to clip
8690
+ * @param  p bit position to clip at
8691
+ * @return clipped value
8692
+ */
8693
+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
8694
+{
8695
+    return a & ((1 << p) - 1);
8696
+}
8697
+
8698
+/**
8699
+ * Add two signed 32-bit values with saturation.
8700
+ *
8701
+ * @param  a one value
8702
+ * @param  b another value
8703
+ * @return sum with signed saturation
8704
+ */
8705
+static av_always_inline int av_sat_add32_c(int a, int b)
8706
+{
8707
+    return av_clipl_int32((int64_t)a + b);
8708
+}
8709
+
8710
+/**
8711
+ * Add a doubled value to another value with saturation at both stages.
8712
+ *
8713
+ * @param  a first value
8714
+ * @param  b value doubled and added to a
8715
+ * @return sum sat(a + sat(2*b)) with signed saturation
8716
+ */
8717
+static av_always_inline int av_sat_dadd32_c(int a, int b)
8718
+{
8719
+    return av_sat_add32(a, av_sat_add32(b, b));
8720
+}
8721
+
8722
+/**
8723
+ * Subtract two signed 32-bit values with saturation.
8724
+ *
8725
+ * @param  a one value
8726
+ * @param  b another value
8727
+ * @return difference with signed saturation
8728
+ */
8729
+static av_always_inline int av_sat_sub32_c(int a, int b)
8730
+{
8731
+    return av_clipl_int32((int64_t)a - b);
8732
+}
8733
+
8734
+/**
8735
+ * Subtract a doubled value from another value with saturation at both stages.
8736
+ *
8737
+ * @param  a first value
8738
+ * @param  b value doubled and subtracted from a
8739
+ * @return difference sat(a - sat(2*b)) with signed saturation
8740
+ */
8741
+static av_always_inline int av_sat_dsub32_c(int a, int b)
8742
+{
8743
+    return av_sat_sub32(a, av_sat_add32(b, b));
8744
+}
8745
+
8746
+/**
8747
+ * Clip a float value into the amin-amax range.
8748
+ * @param a value to clip
8749
+ * @param amin minimum value of the clip range
8750
+ * @param amax maximum value of the clip range
8751
+ * @return clipped value
8752
+ */
8753
+static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
8754
+{
8755
+#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8756
+    if (amin > amax) abort();
8757
+#endif
8758
+    if      (a < amin) return amin;
8759
+    else if (a > amax) return amax;
8760
+    else               return a;
8761
+}
8762
+
8763
+/**
8764
+ * Clip a double value into the amin-amax range.
8765
+ * @param a value to clip
8766
+ * @param amin minimum value of the clip range
8767
+ * @param amax maximum value of the clip range
8768
+ * @return clipped value
8769
+ */
8770
+static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
8771
+{
8772
+#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8773
+    if (amin > amax) abort();
8774
+#endif
8775
+    if      (a < amin) return amin;
8776
+    else if (a > amax) return amax;
8777
+    else               return a;
8778
+}
8779
+
8780
+/** Compute ceil(log2(x)).
8781
+ * @param x value used to compute ceil(log2(x))
8782
+ * @return computed ceiling of log2(x)
8783
+ */
8784
+static av_always_inline av_const int av_ceil_log2_c(int x)
8785
+{
8786
+    return av_log2((x - 1) << 1);
8787
+}
8788
+
8789
+/**
8790
+ * Count number of bits set to one in x
8791
+ * @param x value to count bits of
8792
+ * @return the number of bits set to one in x
8793
+ */
8794
+static av_always_inline av_const int av_popcount_c(uint32_t x)
8795
+{
8796
+    x -= (x >> 1) & 0x55555555;
8797
+    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
8798
+    x = (x + (x >> 4)) & 0x0F0F0F0F;
8799
+    x += x >> 8;
8800
+    return (x + (x >> 16)) & 0x3F;
8801
+}
8802
+
8803
+/**
8804
+ * Count number of bits set to one in x
8805
+ * @param x value to count bits of
8806
+ * @return the number of bits set to one in x
8807
+ */
8808
+static av_always_inline av_const int av_popcount64_c(uint64_t x)
8809
+{
8810
+    return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
8811
+}
8812
+
8813
+static av_always_inline av_const int av_parity_c(uint32_t v)
8814
+{
8815
+    return av_popcount(v) & 1;
8816
+}
8817
+
8818
+#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
8819
+#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
8820
+
8821
+/**
8822
+ * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
8823
+ *
8824
+ * @param val      Output value, must be an lvalue of type uint32_t.
8825
+ * @param GET_BYTE Expression reading one byte from the input.
8826
+ *                 Evaluated up to 7 times (4 for the currently
8827
+ *                 assigned Unicode range).  With a memory buffer
8828
+ *                 input, this could be *ptr++.
8829
+ * @param ERROR    Expression to be evaluated on invalid input,
8830
+ *                 typically a goto statement.
8831
+ *
8832
+ * @warning ERROR should not contain a loop control statement which
8833
+ * could interact with the internal while loop, and should force an
8834
+ * exit from the macro code (e.g. through a goto or a return) in order
8835
+ * to prevent undefined results.
8836
+ */
8837
+#define GET_UTF8(val, GET_BYTE, ERROR)\
8838
+    val= (GET_BYTE);\
8839
+    {\
8840
+        uint32_t top = (val & 128) >> 1;\
8841
+        if ((val & 0xc0) == 0x80 || val >= 0xFE)\
8842
+            ERROR\
8843
+        while (val & top) {\
8844
+            int tmp= (GET_BYTE) - 128;\
8845
+            if(tmp>>6)\
8846
+                ERROR\
8847
+            val= (val<<6) + tmp;\
8848
+            top <<= 5;\
8849
+        }\
8850
+        val &= (top << 1) - 1;\
8851
+    }
8852
+
8853
+/**
8854
+ * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
8855
+ *
8856
+ * @param val       Output value, must be an lvalue of type uint32_t.
8857
+ * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
8858
+ *                  to native byte order.  Evaluated one or two times.
8859
+ * @param ERROR     Expression to be evaluated on invalid input,
8860
+ *                  typically a goto statement.
8861
+ */
8862
+#define GET_UTF16(val, GET_16BIT, ERROR)\
8863
+    val = GET_16BIT;\
8864
+    {\
8865
+        unsigned int hi = val - 0xD800;\
8866
+        if (hi < 0x800) {\
8867
+            val = GET_16BIT - 0xDC00;\
8868
+            if (val > 0x3FFU || hi > 0x3FFU)\
8869
+                ERROR\
8870
+            val += (hi<<10) + 0x10000;\
8871
+        }\
8872
+    }\
8873
+
8874
+/**
8875
+ * @def PUT_UTF8(val, tmp, PUT_BYTE)
8876
+ * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
8877
+ * @param val is an input-only argument and should be of type uint32_t. It holds
8878
+ * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
8879
+ * val is given as a function it is executed only once.
8880
+ * @param tmp is a temporary variable and should be of type uint8_t. It
8881
+ * represents an intermediate value during conversion that is to be
8882
+ * output by PUT_BYTE.
8883
+ * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
8884
+ * It could be a function or a statement, and uses tmp as the input byte.
8885
+ * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
8886
+ * executed up to 4 times for values in the valid UTF-8 range and up to
8887
+ * 7 times in the general case, depending on the length of the converted
8888
+ * Unicode character.
8889
+ */
8890
+#define PUT_UTF8(val, tmp, PUT_BYTE)\
8891
+    {\
8892
+        int bytes, shift;\
8893
+        uint32_t in = val;\
8894
+        if (in < 0x80) {\
8895
+            tmp = in;\
8896
+            PUT_BYTE\
8897
+        } else {\
8898
+            bytes = (av_log2(in) + 4) / 5;\
8899
+            shift = (bytes - 1) * 6;\
8900
+            tmp = (256 - (256 >> bytes)) | (in >> shift);\
8901
+            PUT_BYTE\
8902
+            while (shift >= 6) {\
8903
+                shift -= 6;\
8904
+                tmp = 0x80 | ((in >> shift) & 0x3f);\
8905
+                PUT_BYTE\
8906
+            }\
8907
+        }\
8908
+    }
8909
+
8910
+/**
8911
+ * @def PUT_UTF16(val, tmp, PUT_16BIT)
8912
+ * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
8913
+ * @param val is an input-only argument and should be of type uint32_t. It holds
8914
+ * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
8915
+ * val is given as a function it is executed only once.
8916
+ * @param tmp is a temporary variable and should be of type uint16_t. It
8917
+ * represents an intermediate value during conversion that is to be
8918
+ * output by PUT_16BIT.
8919
+ * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
8920
+ * in desired endianness. It could be a function or a statement, and uses tmp
8921
+ * as the input byte.  For example, PUT_BYTE could be "*output++ = tmp;"
8922
+ * PUT_BYTE will be executed 1 or 2 times depending on input character.
8923
+ */
8924
+#define PUT_UTF16(val, tmp, PUT_16BIT)\
8925
+    {\
8926
+        uint32_t in = val;\
8927
+        if (in < 0x10000) {\
8928
+            tmp = in;\
8929
+            PUT_16BIT\
8930
+        } else {\
8931
+            tmp = 0xD800 | ((in - 0x10000) >> 10);\
8932
+            PUT_16BIT\
8933
+            tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
8934
+            PUT_16BIT\
8935
+        }\
8936
+    }\
8937
+
8938
+
8939
+
8940
+#include "mem.h"
8941
+
8942
+#ifdef HAVE_AV_CONFIG_H
8943
+#    include "internal.h"
8944
+#endif /* HAVE_AV_CONFIG_H */
8945
+
8946
+#endif /* AVUTIL_COMMON_H */
8947
+
8948
+/*
8949
+ * The following definitions are outside the multiple inclusion guard
8950
+ * to ensure they are immediately available in intmath.h.
8951
+ */
8952
+
8953
+#ifndef av_ceil_log2
8954
+#   define av_ceil_log2     av_ceil_log2_c
8955
+#endif
8956
+#ifndef av_clip
8957
+#   define av_clip          av_clip_c
8958
+#endif
8959
+#ifndef av_clip64
8960
+#   define av_clip64        av_clip64_c
8961
+#endif
8962
+#ifndef av_clip_uint8
8963
+#   define av_clip_uint8    av_clip_uint8_c
8964
+#endif
8965
+#ifndef av_clip_int8
8966
+#   define av_clip_int8     av_clip_int8_c
8967
+#endif
8968
+#ifndef av_clip_uint16
8969
+#   define av_clip_uint16   av_clip_uint16_c
8970
+#endif
8971
+#ifndef av_clip_int16
8972
+#   define av_clip_int16    av_clip_int16_c
8973
+#endif
8974
+#ifndef av_clipl_int32
8975
+#   define av_clipl_int32   av_clipl_int32_c
8976
+#endif
8977
+#ifndef av_clip_intp2
8978
+#   define av_clip_intp2    av_clip_intp2_c
8979
+#endif
8980
+#ifndef av_clip_uintp2
8981
+#   define av_clip_uintp2   av_clip_uintp2_c
8982
+#endif
8983
+#ifndef av_mod_uintp2
8984
+#   define av_mod_uintp2    av_mod_uintp2_c
8985
+#endif
8986
+#ifndef av_sat_add32
8987
+#   define av_sat_add32     av_sat_add32_c
8988
+#endif
8989
+#ifndef av_sat_dadd32
8990
+#   define av_sat_dadd32    av_sat_dadd32_c
8991
+#endif
8992
+#ifndef av_sat_sub32
8993
+#   define av_sat_sub32     av_sat_sub32_c
8994
+#endif
8995
+#ifndef av_sat_dsub32
8996
+#   define av_sat_dsub32    av_sat_dsub32_c
8997
+#endif
8998
+#ifndef av_clipf
8999
+#   define av_clipf         av_clipf_c
9000
+#endif
9001
+#ifndef av_clipd
9002
+#   define av_clipd         av_clipd_c
9003
+#endif
9004
+#ifndef av_popcount
9005
+#   define av_popcount      av_popcount_c
9006
+#endif
9007
+#ifndef av_popcount64
9008
+#   define av_popcount64    av_popcount64_c
9009
+#endif
9010
+#ifndef av_parity
9011
+#   define av_parity        av_parity_c
9012
+#endif
9013
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9014
new file mode 100644
9015
index 000000000000..8bb9eb606bf2
9016
--- /dev/null
9017
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9018
@@ -0,0 +1,130 @@
9019
+/*
9020
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
9021
+ *
9022
+ * This file is part of FFmpeg.
9023
+ *
9024
+ * FFmpeg is free software; you can redistribute it and/or
9025
+ * modify it under the terms of the GNU Lesser General Public
9026
+ * License as published by the Free Software Foundation; either
9027
+ * version 2.1 of the License, or (at your option) any later version.
9028
+ *
9029
+ * FFmpeg is distributed in the hope that it will be useful,
9030
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9031
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9032
+ * Lesser General Public License for more details.
9033
+ *
9034
+ * You should have received a copy of the GNU Lesser General Public
9035
+ * License along with FFmpeg; if not, write to the Free Software
9036
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9037
+ */
9038
+
9039
+#ifndef AVUTIL_CPU_H
9040
+#define AVUTIL_CPU_H
9041
+
9042
+#include <stddef.h>
9043
+
9044
+#include "attributes.h"
9045
+
9046
+#define AV_CPU_FLAG_FORCE    0x80000000 /* force usage of selected flags (OR) */
9047
+
9048
+    /* lower 16 bits - CPU features */
9049
+#define AV_CPU_FLAG_MMX          0x0001 ///< standard MMX
9050
+#define AV_CPU_FLAG_MMXEXT       0x0002 ///< SSE integer functions or AMD MMX ext
9051
+#define AV_CPU_FLAG_MMX2         0x0002 ///< SSE integer functions or AMD MMX ext
9052
+#define AV_CPU_FLAG_3DNOW        0x0004 ///< AMD 3DNOW
9053
+#define AV_CPU_FLAG_SSE          0x0008 ///< SSE functions
9054
+#define AV_CPU_FLAG_SSE2         0x0010 ///< PIV SSE2 functions
9055
+#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
9056
+                                        ///< than regular MMX/SSE (e.g. Core1)
9057
+#define AV_CPU_FLAG_3DNOWEXT     0x0020 ///< AMD 3DNowExt
9058
+#define AV_CPU_FLAG_SSE3         0x0040 ///< Prescott SSE3 functions
9059
+#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
9060
+                                        ///< than regular MMX/SSE (e.g. Core1)
9061
+#define AV_CPU_FLAG_SSSE3        0x0080 ///< Conroe SSSE3 functions
9062
+#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
9063
+#define AV_CPU_FLAG_ATOM     0x10000000 ///< Atom processor, some SSSE3 instructions are slower
9064
+#define AV_CPU_FLAG_SSE4         0x0100 ///< Penryn SSE4.1 functions
9065
+#define AV_CPU_FLAG_SSE42        0x0200 ///< Nehalem SSE4.2 functions
9066
+#define AV_CPU_FLAG_AESNI       0x80000 ///< Advanced Encryption Standard functions
9067
+#define AV_CPU_FLAG_AVX          0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
9068
+#define AV_CPU_FLAG_AVXSLOW   0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
9069
+#define AV_CPU_FLAG_XOP          0x0400 ///< Bulldozer XOP functions
9070
+#define AV_CPU_FLAG_FMA4         0x0800 ///< Bulldozer FMA4 functions
9071
+#define AV_CPU_FLAG_CMOV         0x1000 ///< supports cmov instruction
9072
+#define AV_CPU_FLAG_AVX2         0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
9073
+#define AV_CPU_FLAG_FMA3        0x10000 ///< Haswell FMA3 functions
9074
+#define AV_CPU_FLAG_BMI1        0x20000 ///< Bit Manipulation Instruction Set 1
9075
+#define AV_CPU_FLAG_BMI2        0x40000 ///< Bit Manipulation Instruction Set 2
9076
+#define AV_CPU_FLAG_AVX512     0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
9077
+
9078
+#define AV_CPU_FLAG_ALTIVEC      0x0001 ///< standard
9079
+#define AV_CPU_FLAG_VSX          0x0002 ///< ISA 2.06
9080
+#define AV_CPU_FLAG_POWER8       0x0004 ///< ISA 2.07
9081
+
9082
+#define AV_CPU_FLAG_ARMV5TE      (1 << 0)
9083
+#define AV_CPU_FLAG_ARMV6        (1 << 1)
9084
+#define AV_CPU_FLAG_ARMV6T2      (1 << 2)
9085
+#define AV_CPU_FLAG_VFP          (1 << 3)
9086
+#define AV_CPU_FLAG_VFPV3        (1 << 4)
9087
+#define AV_CPU_FLAG_NEON         (1 << 5)
9088
+#define AV_CPU_FLAG_ARMV8        (1 << 6)
9089
+#define AV_CPU_FLAG_VFP_VM       (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
9090
+#define AV_CPU_FLAG_SETEND       (1 <<16)
9091
+
9092
+/**
9093
+ * Return the flags which specify extensions supported by the CPU.
9094
+ * The returned value is affected by av_force_cpu_flags() if that was used
9095
+ * before. So av_get_cpu_flags() can easily be used in an application to
9096
+ * detect the enabled cpu flags.
9097
+ */
9098
+int av_get_cpu_flags(void);
9099
+
9100
+/**
9101
+ * Disables cpu detection and forces the specified flags.
9102
+ * -1 is a special case that disables forcing of specific flags.
9103
+ */
9104
+void av_force_cpu_flags(int flags);
9105
+
9106
+/**
9107
+ * Set a mask on flags returned by av_get_cpu_flags().
9108
+ * This function is mainly useful for testing.
9109
+ * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
9110
+ */
9111
+attribute_deprecated void av_set_cpu_flags_mask(int mask);
9112
+
9113
+/**
9114
+ * Parse CPU flags from a string.
9115
+ *
9116
+ * The returned flags contain the specified flags as well as related unspecified flags.
9117
+ *
9118
+ * This function exists only for compatibility with libav.
9119
+ * Please use av_parse_cpu_caps() when possible.
9120
+ * @return a combination of AV_CPU_* flags, negative on error.
9121
+ */
9122
+attribute_deprecated
9123
+int av_parse_cpu_flags(const char *s);
9124
+
9125
+/**
9126
+ * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
9127
+ *
9128
+ * @return negative on error.
9129
+ */
9130
+int av_parse_cpu_caps(unsigned *flags, const char *s);
9131
+
9132
+/**
9133
+ * @return the number of logical CPU cores present.
9134
+ */
9135
+int av_cpu_count(void);
9136
+
9137
+/**
9138
+ * Get the maximum data alignment that may be required by FFmpeg.
9139
+ *
9140
+ * Note that this is affected by the build configuration and the CPU flags mask,
9141
+ * so e.g. if the CPU supports AVX, but libavutil has been built with
9142
+ * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
9143
+ *  av_set_cpu_flags_mask(), then this function will behave as if AVX is not
9144
+ *  present.
9145
+ */
9146
+size_t av_cpu_max_align(void);
9147
+
9148
+#endif /* AVUTIL_CPU_H */
9149
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9150
new file mode 100644
9151
index 000000000000..118f1f00ed20
9152
--- /dev/null
9153
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9154
@@ -0,0 +1,200 @@
9155
+/*
9156
+ * This file is part of FFmpeg.
9157
+ *
9158
+ * FFmpeg is free software; you can redistribute it and/or
9159
+ * modify it under the terms of the GNU Lesser General Public
9160
+ * License as published by the Free Software Foundation; either
9161
+ * version 2.1 of the License, or (at your option) any later version.
9162
+ *
9163
+ * FFmpeg is distributed in the hope that it will be useful,
9164
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9165
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9166
+ * Lesser General Public License for more details.
9167
+ *
9168
+ * You should have received a copy of the GNU Lesser General Public
9169
+ * License along with FFmpeg; if not, write to the Free Software
9170
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9171
+ */
9172
+
9173
+/**
9174
+ * @file
9175
+ * Public dictionary API.
9176
+ * @deprecated
9177
+ *  AVDictionary is provided for compatibility with libav. It is both in
9178
+ *  implementation as well as API inefficient. It does not scale and is
9179
+ *  extremely slow with large dictionaries.
9180
+ *  It is recommended that new code uses our tree container from tree.c/h
9181
+ *  where applicable, which uses AVL trees to achieve O(log n) performance.
9182
+ */
9183
+
9184
+#ifndef AVUTIL_DICT_H
9185
+#define AVUTIL_DICT_H
9186
+
9187
+#include <stdint.h>
9188
+
9189
+#include "version.h"
9190
+
9191
+/**
9192
+ * @addtogroup lavu_dict AVDictionary
9193
+ * @ingroup lavu_data
9194
+ *
9195
+ * @brief Simple key:value store
9196
+ *
9197
+ * @{
9198
+ * Dictionaries are used for storing key:value pairs. To create
9199
+ * an AVDictionary, simply pass an address of a NULL pointer to
9200
+ * av_dict_set(). NULL can be used as an empty dictionary wherever
9201
+ * a pointer to an AVDictionary is required.
9202
+ * Use av_dict_get() to retrieve an entry or iterate over all
9203
+ * entries and finally av_dict_free() to free the dictionary
9204
+ * and all its contents.
9205
+ *
9206
+ @code
9207
+   AVDictionary *d = NULL;           // "create" an empty dictionary
9208
+   AVDictionaryEntry *t = NULL;
9209
+
9210
+   av_dict_set(&d, "foo", "bar", 0); // add an entry
9211
+
9212
+   char *k = av_strdup("key");       // if your strings are already allocated,
9213
+   char *v = av_strdup("value");     // you can avoid copying them like this
9214
+   av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
9215
+
9216
+   while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
9217
+       <....>                             // iterate over all entries in d
9218
+   }
9219
+   av_dict_free(&d);
9220
+ @endcode
9221
+ */
9222
+
9223
+#define AV_DICT_MATCH_CASE      1   /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
9224
+#define AV_DICT_IGNORE_SUFFIX   2   /**< Return first entry in a dictionary whose first part corresponds to the search key,
9225
+                                         ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
9226
+#define AV_DICT_DONT_STRDUP_KEY 4   /**< Take ownership of a key that's been
9227
+                                         allocated with av_malloc() or another memory allocation function. */
9228
+#define AV_DICT_DONT_STRDUP_VAL 8   /**< Take ownership of a value that's been
9229
+                                         allocated with av_malloc() or another memory allocation function. */
9230
+#define AV_DICT_DONT_OVERWRITE 16   ///< Don't overwrite existing entries.
9231
+#define AV_DICT_APPEND         32   /**< If the entry already exists, append to it.  Note that no
9232
+                                      delimiter is added, the strings are simply concatenated. */
9233
+#define AV_DICT_MULTIKEY       64   /**< Allow to store several equal keys in the dictionary */
9234
+
9235
+typedef struct AVDictionaryEntry {
9236
+    char *key;
9237
+    char *value;
9238
+} AVDictionaryEntry;
9239
+
9240
+typedef struct AVDictionary AVDictionary;
9241
+
9242
+/**
9243
+ * Get a dictionary entry with matching key.
9244
+ *
9245
+ * The returned entry key or value must not be changed, or it will
9246
+ * cause undefined behavior.
9247
+ *
9248
+ * To iterate through all the dictionary entries, you can set the matching key
9249
+ * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
9250
+ *
9251
+ * @param prev Set to the previous matching element to find the next.
9252
+ *             If set to NULL the first matching element is returned.
9253
+ * @param key matching key
9254
+ * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
9255
+ * @return found entry or NULL in case no matching entry was found in the dictionary
9256
+ */
9257
+AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
9258
+                               const AVDictionaryEntry *prev, int flags);
9259
+
9260
+/**
9261
+ * Get number of entries in dictionary.
9262
+ *
9263
+ * @param m dictionary
9264
+ * @return  number of entries in dictionary
9265
+ */
9266
+int av_dict_count(const AVDictionary *m);
9267
+
9268
+/**
9269
+ * Set the given entry in *pm, overwriting an existing entry.
9270
+ *
9271
+ * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
9272
+ * these arguments will be freed on error.
9273
+ *
9274
+ * Warning: Adding a new entry to a dictionary invalidates all existing entries
9275
+ * previously returned with av_dict_get.
9276
+ *
9277
+ * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
9278
+ * a dictionary struct is allocated and put in *pm.
9279
+ * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
9280
+ * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
9281
+ *        Passing a NULL value will cause an existing entry to be deleted.
9282
+ * @return >= 0 on success otherwise an error code <0
9283
+ */
9284
+int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
9285
+
9286
+/**
9287
+ * Convenience wrapper for av_dict_set that converts the value to a string
9288
+ * and stores it.
9289
+ *
9290
+ * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
9291
+ */
9292
+int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
9293
+
9294
+/**
9295
+ * Parse the key/value pairs list and add the parsed entries to a dictionary.
9296
+ *
9297
+ * In case of failure, all the successfully set entries are stored in
9298
+ * *pm. You may need to manually free the created dictionary.
9299
+ *
9300
+ * @param key_val_sep  a 0-terminated list of characters used to separate
9301
+ *                     key from value
9302
+ * @param pairs_sep    a 0-terminated list of characters used to separate
9303
+ *                     two pairs from each other
9304
+ * @param flags        flags to use when adding to dictionary.
9305
+ *                     AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
9306
+ *                     are ignored since the key/value tokens will always
9307
+ *                     be duplicated.
9308
+ * @return             0 on success, negative AVERROR code on failure
9309
+ */
9310
+int av_dict_parse_string(AVDictionary **pm, const char *str,
9311
+                         const char *key_val_sep, const char *pairs_sep,
9312
+                         int flags);
9313
+
9314
+/**
9315
+ * Copy entries from one AVDictionary struct into another.
9316
+ * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
9317
+ *            this function will allocate a struct for you and put it in *dst
9318
+ * @param src pointer to source AVDictionary struct
9319
+ * @param flags flags to use when setting entries in *dst
9320
+ * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
9321
+ * @return 0 on success, negative AVERROR code on failure. If dst was allocated
9322
+ *           by this function, callers should free the associated memory.
9323
+ */
9324
+int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
9325
+
9326
+/**
9327
+ * Free all the memory allocated for an AVDictionary struct
9328
+ * and all keys and values.
9329
+ */
9330
+void av_dict_free(AVDictionary **m);
9331
+
9332
+/**
9333
+ * Get dictionary entries as a string.
9334
+ *
9335
+ * Create a string containing dictionary's entries.
9336
+ * Such string may be passed back to av_dict_parse_string().
9337
+ * @note String is escaped with backslashes ('\').
9338
+ *
9339
+ * @param[in]  m             dictionary
9340
+ * @param[out] buffer        Pointer to buffer that will be allocated with string containg entries.
9341
+ *                           Buffer must be freed by the caller when is no longer needed.
9342
+ * @param[in]  key_val_sep   character used to separate key from value
9343
+ * @param[in]  pairs_sep     character used to separate two pairs from each other
9344
+ * @return                   >= 0 on success, negative on error
9345
+ * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
9346
+ */
9347
+int av_dict_get_string(const AVDictionary *m, char **buffer,
9348
+                       const char key_val_sep, const char pairs_sep);
9349
+
9350
+/**
9351
+ * @}
9352
+ */
9353
+
9354
+#endif /* AVUTIL_DICT_H */
9355
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9356
new file mode 100644
9357
index 000000000000..71df4da353b9
9358
--- /dev/null
9359
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9360
@@ -0,0 +1,126 @@
9361
+/*
9362
+ * This file is part of FFmpeg.
9363
+ *
9364
+ * FFmpeg is free software; you can redistribute it and/or
9365
+ * modify it under the terms of the GNU Lesser General Public
9366
+ * License as published by the Free Software Foundation; either
9367
+ * version 2.1 of the License, or (at your option) any later version.
9368
+ *
9369
+ * FFmpeg is distributed in the hope that it will be useful,
9370
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9371
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9372
+ * Lesser General Public License for more details.
9373
+ *
9374
+ * You should have received a copy of the GNU Lesser General Public
9375
+ * License along with FFmpeg; if not, write to the Free Software
9376
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9377
+ */
9378
+
9379
+/**
9380
+ * @file
9381
+ * error code definitions
9382
+ */
9383
+
9384
+#ifndef AVUTIL_ERROR_H
9385
+#define AVUTIL_ERROR_H
9386
+
9387
+#include <errno.h>
9388
+#include <stddef.h>
9389
+
9390
+/**
9391
+ * @addtogroup lavu_error
9392
+ *
9393
+ * @{
9394
+ */
9395
+
9396
+
9397
+/* error handling */
9398
+#if EDOM > 0
9399
+#define AVERROR(e) (-(e))   ///< Returns a negative error code from a POSIX error code, to return from library functions.
9400
+#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
9401
+#else
9402
+/* Some platforms have E* and errno already negated. */
9403
+#define AVERROR(e) (e)
9404
+#define AVUNERROR(e) (e)
9405
+#endif
9406
+
9407
+#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
9408
+
9409
+#define AVERROR_BSF_NOT_FOUND      FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
9410
+#define AVERROR_BUG                FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
9411
+#define AVERROR_BUFFER_TOO_SMALL   FFERRTAG( 'B','U','F','S') ///< Buffer too small
9412
+#define AVERROR_DECODER_NOT_FOUND  FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
9413
+#define AVERROR_DEMUXER_NOT_FOUND  FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
9414
+#define AVERROR_ENCODER_NOT_FOUND  FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
9415
+#define AVERROR_EOF                FFERRTAG( 'E','O','F',' ') ///< End of file
9416
+#define AVERROR_EXIT               FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
9417
+#define AVERROR_EXTERNAL           FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
9418
+#define AVERROR_FILTER_NOT_FOUND   FFERRTAG(0xF8,'F','I','L') ///< Filter not found
9419
+#define AVERROR_INVALIDDATA        FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
9420
+#define AVERROR_MUXER_NOT_FOUND    FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
9421
+#define AVERROR_OPTION_NOT_FOUND   FFERRTAG(0xF8,'O','P','T') ///< Option not found
9422
+#define AVERROR_PATCHWELCOME       FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
9423
+#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
9424
+
9425
+#define AVERROR_STREAM_NOT_FOUND   FFERRTAG(0xF8,'S','T','R') ///< Stream not found
9426
+/**
9427
+ * This is semantically identical to AVERROR_BUG
9428
+ * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
9429
+ */
9430
+#define AVERROR_BUG2               FFERRTAG( 'B','U','G',' ')
9431
+#define AVERROR_UNKNOWN            FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
9432
+#define AVERROR_EXPERIMENTAL       (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
9433
+#define AVERROR_INPUT_CHANGED      (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
9434
+#define AVERROR_OUTPUT_CHANGED     (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
9435
+/* HTTP & RTSP errors */
9436
+#define AVERROR_HTTP_BAD_REQUEST   FFERRTAG(0xF8,'4','0','0')
9437
+#define AVERROR_HTTP_UNAUTHORIZED  FFERRTAG(0xF8,'4','0','1')
9438
+#define AVERROR_HTTP_FORBIDDEN     FFERRTAG(0xF8,'4','0','3')
9439
+#define AVERROR_HTTP_NOT_FOUND     FFERRTAG(0xF8,'4','0','4')
9440
+#define AVERROR_HTTP_OTHER_4XX     FFERRTAG(0xF8,'4','X','X')
9441
+#define AVERROR_HTTP_SERVER_ERROR  FFERRTAG(0xF8,'5','X','X')
9442
+
9443
+#define AV_ERROR_MAX_STRING_SIZE 64
9444
+
9445
+/**
9446
+ * Put a description of the AVERROR code errnum in errbuf.
9447
+ * In case of failure the global variable errno is set to indicate the
9448
+ * error. Even in case of failure av_strerror() will print a generic
9449
+ * error message indicating the errnum provided to errbuf.
9450
+ *
9451
+ * @param errnum      error code to describe
9452
+ * @param errbuf      buffer to which description is written
9453
+ * @param errbuf_size the size in bytes of errbuf
9454
+ * @return 0 on success, a negative value if a description for errnum
9455
+ * cannot be found
9456
+ */
9457
+int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
9458
+
9459
+/**
9460
+ * Fill the provided buffer with a string containing an error string
9461
+ * corresponding to the AVERROR code errnum.
9462
+ *
9463
+ * @param errbuf         a buffer
9464
+ * @param errbuf_size    size in bytes of errbuf
9465
+ * @param errnum         error code to describe
9466
+ * @return the buffer in input, filled with the error description
9467
+ * @see av_strerror()
9468
+ */
9469
+static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
9470
+{
9471
+    av_strerror(errnum, errbuf, errbuf_size);
9472
+    return errbuf;
9473
+}
9474
+
9475
+/**
9476
+ * Convenience macro, the return value should be used only directly in
9477
+ * function arguments but never stand-alone.
9478
+ */
9479
+#define av_err2str(errnum) \
9480
+    av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
9481
+
9482
+/**
9483
+ * @}
9484
+ */
9485
+
9486
+#endif /* AVUTIL_ERROR_H */
9487
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9488
new file mode 100644
9489
index 000000000000..9d57d6ce66ff
9490
--- /dev/null
9491
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9492
@@ -0,0 +1,893 @@
9493
+/*
9494
+ * This file is part of FFmpeg.
9495
+ *
9496
+ * FFmpeg is free software; you can redistribute it and/or
9497
+ * modify it under the terms of the GNU Lesser General Public
9498
+ * License as published by the Free Software Foundation; either
9499
+ * version 2.1 of the License, or (at your option) any later version.
9500
+ *
9501
+ * FFmpeg is distributed in the hope that it will be useful,
9502
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9503
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9504
+ * Lesser General Public License for more details.
9505
+ *
9506
+ * You should have received a copy of the GNU Lesser General Public
9507
+ * License along with FFmpeg; if not, write to the Free Software
9508
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9509
+ */
9510
+
9511
+/**
9512
+ * @file
9513
+ * @ingroup lavu_frame
9514
+ * reference-counted frame API
9515
+ */
9516
+
9517
+#ifndef AVUTIL_FRAME_H
9518
+#define AVUTIL_FRAME_H
9519
+
9520
+#include <stddef.h>
9521
+#include <stdint.h>
9522
+
9523
+#include "avutil.h"
9524
+#include "buffer.h"
9525
+#include "dict.h"
9526
+#include "rational.h"
9527
+#include "samplefmt.h"
9528
+#include "pixfmt.h"
9529
+#include "version.h"
9530
+
9531
+
9532
+/**
9533
+ * @defgroup lavu_frame AVFrame
9534
+ * @ingroup lavu_data
9535
+ *
9536
+ * @{
9537
+ * AVFrame is an abstraction for reference-counted raw multimedia data.
9538
+ */
9539
+
9540
+enum AVFrameSideDataType {
9541
+    /**
9542
+     * The data is the AVPanScan struct defined in libavcodec.
9543
+     */
9544
+    AV_FRAME_DATA_PANSCAN,
9545
+    /**
9546
+     * ATSC A53 Part 4 Closed Captions.
9547
+     * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
9548
+     * The number of bytes of CC data is AVFrameSideData.size.
9549
+     */
9550
+    AV_FRAME_DATA_A53_CC,
9551
+    /**
9552
+     * Stereoscopic 3d metadata.
9553
+     * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
9554
+     */
9555
+    AV_FRAME_DATA_STEREO3D,
9556
+    /**
9557
+     * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
9558
+     */
9559
+    AV_FRAME_DATA_MATRIXENCODING,
9560
+    /**
9561
+     * Metadata relevant to a downmix procedure.
9562
+     * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
9563
+     */
9564
+    AV_FRAME_DATA_DOWNMIX_INFO,
9565
+    /**
9566
+     * ReplayGain information in the form of the AVReplayGain struct.
9567
+     */
9568
+    AV_FRAME_DATA_REPLAYGAIN,
9569
+    /**
9570
+     * This side data contains a 3x3 transformation matrix describing an affine
9571
+     * transformation that needs to be applied to the frame for correct
9572
+     * presentation.
9573
+     *
9574
+     * See libavutil/display.h for a detailed description of the data.
9575
+     */
9576
+    AV_FRAME_DATA_DISPLAYMATRIX,
9577
+    /**
9578
+     * Active Format Description data consisting of a single byte as specified
9579
+     * in ETSI TS 101 154 using AVActiveFormatDescription enum.
9580
+     */
9581
+    AV_FRAME_DATA_AFD,
9582
+    /**
9583
+     * Motion vectors exported by some codecs (on demand through the export_mvs
9584
+     * flag set in the libavcodec AVCodecContext flags2 option).
9585
+     * The data is the AVMotionVector struct defined in
9586
+     * libavutil/motion_vector.h.
9587
+     */
9588
+    AV_FRAME_DATA_MOTION_VECTORS,
9589
+    /**
9590
+     * Recommmends skipping the specified number of samples. This is exported
9591
+     * only if the "skip_manual" AVOption is set in libavcodec.
9592
+     * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
9593
+     * @code
9594
+     * u32le number of samples to skip from start of this packet
9595
+     * u32le number of samples to skip from end of this packet
9596
+     * u8    reason for start skip
9597
+     * u8    reason for end   skip (0=padding silence, 1=convergence)
9598
+     * @endcode
9599
+     */
9600
+    AV_FRAME_DATA_SKIP_SAMPLES,
9601
+    /**
9602
+     * This side data must be associated with an audio frame and corresponds to
9603
+     * enum AVAudioServiceType defined in avcodec.h.
9604
+     */
9605
+    AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
9606
+    /**
9607
+     * Mastering display metadata associated with a video frame. The payload is
9608
+     * an AVMasteringDisplayMetadata type and contains information about the
9609
+     * mastering display color volume.
9610
+     */
9611
+    AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
9612
+    /**
9613
+     * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
9614
+     * This is set on the first frame of a GOP that has a temporal reference of 0.
9615
+     */
9616
+    AV_FRAME_DATA_GOP_TIMECODE,
9617
+
9618
+    /**
9619
+     * The data represents the AVSphericalMapping structure defined in
9620
+     * libavutil/spherical.h.
9621
+     */
9622
+    AV_FRAME_DATA_SPHERICAL,
9623
+
9624
+    /**
9625
+     * Content light level (based on CTA-861.3). This payload contains data in
9626
+     * the form of the AVContentLightMetadata struct.
9627
+     */
9628
+    AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
9629
+
9630
+    /**
9631
+     * The data contains an ICC profile as an opaque octet buffer following the
9632
+     * format described by ISO 15076-1 with an optional name defined in the
9633
+     * metadata key entry "name".
9634
+     */
9635
+    AV_FRAME_DATA_ICC_PROFILE,
9636
+
9637
+#if FF_API_FRAME_QP
9638
+    /**
9639
+     * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
9640
+     * The contents of this side data are undocumented and internal; use
9641
+     * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
9642
+     * meaningful way instead.
9643
+     */
9644
+    AV_FRAME_DATA_QP_TABLE_PROPERTIES,
9645
+
9646
+    /**
9647
+     * Raw QP table data. Its format is described by
9648
+     * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
9649
+     * av_frame_get_qp_table() to access this instead.
9650
+     */
9651
+    AV_FRAME_DATA_QP_TABLE_DATA,
9652
+#endif
9653
+};
9654
+
9655
+enum AVActiveFormatDescription {
9656
+    AV_AFD_SAME         = 8,
9657
+    AV_AFD_4_3          = 9,
9658
+    AV_AFD_16_9         = 10,
9659
+    AV_AFD_14_9         = 11,
9660
+    AV_AFD_4_3_SP_14_9  = 13,
9661
+    AV_AFD_16_9_SP_14_9 = 14,
9662
+    AV_AFD_SP_4_3       = 15,
9663
+};
9664
+
9665
+
9666
+/**
9667
+ * Structure to hold side data for an AVFrame.
9668
+ *
9669
+ * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
9670
+ * to the end with a minor bump.
9671
+ */
9672
+typedef struct AVFrameSideData {
9673
+    enum AVFrameSideDataType type;
9674
+    uint8_t *data;
9675
+    int      size;
9676
+    AVDictionary *metadata;
9677
+    AVBufferRef *buf;
9678
+} AVFrameSideData;
9679
+
9680
+/**
9681
+ * This structure describes decoded (raw) audio or video data.
9682
+ *
9683
+ * AVFrame must be allocated using av_frame_alloc(). Note that this only
9684
+ * allocates the AVFrame itself, the buffers for the data must be managed
9685
+ * through other means (see below).
9686
+ * AVFrame must be freed with av_frame_free().
9687
+ *
9688
+ * AVFrame is typically allocated once and then reused multiple times to hold
9689
+ * different data (e.g. a single AVFrame to hold frames received from a
9690
+ * decoder). In such a case, av_frame_unref() will free any references held by
9691
+ * the frame and reset it to its original clean state before it
9692
+ * is reused again.
9693
+ *
9694
+ * The data described by an AVFrame is usually reference counted through the
9695
+ * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
9696
+ * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
9697
+ * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
9698
+ * every single data plane must be contained in one of the buffers in
9699
+ * AVFrame.buf or AVFrame.extended_buf.
9700
+ * There may be a single buffer for all the data, or one separate buffer for
9701
+ * each plane, or anything in between.
9702
+ *
9703
+ * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
9704
+ * to the end with a minor bump.
9705
+ *
9706
+ * Fields can be accessed through AVOptions, the name string used, matches the
9707
+ * C structure field name for fields accessible through AVOptions. The AVClass
9708
+ * for AVFrame can be obtained from avcodec_get_frame_class()
9709
+ */
9710
+typedef struct AVFrame {
9711
+#define AV_NUM_DATA_POINTERS 8
9712
+    /**
9713
+     * pointer to the picture/channel planes.
9714
+     * This might be different from the first allocated byte
9715
+     *
9716
+     * Some decoders access areas outside 0,0 - width,height, please
9717
+     * see avcodec_align_dimensions2(). Some filters and swscale can read
9718
+     * up to 16 bytes beyond the planes, if these filters are to be used,
9719
+     * then 16 extra bytes must be allocated.
9720
+     *
9721
+     * NOTE: Except for hwaccel formats, pointers not needed by the format
9722
+     * MUST be set to NULL.
9723
+     */
9724
+    uint8_t *data[AV_NUM_DATA_POINTERS];
9725
+
9726
+    /**
9727
+     * For video, size in bytes of each picture line.
9728
+     * For audio, size in bytes of each plane.
9729
+     *
9730
+     * For audio, only linesize[0] may be set. For planar audio, each channel
9731
+     * plane must be the same size.
9732
+     *
9733
+     * For video the linesizes should be multiples of the CPUs alignment
9734
+     * preference, this is 16 or 32 for modern desktop CPUs.
9735
+     * Some code requires such alignment other code can be slower without
9736
+     * correct alignment, for yet other it makes no difference.
9737
+     *
9738
+     * @note The linesize may be larger than the size of usable data -- there
9739
+     * may be extra padding present for performance reasons.
9740
+     */
9741
+    int linesize[AV_NUM_DATA_POINTERS];
9742
+
9743
+    /**
9744
+     * pointers to the data planes/channels.
9745
+     *
9746
+     * For video, this should simply point to data[].
9747
+     *
9748
+     * For planar audio, each channel has a separate data pointer, and
9749
+     * linesize[0] contains the size of each channel buffer.
9750
+     * For packed audio, there is just one data pointer, and linesize[0]
9751
+     * contains the total size of the buffer for all channels.
9752
+     *
9753
+     * Note: Both data and extended_data should always be set in a valid frame,
9754
+     * but for planar audio with more channels that can fit in data,
9755
+     * extended_data must be used in order to access all channels.
9756
+     */
9757
+    uint8_t **extended_data;
9758
+
9759
+    /**
9760
+     * @name Video dimensions
9761
+     * Video frames only. The coded dimensions (in pixels) of the video frame,
9762
+     * i.e. the size of the rectangle that contains some well-defined values.
9763
+     *
9764
+     * @note The part of the frame intended for display/presentation is further
9765
+     * restricted by the @ref cropping "Cropping rectangle".
9766
+     * @{
9767
+     */
9768
+    int width, height;
9769
+    /**
9770
+     * @}
9771
+     */
9772
+
9773
+    /**
9774
+     * number of audio samples (per channel) described by this frame
9775
+     */
9776
+    int nb_samples;
9777
+
9778
+    /**
9779
+     * format of the frame, -1 if unknown or unset
9780
+     * Values correspond to enum AVPixelFormat for video frames,
9781
+     * enum AVSampleFormat for audio)
9782
+     */
9783
+    int format;
9784
+
9785
+    /**
9786
+     * 1 -> keyframe, 0-> not
9787
+     */
9788
+    int key_frame;
9789
+
9790
+    /**
9791
+     * Picture type of the frame.
9792
+     */
9793
+    enum AVPictureType pict_type;
9794
+
9795
+    /**
9796
+     * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
9797
+     */
9798
+    AVRational sample_aspect_ratio;
9799
+
9800
+    /**
9801
+     * Presentation timestamp in time_base units (time when frame should be shown to user).
9802
+     */
9803
+    int64_t pts;
9804
+
9805
+#if FF_API_PKT_PTS
9806
+    /**
9807
+     * PTS copied from the AVPacket that was decoded to produce this frame.
9808
+     * @deprecated use the pts field instead
9809
+     */
9810
+    attribute_deprecated
9811
+    int64_t pkt_pts;
9812
+#endif
9813
+
9814
+    /**
9815
+     * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
9816
+     * This is also the Presentation time of this AVFrame calculated from
9817
+     * only AVPacket.dts values without pts values.
9818
+     */
9819
+    int64_t pkt_dts;
9820
+
9821
+    /**
9822
+     * picture number in bitstream order
9823
+     */
9824
+    int coded_picture_number;
9825
+    /**
9826
+     * picture number in display order
9827
+     */
9828
+    int display_picture_number;
9829
+
9830
+    /**
9831
+     * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
9832
+     */
9833
+    int quality;
9834
+
9835
+    /**
9836
+     * for some private data of the user
9837
+     */
9838
+    void *opaque;
9839
+
9840
+#if FF_API_ERROR_FRAME
9841
+    /**
9842
+     * @deprecated unused
9843
+     */
9844
+    attribute_deprecated
9845
+    uint64_t error[AV_NUM_DATA_POINTERS];
9846
+#endif
9847
+
9848
+    /**
9849
+     * When decoding, this signals how much the picture must be delayed.
9850
+     * extra_delay = repeat_pict / (2*fps)
9851
+     */
9852
+    int repeat_pict;
9853
+
9854
+    /**
9855
+     * The content of the picture is interlaced.
9856
+     */
9857
+    int interlaced_frame;
9858
+
9859
+    /**
9860
+     * If the content is interlaced, is top field displayed first.
9861
+     */
9862
+    int top_field_first;
9863
+
9864
+    /**
9865
+     * Tell user application that palette has changed from previous frame.
9866
+     */
9867
+    int palette_has_changed;
9868
+
9869
+    /**
9870
+     * reordered opaque 64 bits (generally an integer or a double precision float
9871
+     * PTS but can be anything).
9872
+     * The user sets AVCodecContext.reordered_opaque to represent the input at
9873
+     * that time,
9874
+     * the decoder reorders values as needed and sets AVFrame.reordered_opaque
9875
+     * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
9876
+     * @deprecated in favor of pkt_pts
9877
+     */
9878
+    int64_t reordered_opaque;
9879
+
9880
+    /**
9881
+     * Sample rate of the audio data.
9882
+     */
9883
+    int sample_rate;
9884
+
9885
+    /**
9886
+     * Channel layout of the audio data.
9887
+     */
9888
+    uint64_t channel_layout;
9889
+
9890
+    /**
9891
+     * AVBuffer references backing the data for this frame. If all elements of
9892
+     * this array are NULL, then this frame is not reference counted. This array
9893
+     * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
9894
+     * also be non-NULL for all j < i.
9895
+     *
9896
+     * There may be at most one AVBuffer per data plane, so for video this array
9897
+     * always contains all the references. For planar audio with more than
9898
+     * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
9899
+     * this array. Then the extra AVBufferRef pointers are stored in the
9900
+     * extended_buf array.
9901
+     */
9902
+    AVBufferRef *buf[AV_NUM_DATA_POINTERS];
9903
+
9904
+    /**
9905
+     * For planar audio which requires more than AV_NUM_DATA_POINTERS
9906
+     * AVBufferRef pointers, this array will hold all the references which
9907
+     * cannot fit into AVFrame.buf.
9908
+     *
9909
+     * Note that this is different from AVFrame.extended_data, which always
9910
+     * contains all the pointers. This array only contains the extra pointers,
9911
+     * which cannot fit into AVFrame.buf.
9912
+     *
9913
+     * This array is always allocated using av_malloc() by whoever constructs
9914
+     * the frame. It is freed in av_frame_unref().
9915
+     */
9916
+    AVBufferRef **extended_buf;
9917
+    /**
9918
+     * Number of elements in extended_buf.
9919
+     */
9920
+    int        nb_extended_buf;
9921
+
9922
+    AVFrameSideData **side_data;
9923
+    int            nb_side_data;
9924
+
9925
+/**
9926
+ * @defgroup lavu_frame_flags AV_FRAME_FLAGS
9927
+ * @ingroup lavu_frame
9928
+ * Flags describing additional frame properties.
9929
+ *
9930
+ * @{
9931
+ */
9932
+
9933
+/**
9934
+ * The frame data may be corrupted, e.g. due to decoding errors.
9935
+ */
9936
+#define AV_FRAME_FLAG_CORRUPT       (1 << 0)
9937
+/**
9938
+ * A flag to mark the frames which need to be decoded, but shouldn't be output.
9939
+ */
9940
+#define AV_FRAME_FLAG_DISCARD   (1 << 2)
9941
+/**
9942
+ * @}
9943
+ */
9944
+
9945
+    /**
9946
+     * Frame flags, a combination of @ref lavu_frame_flags
9947
+     */
9948
+    int flags;
9949
+
9950
+    /**
9951
+     * MPEG vs JPEG YUV range.
9952
+     * - encoding: Set by user
9953
+     * - decoding: Set by libavcodec
9954
+     */
9955
+    enum AVColorRange color_range;
9956
+
9957
+    enum AVColorPrimaries color_primaries;
9958
+
9959
+    enum AVColorTransferCharacteristic color_trc;
9960
+
9961
+    /**
9962
+     * YUV colorspace type.
9963
+     * - encoding: Set by user
9964
+     * - decoding: Set by libavcodec
9965
+     */
9966
+    enum AVColorSpace colorspace;
9967
+
9968
+    enum AVChromaLocation chroma_location;
9969
+
9970
+    /**
9971
+     * frame timestamp estimated using various heuristics, in stream time base
9972
+     * - encoding: unused
9973
+     * - decoding: set by libavcodec, read by user.
9974
+     */
9975
+    int64_t best_effort_timestamp;
9976
+
9977
+    /**
9978
+     * reordered pos from the last AVPacket that has been input into the decoder
9979
+     * - encoding: unused
9980
+     * - decoding: Read by user.
9981
+     */
9982
+    int64_t pkt_pos;
9983
+
9984
+    /**
9985
+     * duration of the corresponding packet, expressed in
9986
+     * AVStream->time_base units, 0 if unknown.
9987
+     * - encoding: unused
9988
+     * - decoding: Read by user.
9989
+     */
9990
+    int64_t pkt_duration;
9991
+
9992
+    /**
9993
+     * metadata.
9994
+     * - encoding: Set by user.
9995
+     * - decoding: Set by libavcodec.
9996
+     */
9997
+    AVDictionary *metadata;
9998
+
9999
+    /**
10000
+     * decode error flags of the frame, set to a combination of
10001
+     * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
10002
+     * were errors during the decoding.
10003
+     * - encoding: unused
10004
+     * - decoding: set by libavcodec, read by user.
10005
+     */
10006
+    int decode_error_flags;
10007
+#define FF_DECODE_ERROR_INVALID_BITSTREAM   1
10008
+#define FF_DECODE_ERROR_MISSING_REFERENCE   2
10009
+
10010
+    /**
10011
+     * number of audio channels, only used for audio.
10012
+     * - encoding: unused
10013
+     * - decoding: Read by user.
10014
+     */
10015
+    int channels;
10016
+
10017
+    /**
10018
+     * size of the corresponding packet containing the compressed
10019
+     * frame.
10020
+     * It is set to a negative value if unknown.
10021
+     * - encoding: unused
10022
+     * - decoding: set by libavcodec, read by user.
10023
+     */
10024
+    int pkt_size;
10025
+
10026
+#if FF_API_FRAME_QP
10027
+    /**
10028
+     * QP table
10029
+     */
10030
+    attribute_deprecated
10031
+    int8_t *qscale_table;
10032
+    /**
10033
+     * QP store stride
10034
+     */
10035
+    attribute_deprecated
10036
+    int qstride;
10037
+
10038
+    attribute_deprecated
10039
+    int qscale_type;
10040
+
10041
+    attribute_deprecated
10042
+    AVBufferRef *qp_table_buf;
10043
+#endif
10044
+    /**
10045
+     * For hwaccel-format frames, this should be a reference to the
10046
+     * AVHWFramesContext describing the frame.
10047
+     */
10048
+    AVBufferRef *hw_frames_ctx;
10049
+
10050
+    /**
10051
+     * AVBufferRef for free use by the API user. FFmpeg will never check the
10052
+     * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
10053
+     * the frame is unreferenced. av_frame_copy_props() calls create a new
10054
+     * reference with av_buffer_ref() for the target frame's opaque_ref field.
10055
+     *
10056
+     * This is unrelated to the opaque field, although it serves a similar
10057
+     * purpose.
10058
+     */
10059
+    AVBufferRef *opaque_ref;
10060
+
10061
+    /**
10062
+     * @anchor cropping
10063
+     * @name Cropping
10064
+     * Video frames only. The number of pixels to discard from the the
10065
+     * top/bottom/left/right border of the frame to obtain the sub-rectangle of
10066
+     * the frame intended for presentation.
10067
+     * @{
10068
+     */
10069
+    size_t crop_top;
10070
+    size_t crop_bottom;
10071
+    size_t crop_left;
10072
+    size_t crop_right;
10073
+    /**
10074
+     * @}
10075
+     */
10076
+
10077
+    /**
10078
+     * AVBufferRef for internal use by a single libav* library.
10079
+     * Must not be used to transfer data between libraries.
10080
+     * Has to be NULL when ownership of the frame leaves the respective library.
10081
+     *
10082
+     * Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
10083
+     *
10084
+     * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
10085
+     * av_frame_copy_props() calls create a new reference with av_buffer_ref()
10086
+     * for the target frame's private_ref field.
10087
+     */
10088
+    AVBufferRef *private_ref;
10089
+} AVFrame;
10090
+
10091
+#if FF_API_FRAME_GET_SET
10092
+/**
10093
+ * Accessors for some AVFrame fields. These used to be provided for ABI
10094
+ * compatibility, and do not need to be used anymore.
10095
+ */
10096
+attribute_deprecated
10097
+int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
10098
+attribute_deprecated
10099
+void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
10100
+attribute_deprecated
10101
+int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
10102
+attribute_deprecated
10103
+void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
10104
+attribute_deprecated
10105
+int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
10106
+attribute_deprecated
10107
+void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
10108
+attribute_deprecated
10109
+int64_t av_frame_get_channel_layout       (const AVFrame *frame);
10110
+attribute_deprecated
10111
+void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
10112
+attribute_deprecated
10113
+int     av_frame_get_channels             (const AVFrame *frame);
10114
+attribute_deprecated
10115
+void    av_frame_set_channels             (AVFrame *frame, int     val);
10116
+attribute_deprecated
10117
+int     av_frame_get_sample_rate          (const AVFrame *frame);
10118
+attribute_deprecated
10119
+void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
10120
+attribute_deprecated
10121
+AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
10122
+attribute_deprecated
10123
+void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
10124
+attribute_deprecated
10125
+int     av_frame_get_decode_error_flags   (const AVFrame *frame);
10126
+attribute_deprecated
10127
+void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
10128
+attribute_deprecated
10129
+int     av_frame_get_pkt_size(const AVFrame *frame);
10130
+attribute_deprecated
10131
+void    av_frame_set_pkt_size(AVFrame *frame, int val);
10132
+#if FF_API_FRAME_QP
10133
+attribute_deprecated
10134
+int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
10135
+attribute_deprecated
10136
+int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
10137
+#endif
10138
+attribute_deprecated
10139
+enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
10140
+attribute_deprecated
10141
+void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
10142
+attribute_deprecated
10143
+enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
10144
+attribute_deprecated
10145
+void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
10146
+#endif
10147
+
10148
+/**
10149
+ * Get the name of a colorspace.
10150
+ * @return a static string identifying the colorspace; can be NULL.
10151
+ */
10152
+const char *av_get_colorspace_name(enum AVColorSpace val);
10153
+
10154
+/**
10155
+ * Allocate an AVFrame and set its fields to default values.  The resulting
10156
+ * struct must be freed using av_frame_free().
10157
+ *
10158
+ * @return An AVFrame filled with default values or NULL on failure.
10159
+ *
10160
+ * @note this only allocates the AVFrame itself, not the data buffers. Those
10161
+ * must be allocated through other means, e.g. with av_frame_get_buffer() or
10162
+ * manually.
10163
+ */
10164
+AVFrame *av_frame_alloc(void);
10165
+
10166
+/**
10167
+ * Free the frame and any dynamically allocated objects in it,
10168
+ * e.g. extended_data. If the frame is reference counted, it will be
10169
+ * unreferenced first.
10170
+ *
10171
+ * @param frame frame to be freed. The pointer will be set to NULL.
10172
+ */
10173
+void av_frame_free(AVFrame **frame);
10174
+
10175
+/**
10176
+ * Set up a new reference to the data described by the source frame.
10177
+ *
10178
+ * Copy frame properties from src to dst and create a new reference for each
10179
+ * AVBufferRef from src.
10180
+ *
10181
+ * If src is not reference counted, new buffers are allocated and the data is
10182
+ * copied.
10183
+ *
10184
+ * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
10185
+ *           or newly allocated with av_frame_alloc() before calling this
10186
+ *           function, or undefined behavior will occur.
10187
+ *
10188
+ * @return 0 on success, a negative AVERROR on error
10189
+ */
10190
+int av_frame_ref(AVFrame *dst, const AVFrame *src);
10191
+
10192
+/**
10193
+ * Create a new frame that references the same data as src.
10194
+ *
10195
+ * This is a shortcut for av_frame_alloc()+av_frame_ref().
10196
+ *
10197
+ * @return newly created AVFrame on success, NULL on error.
10198
+ */
10199
+AVFrame *av_frame_clone(const AVFrame *src);
10200
+
10201
+/**
10202
+ * Unreference all the buffers referenced by frame and reset the frame fields.
10203
+ */
10204
+void av_frame_unref(AVFrame *frame);
10205
+
10206
+/**
10207
+ * Move everything contained in src to dst and reset src.
10208
+ *
10209
+ * @warning: dst is not unreferenced, but directly overwritten without reading
10210
+ *           or deallocating its contents. Call av_frame_unref(dst) manually
10211
+ *           before calling this function to ensure that no memory is leaked.
10212
+ */
10213
+void av_frame_move_ref(AVFrame *dst, AVFrame *src);
10214
+
10215
+/**
10216
+ * Allocate new buffer(s) for audio or video data.
10217
+ *
10218
+ * The following fields must be set on frame before calling this function:
10219
+ * - format (pixel format for video, sample format for audio)
10220
+ * - width and height for video
10221
+ * - nb_samples and channel_layout for audio
10222
+ *
10223
+ * This function will fill AVFrame.data and AVFrame.buf arrays and, if
10224
+ * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
10225
+ * For planar formats, one buffer will be allocated for each plane.
10226
+ *
10227
+ * @warning: if frame already has been allocated, calling this function will
10228
+ *           leak memory. In addition, undefined behavior can occur in certain
10229
+ *           cases.
10230
+ *
10231
+ * @param frame frame in which to store the new buffers.
10232
+ * @param align Required buffer size alignment. If equal to 0, alignment will be
10233
+ *              chosen automatically for the current CPU. It is highly
10234
+ *              recommended to pass 0 here unless you know what you are doing.
10235
+ *
10236
+ * @return 0 on success, a negative AVERROR on error.
10237
+ */
10238
+int av_frame_get_buffer(AVFrame *frame, int align);
10239
+
10240
+/**
10241
+ * Check if the frame data is writable.
10242
+ *
10243
+ * @return A positive value if the frame data is writable (which is true if and
10244
+ * only if each of the underlying buffers has only one reference, namely the one
10245
+ * stored in this frame). Return 0 otherwise.
10246
+ *
10247
+ * If 1 is returned the answer is valid until av_buffer_ref() is called on any
10248
+ * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
10249
+ *
10250
+ * @see av_frame_make_writable(), av_buffer_is_writable()
10251
+ */
10252
+int av_frame_is_writable(AVFrame *frame);
10253
+
10254
+/**
10255
+ * Ensure that the frame data is writable, avoiding data copy if possible.
10256
+ *
10257
+ * Do nothing if the frame is writable, allocate new buffers and copy the data
10258
+ * if it is not.
10259
+ *
10260
+ * @return 0 on success, a negative AVERROR on error.
10261
+ *
10262
+ * @see av_frame_is_writable(), av_buffer_is_writable(),
10263
+ * av_buffer_make_writable()
10264
+ */
10265
+int av_frame_make_writable(AVFrame *frame);
10266
+
10267
+/**
10268
+ * Copy the frame data from src to dst.
10269
+ *
10270
+ * This function does not allocate anything, dst must be already initialized and
10271
+ * allocated with the same parameters as src.
10272
+ *
10273
+ * This function only copies the frame data (i.e. the contents of the data /
10274
+ * extended data arrays), not any other properties.
10275
+ *
10276
+ * @return >= 0 on success, a negative AVERROR on error.
10277
+ */
10278
+int av_frame_copy(AVFrame *dst, const AVFrame *src);
10279
+
10280
+/**
10281
+ * Copy only "metadata" fields from src to dst.
10282
+ *
10283
+ * Metadata for the purpose of this function are those fields that do not affect
10284
+ * the data layout in the buffers.  E.g. pts, sample rate (for audio) or sample
10285
+ * aspect ratio (for video), but not width/height or channel layout.
10286
+ * Side data is also copied.
10287
+ */
10288
+int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
10289
+
10290
+/**
10291
+ * Get the buffer reference a given data plane is stored in.
10292
+ *
10293
+ * @param plane index of the data plane of interest in frame->extended_data.
10294
+ *
10295
+ * @return the buffer reference that contains the plane or NULL if the input
10296
+ * frame is not valid.
10297
+ */
10298
+AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
10299
+
10300
+/**
10301
+ * Add a new side data to a frame.
10302
+ *
10303
+ * @param frame a frame to which the side data should be added
10304
+ * @param type type of the added side data
10305
+ * @param size size of the side data
10306
+ *
10307
+ * @return newly added side data on success, NULL on error
10308
+ */
10309
+AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
10310
+                                        enum AVFrameSideDataType type,
10311
+                                        int size);
10312
+
10313
+/**
10314
+ * Add a new side data to a frame from an existing AVBufferRef
10315
+ *
10316
+ * @param frame a frame to which the side data should be added
10317
+ * @param type  the type of the added side data
10318
+ * @param buf   an AVBufferRef to add as side data. The ownership of
10319
+ *              the reference is transferred to the frame.
10320
+ *
10321
+ * @return newly added side data on success, NULL on error. On failure
10322
+ *         the frame is unchanged and the AVBufferRef remains owned by
10323
+ *         the caller.
10324
+ */
10325
+AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
10326
+                                                 enum AVFrameSideDataType type,
10327
+                                                 AVBufferRef *buf);
10328
+
10329
+/**
10330
+ * @return a pointer to the side data of a given type on success, NULL if there
10331
+ * is no side data with such type in this frame.
10332
+ */
10333
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
10334
+                                        enum AVFrameSideDataType type);
10335
+
10336
+/**
10337
+ * If side data of the supplied type exists in the frame, free it and remove it
10338
+ * from the frame.
10339
+ */
10340
+void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
10341
+
10342
+
10343
+/**
10344
+ * Flags for frame cropping.
10345
+ */
10346
+enum {
10347
+    /**
10348
+     * Apply the maximum possible cropping, even if it requires setting the
10349
+     * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
10350
+     * to FFmpeg API is generally not allowed, and causes undefined behavior
10351
+     * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
10352
+     * are explicitly documented to accept it. Use this flag only if you
10353
+     * absolutely know what you are doing.
10354
+     */
10355
+    AV_FRAME_CROP_UNALIGNED     = 1 << 0,
10356
+};
10357
+
10358
+/**
10359
+ * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
10360
+ * crop_bottom fields. If cropping is successful, the function will adjust the
10361
+ * data pointers and the width/height fields, and set the crop fields to 0.
10362
+ *
10363
+ * In all cases, the cropping boundaries will be rounded to the inherent
10364
+ * alignment of the pixel format. In some cases, such as for opaque hwaccel
10365
+ * formats, the left/top cropping is ignored. The crop fields are set to 0 even
10366
+ * if the cropping was rounded or ignored.
10367
+ *
10368
+ * @param frame the frame which should be cropped
10369
+ * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
10370
+ *
10371
+ * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
10372
+ * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
10373
+ */
10374
+int av_frame_apply_cropping(AVFrame *frame, int flags);
10375
+
10376
+/**
10377
+ * @return a string identifying the side data type
10378
+ */
10379
+const char *av_frame_side_data_name(enum AVFrameSideDataType type);
10380
+
10381
+/**
10382
+ * @}
10383
+ */
10384
+
10385
+#endif /* AVUTIL_FRAME_H */
10386
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10387
new file mode 100644
10388
index 000000000000..f5a4b6238774
10389
--- /dev/null
10390
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10391
@@ -0,0 +1,584 @@
10392
+/*
10393
+ * This file is part of FFmpeg.
10394
+ *
10395
+ * FFmpeg is free software; you can redistribute it and/or
10396
+ * modify it under the terms of the GNU Lesser General Public
10397
+ * License as published by the Free Software Foundation; either
10398
+ * version 2.1 of the License, or (at your option) any later version.
10399
+ *
10400
+ * FFmpeg is distributed in the hope that it will be useful,
10401
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10402
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10403
+ * Lesser General Public License for more details.
10404
+ *
10405
+ * You should have received a copy of the GNU Lesser General Public
10406
+ * License along with FFmpeg; if not, write to the Free Software
10407
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
10408
+ */
10409
+
10410
+#ifndef AVUTIL_HWCONTEXT_H
10411
+#define AVUTIL_HWCONTEXT_H
10412
+
10413
+#include "buffer.h"
10414
+#include "frame.h"
10415
+#include "log.h"
10416
+#include "pixfmt.h"
10417
+
10418
+enum AVHWDeviceType {
10419
+    AV_HWDEVICE_TYPE_NONE,
10420
+    AV_HWDEVICE_TYPE_VDPAU,
10421
+    AV_HWDEVICE_TYPE_CUDA,
10422
+    AV_HWDEVICE_TYPE_VAAPI,
10423
+    AV_HWDEVICE_TYPE_DXVA2,
10424
+    AV_HWDEVICE_TYPE_QSV,
10425
+    AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
10426
+    AV_HWDEVICE_TYPE_D3D11VA,
10427
+    AV_HWDEVICE_TYPE_DRM,
10428
+    AV_HWDEVICE_TYPE_OPENCL,
10429
+    AV_HWDEVICE_TYPE_MEDIACODEC,
10430
+};
10431
+
10432
+typedef struct AVHWDeviceInternal AVHWDeviceInternal;
10433
+
10434
+/**
10435
+ * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
10436
+ * i.e. state that is not tied to a concrete processing configuration.
10437
+ * E.g., in an API that supports hardware-accelerated encoding and decoding,
10438
+ * this struct will (if possible) wrap the state that is common to both encoding
10439
+ * and decoding and from which specific instances of encoders or decoders can be
10440
+ * derived.
10441
+ *
10442
+ * This struct is reference-counted with the AVBuffer mechanism. The
10443
+ * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
10444
+ * points to the actual AVHWDeviceContext. Further objects derived from
10445
+ * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
10446
+ * specific properties) will hold an internal reference to it. After all the
10447
+ * references are released, the AVHWDeviceContext itself will be freed,
10448
+ * optionally invoking a user-specified callback for uninitializing the hardware
10449
+ * state.
10450
+ */
10451
+typedef struct AVHWDeviceContext {
10452
+    /**
10453
+     * A class for logging. Set by av_hwdevice_ctx_alloc().
10454
+     */
10455
+    const AVClass *av_class;
10456
+
10457
+    /**
10458
+     * Private data used internally by libavutil. Must not be accessed in any
10459
+     * way by the caller.
10460
+     */
10461
+    AVHWDeviceInternal *internal;
10462
+
10463
+    /**
10464
+     * This field identifies the underlying API used for hardware access.
10465
+     *
10466
+     * This field is set when this struct is allocated and never changed
10467
+     * afterwards.
10468
+     */
10469
+    enum AVHWDeviceType type;
10470
+
10471
+    /**
10472
+     * The format-specific data, allocated and freed by libavutil along with
10473
+     * this context.
10474
+     *
10475
+     * Should be cast by the user to the format-specific context defined in the
10476
+     * corresponding header (hwcontext_*.h) and filled as described in the
10477
+     * documentation before calling av_hwdevice_ctx_init().
10478
+     *
10479
+     * After calling av_hwdevice_ctx_init() this struct should not be modified
10480
+     * by the caller.
10481
+     */
10482
+    void *hwctx;
10483
+
10484
+    /**
10485
+     * This field may be set by the caller before calling av_hwdevice_ctx_init().
10486
+     *
10487
+     * If non-NULL, this callback will be called when the last reference to
10488
+     * this context is unreferenced, immediately before it is freed.
10489
+     *
10490
+     * @note when other objects (e.g an AVHWFramesContext) are derived from this
10491
+     *       struct, this callback will be invoked after all such child objects
10492
+     *       are fully uninitialized and their respective destructors invoked.
10493
+     */
10494
+    void (*free)(struct AVHWDeviceContext *ctx);
10495
+
10496
+    /**
10497
+     * Arbitrary user data, to be used e.g. by the free() callback.
10498
+     */
10499
+    void *user_opaque;
10500
+} AVHWDeviceContext;
10501
+
10502
+typedef struct AVHWFramesInternal AVHWFramesInternal;
10503
+
10504
+/**
10505
+ * This struct describes a set or pool of "hardware" frames (i.e. those with
10506
+ * data not located in normal system memory). All the frames in the pool are
10507
+ * assumed to be allocated in the same way and interchangeable.
10508
+ *
10509
+ * This struct is reference-counted with the AVBuffer mechanism and tied to a
10510
+ * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
10511
+ * yields a reference, whose data field points to the actual AVHWFramesContext
10512
+ * struct.
10513
+ */
10514
+typedef struct AVHWFramesContext {
10515
+    /**
10516
+     * A class for logging.
10517
+     */
10518
+    const AVClass *av_class;
10519
+
10520
+    /**
10521
+     * Private data used internally by libavutil. Must not be accessed in any
10522
+     * way by the caller.
10523
+     */
10524
+    AVHWFramesInternal *internal;
10525
+
10526
+    /**
10527
+     * A reference to the parent AVHWDeviceContext. This reference is owned and
10528
+     * managed by the enclosing AVHWFramesContext, but the caller may derive
10529
+     * additional references from it.
10530
+     */
10531
+    AVBufferRef *device_ref;
10532
+
10533
+    /**
10534
+     * The parent AVHWDeviceContext. This is simply a pointer to
10535
+     * device_ref->data provided for convenience.
10536
+     *
10537
+     * Set by libavutil in av_hwframe_ctx_init().
10538
+     */
10539
+    AVHWDeviceContext *device_ctx;
10540
+
10541
+    /**
10542
+     * The format-specific data, allocated and freed automatically along with
10543
+     * this context.
10544
+     *
10545
+     * Should be cast by the user to the format-specific context defined in the
10546
+     * corresponding header (hwframe_*.h) and filled as described in the
10547
+     * documentation before calling av_hwframe_ctx_init().
10548
+     *
10549
+     * After any frames using this context are created, the contents of this
10550
+     * struct should not be modified by the caller.
10551
+     */
10552
+    void *hwctx;
10553
+
10554
+    /**
10555
+     * This field may be set by the caller before calling av_hwframe_ctx_init().
10556
+     *
10557
+     * If non-NULL, this callback will be called when the last reference to
10558
+     * this context is unreferenced, immediately before it is freed.
10559
+     */
10560
+    void (*free)(struct AVHWFramesContext *ctx);
10561
+
10562
+    /**
10563
+     * Arbitrary user data, to be used e.g. by the free() callback.
10564
+     */
10565
+    void *user_opaque;
10566
+
10567
+    /**
10568
+     * A pool from which the frames are allocated by av_hwframe_get_buffer().
10569
+     * This field may be set by the caller before calling av_hwframe_ctx_init().
10570
+     * The buffers returned by calling av_buffer_pool_get() on this pool must
10571
+     * have the properties described in the documentation in the corresponding hw
10572
+     * type's header (hwcontext_*.h). The pool will be freed strictly before
10573
+     * this struct's free() callback is invoked.
10574
+     *
10575
+     * This field may be NULL, then libavutil will attempt to allocate a pool
10576
+     * internally. Note that certain device types enforce pools allocated at
10577
+     * fixed size (frame count), which cannot be extended dynamically. In such a
10578
+     * case, initial_pool_size must be set appropriately.
10579
+     */
10580
+    AVBufferPool *pool;
10581
+
10582
+    /**
10583
+     * Initial size of the frame pool. If a device type does not support
10584
+     * dynamically resizing the pool, then this is also the maximum pool size.
10585
+     *
10586
+     * May be set by the caller before calling av_hwframe_ctx_init(). Must be
10587
+     * set if pool is NULL and the device type does not support dynamic pools.
10588
+     */
10589
+    int initial_pool_size;
10590
+
10591
+    /**
10592
+     * The pixel format identifying the underlying HW surface type.
10593
+     *
10594
+     * Must be a hwaccel format, i.e. the corresponding descriptor must have the
10595
+     * AV_PIX_FMT_FLAG_HWACCEL flag set.
10596
+     *
10597
+     * Must be set by the user before calling av_hwframe_ctx_init().
10598
+     */
10599
+    enum AVPixelFormat format;
10600
+
10601
+    /**
10602
+     * The pixel format identifying the actual data layout of the hardware
10603
+     * frames.
10604
+     *
10605
+     * Must be set by the caller before calling av_hwframe_ctx_init().
10606
+     *
10607
+     * @note when the underlying API does not provide the exact data layout, but
10608
+     * only the colorspace/bit depth, this field should be set to the fully
10609
+     * planar version of that format (e.g. for 8-bit 420 YUV it should be
10610
+     * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
10611
+     */
10612
+    enum AVPixelFormat sw_format;
10613
+
10614
+    /**
10615
+     * The allocated dimensions of the frames in this pool.
10616
+     *
10617
+     * Must be set by the user before calling av_hwframe_ctx_init().
10618
+     */
10619
+    int width, height;
10620
+} AVHWFramesContext;
10621
+
10622
+/**
10623
+ * Look up an AVHWDeviceType by name.
10624
+ *
10625
+ * @param name String name of the device type (case-insensitive).
10626
+ * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
10627
+ *         not found.
10628
+ */
10629
+enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
10630
+
10631
+/** Get the string name of an AVHWDeviceType.
10632
+ *
10633
+ * @param type Type from enum AVHWDeviceType.
10634
+ * @return Pointer to a static string containing the name, or NULL if the type
10635
+ *         is not valid.
10636
+ */
10637
+const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
10638
+
10639
+/**
10640
+ * Iterate over supported device types.
10641
+ *
10642
+ * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
10643
+ *             returned by this function in subsequent iterations.
10644
+ * @return The next usable device type from enum AVHWDeviceType, or
10645
+ *         AV_HWDEVICE_TYPE_NONE if there are no more.
10646
+ */
10647
+enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
10648
+
10649
+/**
10650
+ * Allocate an AVHWDeviceContext for a given hardware type.
10651
+ *
10652
+ * @param type the type of the hardware device to allocate.
10653
+ * @return a reference to the newly created AVHWDeviceContext on success or NULL
10654
+ *         on failure.
10655
+ */
10656
+AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
10657
+
10658
+/**
10659
+ * Finalize the device context before use. This function must be called after
10660
+ * the context is filled with all the required information and before it is
10661
+ * used in any way.
10662
+ *
10663
+ * @param ref a reference to the AVHWDeviceContext
10664
+ * @return 0 on success, a negative AVERROR code on failure
10665
+ */
10666
+int av_hwdevice_ctx_init(AVBufferRef *ref);
10667
+
10668
+/**
10669
+ * Open a device of the specified type and create an AVHWDeviceContext for it.
10670
+ *
10671
+ * This is a convenience function intended to cover the simple cases. Callers
10672
+ * who need to fine-tune device creation/management should open the device
10673
+ * manually and then wrap it in an AVHWDeviceContext using
10674
+ * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
10675
+ *
10676
+ * The returned context is already initialized and ready for use, the caller
10677
+ * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
10678
+ * the created AVHWDeviceContext are set by this function and should not be
10679
+ * touched by the caller.
10680
+ *
10681
+ * @param device_ctx On success, a reference to the newly-created device context
10682
+ *                   will be written here. The reference is owned by the caller
10683
+ *                   and must be released with av_buffer_unref() when no longer
10684
+ *                   needed. On failure, NULL will be written to this pointer.
10685
+ * @param type The type of the device to create.
10686
+ * @param device A type-specific string identifying the device to open.
10687
+ * @param opts A dictionary of additional (type-specific) options to use in
10688
+ *             opening the device. The dictionary remains owned by the caller.
10689
+ * @param flags currently unused
10690
+ *
10691
+ * @return 0 on success, a negative AVERROR code on failure.
10692
+ */
10693
+int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
10694
+                           const char *device, AVDictionary *opts, int flags);
10695
+
10696
+/**
10697
+ * Create a new device of the specified type from an existing device.
10698
+ *
10699
+ * If the source device is a device of the target type or was originally
10700
+ * derived from such a device (possibly through one or more intermediate
10701
+ * devices of other types), then this will return a reference to the
10702
+ * existing device of the same type as is requested.
10703
+ *
10704
+ * Otherwise, it will attempt to derive a new device from the given source
10705
+ * device.  If direct derivation to the new type is not implemented, it will
10706
+ * attempt the same derivation from each ancestor of the source device in
10707
+ * turn looking for an implemented derivation method.
10708
+ *
10709
+ * @param dst_ctx On success, a reference to the newly-created
10710
+ *                AVHWDeviceContext.
10711
+ * @param type    The type of the new device to create.
10712
+ * @param src_ctx A reference to an existing AVHWDeviceContext which will be
10713
+ *                used to create the new device.
10714
+ * @param flags   Currently unused; should be set to zero.
10715
+ * @return        Zero on success, a negative AVERROR code on failure.
10716
+ */
10717
+int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
10718
+                                   enum AVHWDeviceType type,
10719
+                                   AVBufferRef *src_ctx, int flags);
10720
+
10721
+
10722
+/**
10723
+ * Allocate an AVHWFramesContext tied to a given device context.
10724
+ *
10725
+ * @param device_ctx a reference to a AVHWDeviceContext. This function will make
10726
+ *                   a new reference for internal use, the one passed to the
10727
+ *                   function remains owned by the caller.
10728
+ * @return a reference to the newly created AVHWFramesContext on success or NULL
10729
+ *         on failure.
10730
+ */
10731
+AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
10732
+
10733
+/**
10734
+ * Finalize the context before use. This function must be called after the
10735
+ * context is filled with all the required information and before it is attached
10736
+ * to any frames.
10737
+ *
10738
+ * @param ref a reference to the AVHWFramesContext
10739
+ * @return 0 on success, a negative AVERROR code on failure
10740
+ */
10741
+int av_hwframe_ctx_init(AVBufferRef *ref);
10742
+
10743
+/**
10744
+ * Allocate a new frame attached to the given AVHWFramesContext.
10745
+ *
10746
+ * @param hwframe_ctx a reference to an AVHWFramesContext
10747
+ * @param frame an empty (freshly allocated or unreffed) frame to be filled with
10748
+ *              newly allocated buffers.
10749
+ * @param flags currently unused, should be set to zero
10750
+ * @return 0 on success, a negative AVERROR code on failure
10751
+ */
10752
+int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
10753
+
10754
+/**
10755
+ * Copy data to or from a hw surface. At least one of dst/src must have an
10756
+ * AVHWFramesContext attached.
10757
+ *
10758
+ * If src has an AVHWFramesContext attached, then the format of dst (if set)
10759
+ * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
10760
+ * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
10761
+ * If dst has an AVHWFramesContext attached, then the format of src must use one
10762
+ * of the formats returned by av_hwframe_transfer_get_formats(dst,
10763
+ * AV_HWFRAME_TRANSFER_DIRECTION_TO)
10764
+ *
10765
+ * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
10766
+ * data buffers will be allocated by this function using av_frame_get_buffer().
10767
+ * If dst->format is set, then this format will be used, otherwise (when
10768
+ * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
10769
+ *
10770
+ * The two frames must have matching allocated dimensions (i.e. equal to
10771
+ * AVHWFramesContext.width/height), since not all device types support
10772
+ * transferring a sub-rectangle of the whole surface. The display dimensions
10773
+ * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
10774
+ * also have to be equal for both frames. When the display dimensions are
10775
+ * smaller than the allocated dimensions, the content of the padding in the
10776
+ * destination frame is unspecified.
10777
+ *
10778
+ * @param dst the destination frame. dst is not touched on failure.
10779
+ * @param src the source frame.
10780
+ * @param flags currently unused, should be set to zero
10781
+ * @return 0 on success, a negative AVERROR error code on failure.
10782
+ */
10783
+int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
10784
+
10785
+enum AVHWFrameTransferDirection {
10786
+    /**
10787
+     * Transfer the data from the queried hw frame.
10788
+     */
10789
+    AV_HWFRAME_TRANSFER_DIRECTION_FROM,
10790
+
10791
+    /**
10792
+     * Transfer the data to the queried hw frame.
10793
+     */
10794
+    AV_HWFRAME_TRANSFER_DIRECTION_TO,
10795
+};
10796
+
10797
+/**
10798
+ * Get a list of possible source or target formats usable in
10799
+ * av_hwframe_transfer_data().
10800
+ *
10801
+ * @param hwframe_ctx the frame context to obtain the information for
10802
+ * @param dir the direction of the transfer
10803
+ * @param formats the pointer to the output format list will be written here.
10804
+ *                The list is terminated with AV_PIX_FMT_NONE and must be freed
10805
+ *                by the caller when no longer needed using av_free().
10806
+ *                If this function returns successfully, the format list will
10807
+ *                have at least one item (not counting the terminator).
10808
+ *                On failure, the contents of this pointer are unspecified.
10809
+ * @param flags currently unused, should be set to zero
10810
+ * @return 0 on success, a negative AVERROR code on failure.
10811
+ */
10812
+int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
10813
+                                    enum AVHWFrameTransferDirection dir,
10814
+                                    enum AVPixelFormat **formats, int flags);
10815
+
10816
+
10817
+/**
10818
+ * This struct describes the constraints on hardware frames attached to
10819
+ * a given device with a hardware-specific configuration.  This is returned
10820
+ * by av_hwdevice_get_hwframe_constraints() and must be freed by
10821
+ * av_hwframe_constraints_free() after use.
10822
+ */
10823
+typedef struct AVHWFramesConstraints {
10824
+    /**
10825
+     * A list of possible values for format in the hw_frames_ctx,
10826
+     * terminated by AV_PIX_FMT_NONE.  This member will always be filled.
10827
+     */
10828
+    enum AVPixelFormat *valid_hw_formats;
10829
+
10830
+    /**
10831
+     * A list of possible values for sw_format in the hw_frames_ctx,
10832
+     * terminated by AV_PIX_FMT_NONE.  Can be NULL if this information is
10833
+     * not known.
10834
+     */
10835
+    enum AVPixelFormat *valid_sw_formats;
10836
+
10837
+    /**
10838
+     * The minimum size of frames in this hw_frames_ctx.
10839
+     * (Zero if not known.)
10840
+     */
10841
+    int min_width;
10842
+    int min_height;
10843
+
10844
+    /**
10845
+     * The maximum size of frames in this hw_frames_ctx.
10846
+     * (INT_MAX if not known / no limit.)
10847
+     */
10848
+    int max_width;
10849
+    int max_height;
10850
+} AVHWFramesConstraints;
10851
+
10852
+/**
10853
+ * Allocate a HW-specific configuration structure for a given HW device.
10854
+ * After use, the user must free all members as required by the specific
10855
+ * hardware structure being used, then free the structure itself with
10856
+ * av_free().
10857
+ *
10858
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
10859
+ * @return The newly created HW-specific configuration structure on
10860
+ *         success or NULL on failure.
10861
+ */
10862
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
10863
+
10864
+/**
10865
+ * Get the constraints on HW frames given a device and the HW-specific
10866
+ * configuration to be used with that device.  If no HW-specific
10867
+ * configuration is provided, returns the maximum possible capabilities
10868
+ * of the device.
10869
+ *
10870
+ * @param ref a reference to the associated AVHWDeviceContext.
10871
+ * @param hwconfig a filled HW-specific configuration structure, or NULL
10872
+ *        to return the maximum possible capabilities of the device.
10873
+ * @return AVHWFramesConstraints structure describing the constraints
10874
+ *         on the device, or NULL if not available.
10875
+ */
10876
+AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
10877
+                                                           const void *hwconfig);
10878
+
10879
+/**
10880
+ * Free an AVHWFrameConstraints structure.
10881
+ *
10882
+ * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
10883
+ */
10884
+void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
10885
+
10886
+
10887
+/**
10888
+ * Flags to apply to frame mappings.
10889
+ */
10890
+enum {
10891
+    /**
10892
+     * The mapping must be readable.
10893
+     */
10894
+    AV_HWFRAME_MAP_READ      = 1 << 0,
10895
+    /**
10896
+     * The mapping must be writeable.
10897
+     */
10898
+    AV_HWFRAME_MAP_WRITE     = 1 << 1,
10899
+    /**
10900
+     * The mapped frame will be overwritten completely in subsequent
10901
+     * operations, so the current frame data need not be loaded.  Any values
10902
+     * which are not overwritten are unspecified.
10903
+     */
10904
+    AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
10905
+    /**
10906
+     * The mapping must be direct.  That is, there must not be any copying in
10907
+     * the map or unmap steps.  Note that performance of direct mappings may
10908
+     * be much lower than normal memory.
10909
+     */
10910
+    AV_HWFRAME_MAP_DIRECT    = 1 << 3,
10911
+};
10912
+
10913
+/**
10914
+ * Map a hardware frame.
10915
+ *
10916
+ * This has a number of different possible effects, depending on the format
10917
+ * and origin of the src and dst frames.  On input, src should be a usable
10918
+ * frame with valid buffers and dst should be blank (typically as just created
10919
+ * by av_frame_alloc()).  src should have an associated hwframe context, and
10920
+ * dst may optionally have a format and associated hwframe context.
10921
+ *
10922
+ * If src was created by mapping a frame from the hwframe context of dst,
10923
+ * then this function undoes the mapping - dst is replaced by a reference to
10924
+ * the frame that src was originally mapped from.
10925
+ *
10926
+ * If both src and dst have an associated hwframe context, then this function
10927
+ * attempts to map the src frame from its hardware context to that of dst and
10928
+ * then fill dst with appropriate data to be usable there.  This will only be
10929
+ * possible if the hwframe contexts and associated devices are compatible -
10930
+ * given compatible devices, av_hwframe_ctx_create_derived() can be used to
10931
+ * create a hwframe context for dst in which mapping should be possible.
10932
+ *
10933
+ * If src has a hwframe context but dst does not, then the src frame is
10934
+ * mapped to normal memory and should thereafter be usable as a normal frame.
10935
+ * If the format is set on dst, then the mapping will attempt to create dst
10936
+ * with that format and fail if it is not possible.  If format is unset (is
10937
+ * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
10938
+ * format to use is (probably the sw_format of the src hwframe context).
10939
+ *
10940
+ * A return value of AVERROR(ENOSYS) indicates that the mapping is not
10941
+ * possible with the given arguments and hwframe setup, while other return
10942
+ * values indicate that it failed somehow.
10943
+ *
10944
+ * @param dst Destination frame, to contain the mapping.
10945
+ * @param src Source frame, to be mapped.
10946
+ * @param flags Some combination of AV_HWFRAME_MAP_* flags.
10947
+ * @return Zero on success, negative AVERROR code on failure.
10948
+ */
10949
+int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
10950
+
10951
+
10952
+/**
10953
+ * Create and initialise an AVHWFramesContext as a mapping of another existing
10954
+ * AVHWFramesContext on a different device.
10955
+ *
10956
+ * av_hwframe_ctx_init() should not be called after this.
10957
+ *
10958
+ * @param derived_frame_ctx  On success, a reference to the newly created
10959
+ *                           AVHWFramesContext.
10960
+ * @param derived_device_ctx A reference to the device to create the new
10961
+ *                           AVHWFramesContext on.
10962
+ * @param source_frame_ctx   A reference to an existing AVHWFramesContext
10963
+ *                           which will be mapped to the derived context.
10964
+ * @param flags  Some combination of AV_HWFRAME_MAP_* flags, defining the
10965
+ *               mapping parameters to apply to frames which are allocated
10966
+ *               in the derived device.
10967
+ * @return       Zero on success, negative AVERROR code on failure.
10968
+ */
10969
+int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
10970
+                                  enum AVPixelFormat format,
10971
+                                  AVBufferRef *derived_device_ctx,
10972
+                                  AVBufferRef *source_frame_ctx,
10973
+                                  int flags);
10974
+
10975
+#endif /* AVUTIL_HWCONTEXT_H */
10976
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
10977
new file mode 100644
10978
index 000000000000..fe3d7ec4a5b6
10979
--- /dev/null
10980
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
10981
@@ -0,0 +1,77 @@
10982
+/*
10983
+ * Copyright (c) 2011 Mans Rullgard
10984
+ *
10985
+ * This file is part of FFmpeg.
10986
+ *
10987
+ * FFmpeg is free software; you can redistribute it and/or
10988
+ * modify it under the terms of the GNU Lesser General Public
10989
+ * License as published by the Free Software Foundation; either
10990
+ * version 2.1 of the License, or (at your option) any later version.
10991
+ *
10992
+ * FFmpeg is distributed in the hope that it will be useful,
10993
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10994
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10995
+ * Lesser General Public License for more details.
10996
+ *
10997
+ * You should have received a copy of the GNU Lesser General Public
10998
+ * License along with FFmpeg; if not, write to the Free Software
10999
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11000
+ */
11001
+
11002
+#ifndef AVUTIL_INTFLOAT_H
11003
+#define AVUTIL_INTFLOAT_H
11004
+
11005
+#include <stdint.h>
11006
+#include "attributes.h"
11007
+
11008
+union av_intfloat32 {
11009
+    uint32_t i;
11010
+    float    f;
11011
+};
11012
+
11013
+union av_intfloat64 {
11014
+    uint64_t i;
11015
+    double   f;
11016
+};
11017
+
11018
+/**
11019
+ * Reinterpret a 32-bit integer as a float.
11020
+ */
11021
+static av_always_inline float av_int2float(uint32_t i)
11022
+{
11023
+    union av_intfloat32 v;
11024
+    v.i = i;
11025
+    return v.f;
11026
+}
11027
+
11028
+/**
11029
+ * Reinterpret a float as a 32-bit integer.
11030
+ */
11031
+static av_always_inline uint32_t av_float2int(float f)
11032
+{
11033
+    union av_intfloat32 v;
11034
+    v.f = f;
11035
+    return v.i;
11036
+}
11037
+
11038
+/**
11039
+ * Reinterpret a 64-bit integer as a double.
11040
+ */
11041
+static av_always_inline double av_int2double(uint64_t i)
11042
+{
11043
+    union av_intfloat64 v;
11044
+    v.i = i;
11045
+    return v.f;
11046
+}
11047
+
11048
+/**
11049
+ * Reinterpret a double as a 64-bit integer.
11050
+ */
11051
+static av_always_inline uint64_t av_double2int(double f)
11052
+{
11053
+    union av_intfloat64 v;
11054
+    v.f = f;
11055
+    return v.i;
11056
+}
11057
+
11058
+#endif /* AVUTIL_INTFLOAT_H */
11059
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11060
new file mode 100644
11061
index 000000000000..d9554e609d40
11062
--- /dev/null
11063
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11064
@@ -0,0 +1,362 @@
11065
+/*
11066
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11067
+ *
11068
+ * This file is part of FFmpeg.
11069
+ *
11070
+ * FFmpeg is free software; you can redistribute it and/or
11071
+ * modify it under the terms of the GNU Lesser General Public
11072
+ * License as published by the Free Software Foundation; either
11073
+ * version 2.1 of the License, or (at your option) any later version.
11074
+ *
11075
+ * FFmpeg is distributed in the hope that it will be useful,
11076
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11077
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11078
+ * Lesser General Public License for more details.
11079
+ *
11080
+ * You should have received a copy of the GNU Lesser General Public
11081
+ * License along with FFmpeg; if not, write to the Free Software
11082
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11083
+ */
11084
+
11085
+#ifndef AVUTIL_LOG_H
11086
+#define AVUTIL_LOG_H
11087
+
11088
+#include <stdarg.h>
11089
+#include "avutil.h"
11090
+#include "attributes.h"
11091
+#include "version.h"
11092
+
11093
+typedef enum {
11094
+    AV_CLASS_CATEGORY_NA = 0,
11095
+    AV_CLASS_CATEGORY_INPUT,
11096
+    AV_CLASS_CATEGORY_OUTPUT,
11097
+    AV_CLASS_CATEGORY_MUXER,
11098
+    AV_CLASS_CATEGORY_DEMUXER,
11099
+    AV_CLASS_CATEGORY_ENCODER,
11100
+    AV_CLASS_CATEGORY_DECODER,
11101
+    AV_CLASS_CATEGORY_FILTER,
11102
+    AV_CLASS_CATEGORY_BITSTREAM_FILTER,
11103
+    AV_CLASS_CATEGORY_SWSCALER,
11104
+    AV_CLASS_CATEGORY_SWRESAMPLER,
11105
+    AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
11106
+    AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
11107
+    AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
11108
+    AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
11109
+    AV_CLASS_CATEGORY_DEVICE_OUTPUT,
11110
+    AV_CLASS_CATEGORY_DEVICE_INPUT,
11111
+    AV_CLASS_CATEGORY_NB  ///< not part of ABI/API
11112
+}AVClassCategory;
11113
+
11114
+#define AV_IS_INPUT_DEVICE(category) \
11115
+    (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
11116
+     ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
11117
+     ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
11118
+
11119
+#define AV_IS_OUTPUT_DEVICE(category) \
11120
+    (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
11121
+     ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
11122
+     ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
11123
+
11124
+struct AVOptionRanges;
11125
+
11126
+/**
11127
+ * Describe the class of an AVClass context structure. That is an
11128
+ * arbitrary struct of which the first field is a pointer to an
11129
+ * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
11130
+ */
11131
+typedef struct AVClass {
11132
+    /**
11133
+     * The name of the class; usually it is the same name as the
11134
+     * context structure type to which the AVClass is associated.
11135
+     */
11136
+    const char* class_name;
11137
+
11138
+    /**
11139
+     * A pointer to a function which returns the name of a context
11140
+     * instance ctx associated with the class.
11141
+     */
11142
+    const char* (*item_name)(void* ctx);
11143
+
11144
+    /**
11145
+     * a pointer to the first option specified in the class if any or NULL
11146
+     *
11147
+     * @see av_set_default_options()
11148
+     */
11149
+    const struct AVOption *option;
11150
+
11151
+    /**
11152
+     * LIBAVUTIL_VERSION with which this structure was created.
11153
+     * This is used to allow fields to be added without requiring major
11154
+     * version bumps everywhere.
11155
+     */
11156
+
11157
+    int version;
11158
+
11159
+    /**
11160
+     * Offset in the structure where log_level_offset is stored.
11161
+     * 0 means there is no such variable
11162
+     */
11163
+    int log_level_offset_offset;
11164
+
11165
+    /**
11166
+     * Offset in the structure where a pointer to the parent context for
11167
+     * logging is stored. For example a decoder could pass its AVCodecContext
11168
+     * to eval as such a parent context, which an av_log() implementation
11169
+     * could then leverage to display the parent context.
11170
+     * The offset can be NULL.
11171
+     */
11172
+    int parent_log_context_offset;
11173
+
11174
+    /**
11175
+     * Return next AVOptions-enabled child or NULL
11176
+     */
11177
+    void* (*child_next)(void *obj, void *prev);
11178
+
11179
+    /**
11180
+     * Return an AVClass corresponding to the next potential
11181
+     * AVOptions-enabled child.
11182
+     *
11183
+     * The difference between child_next and this is that
11184
+     * child_next iterates over _already existing_ objects, while
11185
+     * child_class_next iterates over _all possible_ children.
11186
+     */
11187
+    const struct AVClass* (*child_class_next)(const struct AVClass *prev);
11188
+
11189
+    /**
11190
+     * Category used for visualization (like color)
11191
+     * This is only set if the category is equal for all objects using this class.
11192
+     * available since version (51 << 16 | 56 << 8 | 100)
11193
+     */
11194
+    AVClassCategory category;
11195
+
11196
+    /**
11197
+     * Callback to return the category.
11198
+     * available since version (51 << 16 | 59 << 8 | 100)
11199
+     */
11200
+    AVClassCategory (*get_category)(void* ctx);
11201
+
11202
+    /**
11203
+     * Callback to return the supported/allowed ranges.
11204
+     * available since version (52.12)
11205
+     */
11206
+    int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
11207
+} AVClass;
11208
+
11209
+/**
11210
+ * @addtogroup lavu_log
11211
+ *
11212
+ * @{
11213
+ *
11214
+ * @defgroup lavu_log_constants Logging Constants
11215
+ *
11216
+ * @{
11217
+ */
11218
+
11219
+/**
11220
+ * Print no output.
11221
+ */
11222
+#define AV_LOG_QUIET    -8
11223
+
11224
+/**
11225
+ * Something went really wrong and we will crash now.
11226
+ */
11227
+#define AV_LOG_PANIC     0
11228
+
11229
+/**
11230
+ * Something went wrong and recovery is not possible.
11231
+ * For example, no header was found for a format which depends
11232
+ * on headers or an illegal combination of parameters is used.
11233
+ */
11234
+#define AV_LOG_FATAL     8
11235
+
11236
+/**
11237
+ * Something went wrong and cannot losslessly be recovered.
11238
+ * However, not all future data is affected.
11239
+ */
11240
+#define AV_LOG_ERROR    16
11241
+
11242
+/**
11243
+ * Something somehow does not look correct. This may or may not
11244
+ * lead to problems. An example would be the use of '-vstrict -2'.
11245
+ */
11246
+#define AV_LOG_WARNING  24
11247
+
11248
+/**
11249
+ * Standard information.
11250
+ */
11251
+#define AV_LOG_INFO     32
11252
+
11253
+/**
11254
+ * Detailed information.
11255
+ */
11256
+#define AV_LOG_VERBOSE  40
11257
+
11258
+/**
11259
+ * Stuff which is only useful for libav* developers.
11260
+ */
11261
+#define AV_LOG_DEBUG    48
11262
+
11263
+/**
11264
+ * Extremely verbose debugging, useful for libav* development.
11265
+ */
11266
+#define AV_LOG_TRACE    56
11267
+
11268
+#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
11269
+
11270
+/**
11271
+ * @}
11272
+ */
11273
+
11274
+/**
11275
+ * Sets additional colors for extended debugging sessions.
11276
+ * @code
11277
+   av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
11278
+   @endcode
11279
+ * Requires 256color terminal support. Uses outside debugging is not
11280
+ * recommended.
11281
+ */
11282
+#define AV_LOG_C(x) ((x) << 8)
11283
+
11284
+/**
11285
+ * Send the specified message to the log if the level is less than or equal
11286
+ * to the current av_log_level. By default, all logging messages are sent to
11287
+ * stderr. This behavior can be altered by setting a different logging callback
11288
+ * function.
11289
+ * @see av_log_set_callback
11290
+ *
11291
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
11292
+ *        pointer to an AVClass struct or NULL if general log.
11293
+ * @param level The importance level of the message expressed using a @ref
11294
+ *        lavu_log_constants "Logging Constant".
11295
+ * @param fmt The format string (printf-compatible) that specifies how
11296
+ *        subsequent arguments are converted to output.
11297
+ */
11298
+void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
11299
+
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.
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
+ * @param vl The arguments referenced by the format string.
11315
+ */
11316
+void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
11317
+
11318
+/**
11319
+ * Get the current log level
11320
+ *
11321
+ * @see lavu_log_constants
11322
+ *
11323
+ * @return Current log level
11324
+ */
11325
+int av_log_get_level(void);
11326
+
11327
+/**
11328
+ * Set the log level
11329
+ *
11330
+ * @see lavu_log_constants
11331
+ *
11332
+ * @param level Logging level
11333
+ */
11334
+void av_log_set_level(int level);
11335
+
11336
+/**
11337
+ * Set the logging callback
11338
+ *
11339
+ * @note The callback must be thread safe, even if the application does not use
11340
+ *       threads itself as some codecs are multithreaded.
11341
+ *
11342
+ * @see av_log_default_callback
11343
+ *
11344
+ * @param callback A logging function with a compatible signature.
11345
+ */
11346
+void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
11347
+
11348
+/**
11349
+ * Default logging callback
11350
+ *
11351
+ * It prints the message to stderr, optionally colorizing it.
11352
+ *
11353
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
11354
+ *        pointer to an AVClass struct.
11355
+ * @param level The importance level of the message expressed using a @ref
11356
+ *        lavu_log_constants "Logging Constant".
11357
+ * @param fmt The format string (printf-compatible) that specifies how
11358
+ *        subsequent arguments are converted to output.
11359
+ * @param vl The arguments referenced by the format string.
11360
+ */
11361
+void av_log_default_callback(void *avcl, int level, const char *fmt,
11362
+                             va_list vl);
11363
+
11364
+/**
11365
+ * Return the context name
11366
+ *
11367
+ * @param  ctx The AVClass context
11368
+ *
11369
+ * @return The AVClass class_name
11370
+ */
11371
+const char* av_default_item_name(void* ctx);
11372
+AVClassCategory av_default_get_category(void *ptr);
11373
+
11374
+/**
11375
+ * Format a line of log the same way as the default callback.
11376
+ * @param line          buffer to receive the formatted line
11377
+ * @param line_size     size of the buffer
11378
+ * @param print_prefix  used to store whether the prefix must be printed;
11379
+ *                      must point to a persistent integer initially set to 1
11380
+ */
11381
+void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
11382
+                        char *line, int line_size, int *print_prefix);
11383
+
11384
+/**
11385
+ * Format a line of log the same way as the default callback.
11386
+ * @param line          buffer to receive the formatted line;
11387
+ *                      may be NULL if line_size is 0
11388
+ * @param line_size     size of the buffer; at most line_size-1 characters will
11389
+ *                      be written to the buffer, plus one null terminator
11390
+ * @param print_prefix  used to store whether the prefix must be printed;
11391
+ *                      must point to a persistent integer initially set to 1
11392
+ * @return Returns a negative value if an error occurred, otherwise returns
11393
+ *         the number of characters that would have been written for a
11394
+ *         sufficiently large buffer, not including the terminating null
11395
+ *         character. If the return value is not less than line_size, it means
11396
+ *         that the log message was truncated to fit the buffer.
11397
+ */
11398
+int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
11399
+                        char *line, int line_size, int *print_prefix);
11400
+
11401
+/**
11402
+ * Skip repeated messages, this requires the user app to use av_log() instead of
11403
+ * (f)printf as the 2 would otherwise interfere and lead to
11404
+ * "Last message repeated x times" messages below (f)printf messages with some
11405
+ * bad luck.
11406
+ * Also to receive the last, "last repeated" line if any, the user app must
11407
+ * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
11408
+ */
11409
+#define AV_LOG_SKIP_REPEATED 1
11410
+
11411
+/**
11412
+ * Include the log severity in messages originating from codecs.
11413
+ *
11414
+ * Results in messages such as:
11415
+ * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
11416
+ */
11417
+#define AV_LOG_PRINT_LEVEL 2
11418
+
11419
+void av_log_set_flags(int arg);
11420
+int av_log_get_flags(void);
11421
+
11422
+/**
11423
+ * @}
11424
+ */
11425
+
11426
+#endif /* AVUTIL_LOG_H */
11427
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11428
new file mode 100644
11429
index 000000000000..2007ee561987
11430
--- /dev/null
11431
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11432
@@ -0,0 +1,50 @@
11433
+/*
11434
+ * This file is part of FFmpeg.
11435
+ *
11436
+ * FFmpeg is free software; you can redistribute it and/or
11437
+ * modify it under the terms of the GNU Lesser General Public
11438
+ * License as published by the Free Software Foundation; either
11439
+ * version 2.1 of the License, or (at your option) any later version.
11440
+ *
11441
+ * FFmpeg is distributed in the hope that it will be useful,
11442
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11443
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11444
+ * Lesser General Public License for more details.
11445
+ *
11446
+ * You should have received a copy of the GNU Lesser General Public
11447
+ * License along with FFmpeg; if not, write to the Free Software
11448
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11449
+ */
11450
+
11451
+/**
11452
+ * @file
11453
+ * @ingroup lavu
11454
+ * Utility Preprocessor macros
11455
+ */
11456
+
11457
+#ifndef AVUTIL_MACROS_H
11458
+#define AVUTIL_MACROS_H
11459
+
11460
+/**
11461
+ * @addtogroup preproc_misc Preprocessor String Macros
11462
+ *
11463
+ * String manipulation macros
11464
+ *
11465
+ * @{
11466
+ */
11467
+
11468
+#define AV_STRINGIFY(s)         AV_TOSTRING(s)
11469
+#define AV_TOSTRING(s) #s
11470
+
11471
+#define AV_GLUE(a, b) a ## b
11472
+#define AV_JOIN(a, b) AV_GLUE(a, b)
11473
+
11474
+/**
11475
+ * @}
11476
+ */
11477
+
11478
+#define AV_PRAGMA(s) _Pragma(#s)
11479
+
11480
+#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
11481
+
11482
+#endif /* AVUTIL_MACROS_H */
11483
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11484
new file mode 100644
11485
index 000000000000..54901800ba6a
11486
--- /dev/null
11487
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11488
@@ -0,0 +1,242 @@
11489
+/*
11490
+ * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
11491
+ *
11492
+ * This file is part of FFmpeg.
11493
+ *
11494
+ * FFmpeg is free software; you can redistribute it and/or
11495
+ * modify it under the terms of the GNU Lesser General Public
11496
+ * License as published by the Free Software Foundation; either
11497
+ * version 2.1 of the License, or (at your option) any later version.
11498
+ *
11499
+ * FFmpeg is distributed in the hope that it will be useful,
11500
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11501
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11502
+ * Lesser General Public License for more details.
11503
+ *
11504
+ * You should have received a copy of the GNU Lesser General Public
11505
+ * License along with FFmpeg; if not, write to the Free Software
11506
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11507
+ */
11508
+
11509
+/**
11510
+ * @file
11511
+ * @addtogroup lavu_math
11512
+ * Mathematical utilities for working with timestamp and time base.
11513
+ */
11514
+
11515
+#ifndef AVUTIL_MATHEMATICS_H
11516
+#define AVUTIL_MATHEMATICS_H
11517
+
11518
+#include <stdint.h>
11519
+#include <math.h>
11520
+#include "attributes.h"
11521
+#include "rational.h"
11522
+#include "intfloat.h"
11523
+
11524
+#ifndef M_E
11525
+#define M_E            2.7182818284590452354   /* e */
11526
+#endif
11527
+#ifndef M_LN2
11528
+#define M_LN2          0.69314718055994530942  /* log_e 2 */
11529
+#endif
11530
+#ifndef M_LN10
11531
+#define M_LN10         2.30258509299404568402  /* log_e 10 */
11532
+#endif
11533
+#ifndef M_LOG2_10
11534
+#define M_LOG2_10      3.32192809488736234787  /* log_2 10 */
11535
+#endif
11536
+#ifndef M_PHI
11537
+#define M_PHI          1.61803398874989484820   /* phi / golden ratio */
11538
+#endif
11539
+#ifndef M_PI
11540
+#define M_PI           3.14159265358979323846  /* pi */
11541
+#endif
11542
+#ifndef M_PI_2
11543
+#define M_PI_2         1.57079632679489661923  /* pi/2 */
11544
+#endif
11545
+#ifndef M_SQRT1_2
11546
+#define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
11547
+#endif
11548
+#ifndef M_SQRT2
11549
+#define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
11550
+#endif
11551
+#ifndef NAN
11552
+#define NAN            av_int2float(0x7fc00000)
11553
+#endif
11554
+#ifndef INFINITY
11555
+#define INFINITY       av_int2float(0x7f800000)
11556
+#endif
11557
+
11558
+/**
11559
+ * @addtogroup lavu_math
11560
+ *
11561
+ * @{
11562
+ */
11563
+
11564
+/**
11565
+ * Rounding methods.
11566
+ */
11567
+enum AVRounding {
11568
+    AV_ROUND_ZERO     = 0, ///< Round toward zero.
11569
+    AV_ROUND_INF      = 1, ///< Round away from zero.
11570
+    AV_ROUND_DOWN     = 2, ///< Round toward -infinity.
11571
+    AV_ROUND_UP       = 3, ///< Round toward +infinity.
11572
+    AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
11573
+    /**
11574
+     * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
11575
+     * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
11576
+     *
11577
+     * Unlike other values of the enumeration AVRounding, this value is a
11578
+     * bitmask that must be used in conjunction with another value of the
11579
+     * enumeration through a bitwise OR, in order to set behavior for normal
11580
+     * cases.
11581
+     *
11582
+     * @code{.c}
11583
+     * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11584
+     * // Rescaling 3:
11585
+     * //     Calculating 3 * 1 / 2
11586
+     * //     3 / 2 is rounded up to 2
11587
+     * //     => 2
11588
+     *
11589
+     * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11590
+     * // Rescaling AV_NOPTS_VALUE:
11591
+     * //     AV_NOPTS_VALUE == INT64_MIN
11592
+     * //     AV_NOPTS_VALUE is passed through
11593
+     * //     => AV_NOPTS_VALUE
11594
+     * @endcode
11595
+     */
11596
+    AV_ROUND_PASS_MINMAX = 8192,
11597
+};
11598
+
11599
+/**
11600
+ * Compute the greatest common divisor of two integer operands.
11601
+ *
11602
+ * @param a,b Operands
11603
+ * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
11604
+ * if a == 0 and b == 0, returns 0.
11605
+ */
11606
+int64_t av_const av_gcd(int64_t a, int64_t b);
11607
+
11608
+/**
11609
+ * Rescale a 64-bit integer with rounding to nearest.
11610
+ *
11611
+ * The operation is mathematically equivalent to `a * b / c`, but writing that
11612
+ * directly can overflow.
11613
+ *
11614
+ * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
11615
+ *
11616
+ * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
11617
+ */
11618
+int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
11619
+
11620
+/**
11621
+ * Rescale a 64-bit integer with specified rounding.
11622
+ *
11623
+ * The operation is mathematically equivalent to `a * b / c`, but writing that
11624
+ * directly can overflow, and does not support different rounding methods.
11625
+ *
11626
+ * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
11627
+ */
11628
+int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
11629
+
11630
+/**
11631
+ * Rescale a 64-bit integer by 2 rational numbers.
11632
+ *
11633
+ * The operation is mathematically equivalent to `a * bq / cq`.
11634
+ *
11635
+ * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
11636
+ *
11637
+ * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
11638
+ */
11639
+int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
11640
+
11641
+/**
11642
+ * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
11643
+ *
11644
+ * The operation is mathematically equivalent to `a * bq / cq`.
11645
+ *
11646
+ * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
11647
+ */
11648
+int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
11649
+                         enum AVRounding rnd) av_const;
11650
+
11651
+/**
11652
+ * Compare two timestamps each in its own time base.
11653
+ *
11654
+ * @return One of the following values:
11655
+ *         - -1 if `ts_a` is before `ts_b`
11656
+ *         - 1 if `ts_a` is after `ts_b`
11657
+ *         - 0 if they represent the same position
11658
+ *
11659
+ * @warning
11660
+ * The result of the function is undefined if one of the timestamps is outside
11661
+ * the `int64_t` range when represented in the other's timebase.
11662
+ */
11663
+int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
11664
+
11665
+/**
11666
+ * Compare the remainders of two integer operands divided by a common divisor.
11667
+ *
11668
+ * In other words, compare the least significant `log2(mod)` bits of integers
11669
+ * `a` and `b`.
11670
+ *
11671
+ * @code{.c}
11672
+ * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10  (0x1) < 0x02 % 0x10  (0x2)
11673
+ * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
11674
+ * @endcode
11675
+ *
11676
+ * @param a,b Operands
11677
+ * @param mod Divisor; must be a power of 2
11678
+ * @return
11679
+ *         - a negative value if `a % mod < b % mod`
11680
+ *         - a positive value if `a % mod > b % mod`
11681
+ *         - zero             if `a % mod == b % mod`
11682
+ */
11683
+int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
11684
+
11685
+/**
11686
+ * Rescale a timestamp while preserving known durations.
11687
+ *
11688
+ * This function is designed to be called per audio packet to scale the input
11689
+ * timestamp to a different time base. Compared to a simple av_rescale_q()
11690
+ * call, this function is robust against possible inconsistent frame durations.
11691
+ *
11692
+ * The `last` parameter is a state variable that must be preserved for all
11693
+ * subsequent calls for the same stream. For the first call, `*last` should be
11694
+ * initialized to #AV_NOPTS_VALUE.
11695
+ *
11696
+ * @param[in]     in_tb    Input time base
11697
+ * @param[in]     in_ts    Input timestamp
11698
+ * @param[in]     fs_tb    Duration time base; typically this is finer-grained
11699
+ *                         (greater) than `in_tb` and `out_tb`
11700
+ * @param[in]     duration Duration till the next call to this function (i.e.
11701
+ *                         duration of the current packet/frame)
11702
+ * @param[in,out] last     Pointer to a timestamp expressed in terms of
11703
+ *                         `fs_tb`, acting as a state variable
11704
+ * @param[in]     out_tb   Output timebase
11705
+ * @return        Timestamp expressed in terms of `out_tb`
11706
+ *
11707
+ * @note In the context of this function, "duration" is in term of samples, not
11708
+ *       seconds.
11709
+ */
11710
+int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts,  AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
11711
+
11712
+/**
11713
+ * Add a value to a timestamp.
11714
+ *
11715
+ * This function guarantees that when the same value is repeatly added that
11716
+ * no accumulation of rounding errors occurs.
11717
+ *
11718
+ * @param[in] ts     Input timestamp
11719
+ * @param[in] ts_tb  Input timestamp time base
11720
+ * @param[in] inc    Value to be added
11721
+ * @param[in] inc_tb Time base of `inc`
11722
+ */
11723
+int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
11724
+
11725
+
11726
+/**
11727
+ * @}
11728
+ */
11729
+
11730
+#endif /* AVUTIL_MATHEMATICS_H */
11731
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11732
new file mode 100644
11733
index 000000000000..7e0b12a8a782
11734
--- /dev/null
11735
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11736
@@ -0,0 +1,700 @@
11737
+/*
11738
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11739
+ *
11740
+ * This file is part of FFmpeg.
11741
+ *
11742
+ * FFmpeg is free software; you can redistribute it and/or
11743
+ * modify it under the terms of the GNU Lesser General Public
11744
+ * License as published by the Free Software Foundation; either
11745
+ * version 2.1 of the License, or (at your option) any later version.
11746
+ *
11747
+ * FFmpeg is distributed in the hope that it will be useful,
11748
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11749
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11750
+ * Lesser General Public License for more details.
11751
+ *
11752
+ * You should have received a copy of the GNU Lesser General Public
11753
+ * License along with FFmpeg; if not, write to the Free Software
11754
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11755
+ */
11756
+
11757
+/**
11758
+ * @file
11759
+ * @ingroup lavu_mem
11760
+ * Memory handling functions
11761
+ */
11762
+
11763
+#ifndef AVUTIL_MEM_H
11764
+#define AVUTIL_MEM_H
11765
+
11766
+#include <limits.h>
11767
+#include <stdint.h>
11768
+
11769
+#include "attributes.h"
11770
+#include "error.h"
11771
+#include "avutil.h"
11772
+
11773
+/**
11774
+ * @addtogroup lavu_mem
11775
+ * Utilities for manipulating memory.
11776
+ *
11777
+ * FFmpeg has several applications of memory that are not required of a typical
11778
+ * program. For example, the computing-heavy components like video decoding and
11779
+ * encoding can be sped up significantly through the use of aligned memory.
11780
+ *
11781
+ * However, for each of FFmpeg's applications of memory, there might not be a
11782
+ * recognized or standardized API for that specific use. Memory alignment, for
11783
+ * instance, varies wildly depending on operating systems, architectures, and
11784
+ * compilers. Hence, this component of @ref libavutil is created to make
11785
+ * dealing with memory consistently possible on all platforms.
11786
+ *
11787
+ * @{
11788
+ *
11789
+ * @defgroup lavu_mem_macros Alignment Macros
11790
+ * Helper macros for declaring aligned variables.
11791
+ * @{
11792
+ */
11793
+
11794
+/**
11795
+ * @def DECLARE_ALIGNED(n,t,v)
11796
+ * Declare a variable that is aligned in memory.
11797
+ *
11798
+ * @code{.c}
11799
+ * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
11800
+ * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
11801
+ *
11802
+ * // The default-alignment equivalent would be
11803
+ * uint16_t aligned_int = 42;
11804
+ * uint8_t aligned_array[128];
11805
+ * @endcode
11806
+ *
11807
+ * @param n Minimum alignment in bytes
11808
+ * @param t Type of the variable (or array element)
11809
+ * @param v Name of the variable
11810
+ */
11811
+
11812
+/**
11813
+ * @def DECLARE_ASM_ALIGNED(n,t,v)
11814
+ * Declare an aligned variable appropriate for use in inline assembly code.
11815
+ *
11816
+ * @code{.c}
11817
+ * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11818
+ * @endcode
11819
+ *
11820
+ * @param n Minimum alignment in bytes
11821
+ * @param t Type of the variable (or array element)
11822
+ * @param v Name of the variable
11823
+ */
11824
+
11825
+/**
11826
+ * @def DECLARE_ASM_CONST(n,t,v)
11827
+ * Declare a static constant aligned variable appropriate for use in inline
11828
+ * assembly code.
11829
+ *
11830
+ * @code{.c}
11831
+ * DECLARE_ASM_CONST(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
+#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
11840
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
11841
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
11842
+    #define DECLARE_ASM_CONST(n,t,v)    const t __attribute__ ((aligned (n))) v
11843
+#elif defined(__DJGPP__)
11844
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (FFMIN(n, 16)))) v
11845
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11846
+    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11847
+#elif defined(__GNUC__) || defined(__clang__)
11848
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
11849
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (n))) v
11850
+    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (n))) v
11851
+#elif defined(_MSC_VER)
11852
+    #define DECLARE_ALIGNED(n,t,v)      __declspec(align(n)) t v
11853
+    #define DECLARE_ASM_ALIGNED(n,t,v)  __declspec(align(n)) t v
11854
+    #define DECLARE_ASM_CONST(n,t,v)    __declspec(align(n)) static const t v
11855
+#else
11856
+    #define DECLARE_ALIGNED(n,t,v)      t v
11857
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t v
11858
+    #define DECLARE_ASM_CONST(n,t,v)    static const t v
11859
+#endif
11860
+
11861
+/**
11862
+ * @}
11863
+ */
11864
+
11865
+/**
11866
+ * @defgroup lavu_mem_attrs Function Attributes
11867
+ * Function attributes applicable to memory handling functions.
11868
+ *
11869
+ * These function attributes can help compilers emit more useful warnings, or
11870
+ * generate better code.
11871
+ * @{
11872
+ */
11873
+
11874
+/**
11875
+ * @def av_malloc_attrib
11876
+ * Function attribute denoting a malloc-like function.
11877
+ *
11878
+ * @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>
11879
+ */
11880
+
11881
+#if AV_GCC_VERSION_AT_LEAST(3,1)
11882
+    #define av_malloc_attrib __attribute__((__malloc__))
11883
+#else
11884
+    #define av_malloc_attrib
11885
+#endif
11886
+
11887
+/**
11888
+ * @def av_alloc_size(...)
11889
+ * Function attribute used on a function that allocates memory, whose size is
11890
+ * given by the specified parameter(s).
11891
+ *
11892
+ * @code{.c}
11893
+ * void *av_malloc(size_t size) av_alloc_size(1);
11894
+ * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
11895
+ * @endcode
11896
+ *
11897
+ * @param ... One or two parameter indexes, separated by a comma
11898
+ *
11899
+ * @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>
11900
+ */
11901
+
11902
+#if AV_GCC_VERSION_AT_LEAST(4,3)
11903
+    #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
11904
+#else
11905
+    #define av_alloc_size(...)
11906
+#endif
11907
+
11908
+/**
11909
+ * @}
11910
+ */
11911
+
11912
+/**
11913
+ * @defgroup lavu_mem_funcs Heap Management
11914
+ * Functions responsible for allocating, freeing, and copying memory.
11915
+ *
11916
+ * All memory allocation functions have a built-in upper limit of `INT_MAX`
11917
+ * bytes. This may be changed with av_max_alloc(), although exercise extreme
11918
+ * caution when doing so.
11919
+ *
11920
+ * @{
11921
+ */
11922
+
11923
+/**
11924
+ * Allocate a memory block with alignment suitable for all memory accesses
11925
+ * (including vectors if available on the CPU).
11926
+ *
11927
+ * @param size Size in bytes for the memory block to be allocated
11928
+ * @return Pointer to the allocated block, or `NULL` if the block cannot
11929
+ *         be allocated
11930
+ * @see av_mallocz()
11931
+ */
11932
+void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
11933
+
11934
+/**
11935
+ * Allocate a memory block with alignment suitable for all memory accesses
11936
+ * (including vectors if available on the CPU) and zero all the bytes of the
11937
+ * block.
11938
+ *
11939
+ * @param size Size in bytes for the memory block to be allocated
11940
+ * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
11941
+ * @see av_malloc()
11942
+ */
11943
+void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
11944
+
11945
+/**
11946
+ * Allocate a memory block for an array with av_malloc().
11947
+ *
11948
+ * The allocated memory will have size `size * nmemb` bytes.
11949
+ *
11950
+ * @param nmemb Number of element
11951
+ * @param size  Size of a single element
11952
+ * @return Pointer to the allocated block, or `NULL` if the block cannot
11953
+ *         be allocated
11954
+ * @see av_malloc()
11955
+ */
11956
+av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
11957
+
11958
+/**
11959
+ * Allocate a memory block for an array with av_mallocz().
11960
+ *
11961
+ * The allocated memory will have size `size * nmemb` bytes.
11962
+ *
11963
+ * @param nmemb Number of elements
11964
+ * @param size  Size of the single element
11965
+ * @return Pointer to the allocated block, or `NULL` if the block cannot
11966
+ *         be allocated
11967
+ *
11968
+ * @see av_mallocz()
11969
+ * @see av_malloc_array()
11970
+ */
11971
+av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
11972
+
11973
+/**
11974
+ * Non-inlined equivalent of av_mallocz_array().
11975
+ *
11976
+ * Created for symmetry with the calloc() C function.
11977
+ */
11978
+void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
11979
+
11980
+/**
11981
+ * Allocate, reallocate, or free a block of memory.
11982
+ *
11983
+ * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
11984
+ * zero, free the memory block pointed to by `ptr`. Otherwise, expand or
11985
+ * shrink that block of memory according to `size`.
11986
+ *
11987
+ * @param ptr  Pointer to a memory block already allocated with
11988
+ *             av_realloc() or `NULL`
11989
+ * @param size Size in bytes of the memory block to be allocated or
11990
+ *             reallocated
11991
+ *
11992
+ * @return Pointer to a newly-reallocated block or `NULL` if the block
11993
+ *         cannot be reallocated or the function is used to free the memory block
11994
+ *
11995
+ * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
11996
+ *          correctly aligned.
11997
+ * @see av_fast_realloc()
11998
+ * @see av_reallocp()
11999
+ */
12000
+void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
12001
+
12002
+/**
12003
+ * Allocate, reallocate, or free a block of memory through a pointer to a
12004
+ * pointer.
12005
+ *
12006
+ * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
12007
+ * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
12008
+ * shrink that block of memory according to `size`.
12009
+ *
12010
+ * @param[in,out] ptr  Pointer to a pointer to a memory block already allocated
12011
+ *                     with av_realloc(), or a pointer to `NULL`. The pointer
12012
+ *                     is updated on success, or freed on failure.
12013
+ * @param[in]     size Size in bytes for the memory block to be allocated or
12014
+ *                     reallocated
12015
+ *
12016
+ * @return Zero on success, an AVERROR error code on failure
12017
+ *
12018
+ * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12019
+ *          correctly aligned.
12020
+ */
12021
+av_warn_unused_result
12022
+int av_reallocp(void *ptr, size_t size);
12023
+
12024
+/**
12025
+ * Allocate, reallocate, or free a block of memory.
12026
+ *
12027
+ * This function does the same thing as av_realloc(), except:
12028
+ * - It takes two size arguments and allocates `nelem * elsize` bytes,
12029
+ *   after checking the result of the multiplication for integer overflow.
12030
+ * - It frees the input block in case of failure, thus avoiding the memory
12031
+ *   leak with the classic
12032
+ *   @code{.c}
12033
+ *   buf = realloc(buf);
12034
+ *   if (!buf)
12035
+ *       return -1;
12036
+ *   @endcode
12037
+ *   pattern.
12038
+ */
12039
+void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
12040
+
12041
+/**
12042
+ * Allocate, reallocate, or free an array.
12043
+ *
12044
+ * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
12045
+ * `nmemb` is zero, free the memory block pointed to by `ptr`.
12046
+ *
12047
+ * @param ptr   Pointer to a memory block already allocated with
12048
+ *              av_realloc() or `NULL`
12049
+ * @param nmemb Number of elements in the array
12050
+ * @param size  Size of the single element of the array
12051
+ *
12052
+ * @return Pointer to a newly-reallocated block or NULL if the block
12053
+ *         cannot be reallocated or the function is used to free the memory block
12054
+ *
12055
+ * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12056
+ *          correctly aligned.
12057
+ * @see av_reallocp_array()
12058
+ */
12059
+av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
12060
+
12061
+/**
12062
+ * Allocate, reallocate, or free an array through a pointer to a pointer.
12063
+ *
12064
+ * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
12065
+ * zero, free the memory block pointed to by `*ptr`.
12066
+ *
12067
+ * @param[in,out] ptr   Pointer to a pointer to a memory block already
12068
+ *                      allocated with av_realloc(), or a pointer to `NULL`.
12069
+ *                      The pointer is updated on success, or freed on failure.
12070
+ * @param[in]     nmemb Number of elements
12071
+ * @param[in]     size  Size of the single element
12072
+ *
12073
+ * @return Zero on success, an AVERROR error code on failure
12074
+ *
12075
+ * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12076
+ *          correctly aligned.
12077
+ */
12078
+av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
12079
+
12080
+/**
12081
+ * Reallocate the given buffer if it is not large enough, otherwise do nothing.
12082
+ *
12083
+ * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
12084
+ *
12085
+ * If the given buffer is not large enough, and reallocation fails, `NULL` is
12086
+ * returned and `*size` is set to 0, but the original buffer is not changed or
12087
+ * freed.
12088
+ *
12089
+ * A typical use pattern follows:
12090
+ *
12091
+ * @code{.c}
12092
+ * uint8_t *buf = ...;
12093
+ * uint8_t *new_buf = av_fast_realloc(buf, &current_size, size_needed);
12094
+ * if (!new_buf) {
12095
+ *     // Allocation failed; clean up original buffer
12096
+ *     av_freep(&buf);
12097
+ *     return AVERROR(ENOMEM);
12098
+ * }
12099
+ * @endcode
12100
+ *
12101
+ * @param[in,out] ptr      Already allocated buffer, or `NULL`
12102
+ * @param[in,out] size     Pointer to current size of buffer `ptr`. `*size` is
12103
+ *                         changed to `min_size` in case of success or 0 in
12104
+ *                         case of failure
12105
+ * @param[in]     min_size New size of buffer `ptr`
12106
+ * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
12107
+ *         buffer if the buffer was not large enough, or `NULL` in case of
12108
+ *         error
12109
+ * @see av_realloc()
12110
+ * @see av_fast_malloc()
12111
+ */
12112
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
12113
+
12114
+/**
12115
+ * Allocate a buffer, reusing the given one if large enough.
12116
+ *
12117
+ * Contrary to av_fast_realloc(), the current buffer contents might not be
12118
+ * preserved and on error the old buffer is freed, thus no special handling to
12119
+ * avoid memleaks is necessary.
12120
+ *
12121
+ * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12122
+ * `size_needed` is greater than 0.
12123
+ *
12124
+ * @code{.c}
12125
+ * uint8_t *buf = ...;
12126
+ * av_fast_malloc(&buf, &current_size, size_needed);
12127
+ * if (!buf) {
12128
+ *     // Allocation failed; buf already freed
12129
+ *     return AVERROR(ENOMEM);
12130
+ * }
12131
+ * @endcode
12132
+ *
12133
+ * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
12134
+ *                         `*ptr` will be overwritten with pointer to new
12135
+ *                         buffer on success or `NULL` on failure
12136
+ * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
12137
+ *                         changed to `min_size` in case of success or 0 in
12138
+ *                         case of failure
12139
+ * @param[in]     min_size New size of buffer `*ptr`
12140
+ * @see av_realloc()
12141
+ * @see av_fast_mallocz()
12142
+ */
12143
+void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
12144
+
12145
+/**
12146
+ * Allocate and clear a buffer, reusing the given one if large enough.
12147
+ *
12148
+ * Like av_fast_malloc(), but all newly allocated space is initially cleared.
12149
+ * Reused buffer is not cleared.
12150
+ *
12151
+ * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12152
+ * `size_needed` is greater than 0.
12153
+ *
12154
+ * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
12155
+ *                         `*ptr` will be overwritten with pointer to new
12156
+ *                         buffer on success or `NULL` on failure
12157
+ * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
12158
+ *                         changed to `min_size` in case of success or 0 in
12159
+ *                         case of failure
12160
+ * @param[in]     min_size New size of buffer `*ptr`
12161
+ * @see av_fast_malloc()
12162
+ */
12163
+void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
12164
+
12165
+/**
12166
+ * Free a memory block which has been allocated with a function of av_malloc()
12167
+ * or av_realloc() family.
12168
+ *
12169
+ * @param ptr Pointer to the memory block which should be freed.
12170
+ *
12171
+ * @note `ptr = NULL` is explicitly allowed.
12172
+ * @note It is recommended that you use av_freep() instead, to prevent leaving
12173
+ *       behind dangling pointers.
12174
+ * @see av_freep()
12175
+ */
12176
+void av_free(void *ptr);
12177
+
12178
+/**
12179
+ * Free a memory block which has been allocated with a function of av_malloc()
12180
+ * or av_realloc() family, and set the pointer pointing to it to `NULL`.
12181
+ *
12182
+ * @code{.c}
12183
+ * uint8_t *buf = av_malloc(16);
12184
+ * av_free(buf);
12185
+ * // buf now contains a dangling pointer to freed memory, and accidental
12186
+ * // dereference of buf will result in a use-after-free, which may be a
12187
+ * // security risk.
12188
+ *
12189
+ * uint8_t *buf = av_malloc(16);
12190
+ * av_freep(&buf);
12191
+ * // buf is now NULL, and accidental dereference will only result in a
12192
+ * // NULL-pointer dereference.
12193
+ * @endcode
12194
+ *
12195
+ * @param ptr Pointer to the pointer to the memory block which should be freed
12196
+ * @note `*ptr = NULL` is safe and leads to no action.
12197
+ * @see av_free()
12198
+ */
12199
+void av_freep(void *ptr);
12200
+
12201
+/**
12202
+ * Duplicate a string.
12203
+ *
12204
+ * @param s String to be duplicated
12205
+ * @return Pointer to a newly-allocated string containing a
12206
+ *         copy of `s` or `NULL` if the string cannot be allocated
12207
+ * @see av_strndup()
12208
+ */
12209
+char *av_strdup(const char *s) av_malloc_attrib;
12210
+
12211
+/**
12212
+ * Duplicate a substring of a string.
12213
+ *
12214
+ * @param s   String to be duplicated
12215
+ * @param len Maximum length of the resulting string (not counting the
12216
+ *            terminating byte)
12217
+ * @return Pointer to a newly-allocated string containing a
12218
+ *         substring of `s` or `NULL` if the string cannot be allocated
12219
+ */
12220
+char *av_strndup(const char *s, size_t len) av_malloc_attrib;
12221
+
12222
+/**
12223
+ * Duplicate a buffer with av_malloc().
12224
+ *
12225
+ * @param p    Buffer to be duplicated
12226
+ * @param size Size in bytes of the buffer copied
12227
+ * @return Pointer to a newly allocated buffer containing a
12228
+ *         copy of `p` or `NULL` if the buffer cannot be allocated
12229
+ */
12230
+void *av_memdup(const void *p, size_t size);
12231
+
12232
+/**
12233
+ * Overlapping memcpy() implementation.
12234
+ *
12235
+ * @param dst  Destination buffer
12236
+ * @param back Number of bytes back to start copying (i.e. the initial size of
12237
+ *             the overlapping window); must be > 0
12238
+ * @param cnt  Number of bytes to copy; must be >= 0
12239
+ *
12240
+ * @note `cnt > back` is valid, this will copy the bytes we just copied,
12241
+ *       thus creating a repeating pattern with a period length of `back`.
12242
+ */
12243
+void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
12244
+
12245
+/**
12246
+ * @}
12247
+ */
12248
+
12249
+/**
12250
+ * @defgroup lavu_mem_dynarray Dynamic Array
12251
+ *
12252
+ * Utilities to make an array grow when needed.
12253
+ *
12254
+ * Sometimes, the programmer would want to have an array that can grow when
12255
+ * needed. The libavutil dynamic array utilities fill that need.
12256
+ *
12257
+ * libavutil supports two systems of appending elements onto a dynamically
12258
+ * allocated array, the first one storing the pointer to the value in the
12259
+ * array, and the second storing the value directly. In both systems, the
12260
+ * caller is responsible for maintaining a variable containing the length of
12261
+ * the array, as well as freeing of the array after use.
12262
+ *
12263
+ * The first system stores pointers to values in a block of dynamically
12264
+ * allocated memory. Since only pointers are stored, the function does not need
12265
+ * to know the size of the type. Both av_dynarray_add() and
12266
+ * av_dynarray_add_nofree() implement this system.
12267
+ *
12268
+ * @code
12269
+ * type **array = NULL; //< an array of pointers to values
12270
+ * int    nb    = 0;    //< a variable to keep track of the length of the array
12271
+ *
12272
+ * type to_be_added  = ...;
12273
+ * type to_be_added2 = ...;
12274
+ *
12275
+ * av_dynarray_add(&array, &nb, &to_be_added);
12276
+ * if (nb == 0)
12277
+ *     return AVERROR(ENOMEM);
12278
+ *
12279
+ * av_dynarray_add(&array, &nb, &to_be_added2);
12280
+ * if (nb == 0)
12281
+ *     return AVERROR(ENOMEM);
12282
+ *
12283
+ * // Now:
12284
+ * //  nb           == 2
12285
+ * // &to_be_added  == array[0]
12286
+ * // &to_be_added2 == array[1]
12287
+ *
12288
+ * av_freep(&array);
12289
+ * @endcode
12290
+ *
12291
+ * The second system stores the value directly in a block of memory. As a
12292
+ * result, the function has to know the size of the type. av_dynarray2_add()
12293
+ * implements this mechanism.
12294
+ *
12295
+ * @code
12296
+ * type *array = NULL; //< an array of values
12297
+ * int   nb    = 0;    //< a variable to keep track of the length of the array
12298
+ *
12299
+ * type to_be_added  = ...;
12300
+ * type to_be_added2 = ...;
12301
+ *
12302
+ * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
12303
+ * if (!addr)
12304
+ *     return AVERROR(ENOMEM);
12305
+ * memcpy(addr, &to_be_added, sizeof(to_be_added));
12306
+ *
12307
+ * // Shortcut of the above.
12308
+ * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
12309
+ *                               (const void *)&to_be_added2);
12310
+ * if (!addr)
12311
+ *     return AVERROR(ENOMEM);
12312
+ *
12313
+ * // Now:
12314
+ * //  nb           == 2
12315
+ * //  to_be_added  == array[0]
12316
+ * //  to_be_added2 == array[1]
12317
+ *
12318
+ * av_freep(&array);
12319
+ * @endcode
12320
+ *
12321
+ * @{
12322
+ */
12323
+
12324
+/**
12325
+ * Add the pointer to an element to a dynamic array.
12326
+ *
12327
+ * The array to grow is supposed to be an array of pointers to
12328
+ * structures, and the element to add must be a pointer to an already
12329
+ * allocated structure.
12330
+ *
12331
+ * The array is reallocated when its size reaches powers of 2.
12332
+ * Therefore, the amortized cost of adding an element is constant.
12333
+ *
12334
+ * In case of success, the pointer to the array is updated in order to
12335
+ * point to the new grown array, and the number pointed to by `nb_ptr`
12336
+ * is incremented.
12337
+ * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12338
+ * `*nb_ptr` is set to 0.
12339
+ *
12340
+ * @param[in,out] tab_ptr Pointer to the array to grow
12341
+ * @param[in,out] nb_ptr  Pointer to the number of elements in the array
12342
+ * @param[in]     elem    Element to add
12343
+ * @see av_dynarray_add_nofree(), av_dynarray2_add()
12344
+ */
12345
+void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
12346
+
12347
+/**
12348
+ * Add an element to a dynamic array.
12349
+ *
12350
+ * Function has the same functionality as av_dynarray_add(),
12351
+ * but it doesn't free memory on fails. It returns error code
12352
+ * instead and leave current buffer untouched.
12353
+ *
12354
+ * @return >=0 on success, negative otherwise
12355
+ * @see av_dynarray_add(), av_dynarray2_add()
12356
+ */
12357
+av_warn_unused_result
12358
+int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
12359
+
12360
+/**
12361
+ * Add an element of size `elem_size` to a dynamic array.
12362
+ *
12363
+ * The array is reallocated when its number of elements reaches powers of 2.
12364
+ * Therefore, the amortized cost of adding an element is constant.
12365
+ *
12366
+ * In case of success, the pointer to the array is updated in order to
12367
+ * point to the new grown array, and the number pointed to by `nb_ptr`
12368
+ * is incremented.
12369
+ * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12370
+ * `*nb_ptr` is set to 0.
12371
+ *
12372
+ * @param[in,out] tab_ptr   Pointer to the array to grow
12373
+ * @param[in,out] nb_ptr    Pointer to the number of elements in the array
12374
+ * @param[in]     elem_size Size in bytes of an element in the array
12375
+ * @param[in]     elem_data Pointer to the data of the element to add. If
12376
+ *                          `NULL`, the space of the newly added element is
12377
+ *                          allocated but left uninitialized.
12378
+ *
12379
+ * @return Pointer to the data of the element to copy in the newly allocated
12380
+ *         space
12381
+ * @see av_dynarray_add(), av_dynarray_add_nofree()
12382
+ */
12383
+void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
12384
+                       const uint8_t *elem_data);
12385
+
12386
+/**
12387
+ * @}
12388
+ */
12389
+
12390
+/**
12391
+ * @defgroup lavu_mem_misc Miscellaneous Functions
12392
+ *
12393
+ * Other functions related to memory allocation.
12394
+ *
12395
+ * @{
12396
+ */
12397
+
12398
+/**
12399
+ * Multiply two `size_t` values checking for overflow.
12400
+ *
12401
+ * @param[in]  a,b Operands of multiplication
12402
+ * @param[out] r   Pointer to the result of the operation
12403
+ * @return 0 on success, AVERROR(EINVAL) on overflow
12404
+ */
12405
+static inline int av_size_mult(size_t a, size_t b, size_t *r)
12406
+{
12407
+    size_t t = a * b;
12408
+    /* Hack inspired from glibc: don't try the division if nelem and elsize
12409
+     * are both less than sqrt(SIZE_MAX). */
12410
+    if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
12411
+        return AVERROR(EINVAL);
12412
+    *r = t;
12413
+    return 0;
12414
+}
12415
+
12416
+/**
12417
+ * Set the maximum size that may be allocated in one block.
12418
+ *
12419
+ * The value specified with this function is effective for all libavutil's @ref
12420
+ * lavu_mem_funcs "heap management functions."
12421
+ *
12422
+ * By default, the max value is defined as `INT_MAX`.
12423
+ *
12424
+ * @param max Value to be set as the new maximum size
12425
+ *
12426
+ * @warning Exercise extreme caution when using this function. Don't touch
12427
+ *          this if you do not understand the full consequence of doing so.
12428
+ */
12429
+void av_max_alloc(size_t max);
12430
+
12431
+/**
12432
+ * @}
12433
+ * @}
12434
+ */
12435
+
12436
+#endif /* AVUTIL_MEM_H */
12437
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12438
new file mode 100644
12439
index 000000000000..e184a56672dc
12440
--- /dev/null
12441
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12442
@@ -0,0 +1,529 @@
12443
+/*
12444
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
12445
+ *
12446
+ * This file is part of FFmpeg.
12447
+ *
12448
+ * FFmpeg is free software; you can redistribute it and/or
12449
+ * modify it under the terms of the GNU Lesser General Public
12450
+ * License as published by the Free Software Foundation; either
12451
+ * version 2.1 of the License, or (at your option) any later version.
12452
+ *
12453
+ * FFmpeg is distributed in the hope that it will be useful,
12454
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12455
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12456
+ * Lesser General Public License for more details.
12457
+ *
12458
+ * You should have received a copy of the GNU Lesser General Public
12459
+ * License along with FFmpeg; if not, write to the Free Software
12460
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12461
+ */
12462
+
12463
+#ifndef AVUTIL_PIXFMT_H
12464
+#define AVUTIL_PIXFMT_H
12465
+
12466
+/**
12467
+ * @file
12468
+ * pixel format definitions
12469
+ */
12470
+
12471
+#include "libavutil/avconfig.h"
12472
+#include "version.h"
12473
+
12474
+#define AVPALETTE_SIZE 1024
12475
+#define AVPALETTE_COUNT 256
12476
+
12477
+/**
12478
+ * Pixel format.
12479
+ *
12480
+ * @note
12481
+ * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
12482
+ * color is put together as:
12483
+ *  (A << 24) | (R << 16) | (G << 8) | B
12484
+ * This is stored as BGRA on little-endian CPU architectures and ARGB on
12485
+ * big-endian CPUs.
12486
+ *
12487
+ * @par
12488
+ * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
12489
+ * image data is stored in AVFrame.data[0]. The palette is transported in
12490
+ * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
12491
+ * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
12492
+ * also endian-specific). Note also that the individual RGB32 palette
12493
+ * components stored in AVFrame.data[1] should be in the range 0..255.
12494
+ * This is important as many custom PAL8 video codecs that were designed
12495
+ * to run on the IBM VGA graphics adapter use 6-bit palette components.
12496
+ *
12497
+ * @par
12498
+ * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
12499
+ * for pal8. This palette is filled in automatically by the function
12500
+ * allocating the picture.
12501
+ */
12502
+enum AVPixelFormat {
12503
+    AV_PIX_FMT_NONE = -1,
12504
+    AV_PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
12505
+    AV_PIX_FMT_YUYV422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
12506
+    AV_PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...
12507
+    AV_PIX_FMT_BGR24,     ///< packed RGB 8:8:8, 24bpp, BGRBGR...
12508
+    AV_PIX_FMT_YUV422P,   ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12509
+    AV_PIX_FMT_YUV444P,   ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
12510
+    AV_PIX_FMT_YUV410P,   ///< planar YUV 4:1:0,  9bpp, (1 Cr & Cb sample per 4x4 Y samples)
12511
+    AV_PIX_FMT_YUV411P,   ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
12512
+    AV_PIX_FMT_GRAY8,     ///<        Y        ,  8bpp
12513
+    AV_PIX_FMT_MONOWHITE, ///<        Y        ,  1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
12514
+    AV_PIX_FMT_MONOBLACK, ///<        Y        ,  1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
12515
+    AV_PIX_FMT_PAL8,      ///< 8 bits with AV_PIX_FMT_RGB32 palette
12516
+    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
12517
+    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
12518
+    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
12519
+    AV_PIX_FMT_UYVY422,   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
12520
+    AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
12521
+    AV_PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
12522
+    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
12523
+    AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1B 2G 1R(lsb)
12524
+    AV_PIX_FMT_RGB8,      ///< packed RGB 3:3:2,  8bpp, (msb)2R 3G 3B(lsb)
12525
+    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
12526
+    AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1R 2G 1B(lsb)
12527
+    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)
12528
+    AV_PIX_FMT_NV21,      ///< as above, but U and V bytes are swapped
12529
+
12530
+    AV_PIX_FMT_ARGB,      ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
12531
+    AV_PIX_FMT_RGBA,      ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
12532
+    AV_PIX_FMT_ABGR,      ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
12533
+    AV_PIX_FMT_BGRA,      ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
12534
+
12535
+    AV_PIX_FMT_GRAY16BE,  ///<        Y        , 16bpp, big-endian
12536
+    AV_PIX_FMT_GRAY16LE,  ///<        Y        , 16bpp, little-endian
12537
+    AV_PIX_FMT_YUV440P,   ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
12538
+    AV_PIX_FMT_YUVJ440P,  ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
12539
+    AV_PIX_FMT_YUVA420P,  ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
12540
+    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
12541
+    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
12542
+
12543
+    AV_PIX_FMT_RGB565BE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), big-endian
12544
+    AV_PIX_FMT_RGB565LE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), little-endian
12545
+    AV_PIX_FMT_RGB555BE,  ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian   , X=unused/undefined
12546
+    AV_PIX_FMT_RGB555LE,  ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
12547
+
12548
+    AV_PIX_FMT_BGR565BE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), big-endian
12549
+    AV_PIX_FMT_BGR565LE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), little-endian
12550
+    AV_PIX_FMT_BGR555BE,  ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian   , X=unused/undefined
12551
+    AV_PIX_FMT_BGR555LE,  ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
12552
+
12553
+#if FF_API_VAAPI
12554
+    /** @name Deprecated pixel formats */
12555
+    /**@{*/
12556
+    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
12557
+    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
12558
+    AV_PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
12559
+    /**@}*/
12560
+    AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
12561
+#else
12562
+    /**
12563
+     *  Hardware acceleration through VA-API, data[3] contains a
12564
+     *  VASurfaceID.
12565
+     */
12566
+    AV_PIX_FMT_VAAPI,
12567
+#endif
12568
+
12569
+    AV_PIX_FMT_YUV420P16LE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12570
+    AV_PIX_FMT_YUV420P16BE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12571
+    AV_PIX_FMT_YUV422P16LE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12572
+    AV_PIX_FMT_YUV422P16BE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12573
+    AV_PIX_FMT_YUV444P16LE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12574
+    AV_PIX_FMT_YUV444P16BE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12575
+    AV_PIX_FMT_DXVA2_VLD,    ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
12576
+
12577
+    AV_PIX_FMT_RGB444LE,  ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
12578
+    AV_PIX_FMT_RGB444BE,  ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian,    X=unused/undefined
12579
+    AV_PIX_FMT_BGR444LE,  ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
12580
+    AV_PIX_FMT_BGR444BE,  ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian,    X=unused/undefined
12581
+    AV_PIX_FMT_YA8,       ///< 8 bits gray, 8 bits alpha
12582
+
12583
+    AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12584
+    AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12585
+
12586
+    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
12587
+    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
12588
+
12589
+    /**
12590
+     * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
12591
+     * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
12592
+     * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
12593
+     */
12594
+    AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12595
+    AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12596
+    AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12597
+    AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12598
+    AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12599
+    AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12600
+    AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12601
+    AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12602
+    AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12603
+    AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12604
+    AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12605
+    AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12606
+    AV_PIX_FMT_GBRP,      ///< planar GBR 4:4:4 24bpp
12607
+    AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
12608
+    AV_PIX_FMT_GBRP9BE,   ///< planar GBR 4:4:4 27bpp, big-endian
12609
+    AV_PIX_FMT_GBRP9LE,   ///< planar GBR 4:4:4 27bpp, little-endian
12610
+    AV_PIX_FMT_GBRP10BE,  ///< planar GBR 4:4:4 30bpp, big-endian
12611
+    AV_PIX_FMT_GBRP10LE,  ///< planar GBR 4:4:4 30bpp, little-endian
12612
+    AV_PIX_FMT_GBRP16BE,  ///< planar GBR 4:4:4 48bpp, big-endian
12613
+    AV_PIX_FMT_GBRP16LE,  ///< planar GBR 4:4:4 48bpp, little-endian
12614
+    AV_PIX_FMT_YUVA422P,  ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
12615
+    AV_PIX_FMT_YUVA444P,  ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
12616
+    AV_PIX_FMT_YUVA420P9BE,  ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
12617
+    AV_PIX_FMT_YUVA420P9LE,  ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
12618
+    AV_PIX_FMT_YUVA422P9BE,  ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
12619
+    AV_PIX_FMT_YUVA422P9LE,  ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
12620
+    AV_PIX_FMT_YUVA444P9BE,  ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12621
+    AV_PIX_FMT_YUVA444P9LE,  ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12622
+    AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12623
+    AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12624
+    AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12625
+    AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12626
+    AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12627
+    AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12628
+    AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12629
+    AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12630
+    AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12631
+    AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12632
+    AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12633
+    AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12634
+
12635
+    AV_PIX_FMT_VDPAU,     ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
12636
+
12637
+    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
12638
+    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
12639
+    AV_PIX_FMT_NV16,         ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12640
+    AV_PIX_FMT_NV20LE,       ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12641
+    AV_PIX_FMT_NV20BE,       ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12642
+
12643
+    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
12644
+    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
12645
+    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
12646
+    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
12647
+
12648
+    AV_PIX_FMT_YVYU422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
12649
+
12650
+    AV_PIX_FMT_YA16BE,       ///< 16 bits gray, 16 bits alpha (big-endian)
12651
+    AV_PIX_FMT_YA16LE,       ///< 16 bits gray, 16 bits alpha (little-endian)
12652
+
12653
+    AV_PIX_FMT_GBRAP,        ///< planar GBRA 4:4:4:4 32bpp
12654
+    AV_PIX_FMT_GBRAP16BE,    ///< planar GBRA 4:4:4:4 64bpp, big-endian
12655
+    AV_PIX_FMT_GBRAP16LE,    ///< planar GBRA 4:4:4:4 64bpp, little-endian
12656
+    /**
12657
+     *  HW acceleration through QSV, data[3] contains a pointer to the
12658
+     *  mfxFrameSurface1 structure.
12659
+     */
12660
+    AV_PIX_FMT_QSV,
12661
+    /**
12662
+     * HW acceleration though MMAL, data[3] contains a pointer to the
12663
+     * MMAL_BUFFER_HEADER_T structure.
12664
+     */
12665
+    AV_PIX_FMT_MMAL,
12666
+
12667
+    AV_PIX_FMT_D3D11VA_VLD,  ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
12668
+
12669
+    /**
12670
+     * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
12671
+     * exactly as for system memory frames.
12672
+     */
12673
+    AV_PIX_FMT_CUDA,
12674
+
12675
+    AV_PIX_FMT_0RGB,        ///< packed RGB 8:8:8, 32bpp, XRGBXRGB...   X=unused/undefined
12676
+    AV_PIX_FMT_RGB0,        ///< packed RGB 8:8:8, 32bpp, RGBXRGBX...   X=unused/undefined
12677
+    AV_PIX_FMT_0BGR,        ///< packed BGR 8:8:8, 32bpp, XBGRXBGR...   X=unused/undefined
12678
+    AV_PIX_FMT_BGR0,        ///< packed BGR 8:8:8, 32bpp, BGRXBGRX...   X=unused/undefined
12679
+
12680
+    AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12681
+    AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12682
+    AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12683
+    AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12684
+    AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12685
+    AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12686
+    AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12687
+    AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12688
+    AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12689
+    AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12690
+    AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12691
+    AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12692
+    AV_PIX_FMT_GBRP12BE,    ///< planar GBR 4:4:4 36bpp, big-endian
12693
+    AV_PIX_FMT_GBRP12LE,    ///< planar GBR 4:4:4 36bpp, little-endian
12694
+    AV_PIX_FMT_GBRP14BE,    ///< planar GBR 4:4:4 42bpp, big-endian
12695
+    AV_PIX_FMT_GBRP14LE,    ///< planar GBR 4:4:4 42bpp, little-endian
12696
+    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
12697
+
12698
+    AV_PIX_FMT_BAYER_BGGR8,    ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
12699
+    AV_PIX_FMT_BAYER_RGGB8,    ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
12700
+    AV_PIX_FMT_BAYER_GBRG8,    ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
12701
+    AV_PIX_FMT_BAYER_GRBG8,    ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
12702
+    AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
12703
+    AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
12704
+    AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
12705
+    AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
12706
+    AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
12707
+    AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
12708
+    AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
12709
+    AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
12710
+
12711
+    AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
12712
+
12713
+    AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12714
+    AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12715
+    AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12716
+    AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12717
+    AV_PIX_FMT_AYUV64LE,    ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12718
+    AV_PIX_FMT_AYUV64BE,    ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12719
+
12720
+    AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
12721
+
12722
+    AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
12723
+    AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
12724
+
12725
+    AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp, big-endian
12726
+    AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp, little-endian
12727
+
12728
+    AV_PIX_FMT_GBRAP10BE,  ///< planar GBR 4:4:4:4 40bpp, big-endian
12729
+    AV_PIX_FMT_GBRAP10LE,  ///< planar GBR 4:4:4:4 40bpp, little-endian
12730
+
12731
+    AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
12732
+
12733
+    AV_PIX_FMT_GRAY12BE,   ///<        Y        , 12bpp, big-endian
12734
+    AV_PIX_FMT_GRAY12LE,   ///<        Y        , 12bpp, little-endian
12735
+    AV_PIX_FMT_GRAY10BE,   ///<        Y        , 10bpp, big-endian
12736
+    AV_PIX_FMT_GRAY10LE,   ///<        Y        , 10bpp, little-endian
12737
+
12738
+    AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
12739
+    AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
12740
+
12741
+    /**
12742
+     * Hardware surfaces for Direct3D11.
12743
+     *
12744
+     * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
12745
+     * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
12746
+     *
12747
+     * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
12748
+     * texture array index of the frame as intptr_t if the ID3D11Texture2D is
12749
+     * an array texture (or always 0 if it's a normal texture).
12750
+     */
12751
+    AV_PIX_FMT_D3D11,
12752
+
12753
+    AV_PIX_FMT_GRAY9BE,   ///<        Y        , 9bpp, big-endian
12754
+    AV_PIX_FMT_GRAY9LE,   ///<        Y        , 9bpp, little-endian
12755
+
12756
+    AV_PIX_FMT_GBRPF32BE,  ///< IEEE-754 single precision planar GBR 4:4:4,     96bpp, big-endian
12757
+    AV_PIX_FMT_GBRPF32LE,  ///< IEEE-754 single precision planar GBR 4:4:4,     96bpp, little-endian
12758
+    AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
12759
+    AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
12760
+
12761
+    /**
12762
+     * DRM-managed buffers exposed through PRIME buffer sharing.
12763
+     *
12764
+     * data[0] points to an AVDRMFrameDescriptor.
12765
+     */
12766
+    AV_PIX_FMT_DRM_PRIME,
12767
+    /**
12768
+     * Hardware surfaces for OpenCL.
12769
+     *
12770
+     * data[i] contain 2D image objects (typed in C as cl_mem, used
12771
+     * in OpenCL as image2d_t) for each plane of the surface.
12772
+     */
12773
+    AV_PIX_FMT_OPENCL,
12774
+
12775
+    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
12776
+};
12777
+
12778
+#if AV_HAVE_BIGENDIAN
12779
+#   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
12780
+#else
12781
+#   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
12782
+#endif
12783
+
12784
+#define AV_PIX_FMT_RGB32   AV_PIX_FMT_NE(ARGB, BGRA)
12785
+#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
12786
+#define AV_PIX_FMT_BGR32   AV_PIX_FMT_NE(ABGR, RGBA)
12787
+#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
12788
+#define AV_PIX_FMT_0RGB32  AV_PIX_FMT_NE(0RGB, BGR0)
12789
+#define AV_PIX_FMT_0BGR32  AV_PIX_FMT_NE(0BGR, RGB0)
12790
+
12791
+#define AV_PIX_FMT_GRAY9  AV_PIX_FMT_NE(GRAY9BE,  GRAY9LE)
12792
+#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
12793
+#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
12794
+#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
12795
+#define AV_PIX_FMT_YA16   AV_PIX_FMT_NE(YA16BE,   YA16LE)
12796
+#define AV_PIX_FMT_RGB48  AV_PIX_FMT_NE(RGB48BE,  RGB48LE)
12797
+#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
12798
+#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
12799
+#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
12800
+#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
12801
+#define AV_PIX_FMT_BGR48  AV_PIX_FMT_NE(BGR48BE,  BGR48LE)
12802
+#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
12803
+#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
12804
+#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
12805
+#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
12806
+
12807
+#define AV_PIX_FMT_YUV420P9  AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
12808
+#define AV_PIX_FMT_YUV422P9  AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
12809
+#define AV_PIX_FMT_YUV444P9  AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
12810
+#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
12811
+#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
12812
+#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
12813
+#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
12814
+#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
12815
+#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
12816
+#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
12817
+#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
12818
+#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
12819
+#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
12820
+#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
12821
+#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
12822
+#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
12823
+#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
12824
+
12825
+#define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
12826
+#define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
12827
+#define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
12828
+#define AV_PIX_FMT_GBRP14    AV_PIX_FMT_NE(GBRP14BE,    GBRP14LE)
12829
+#define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
12830
+#define AV_PIX_FMT_GBRAP10   AV_PIX_FMT_NE(GBRAP10BE,   GBRAP10LE)
12831
+#define AV_PIX_FMT_GBRAP12   AV_PIX_FMT_NE(GBRAP12BE,   GBRAP12LE)
12832
+#define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
12833
+
12834
+#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    BAYER_BGGR16LE)
12835
+#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE,    BAYER_RGGB16LE)
12836
+#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE,    BAYER_GBRG16LE)
12837
+#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE,    BAYER_GRBG16LE)
12838
+
12839
+#define AV_PIX_FMT_GBRPF32    AV_PIX_FMT_NE(GBRPF32BE,  GBRPF32LE)
12840
+#define AV_PIX_FMT_GBRAPF32   AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
12841
+
12842
+#define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
12843
+#define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
12844
+#define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
12845
+#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
12846
+#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
12847
+#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
12848
+#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
12849
+#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
12850
+#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
12851
+
12852
+#define AV_PIX_FMT_XYZ12      AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
12853
+#define AV_PIX_FMT_NV20       AV_PIX_FMT_NE(NV20BE,  NV20LE)
12854
+#define AV_PIX_FMT_AYUV64     AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
12855
+#define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
12856
+#define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
12857
+
12858
+/**
12859
+  * Chromaticity coordinates of the source primaries.
12860
+  * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
12861
+  */
12862
+enum AVColorPrimaries {
12863
+    AVCOL_PRI_RESERVED0   = 0,
12864
+    AVCOL_PRI_BT709       = 1,  ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
12865
+    AVCOL_PRI_UNSPECIFIED = 2,
12866
+    AVCOL_PRI_RESERVED    = 3,
12867
+    AVCOL_PRI_BT470M      = 4,  ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12868
+
12869
+    AVCOL_PRI_BT470BG     = 5,  ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
12870
+    AVCOL_PRI_SMPTE170M   = 6,  ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12871
+    AVCOL_PRI_SMPTE240M   = 7,  ///< functionally identical to above
12872
+    AVCOL_PRI_FILM        = 8,  ///< colour filters using Illuminant C
12873
+    AVCOL_PRI_BT2020      = 9,  ///< ITU-R BT2020
12874
+    AVCOL_PRI_SMPTE428    = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
12875
+    AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
12876
+    AVCOL_PRI_SMPTE431    = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
12877
+    AVCOL_PRI_SMPTE432    = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
12878
+    AVCOL_PRI_JEDEC_P22   = 22, ///< JEDEC P22 phosphors
12879
+    AVCOL_PRI_NB                ///< Not part of ABI
12880
+};
12881
+
12882
+/**
12883
+ * Color Transfer Characteristic.
12884
+ * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
12885
+ */
12886
+enum AVColorTransferCharacteristic {
12887
+    AVCOL_TRC_RESERVED0    = 0,
12888
+    AVCOL_TRC_BT709        = 1,  ///< also ITU-R BT1361
12889
+    AVCOL_TRC_UNSPECIFIED  = 2,
12890
+    AVCOL_TRC_RESERVED     = 3,
12891
+    AVCOL_TRC_GAMMA22      = 4,  ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
12892
+    AVCOL_TRC_GAMMA28      = 5,  ///< also ITU-R BT470BG
12893
+    AVCOL_TRC_SMPTE170M    = 6,  ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
12894
+    AVCOL_TRC_SMPTE240M    = 7,
12895
+    AVCOL_TRC_LINEAR       = 8,  ///< "Linear transfer characteristics"
12896
+    AVCOL_TRC_LOG          = 9,  ///< "Logarithmic transfer characteristic (100:1 range)"
12897
+    AVCOL_TRC_LOG_SQRT     = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
12898
+    AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
12899
+    AVCOL_TRC_BT1361_ECG   = 12, ///< ITU-R BT1361 Extended Colour Gamut
12900
+    AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
12901
+    AVCOL_TRC_BT2020_10    = 14, ///< ITU-R BT2020 for 10-bit system
12902
+    AVCOL_TRC_BT2020_12    = 15, ///< ITU-R BT2020 for 12-bit system
12903
+    AVCOL_TRC_SMPTE2084    = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
12904
+    AVCOL_TRC_SMPTEST2084  = AVCOL_TRC_SMPTE2084,
12905
+    AVCOL_TRC_SMPTE428     = 17, ///< SMPTE ST 428-1
12906
+    AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
12907
+    AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
12908
+    AVCOL_TRC_NB                 ///< Not part of ABI
12909
+};
12910
+
12911
+/**
12912
+ * YUV colorspace type.
12913
+ * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
12914
+ */
12915
+enum AVColorSpace {
12916
+    AVCOL_SPC_RGB         = 0,  ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
12917
+    AVCOL_SPC_BT709       = 1,  ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
12918
+    AVCOL_SPC_UNSPECIFIED = 2,
12919
+    AVCOL_SPC_RESERVED    = 3,
12920
+    AVCOL_SPC_FCC         = 4,  ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12921
+    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
12922
+    AVCOL_SPC_SMPTE170M   = 6,  ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12923
+    AVCOL_SPC_SMPTE240M   = 7,  ///< functionally identical to above
12924
+    AVCOL_SPC_YCGCO       = 8,  ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
12925
+    AVCOL_SPC_YCOCG       = AVCOL_SPC_YCGCO,
12926
+    AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance system
12927
+    AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
12928
+    AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
12929
+    AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
12930
+    AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
12931
+    AVCOL_SPC_ICTCP       = 14, ///< ITU-R BT.2100-0, ICtCp
12932
+    AVCOL_SPC_NB                ///< Not part of ABI
12933
+};
12934
+
12935
+/**
12936
+ * MPEG vs JPEG YUV range.
12937
+ */
12938
+enum AVColorRange {
12939
+    AVCOL_RANGE_UNSPECIFIED = 0,
12940
+    AVCOL_RANGE_MPEG        = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
12941
+    AVCOL_RANGE_JPEG        = 2, ///< the normal     2^n-1   "JPEG" YUV ranges
12942
+    AVCOL_RANGE_NB               ///< Not part of ABI
12943
+};
12944
+
12945
+/**
12946
+ * Location of chroma samples.
12947
+ *
12948
+ * Illustration showing the location of the first (top left) chroma sample of the
12949
+ * image, the left shows only luma, the right
12950
+ * shows the location of the chroma sample, the 2 could be imagined to overlay
12951
+ * each other but are drawn separately due to limitations of ASCII
12952
+ *
12953
+ *                1st 2nd       1st 2nd horizontal luma sample positions
12954
+ *                 v   v         v   v
12955
+ *                 ______        ______
12956
+ *1st luma line > |X   X ...    |3 4 X ...     X are luma samples,
12957
+ *                |             |1 2           1-6 are possible chroma positions
12958
+ *2nd luma line > |X   X ...    |5 6 X ...     0 is undefined/unknown position
12959
+ */
12960
+enum AVChromaLocation {
12961
+    AVCHROMA_LOC_UNSPECIFIED = 0,
12962
+    AVCHROMA_LOC_LEFT        = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
12963
+    AVCHROMA_LOC_CENTER      = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
12964
+    AVCHROMA_LOC_TOPLEFT     = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
12965
+    AVCHROMA_LOC_TOP         = 4,
12966
+    AVCHROMA_LOC_BOTTOMLEFT  = 5,
12967
+    AVCHROMA_LOC_BOTTOM      = 6,
12968
+    AVCHROMA_LOC_NB               ///< Not part of ABI
12969
+};
12970
+
12971
+#endif /* AVUTIL_PIXFMT_H */
12972
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12973
new file mode 100644
12974
index 000000000000..5c6b67b4e9f8
12975
--- /dev/null
12976
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12977
@@ -0,0 +1,214 @@
12978
+/*
12979
+ * rational numbers
12980
+ * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
12981
+ *
12982
+ * This file is part of FFmpeg.
12983
+ *
12984
+ * FFmpeg is free software; you can redistribute it and/or
12985
+ * modify it under the terms of the GNU Lesser General Public
12986
+ * License as published by the Free Software Foundation; either
12987
+ * version 2.1 of the License, or (at your option) any later version.
12988
+ *
12989
+ * FFmpeg is distributed in the hope that it will be useful,
12990
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12991
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12992
+ * Lesser General Public License for more details.
12993
+ *
12994
+ * You should have received a copy of the GNU Lesser General Public
12995
+ * License along with FFmpeg; if not, write to the Free Software
12996
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12997
+ */
12998
+
12999
+/**
13000
+ * @file
13001
+ * @ingroup lavu_math_rational
13002
+ * Utilties for rational number calculation.
13003
+ * @author Michael Niedermayer <michaelni@gmx.at>
13004
+ */
13005
+
13006
+#ifndef AVUTIL_RATIONAL_H
13007
+#define AVUTIL_RATIONAL_H
13008
+
13009
+#include <stdint.h>
13010
+#include <limits.h>
13011
+#include "attributes.h"
13012
+
13013
+/**
13014
+ * @defgroup lavu_math_rational AVRational
13015
+ * @ingroup lavu_math
13016
+ * Rational number calculation.
13017
+ *
13018
+ * While rational numbers can be expressed as floating-point numbers, the
13019
+ * conversion process is a lossy one, so are floating-point operations. On the
13020
+ * other hand, the nature of FFmpeg demands highly accurate calculation of
13021
+ * timestamps. This set of rational number utilities serves as a generic
13022
+ * interface for manipulating rational numbers as pairs of numerators and
13023
+ * denominators.
13024
+ *
13025
+ * Many of the functions that operate on AVRational's have the suffix `_q`, in
13026
+ * reference to the mathematical symbol "â„š" (Q) which denotes the set of all
13027
+ * rational numbers.
13028
+ *
13029
+ * @{
13030
+ */
13031
+
13032
+/**
13033
+ * Rational number (pair of numerator and denominator).
13034
+ */
13035
+typedef struct AVRational{
13036
+    int num; ///< Numerator
13037
+    int den; ///< Denominator
13038
+} AVRational;
13039
+
13040
+/**
13041
+ * Create an AVRational.
13042
+ *
13043
+ * Useful for compilers that do not support compound literals.
13044
+ *
13045
+ * @note The return value is not reduced.
13046
+ * @see av_reduce()
13047
+ */
13048
+static inline AVRational av_make_q(int num, int den)
13049
+{
13050
+    AVRational r = { num, den };
13051
+    return r;
13052
+}
13053
+
13054
+/**
13055
+ * Compare two rationals.
13056
+ *
13057
+ * @param a First rational
13058
+ * @param b Second rational
13059
+ *
13060
+ * @return One of the following values:
13061
+ *         - 0 if `a == b`
13062
+ *         - 1 if `a > b`
13063
+ *         - -1 if `a < b`
13064
+ *         - `INT_MIN` if one of the values is of the form `0 / 0`
13065
+ */
13066
+static inline int av_cmp_q(AVRational a, AVRational b){
13067
+    const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
13068
+
13069
+    if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
13070
+    else if(b.den && a.den) return 0;
13071
+    else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
13072
+    else                    return INT_MIN;
13073
+}
13074
+
13075
+/**
13076
+ * Convert an AVRational to a `double`.
13077
+ * @param a AVRational to convert
13078
+ * @return `a` in floating-point form
13079
+ * @see av_d2q()
13080
+ */
13081
+static inline double av_q2d(AVRational a){
13082
+    return a.num / (double) a.den;
13083
+}
13084
+
13085
+/**
13086
+ * Reduce a fraction.
13087
+ *
13088
+ * This is useful for framerate calculations.
13089
+ *
13090
+ * @param[out] dst_num Destination numerator
13091
+ * @param[out] dst_den Destination denominator
13092
+ * @param[in]      num Source numerator
13093
+ * @param[in]      den Source denominator
13094
+ * @param[in]      max Maximum allowed values for `dst_num` & `dst_den`
13095
+ * @return 1 if the operation is exact, 0 otherwise
13096
+ */
13097
+int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
13098
+
13099
+/**
13100
+ * Multiply two rationals.
13101
+ * @param b First rational
13102
+ * @param c Second rational
13103
+ * @return b*c
13104
+ */
13105
+AVRational av_mul_q(AVRational b, AVRational c) av_const;
13106
+
13107
+/**
13108
+ * Divide one rational by another.
13109
+ * @param b First rational
13110
+ * @param c Second rational
13111
+ * @return b/c
13112
+ */
13113
+AVRational av_div_q(AVRational b, AVRational c) av_const;
13114
+
13115
+/**
13116
+ * Add two rationals.
13117
+ * @param b First rational
13118
+ * @param c Second rational
13119
+ * @return b+c
13120
+ */
13121
+AVRational av_add_q(AVRational b, AVRational c) av_const;
13122
+
13123
+/**
13124
+ * Subtract one rational from another.
13125
+ * @param b First rational
13126
+ * @param c Second rational
13127
+ * @return b-c
13128
+ */
13129
+AVRational av_sub_q(AVRational b, AVRational c) av_const;
13130
+
13131
+/**
13132
+ * Invert a rational.
13133
+ * @param q value
13134
+ * @return 1 / q
13135
+ */
13136
+static av_always_inline AVRational av_inv_q(AVRational q)
13137
+{
13138
+    AVRational r = { q.den, q.num };
13139
+    return r;
13140
+}
13141
+
13142
+/**
13143
+ * Convert a double precision floating point number to a rational.
13144
+ *
13145
+ * In case of infinity, the returned value is expressed as `{1, 0}` or
13146
+ * `{-1, 0}` depending on the sign.
13147
+ *
13148
+ * @param d   `double` to convert
13149
+ * @param max Maximum allowed numerator and denominator
13150
+ * @return `d` in AVRational form
13151
+ * @see av_q2d()
13152
+ */
13153
+AVRational av_d2q(double d, int max) av_const;
13154
+
13155
+/**
13156
+ * Find which of the two rationals is closer to another rational.
13157
+ *
13158
+ * @param q     Rational to be compared against
13159
+ * @param q1,q2 Rationals to be tested
13160
+ * @return One of the following values:
13161
+ *         - 1 if `q1` is nearer to `q` than `q2`
13162
+ *         - -1 if `q2` is nearer to `q` than `q1`
13163
+ *         - 0 if they have the same distance
13164
+ */
13165
+int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
13166
+
13167
+/**
13168
+ * Find the value in a list of rationals nearest a given reference rational.
13169
+ *
13170
+ * @param q      Reference rational
13171
+ * @param q_list Array of rationals terminated by `{0, 0}`
13172
+ * @return Index of the nearest value found in the array
13173
+ */
13174
+int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
13175
+
13176
+/**
13177
+ * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
13178
+ * format.
13179
+ *
13180
+ * @param q Rational to be converted
13181
+ * @return Equivalent floating-point value, expressed as an unsigned 32-bit
13182
+ *         integer.
13183
+ * @note The returned value is platform-indepedant.
13184
+ */
13185
+uint32_t av_q2intfloat(AVRational q);
13186
+
13187
+/**
13188
+ * @}
13189
+ */
13190
+
13191
+#endif /* AVUTIL_RATIONAL_H */
13192
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13193
new file mode 100644
13194
index 000000000000..8cd43ae8568a
13195
--- /dev/null
13196
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13197
@@ -0,0 +1,272 @@
13198
+/*
13199
+ * This file is part of FFmpeg.
13200
+ *
13201
+ * FFmpeg is free software; you can redistribute it and/or
13202
+ * modify it under the terms of the GNU Lesser General Public
13203
+ * License as published by the Free Software Foundation; either
13204
+ * version 2.1 of the License, or (at your option) any later version.
13205
+ *
13206
+ * FFmpeg is distributed in the hope that it will be useful,
13207
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13208
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13209
+ * Lesser General Public License for more details.
13210
+ *
13211
+ * You should have received a copy of the GNU Lesser General Public
13212
+ * License along with FFmpeg; if not, write to the Free Software
13213
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13214
+ */
13215
+
13216
+#ifndef AVUTIL_SAMPLEFMT_H
13217
+#define AVUTIL_SAMPLEFMT_H
13218
+
13219
+#include <stdint.h>
13220
+
13221
+#include "avutil.h"
13222
+#include "attributes.h"
13223
+
13224
+/**
13225
+ * @addtogroup lavu_audio
13226
+ * @{
13227
+ *
13228
+ * @defgroup lavu_sampfmts Audio sample formats
13229
+ *
13230
+ * Audio sample format enumeration and related convenience functions.
13231
+ * @{
13232
+ */
13233
+
13234
+/**
13235
+ * Audio sample formats
13236
+ *
13237
+ * - The data described by the sample format is always in native-endian order.
13238
+ *   Sample values can be expressed by native C types, hence the lack of a signed
13239
+ *   24-bit sample format even though it is a common raw audio data format.
13240
+ *
13241
+ * - The floating-point formats are based on full volume being in the range
13242
+ *   [-1.0, 1.0]. Any values outside this range are beyond full volume level.
13243
+ *
13244
+ * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
13245
+ *   (such as AVFrame in libavcodec) is as follows:
13246
+ *
13247
+ * @par
13248
+ * For planar sample formats, each audio channel is in a separate data plane,
13249
+ * and linesize is the buffer size, in bytes, for a single plane. All data
13250
+ * planes must be the same size. For packed sample formats, only the first data
13251
+ * plane is used, and samples for each channel are interleaved. In this case,
13252
+ * linesize is the buffer size, in bytes, for the 1 plane.
13253
+ *
13254
+ */
13255
+enum AVSampleFormat {
13256
+    AV_SAMPLE_FMT_NONE = -1,
13257
+    AV_SAMPLE_FMT_U8,          ///< unsigned 8 bits
13258
+    AV_SAMPLE_FMT_S16,         ///< signed 16 bits
13259
+    AV_SAMPLE_FMT_S32,         ///< signed 32 bits
13260
+    AV_SAMPLE_FMT_FLT,         ///< float
13261
+    AV_SAMPLE_FMT_DBL,         ///< double
13262
+
13263
+    AV_SAMPLE_FMT_U8P,         ///< unsigned 8 bits, planar
13264
+    AV_SAMPLE_FMT_S16P,        ///< signed 16 bits, planar
13265
+    AV_SAMPLE_FMT_S32P,        ///< signed 32 bits, planar
13266
+    AV_SAMPLE_FMT_FLTP,        ///< float, planar
13267
+    AV_SAMPLE_FMT_DBLP,        ///< double, planar
13268
+    AV_SAMPLE_FMT_S64,         ///< signed 64 bits
13269
+    AV_SAMPLE_FMT_S64P,        ///< signed 64 bits, planar
13270
+
13271
+    AV_SAMPLE_FMT_NB           ///< Number of sample formats. DO NOT USE if linking dynamically
13272
+};
13273
+
13274
+/**
13275
+ * Return the name of sample_fmt, or NULL if sample_fmt is not
13276
+ * recognized.
13277
+ */
13278
+const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
13279
+
13280
+/**
13281
+ * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
13282
+ * on error.
13283
+ */
13284
+enum AVSampleFormat av_get_sample_fmt(const char *name);
13285
+
13286
+/**
13287
+ * Return the planar<->packed alternative form of the given sample format, or
13288
+ * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
13289
+ * requested planar/packed format, the format returned is the same as the
13290
+ * input.
13291
+ */
13292
+enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
13293
+
13294
+/**
13295
+ * Get the packed alternative form of the given sample format.
13296
+ *
13297
+ * If the passed sample_fmt is already in packed format, the format returned is
13298
+ * the same as the input.
13299
+ *
13300
+ * @return  the packed alternative form of the given sample format or
13301
+            AV_SAMPLE_FMT_NONE on error.
13302
+ */
13303
+enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
13304
+
13305
+/**
13306
+ * Get the planar alternative form of the given sample format.
13307
+ *
13308
+ * If the passed sample_fmt is already in planar format, the format returned is
13309
+ * the same as the input.
13310
+ *
13311
+ * @return  the planar alternative form of the given sample format or
13312
+            AV_SAMPLE_FMT_NONE on error.
13313
+ */
13314
+enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
13315
+
13316
+/**
13317
+ * Generate a string corresponding to the sample format with
13318
+ * sample_fmt, or a header if sample_fmt is negative.
13319
+ *
13320
+ * @param buf the buffer where to write the string
13321
+ * @param buf_size the size of buf
13322
+ * @param sample_fmt the number of the sample format to print the
13323
+ * corresponding info string, or a negative value to print the
13324
+ * corresponding header.
13325
+ * @return the pointer to the filled buffer or NULL if sample_fmt is
13326
+ * unknown or in case of other errors
13327
+ */
13328
+char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
13329
+
13330
+/**
13331
+ * Return number of bytes per sample.
13332
+ *
13333
+ * @param sample_fmt the sample format
13334
+ * @return number of bytes per sample or zero if unknown for the given
13335
+ * sample format
13336
+ */
13337
+int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
13338
+
13339
+/**
13340
+ * Check if the sample format is planar.
13341
+ *
13342
+ * @param sample_fmt the sample format to inspect
13343
+ * @return 1 if the sample format is planar, 0 if it is interleaved
13344
+ */
13345
+int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
13346
+
13347
+/**
13348
+ * Get the required buffer size for the given audio parameters.
13349
+ *
13350
+ * @param[out] linesize calculated linesize, may be NULL
13351
+ * @param nb_channels   the number of channels
13352
+ * @param nb_samples    the number of samples in a single channel
13353
+ * @param sample_fmt    the sample format
13354
+ * @param align         buffer size alignment (0 = default, 1 = no alignment)
13355
+ * @return              required buffer size, or negative error code on failure
13356
+ */
13357
+int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
13358
+                               enum AVSampleFormat sample_fmt, int align);
13359
+
13360
+/**
13361
+ * @}
13362
+ *
13363
+ * @defgroup lavu_sampmanip Samples manipulation
13364
+ *
13365
+ * Functions that manipulate audio samples
13366
+ * @{
13367
+ */
13368
+
13369
+/**
13370
+ * Fill plane data pointers and linesize for samples with sample
13371
+ * format sample_fmt.
13372
+ *
13373
+ * The audio_data array is filled with the pointers to the samples data planes:
13374
+ * for planar, set the start point of each channel's data within the buffer,
13375
+ * for packed, set the start point of the entire buffer only.
13376
+ *
13377
+ * The value pointed to by linesize is set to the aligned size of each
13378
+ * channel's data buffer for planar layout, or to the aligned size of the
13379
+ * buffer for all channels for packed layout.
13380
+ *
13381
+ * The buffer in buf must be big enough to contain all the samples
13382
+ * (use av_samples_get_buffer_size() to compute its minimum size),
13383
+ * otherwise the audio_data pointers will point to invalid data.
13384
+ *
13385
+ * @see enum AVSampleFormat
13386
+ * The documentation for AVSampleFormat describes the data layout.
13387
+ *
13388
+ * @param[out] audio_data  array to be filled with the pointer for each channel
13389
+ * @param[out] linesize    calculated linesize, may be NULL
13390
+ * @param buf              the pointer to a buffer containing the samples
13391
+ * @param nb_channels      the number of channels
13392
+ * @param nb_samples       the number of samples in a single channel
13393
+ * @param sample_fmt       the sample format
13394
+ * @param align            buffer size alignment (0 = default, 1 = no alignment)
13395
+ * @return                 >=0 on success or a negative error code on failure
13396
+ * @todo return minimum size in bytes required for the buffer in case
13397
+ * of success at the next bump
13398
+ */
13399
+int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
13400
+                           const uint8_t *buf,
13401
+                           int nb_channels, int nb_samples,
13402
+                           enum AVSampleFormat sample_fmt, int align);
13403
+
13404
+/**
13405
+ * Allocate a samples buffer for nb_samples samples, and fill data pointers and
13406
+ * linesize accordingly.
13407
+ * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
13408
+ * Allocated data will be initialized to silence.
13409
+ *
13410
+ * @see enum AVSampleFormat
13411
+ * The documentation for AVSampleFormat describes the data layout.
13412
+ *
13413
+ * @param[out] audio_data  array to be filled with the pointer for each channel
13414
+ * @param[out] linesize    aligned size for audio buffer(s), may be NULL
13415
+ * @param nb_channels      number of audio channels
13416
+ * @param nb_samples       number of samples per channel
13417
+ * @param align            buffer size alignment (0 = default, 1 = no alignment)
13418
+ * @return                 >=0 on success or a negative error code on failure
13419
+ * @todo return the size of the allocated buffer in case of success at the next bump
13420
+ * @see av_samples_fill_arrays()
13421
+ * @see av_samples_alloc_array_and_samples()
13422
+ */
13423
+int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
13424
+                     int nb_samples, enum AVSampleFormat sample_fmt, int align);
13425
+
13426
+/**
13427
+ * Allocate a data pointers array, samples buffer for nb_samples
13428
+ * samples, and fill data pointers and linesize accordingly.
13429
+ *
13430
+ * This is the same as av_samples_alloc(), but also allocates the data
13431
+ * pointers array.
13432
+ *
13433
+ * @see av_samples_alloc()
13434
+ */
13435
+int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
13436
+                                       int nb_samples, enum AVSampleFormat sample_fmt, int align);
13437
+
13438
+/**
13439
+ * Copy samples from src to dst.
13440
+ *
13441
+ * @param dst destination array of pointers to data planes
13442
+ * @param src source array of pointers to data planes
13443
+ * @param dst_offset offset in samples at which the data will be written to dst
13444
+ * @param src_offset offset in samples at which the data will be read from src
13445
+ * @param nb_samples number of samples to be copied
13446
+ * @param nb_channels number of audio channels
13447
+ * @param sample_fmt audio sample format
13448
+ */
13449
+int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
13450
+                    int src_offset, int nb_samples, int nb_channels,
13451
+                    enum AVSampleFormat sample_fmt);
13452
+
13453
+/**
13454
+ * Fill an audio buffer with silence.
13455
+ *
13456
+ * @param audio_data  array of pointers to data planes
13457
+ * @param offset      offset in samples at which to start filling
13458
+ * @param nb_samples  number of samples to fill
13459
+ * @param nb_channels number of audio channels
13460
+ * @param sample_fmt  audio sample format
13461
+ */
13462
+int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
13463
+                           int nb_channels, enum AVSampleFormat sample_fmt);
13464
+
13465
+/**
13466
+ * @}
13467
+ * @}
13468
+ */
13469
+#endif /* AVUTIL_SAMPLEFMT_H */
13470
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13471
new file mode 100644
13472
index 000000000000..3a63e6355f84
13473
--- /dev/null
13474
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13475
@@ -0,0 +1,139 @@
13476
+/*
13477
+ * copyright (c) 2003 Fabrice Bellard
13478
+ *
13479
+ * This file is part of FFmpeg.
13480
+ *
13481
+ * FFmpeg is free software; you can redistribute it and/or
13482
+ * modify it under the terms of the GNU Lesser General Public
13483
+ * License as published by the Free Software Foundation; either
13484
+ * version 2.1 of the License, or (at your option) any later version.
13485
+ *
13486
+ * FFmpeg is distributed in the hope that it will be useful,
13487
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13488
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13489
+ * Lesser General Public License for more details.
13490
+ *
13491
+ * You should have received a copy of the GNU Lesser General Public
13492
+ * License along with FFmpeg; if not, write to the Free Software
13493
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13494
+ */
13495
+
13496
+/**
13497
+ * @file
13498
+ * @ingroup lavu
13499
+ * Libavutil version macros
13500
+ */
13501
+
13502
+#ifndef AVUTIL_VERSION_H
13503
+#define AVUTIL_VERSION_H
13504
+
13505
+#include "macros.h"
13506
+
13507
+/**
13508
+ * @addtogroup version_utils
13509
+ *
13510
+ * Useful to check and match library version in order to maintain
13511
+ * backward compatibility.
13512
+ *
13513
+ * The FFmpeg libraries follow a versioning sheme very similar to
13514
+ * Semantic Versioning (http://semver.org/)
13515
+ * The difference is that the component called PATCH is called MICRO in FFmpeg
13516
+ * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
13517
+ * Also we do not increase MICRO for every bugfix or change in git master.
13518
+ *
13519
+ * Prior to FFmpeg 3.2 point releases did not change any lib version number to
13520
+ * avoid aliassing different git master checkouts.
13521
+ * Starting with FFmpeg 3.2, the released library versions will occupy
13522
+ * a separate MAJOR.MINOR that is not used on the master development branch.
13523
+ * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
13524
+ * for the release and master will continue at 55.12.100 after it. Each new
13525
+ * point release will then bump the MICRO improving the usefulness of the lib
13526
+ * versions.
13527
+ *
13528
+ * @{
13529
+ */
13530
+
13531
+#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
13532
+#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
13533
+#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
13534
+
13535
+/**
13536
+ * Extract version components from the full ::AV_VERSION_INT int as returned
13537
+ * by functions like ::avformat_version() and ::avcodec_version()
13538
+ */
13539
+#define AV_VERSION_MAJOR(a) ((a) >> 16)
13540
+#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
13541
+#define AV_VERSION_MICRO(a) ((a) & 0xFF)
13542
+
13543
+/**
13544
+ * @}
13545
+ */
13546
+
13547
+/**
13548
+ * @defgroup lavu_ver Version and Build diagnostics
13549
+ *
13550
+ * Macros and function useful to check at compiletime and at runtime
13551
+ * which version of libavutil is in use.
13552
+ *
13553
+ * @{
13554
+ */
13555
+
13556
+#define LIBAVUTIL_VERSION_MAJOR  56
13557
+#define LIBAVUTIL_VERSION_MINOR  14
13558
+#define LIBAVUTIL_VERSION_MICRO 100
13559
+
13560
+#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
13561
+                                               LIBAVUTIL_VERSION_MINOR, \
13562
+                                               LIBAVUTIL_VERSION_MICRO)
13563
+#define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_MAJOR,     \
13564
+                                           LIBAVUTIL_VERSION_MINOR,     \
13565
+                                           LIBAVUTIL_VERSION_MICRO)
13566
+#define LIBAVUTIL_BUILD         LIBAVUTIL_VERSION_INT
13567
+
13568
+#define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
13569
+
13570
+/**
13571
+ * @defgroup lavu_depr_guards Deprecation Guards
13572
+ * FF_API_* defines may be placed below to indicate public API that will be
13573
+ * dropped at a future version bump. The defines themselves are not part of
13574
+ * the public API and may change, break or disappear at any time.
13575
+ *
13576
+ * @note, when bumping the major version it is recommended to manually
13577
+ * disable each FF_API_* in its own commit instead of disabling them all
13578
+ * at once through the bump. This improves the git bisect-ability of the change.
13579
+ *
13580
+ * @{
13581
+ */
13582
+
13583
+#ifndef FF_API_VAAPI
13584
+#define FF_API_VAAPI                    (LIBAVUTIL_VERSION_MAJOR < 57)
13585
+#endif
13586
+#ifndef FF_API_FRAME_QP
13587
+#define FF_API_FRAME_QP                 (LIBAVUTIL_VERSION_MAJOR < 57)
13588
+#endif
13589
+#ifndef FF_API_PLUS1_MINUS1
13590
+#define FF_API_PLUS1_MINUS1             (LIBAVUTIL_VERSION_MAJOR < 57)
13591
+#endif
13592
+#ifndef FF_API_ERROR_FRAME
13593
+#define FF_API_ERROR_FRAME              (LIBAVUTIL_VERSION_MAJOR < 57)
13594
+#endif
13595
+#ifndef FF_API_PKT_PTS
13596
+#define FF_API_PKT_PTS                  (LIBAVUTIL_VERSION_MAJOR < 57)
13597
+#endif
13598
+#ifndef FF_API_CRYPTO_SIZE_T
13599
+#define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
13600
+#endif
13601
+#ifndef FF_API_FRAME_GET_SET
13602
+#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
13603
+#endif
13604
+#ifndef FF_API_PSEUDOPAL
13605
+#define FF_API_PSEUDOPAL                (LIBAVUTIL_VERSION_MAJOR < 57)
13606
+#endif
13607
+
13608
+
13609
+/**
13610
+ * @}
13611
+ * @}
13612
+ */
13613
+
13614
+#endif /* AVUTIL_VERSION_H */
13615
diff --git dom/media/platforms/ffmpeg/ffmpeg58/moz.build dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13616
new file mode 100644
13617
index 000000000000..c757ed6fad04
13618
--- /dev/null
13619
+++ dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13620
@@ -0,0 +1,25 @@
13621
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
13622
+# vim: set filetype=python:
13623
+# This Source Code Form is subject to the terms of the Mozilla Public
13624
+# License, v. 2.0. If a copy of the MPL was not distributed with this
13625
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
13626
+
13627
+UNIFIED_SOURCES += [
13628
+    '../FFmpegAudioDecoder.cpp',
13629
+    '../FFmpegDataDecoder.cpp',
13630
+    '../FFmpegDecoderModule.cpp',
13631
+    '../FFmpegH264Decoder.cpp',
13632
+]
13633
+LOCAL_INCLUDES += [
13634
+    '..',
13635
+    'include',
13636
+]
13637
+
13638
+if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
13639
+  CXXFLAGS += [ '-Wno-deprecated-declarations' ]
13640
+if CONFIG['CC_TYPE'] == 'clang':
13641
+  CXXFLAGS += [
13642
+    '-Wno-unknown-attributes',
13643
+  ]
13644
+
13645
+FINAL_LIBRARY = 'xul'
13646
diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
13647
index 604e445aa4d9..af96fb521e3d 100644
13648
--- dom/media/platforms/moz.build
13649
+++ dom/media/platforms/moz.build
13650
@@ -35,6 +35,7 @@ if CONFIG['MOZ_FFMPEG']:
13651
         'ffmpeg/libav54',
13652
         'ffmpeg/libav55',
13653
         'ffmpeg/ffmpeg57',
13654
+        'ffmpeg/ffmpeg58',
13655
     ]
13656
     LOCAL_INCLUDES += [
13657
         'ffmpeg',

Return to bug 228160