3 # User Jean-Yves Avenard <jyavenard@mozilla.com>
4 # Date 1524125955 -7200
5 # Node ID 2f39b32593bd0d1d5ebd7623bdf324610027074f
6 # Parent b2e2129293dd05a64e0d9ccaf3ff214307b2c8b7
7 Bug 1435212 - Add support for FFmpeg 4.0. r=bryce, a=jcristau
9 MozReview-Commit-ID: JlDFSUyGQu
11 diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
12 --- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
13 +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
14 @@ -72,25 +72,31 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecode
15 mCodecContext->opaque = this;
20 mCodecContext->extradata_size = mExtraData->Length();
21 // FFmpeg may use SIMD instructions to access the data which reads the
22 // data in 32 bytes block. Must ensure we have enough data to read.
23 +#if LIBAVCODEC_VERSION_MAJOR >= 58
24 + mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
26 mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
28 mCodecContext->extradata = mExtraData->Elements();
30 mCodecContext->extradata_size = 0;
33 +#if LIBAVCODEC_VERSION_MAJOR < 57
34 if (codec->capabilities & CODEC_CAP_DR1) {
35 mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
39 if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
40 NS_WARNING("Couldn't initialise ffmpeg decoder");
41 mLib->avcodec_close(mCodecContext);
42 mLib->av_freep(&mCodecContext);
43 return NS_ERROR_FAILURE;
46 diff --git a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
47 --- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
48 +++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
49 @@ -56,22 +56,24 @@ FFmpegLibWrapper::Link()
52 AV_FUNC_AVUTIL_MASK = 1 << 8,
58 + AV_FUNC_58 = 1 << 5,
59 AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
60 AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
61 AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
62 AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
63 AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
64 - AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
65 + AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
66 + AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
67 AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
75 @@ -81,16 +83,19 @@ FFmpegLibWrapper::Link()
85 + version = AV_FUNC_58;
88 FFMPEG_LOG("Unknown avcodec version");
92 ? LinkResult::UnknownFutureFFMpegVersion
93 : LinkResult::UnknownOlderFFMpegVersion)
94 // All LibAV versions<54.35.1 are blocked, therefore we must be
95 @@ -129,19 +134,19 @@ FFmpegLibWrapper::Link()
96 AV_FUNC(av_parser_close, AV_FUNC_AVCODEC_ALL)
97 AV_FUNC(av_parser_parse2, AV_FUNC_AVCODEC_ALL)
98 AV_FUNC(avcodec_alloc_frame, (AV_FUNC_53 | AV_FUNC_54))
99 AV_FUNC(avcodec_get_frame_defaults, (AV_FUNC_53 | AV_FUNC_54))
100 AV_FUNC(avcodec_free_frame, AV_FUNC_54)
101 AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
102 AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
103 AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
104 - AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
105 - AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
106 - AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
107 + AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
108 + AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
109 + AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
110 AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
112 #undef AV_FUNC_OPTION
114 avcodec_register_all();
116 av_log_set_level(AV_LOG_DEBUG);
118 diff --git a/dom/media/platforms/ffmpeg/FFmpegLibs.h b/dom/media/platforms/ffmpeg/FFmpegLibs.h
119 --- a/dom/media/platforms/ffmpeg/FFmpegLibs.h
120 +++ b/dom/media/platforms/ffmpeg/FFmpegLibs.h
121 @@ -22,17 +22,19 @@ extern "C" {
122 #if LIBAVCODEC_VERSION_MAJOR < 55
123 #define AV_CODEC_ID_VP6F CODEC_ID_VP6F
124 #define AV_CODEC_ID_H264 CODEC_ID_H264
125 #define AV_CODEC_ID_AAC CODEC_ID_AAC
126 #define AV_CODEC_ID_MP3 CODEC_ID_MP3
127 #define AV_CODEC_ID_VP8 CODEC_ID_VP8
128 #define AV_CODEC_ID_NONE CODEC_ID_NONE
129 #define AV_CODEC_ID_FLAC CODEC_ID_FLAC
130 +typedef CodecID AVCodecID;
132 +#if LIBAVCODEC_VERSION_MAJOR <= 55
133 -typedef CodecID AVCodecID;
137 enum { LIBAV_VER = FFVPX_VERSION };
139 enum { LIBAV_VER = LIBAVCODEC_VERSION_MAJOR };
142 diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
143 --- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
144 +++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
145 @@ -21,22 +21,25 @@ template <int V> class FFmpegDecoderModu
147 static already_AddRefed<PlatformDecoderModule> Create(FFmpegLibWrapper*);
150 static FFmpegLibWrapper sLibAV;
152 static const char* sLibs[] = {
153 #if defined(XP_DARWIN)
154 + "libavcodec.58.dylib",
155 "libavcodec.57.dylib",
156 "libavcodec.56.dylib",
157 "libavcodec.55.dylib",
158 "libavcodec.54.dylib",
159 "libavcodec.53.dylib",
161 + "libavcodec.so.58",
162 + "libavcodec-ffmpeg.so.58",
163 "libavcodec-ffmpeg.so.57",
164 "libavcodec-ffmpeg.so.56",
171 @@ -129,16 +132,17 @@ FFmpegRuntimeLinker::CreateDecoderModule
173 RefPtr<PlatformDecoderModule> module;
174 switch (sLibAV.mVersion) {
175 case 53: module = FFmpegDecoderModule<53>::Create(&sLibAV); break;
176 case 54: module = FFmpegDecoderModule<54>::Create(&sLibAV); break;
178 case 56: module = FFmpegDecoderModule<55>::Create(&sLibAV); break;
179 case 57: module = FFmpegDecoderModule<57>::Create(&sLibAV); break;
180 + case 58: module = FFmpegDecoderModule<58>::Create(&sLibAV); break;
181 default: module = nullptr;
183 return module.forget();
186 /* static */ const char*
187 FFmpegRuntimeLinker::LinkStatusString()
189 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
192 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
194 + GNU LESSER GENERAL PUBLIC LICENSE
195 + Version 2.1, February 1999
197 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
198 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
199 + Everyone is permitted to copy and distribute verbatim copies
200 + of this license document, but changing it is not allowed.
202 +[This is the first released version of the Lesser GPL. It also counts
203 + as the successor of the GNU Library Public License, version 2, hence
204 + the version number 2.1.]
208 + The licenses for most software are designed to take away your
209 +freedom to share and change it. By contrast, the GNU General Public
210 +Licenses are intended to guarantee your freedom to share and change
211 +free software--to make sure the software is free for all its users.
213 + This license, the Lesser General Public License, applies to some
214 +specially designated software packages--typically libraries--of the
215 +Free Software Foundation and other authors who decide to use it. You
216 +can use it too, but we suggest you first think carefully about whether
217 +this license or the ordinary General Public License is the better
218 +strategy to use in any particular case, based on the explanations below.
220 + When we speak of free software, we are referring to freedom of use,
221 +not price. Our General Public Licenses are designed to make sure that
222 +you have the freedom to distribute copies of free software (and charge
223 +for this service if you wish); that you receive source code or can get
224 +it if you want it; that you can change the software and use pieces of
225 +it in new free programs; and that you are informed that you can do
228 + To protect your rights, we need to make restrictions that forbid
229 +distributors to deny you these rights or to ask you to surrender these
230 +rights. These restrictions translate to certain responsibilities for
231 +you if you distribute copies of the library or if you modify it.
233 + For example, if you distribute copies of the library, whether gratis
234 +or for a fee, you must give the recipients all the rights that we gave
235 +you. You must make sure that they, too, receive or can get the source
236 +code. If you link other code with the library, you must provide
237 +complete object files to the recipients, so that they can relink them
238 +with the library after making changes to the library and recompiling
239 +it. And you must show them these terms so they know their rights.
241 + We protect your rights with a two-step method: (1) we copyright the
242 +library, and (2) we offer you this license, which gives you legal
243 +permission to copy, distribute and/or modify the library.
245 + To protect each distributor, we want to make it very clear that
246 +there is no warranty for the free library. Also, if the library is
247 +modified by someone else and passed on, the recipients should know
248 +that what they have is not the original version, so that the original
249 +author's reputation will not be affected by problems that might be
250 +introduced by others.
252 + Finally, software patents pose a constant threat to the existence of
253 +any free program. We wish to make sure that a company cannot
254 +effectively restrict the users of a free program by obtaining a
255 +restrictive license from a patent holder. Therefore, we insist that
256 +any patent license obtained for a version of the library must be
257 +consistent with the full freedom of use specified in this license.
259 + Most GNU software, including some libraries, is covered by the
260 +ordinary GNU General Public License. This license, the GNU Lesser
261 +General Public License, applies to certain designated libraries, and
262 +is quite different from the ordinary General Public License. We use
263 +this license for certain libraries in order to permit linking those
264 +libraries into non-free programs.
266 + When a program is linked with a library, whether statically or using
267 +a shared library, the combination of the two is legally speaking a
268 +combined work, a derivative of the original library. The ordinary
269 +General Public License therefore permits such linking only if the
270 +entire combination fits its criteria of freedom. The Lesser General
271 +Public License permits more lax criteria for linking other code with
274 + We call this license the "Lesser" General Public License because it
275 +does Less to protect the user's freedom than the ordinary General
276 +Public License. It also provides other free software developers Less
277 +of an advantage over competing non-free programs. These disadvantages
278 +are the reason we use the ordinary General Public License for many
279 +libraries. However, the Lesser license provides advantages in certain
280 +special circumstances.
282 + For example, on rare occasions, there may be a special need to
283 +encourage the widest possible use of a certain library, so that it becomes
284 +a de-facto standard. To achieve this, non-free programs must be
285 +allowed to use the library. A more frequent case is that a free
286 +library does the same job as widely used non-free libraries. In this
287 +case, there is little to gain by limiting the free library to free
288 +software only, so we use the Lesser General Public License.
290 + In other cases, permission to use a particular library in non-free
291 +programs enables a greater number of people to use a large body of
292 +free software. For example, permission to use the GNU C Library in
293 +non-free programs enables many more people to use the whole GNU
294 +operating system, as well as its variant, the GNU/Linux operating
297 + Although the Lesser General Public License is Less protective of the
298 +users' freedom, it does ensure that the user of a program that is
299 +linked with the Library has the freedom and the wherewithal to run
300 +that program using a modified version of the Library.
302 + The precise terms and conditions for copying, distribution and
303 +modification follow. Pay close attention to the difference between a
304 +"work based on the library" and a "work that uses the library". The
305 +former contains code derived from the library, whereas the latter must
306 +be combined with the library in order to run.
308 + GNU LESSER GENERAL PUBLIC LICENSE
309 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
311 + 0. This License Agreement applies to any software library or other
312 +program which contains a notice placed by the copyright holder or
313 +other authorized party saying it may be distributed under the terms of
314 +this Lesser General Public License (also called "this License").
315 +Each licensee is addressed as "you".
317 + A "library" means a collection of software functions and/or data
318 +prepared so as to be conveniently linked with application programs
319 +(which use some of those functions and data) to form executables.
321 + The "Library", below, refers to any such software library or work
322 +which has been distributed under these terms. A "work based on the
323 +Library" means either the Library or any derivative work under
324 +copyright law: that is to say, a work containing the Library or a
325 +portion of it, either verbatim or with modifications and/or translated
326 +straightforwardly into another language. (Hereinafter, translation is
327 +included without limitation in the term "modification".)
329 + "Source code" for a work means the preferred form of the work for
330 +making modifications to it. For a library, complete source code means
331 +all the source code for all modules it contains, plus any associated
332 +interface definition files, plus the scripts used to control compilation
333 +and installation of the library.
335 + Activities other than copying, distribution and modification are not
336 +covered by this License; they are outside its scope. The act of
337 +running a program using the Library is not restricted, and output from
338 +such a program is covered only if its contents constitute a work based
339 +on the Library (independent of the use of the Library in a tool for
340 +writing it). Whether that is true depends on what the Library does
341 +and what the program that uses the Library does.
343 + 1. You may copy and distribute verbatim copies of the Library's
344 +complete source code as you receive it, in any medium, provided that
345 +you conspicuously and appropriately publish on each copy an
346 +appropriate copyright notice and disclaimer of warranty; keep intact
347 +all the notices that refer to this License and to the absence of any
348 +warranty; and distribute a copy of this License along with the
351 + You may charge a fee for the physical act of transferring a copy,
352 +and you may at your option offer warranty protection in exchange for a
355 + 2. You may modify your copy or copies of the Library or any portion
356 +of it, thus forming a work based on the Library, and copy and
357 +distribute such modifications or work under the terms of Section 1
358 +above, provided that you also meet all of these conditions:
360 + a) The modified work must itself be a software library.
362 + b) You must cause the files modified to carry prominent notices
363 + stating that you changed the files and the date of any change.
365 + c) You must cause the whole of the work to be licensed at no
366 + charge to all third parties under the terms of this License.
368 + d) If a facility in the modified Library refers to a function or a
369 + table of data to be supplied by an application program that uses
370 + the facility, other than as an argument passed when the facility
371 + is invoked, then you must make a good faith effort to ensure that,
372 + in the event an application does not supply such function or
373 + table, the facility still operates, and performs whatever part of
374 + its purpose remains meaningful.
376 + (For example, a function in a library to compute square roots has
377 + a purpose that is entirely well-defined independent of the
378 + application. Therefore, Subsection 2d requires that any
379 + application-supplied function or table used by this function must
380 + be optional: if the application does not supply it, the square
381 + root function must still compute square roots.)
383 +These requirements apply to the modified work as a whole. If
384 +identifiable sections of that work are not derived from the Library,
385 +and can be reasonably considered independent and separate works in
386 +themselves, then this License, and its terms, do not apply to those
387 +sections when you distribute them as separate works. But when you
388 +distribute the same sections as part of a whole which is a work based
389 +on the Library, the distribution of the whole must be on the terms of
390 +this License, whose permissions for other licensees extend to the
391 +entire whole, and thus to each and every part regardless of who wrote
394 +Thus, it is not the intent of this section to claim rights or contest
395 +your rights to work written entirely by you; rather, the intent is to
396 +exercise the right to control the distribution of derivative or
397 +collective works based on the Library.
399 +In addition, mere aggregation of another work not based on the Library
400 +with the Library (or with a work based on the Library) on a volume of
401 +a storage or distribution medium does not bring the other work under
402 +the scope of this License.
404 + 3. You may opt to apply the terms of the ordinary GNU General Public
405 +License instead of this License to a given copy of the Library. To do
406 +this, you must alter all the notices that refer to this License, so
407 +that they refer to the ordinary GNU General Public License, version 2,
408 +instead of to this License. (If a newer version than version 2 of the
409 +ordinary GNU General Public License has appeared, then you can specify
410 +that version instead if you wish.) Do not make any other change in
413 + Once this change is made in a given copy, it is irreversible for
414 +that copy, so the ordinary GNU General Public License applies to all
415 +subsequent copies and derivative works made from that copy.
417 + This option is useful when you wish to copy part of the code of
418 +the Library into a program that is not a library.
420 + 4. You may copy and distribute the Library (or a portion or
421 +derivative of it, under Section 2) in object code or executable form
422 +under the terms of Sections 1 and 2 above provided that you accompany
423 +it with the complete corresponding machine-readable source code, which
424 +must be distributed under the terms of Sections 1 and 2 above on a
425 +medium customarily used for software interchange.
427 + If distribution of object code is made by offering access to copy
428 +from a designated place, then offering equivalent access to copy the
429 +source code from the same place satisfies the requirement to
430 +distribute the source code, even though third parties are not
431 +compelled to copy the source along with the object code.
433 + 5. A program that contains no derivative of any portion of the
434 +Library, but is designed to work with the Library by being compiled or
435 +linked with it, is called a "work that uses the Library". Such a
436 +work, in isolation, is not a derivative work of the Library, and
437 +therefore falls outside the scope of this License.
439 + However, linking a "work that uses the Library" with the Library
440 +creates an executable that is a derivative of the Library (because it
441 +contains portions of the Library), rather than a "work that uses the
442 +library". The executable is therefore covered by this License.
443 +Section 6 states terms for distribution of such executables.
445 + When a "work that uses the Library" uses material from a header file
446 +that is part of the Library, the object code for the work may be a
447 +derivative work of the Library even though the source code is not.
448 +Whether this is true is especially significant if the work can be
449 +linked without the Library, or if the work is itself a library. The
450 +threshold for this to be true is not precisely defined by law.
452 + If such an object file uses only numerical parameters, data
453 +structure layouts and accessors, and small macros and small inline
454 +functions (ten lines or less in length), then the use of the object
455 +file is unrestricted, regardless of whether it is legally a derivative
456 +work. (Executables containing this object code plus portions of the
457 +Library will still fall under Section 6.)
459 + Otherwise, if the work is a derivative of the Library, you may
460 +distribute the object code for the work under the terms of Section 6.
461 +Any executables containing that work also fall under Section 6,
462 +whether or not they are linked directly with the Library itself.
464 + 6. As an exception to the Sections above, you may also combine or
465 +link a "work that uses the Library" with the Library to produce a
466 +work containing portions of the Library, and distribute that work
467 +under terms of your choice, provided that the terms permit
468 +modification of the work for the customer's own use and reverse
469 +engineering for debugging such modifications.
471 + You must give prominent notice with each copy of the work that the
472 +Library is used in it and that the Library and its use are covered by
473 +this License. You must supply a copy of this License. If the work
474 +during execution displays copyright notices, you must include the
475 +copyright notice for the Library among them, as well as a reference
476 +directing the user to the copy of this License. Also, you must do one
479 + a) Accompany the work with the complete corresponding
480 + machine-readable source code for the Library including whatever
481 + changes were used in the work (which must be distributed under
482 + Sections 1 and 2 above); and, if the work is an executable linked
483 + with the Library, with the complete machine-readable "work that
484 + uses the Library", as object code and/or source code, so that the
485 + user can modify the Library and then relink to produce a modified
486 + executable containing the modified Library. (It is understood
487 + that the user who changes the contents of definitions files in the
488 + Library will not necessarily be able to recompile the application
489 + to use the modified definitions.)
491 + b) Use a suitable shared library mechanism for linking with the
492 + Library. A suitable mechanism is one that (1) uses at run time a
493 + copy of the library already present on the user's computer system,
494 + rather than copying library functions into the executable, and (2)
495 + will operate properly with a modified version of the library, if
496 + the user installs one, as long as the modified version is
497 + interface-compatible with the version that the work was made with.
499 + c) Accompany the work with a written offer, valid for at
500 + least three years, to give the same user the materials
501 + specified in Subsection 6a, above, for a charge no more
502 + than the cost of performing this distribution.
504 + d) If distribution of the work is made by offering access to copy
505 + from a designated place, offer equivalent access to copy the above
506 + specified materials from the same place.
508 + e) Verify that the user has already received a copy of these
509 + materials or that you have already sent this user a copy.
511 + For an executable, the required form of the "work that uses the
512 +Library" must include any data and utility programs needed for
513 +reproducing the executable from it. However, as a special exception,
514 +the materials to be distributed need not include anything that is
515 +normally distributed (in either source or binary form) with the major
516 +components (compiler, kernel, and so on) of the operating system on
517 +which the executable runs, unless that component itself accompanies
520 + It may happen that this requirement contradicts the license
521 +restrictions of other proprietary libraries that do not normally
522 +accompany the operating system. Such a contradiction means you cannot
523 +use both them and the Library together in an executable that you
526 + 7. You may place library facilities that are a work based on the
527 +Library side-by-side in a single library together with other library
528 +facilities not covered by this License, and distribute such a combined
529 +library, provided that the separate distribution of the work based on
530 +the Library and of the other library facilities is otherwise
531 +permitted, and provided that you do these two things:
533 + a) Accompany the combined library with a copy of the same work
534 + based on the Library, uncombined with any other library
535 + facilities. This must be distributed under the terms of the
538 + b) Give prominent notice with the combined library of the fact
539 + that part of it is a work based on the Library, and explaining
540 + where to find the accompanying uncombined form of the same work.
542 + 8. You may not copy, modify, sublicense, link with, or distribute
543 +the Library except as expressly provided under this License. Any
544 +attempt otherwise to copy, modify, sublicense, link with, or
545 +distribute the Library is void, and will automatically terminate your
546 +rights under this License. However, parties who have received copies,
547 +or rights, from you under this License will not have their licenses
548 +terminated so long as such parties remain in full compliance.
550 + 9. You are not required to accept this License, since you have not
551 +signed it. However, nothing else grants you permission to modify or
552 +distribute the Library or its derivative works. These actions are
553 +prohibited by law if you do not accept this License. Therefore, by
554 +modifying or distributing the Library (or any work based on the
555 +Library), you indicate your acceptance of this License to do so, and
556 +all its terms and conditions for copying, distributing or modifying
557 +the Library or works based on it.
559 + 10. Each time you redistribute the Library (or any work based on the
560 +Library), the recipient automatically receives a license from the
561 +original licensor to copy, distribute, link with or modify the Library
562 +subject to these terms and conditions. You may not impose any further
563 +restrictions on the recipients' exercise of the rights granted herein.
564 +You are not responsible for enforcing compliance by third parties with
567 + 11. If, as a consequence of a court judgment or allegation of patent
568 +infringement or for any other reason (not limited to patent issues),
569 +conditions are imposed on you (whether by court order, agreement or
570 +otherwise) that contradict the conditions of this License, they do not
571 +excuse you from the conditions of this License. If you cannot
572 +distribute so as to satisfy simultaneously your obligations under this
573 +License and any other pertinent obligations, then as a consequence you
574 +may not distribute the Library at all. For example, if a patent
575 +license would not permit royalty-free redistribution of the Library by
576 +all those who receive copies directly or indirectly through you, then
577 +the only way you could satisfy both it and this License would be to
578 +refrain entirely from distribution of the Library.
580 +If any portion of this section is held invalid or unenforceable under any
581 +particular circumstance, the balance of the section is intended to apply,
582 +and the section as a whole is intended to apply in other circumstances.
584 +It is not the purpose of this section to induce you to infringe any
585 +patents or other property right claims or to contest validity of any
586 +such claims; this section has the sole purpose of protecting the
587 +integrity of the free software distribution system which is
588 +implemented by public license practices. Many people have made
589 +generous contributions to the wide range of software distributed
590 +through that system in reliance on consistent application of that
591 +system; it is up to the author/donor to decide if he or she is willing
592 +to distribute software through any other system and a licensee cannot
595 +This section is intended to make thoroughly clear what is believed to
596 +be a consequence of the rest of this License.
598 + 12. If the distribution and/or use of the Library is restricted in
599 +certain countries either by patents or by copyrighted interfaces, the
600 +original copyright holder who places the Library under this License may add
601 +an explicit geographical distribution limitation excluding those countries,
602 +so that distribution is permitted only in or among countries not thus
603 +excluded. In such case, this License incorporates the limitation as if
604 +written in the body of this License.
606 + 13. The Free Software Foundation may publish revised and/or new
607 +versions of the Lesser General Public License from time to time.
608 +Such new versions will be similar in spirit to the present version,
609 +but may differ in detail to address new problems or concerns.
611 +Each version is given a distinguishing version number. If the Library
612 +specifies a version number of this License which applies to it and
613 +"any later version", you have the option of following the terms and
614 +conditions either of that version or of any later version published by
615 +the Free Software Foundation. If the Library does not specify a
616 +license version number, you may choose any version ever published by
617 +the Free Software Foundation.
619 + 14. If you wish to incorporate parts of the Library into other free
620 +programs whose distribution conditions are incompatible with these,
621 +write to the author to ask for permission. For software which is
622 +copyrighted by the Free Software Foundation, write to the Free
623 +Software Foundation; we sometimes make exceptions for this. Our
624 +decision will be guided by the two goals of preserving the free status
625 +of all derivatives of our free software and of promoting the sharing
626 +and reuse of software generally.
630 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
631 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
632 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
633 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
634 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
635 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
636 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
637 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
638 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
640 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
641 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
642 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
643 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
644 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
645 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
646 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
647 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
648 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
651 + END OF TERMS AND CONDITIONS
653 + How to Apply These Terms to Your New Libraries
655 + If you develop a new library, and you want it to be of the greatest
656 +possible use to the public, we recommend making it free software that
657 +everyone can redistribute and change. You can do so by permitting
658 +redistribution under these terms (or, alternatively, under the terms of the
659 +ordinary General Public License).
661 + To apply these terms, attach the following notices to the library. It is
662 +safest to attach them to the start of each source file to most effectively
663 +convey the exclusion of warranty; and each file should have at least the
664 +"copyright" line and a pointer to where the full notice is found.
666 + <one line to give the library's name and a brief idea of what it does.>
667 + Copyright (C) <year> <name of author>
669 + This library is free software; you can redistribute it and/or
670 + modify it under the terms of the GNU Lesser General Public
671 + License as published by the Free Software Foundation; either
672 + version 2.1 of the License, or (at your option) any later version.
674 + This library is distributed in the hope that it will be useful,
675 + but WITHOUT ANY WARRANTY; without even the implied warranty of
676 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
677 + Lesser General Public License for more details.
679 + You should have received a copy of the GNU Lesser General Public
680 + License along with this library; if not, write to the Free Software
681 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
683 +Also add information on how to contact you by electronic and paper mail.
685 +You should also get your employer (if you work as a programmer) or your
686 +school, if any, to sign a "copyright disclaimer" for the library, if
687 +necessary. Here is a sample; alter the names:
689 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
690 + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
692 + <signature of Ty Coon>, 1 April 1990
693 + Ty Coon, President of Vice
695 +That's all there is to it!
698 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
701 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
704 + * copyright (c) 2001 Fabrice Bellard
706 + * This file is part of FFmpeg.
708 + * FFmpeg is free software; you can redistribute it and/or
709 + * modify it under the terms of the GNU Lesser General Public
710 + * License as published by the Free Software Foundation; either
711 + * version 2.1 of the License, or (at your option) any later version.
713 + * FFmpeg is distributed in the hope that it will be useful,
714 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
715 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
716 + * Lesser General Public License for more details.
718 + * You should have received a copy of the GNU Lesser General Public
719 + * License along with FFmpeg; if not, write to the Free Software
720 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
723 +#ifndef AVCODEC_AVCODEC_H
724 +#define AVCODEC_AVCODEC_H
729 + * Libavcodec external API header
733 +#include "libavutil/samplefmt.h"
734 +#include "libavutil/attributes.h"
735 +#include "libavutil/avutil.h"
736 +#include "libavutil/buffer.h"
737 +#include "libavutil/cpu.h"
738 +#include "libavutil/channel_layout.h"
739 +#include "libavutil/dict.h"
740 +#include "libavutil/frame.h"
741 +#include "libavutil/hwcontext.h"
742 +#include "libavutil/log.h"
743 +#include "libavutil/pixfmt.h"
744 +#include "libavutil/rational.h"
746 +#include "version.h"
749 + * @defgroup libavc libavcodec
750 + * Encoding/Decoding Library
754 + * @defgroup lavc_decoding Decoding
758 + * @defgroup lavc_encoding Encoding
762 + * @defgroup lavc_codec Codecs
764 + * @defgroup lavc_codec_native Native Codecs
767 + * @defgroup lavc_codec_wrappers External library wrappers
770 + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
774 + * @defgroup lavc_internal Internal
782 + * @defgroup lavc_encdec send/receive encoding and decoding API overview
785 + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
786 + * avcodec_receive_packet() functions provide an encode/decode API, which
787 + * decouples input and output.
789 + * The API is very similar for encoding/decoding and audio/video, and works as
791 + * - Set up and open the AVCodecContext as usual.
792 + * - Send valid input:
793 + * - For decoding, call avcodec_send_packet() to give the decoder raw
794 + * compressed data in an AVPacket.
795 + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
796 + * containing uncompressed audio or video.
797 + * In both cases, it is recommended that AVPackets and AVFrames are
798 + * refcounted, or libavcodec might have to copy the input data. (libavformat
799 + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates
800 + * refcounted AVFrames.)
801 + * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
802 + * functions and process their output:
803 + * - For decoding, call avcodec_receive_frame(). On success, it will return
804 + * an AVFrame containing uncompressed audio or video data.
805 + * - For encoding, call avcodec_receive_packet(). On success, it will return
806 + * an AVPacket with a compressed frame.
807 + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The
808 + * AVERROR(EAGAIN) return value means that new input data is required to
809 + * return new output. In this case, continue with sending input. For each
810 + * input frame/packet, the codec will typically return 1 output frame/packet,
811 + * but it can also be 0 or more than 1.
813 + * At the beginning of decoding or encoding, the codec might accept multiple
814 + * input frames/packets without returning a frame, until its internal buffers
815 + * are filled. This situation is handled transparently if you follow the steps
818 + * In theory, sending input can result in EAGAIN - this should happen only if
819 + * not all output was received. You can use this to structure alternative decode
820 + * or encode loops other than the one suggested above. For example, you could
821 + * try sending new input on each iteration, and try to receive output if that
824 + * End of stream situations. These require "flushing" (aka draining) the codec,
825 + * as the codec might buffer multiple frames or packets internally for
826 + * performance or out of necessity (consider B-frames).
827 + * This is handled as follows:
828 + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
829 + * or avcodec_send_frame() (encoding) functions. This will enter draining
831 + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
832 + * (encoding) in a loop until AVERROR_EOF is returned. The functions will
833 + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
834 + * - Before decoding can be resumed again, the codec has to be reset with
835 + * avcodec_flush_buffers().
837 + * Using the API as outlined above is highly recommended. But it is also
838 + * possible to call functions outside of this rigid schema. For example, you can
839 + * call avcodec_send_packet() repeatedly without calling
840 + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
841 + * until the codec's internal buffer has been filled up (which is typically of
842 + * size 1 per output frame, after initial input), and then reject input with
843 + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
844 + * read at least some output.
846 + * Not all codecs will follow a rigid and predictable dataflow; the only
847 + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
848 + * one end implies that a receive/send call on the other end will succeed, or
849 + * at least will not fail with AVERROR(EAGAIN). In general, no codec will
850 + * permit unlimited buffering of input or output.
852 + * This API replaces the following legacy functions:
853 + * - avcodec_decode_video2() and avcodec_decode_audio4():
854 + * Use avcodec_send_packet() to feed input to the decoder, then use
855 + * avcodec_receive_frame() to receive decoded frames after each packet.
856 + * Unlike with the old video decoding API, multiple frames might result from
857 + * a packet. For audio, splitting the input packet into frames by partially
858 + * decoding packets becomes transparent to the API user. You never need to
859 + * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
860 + * no data was read from the packet).
861 + * Additionally, sending a flush/draining packet is required only once.
862 + * - avcodec_encode_video2()/avcodec_encode_audio2():
863 + * Use avcodec_send_frame() to feed input to the encoder, then use
864 + * avcodec_receive_packet() to receive encoded packets.
865 + * Providing user-allocated buffers for avcodec_receive_packet() is not
867 + * - The new API does not handle subtitles yet.
869 + * Mixing new and old function calls on the same AVCodecContext is not allowed,
870 + * and will result in undefined behavior.
872 + * Some codecs might require using the new API; using the old API will return
873 + * an error when calling it. All codecs support the new API.
875 + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
876 + * would be an invalid state, which could put the codec user into an endless
877 + * loop. The API has no concept of time either: it cannot happen that trying to
878 + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
879 + * later accepts the packet (with no other receive/flush API calls involved).
880 + * The API is a strict state machine, and the passage of time is not supposed
881 + * to influence it. Some timing-dependent behavior might still be deemed
882 + * acceptable in certain cases. But it must never result in both send/receive
883 + * returning EAGAIN at the same time at any point. It must also absolutely be
884 + * avoided that the current state is "unstable" and can "flip-flop" between
885 + * the send/receive APIs allowing progress. For example, it's not allowed that
886 + * the codec randomly decides that it actually wants to consume a packet now
887 + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
888 + * avcodec_send_packet() call.
893 + * @defgroup lavc_core Core functions/structures.
896 + * Basic definitions, functions for querying libavcodec capabilities,
897 + * allocating core structures, etc.
903 + * Identify the syntax and semantics of the bitstream.
904 + * The principle is roughly:
905 + * Two decoders with the same ID can decode the same streams.
906 + * Two encoders with the same ID can encode compatible streams.
907 + * There may be slight deviations from the principle due to implementation
910 + * If you add a codec ID to this list, add it so that
911 + * 1. no value of an existing codec ID changes (that would break ABI),
912 + * 2. it is as close as possible to similar codecs
914 + * After adding new codec IDs, do not forget to add an entry to the codec
915 + * descriptor list and bump libavcodec minor version.
921 + AV_CODEC_ID_MPEG1VIDEO,
922 + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
928 + AV_CODEC_ID_MJPEGB,
931 + AV_CODEC_ID_JPEGLS,
933 + AV_CODEC_ID_RAWVIDEO,
934 + AV_CODEC_ID_MSMPEG4V1,
935 + AV_CODEC_ID_MSMPEG4V2,
936 + AV_CODEC_ID_MSMPEG4V3,
944 + AV_CODEC_ID_DVVIDEO,
945 + AV_CODEC_ID_HUFFYUV,
948 + AV_CODEC_ID_INDEO3,
950 + AV_CODEC_ID_THEORA,
959 + AV_CODEC_ID_INTERPLAY_VIDEO,
960 + AV_CODEC_ID_XAN_WC3,
961 + AV_CODEC_ID_XAN_WC4,
963 + AV_CODEC_ID_CINEPAK,
964 + AV_CODEC_ID_WS_VQA,
966 + AV_CODEC_ID_MSVIDEO1,
971 + AV_CODEC_ID_TRUEMOTION1,
972 + AV_CODEC_ID_VMDVIDEO,
985 + AV_CODEC_ID_PGMYUV,
987 + AV_CODEC_ID_FFVHUFF,
995 + AV_CODEC_ID_INDEO2,
997 + AV_CODEC_ID_TRUEMOTION2,
1000 + AV_CODEC_ID_MMVIDEO,
1003 + AV_CODEC_ID_SMACKVIDEO,
1006 + AV_CODEC_ID_FLASHSV,
1008 + AV_CODEC_ID_JPEG2000,
1013 + AV_CODEC_ID_TARGA,
1014 + AV_CODEC_ID_DSICINVIDEO,
1015 + AV_CODEC_ID_TIERTEXSEQVIDEO,
1019 + AV_CODEC_ID_DNXHD,
1023 + AV_CODEC_ID_BETHSOFTVID,
1030 + AV_CODEC_ID_SUNRAST,
1031 + AV_CODEC_ID_INDEO4,
1032 + AV_CODEC_ID_INDEO5,
1033 + AV_CODEC_ID_MIMIC,
1035 + AV_CODEC_ID_ESCAPE124,
1036 + AV_CODEC_ID_DIRAC,
1039 + AV_CODEC_ID_MOTIONPIXELS,
1044 + AV_CODEC_ID_AURA2,
1045 + AV_CODEC_ID_V210X,
1051 + AV_CODEC_ID_FLASHSV2,
1052 + AV_CODEC_ID_CDGRAPHICS,
1055 + AV_CODEC_ID_BINKVIDEO,
1056 + AV_CODEC_ID_IFF_ILBM,
1057 +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1061 + AV_CODEC_ID_PICTOR,
1063 + AV_CODEC_ID_A64_MULTI,
1064 + AV_CODEC_ID_A64_MULTI5,
1066 + AV_CODEC_ID_MXPEG,
1067 + AV_CODEC_ID_LAGARITH,
1068 + AV_CODEC_ID_PRORES,
1071 + AV_CODEC_ID_WMV3IMAGE,
1072 + AV_CODEC_ID_VC1IMAGE,
1073 + AV_CODEC_ID_UTVIDEO,
1074 + AV_CODEC_ID_BMV_VIDEO,
1076 + AV_CODEC_ID_DXTORY,
1081 + AV_CODEC_ID_ZEROCODEC,
1084 + AV_CODEC_ID_TSCC2,
1090 + AV_CODEC_ID_ESCAPE130,
1093 + AV_CODEC_ID_HNM4_VIDEO,
1095 +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1097 + AV_CODEC_ID_ALIAS_PIX,
1098 + AV_CODEC_ID_BRENDER_PIX,
1099 + AV_CODEC_ID_PAF_VIDEO,
1103 + AV_CODEC_ID_SGIRLE,
1108 + AV_CODEC_ID_HQ_HQA,
1112 + AV_CODEC_ID_SCREENPRESSO,
1115 + AV_CODEC_ID_Y41P = 0x8000,
1120 + AV_CODEC_ID_TARGA_Y216,
1126 + AV_CODEC_ID_XFACE,
1128 + AV_CODEC_ID_SMVJPEG,
1130 + AV_CODEC_ID_DAALA,
1132 + AV_CODEC_ID_TRUEMOTION2RT,
1134 + AV_CODEC_ID_MAGICYUV,
1135 + AV_CODEC_ID_SHEERVIDEO,
1138 + AV_CODEC_ID_PIXLET,
1139 + AV_CODEC_ID_SPEEDHQ,
1142 + AV_CODEC_ID_CLEARVIDEO,
1145 + AV_CODEC_ID_BITPACKED,
1152 + /* various PCM "codecs" */
1153 + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
1154 + AV_CODEC_ID_PCM_S16LE = 0x10000,
1155 + AV_CODEC_ID_PCM_S16BE,
1156 + AV_CODEC_ID_PCM_U16LE,
1157 + AV_CODEC_ID_PCM_U16BE,
1158 + AV_CODEC_ID_PCM_S8,
1159 + AV_CODEC_ID_PCM_U8,
1160 + AV_CODEC_ID_PCM_MULAW,
1161 + AV_CODEC_ID_PCM_ALAW,
1162 + AV_CODEC_ID_PCM_S32LE,
1163 + AV_CODEC_ID_PCM_S32BE,
1164 + AV_CODEC_ID_PCM_U32LE,
1165 + AV_CODEC_ID_PCM_U32BE,
1166 + AV_CODEC_ID_PCM_S24LE,
1167 + AV_CODEC_ID_PCM_S24BE,
1168 + AV_CODEC_ID_PCM_U24LE,
1169 + AV_CODEC_ID_PCM_U24BE,
1170 + AV_CODEC_ID_PCM_S24DAUD,
1171 + AV_CODEC_ID_PCM_ZORK,
1172 + AV_CODEC_ID_PCM_S16LE_PLANAR,
1173 + AV_CODEC_ID_PCM_DVD,
1174 + AV_CODEC_ID_PCM_F32BE,
1175 + AV_CODEC_ID_PCM_F32LE,
1176 + AV_CODEC_ID_PCM_F64BE,
1177 + AV_CODEC_ID_PCM_F64LE,
1178 + AV_CODEC_ID_PCM_BLURAY,
1179 + AV_CODEC_ID_PCM_LXF,
1180 + AV_CODEC_ID_S302M,
1181 + AV_CODEC_ID_PCM_S8_PLANAR,
1182 + AV_CODEC_ID_PCM_S24LE_PLANAR,
1183 + AV_CODEC_ID_PCM_S32LE_PLANAR,
1184 + AV_CODEC_ID_PCM_S16BE_PLANAR,
1186 + AV_CODEC_ID_PCM_S64LE = 0x10800,
1187 + AV_CODEC_ID_PCM_S64BE,
1188 + AV_CODEC_ID_PCM_F16LE,
1189 + AV_CODEC_ID_PCM_F24LE,
1191 + /* various ADPCM codecs */
1192 + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
1193 + AV_CODEC_ID_ADPCM_IMA_WAV,
1194 + AV_CODEC_ID_ADPCM_IMA_DK3,
1195 + AV_CODEC_ID_ADPCM_IMA_DK4,
1196 + AV_CODEC_ID_ADPCM_IMA_WS,
1197 + AV_CODEC_ID_ADPCM_IMA_SMJPEG,
1198 + AV_CODEC_ID_ADPCM_MS,
1199 + AV_CODEC_ID_ADPCM_4XM,
1200 + AV_CODEC_ID_ADPCM_XA,
1201 + AV_CODEC_ID_ADPCM_ADX,
1202 + AV_CODEC_ID_ADPCM_EA,
1203 + AV_CODEC_ID_ADPCM_G726,
1204 + AV_CODEC_ID_ADPCM_CT,
1205 + AV_CODEC_ID_ADPCM_SWF,
1206 + AV_CODEC_ID_ADPCM_YAMAHA,
1207 + AV_CODEC_ID_ADPCM_SBPRO_4,
1208 + AV_CODEC_ID_ADPCM_SBPRO_3,
1209 + AV_CODEC_ID_ADPCM_SBPRO_2,
1210 + AV_CODEC_ID_ADPCM_THP,
1211 + AV_CODEC_ID_ADPCM_IMA_AMV,
1212 + AV_CODEC_ID_ADPCM_EA_R1,
1213 + AV_CODEC_ID_ADPCM_EA_R3,
1214 + AV_CODEC_ID_ADPCM_EA_R2,
1215 + AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
1216 + AV_CODEC_ID_ADPCM_IMA_EA_EACS,
1217 + AV_CODEC_ID_ADPCM_EA_XAS,
1218 + AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
1219 + AV_CODEC_ID_ADPCM_IMA_ISS,
1220 + AV_CODEC_ID_ADPCM_G722,
1221 + AV_CODEC_ID_ADPCM_IMA_APC,
1222 + AV_CODEC_ID_ADPCM_VIMA,
1224 + AV_CODEC_ID_ADPCM_AFC = 0x11800,
1225 + AV_CODEC_ID_ADPCM_IMA_OKI,
1226 + AV_CODEC_ID_ADPCM_DTK,
1227 + AV_CODEC_ID_ADPCM_IMA_RAD,
1228 + AV_CODEC_ID_ADPCM_G726LE,
1229 + AV_CODEC_ID_ADPCM_THP_LE,
1230 + AV_CODEC_ID_ADPCM_PSX,
1231 + AV_CODEC_ID_ADPCM_AICA,
1232 + AV_CODEC_ID_ADPCM_IMA_DAT4,
1233 + AV_CODEC_ID_ADPCM_MTAF,
1236 + AV_CODEC_ID_AMR_NB = 0x12000,
1237 + AV_CODEC_ID_AMR_WB,
1239 + /* RealAudio codecs*/
1240 + AV_CODEC_ID_RA_144 = 0x13000,
1241 + AV_CODEC_ID_RA_288,
1243 + /* various DPCM codecs */
1244 + AV_CODEC_ID_ROQ_DPCM = 0x14000,
1245 + AV_CODEC_ID_INTERPLAY_DPCM,
1246 + AV_CODEC_ID_XAN_DPCM,
1247 + AV_CODEC_ID_SOL_DPCM,
1249 + AV_CODEC_ID_SDX2_DPCM = 0x14800,
1250 + AV_CODEC_ID_GREMLIN_DPCM,
1252 + /* audio codecs */
1253 + AV_CODEC_ID_MP2 = 0x15000,
1254 + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
1258 + AV_CODEC_ID_VORBIS,
1259 + AV_CODEC_ID_DVAUDIO,
1260 + AV_CODEC_ID_WMAV1,
1261 + AV_CODEC_ID_WMAV2,
1262 + AV_CODEC_ID_MACE3,
1263 + AV_CODEC_ID_MACE6,
1264 + AV_CODEC_ID_VMDAUDIO,
1266 + AV_CODEC_ID_MP3ADU,
1267 + AV_CODEC_ID_MP3ON4,
1268 + AV_CODEC_ID_SHORTEN,
1270 + AV_CODEC_ID_WESTWOOD_SND1,
1271 + AV_CODEC_ID_GSM, ///< as in Berlin toast format
1274 + AV_CODEC_ID_TRUESPEECH,
1276 + AV_CODEC_ID_SMACKAUDIO,
1277 + AV_CODEC_ID_QCELP,
1278 + AV_CODEC_ID_WAVPACK,
1279 + AV_CODEC_ID_DSICINAUDIO,
1281 + AV_CODEC_ID_MUSEPACK7,
1283 + AV_CODEC_ID_GSM_MS, /* as found in WAV */
1284 + AV_CODEC_ID_ATRAC3,
1286 + AV_CODEC_ID_NELLYMOSER,
1287 + AV_CODEC_ID_MUSEPACK8,
1288 + AV_CODEC_ID_SPEEX,
1289 + AV_CODEC_ID_WMAVOICE,
1290 + AV_CODEC_ID_WMAPRO,
1291 + AV_CODEC_ID_WMALOSSLESS,
1292 + AV_CODEC_ID_ATRAC3P,
1296 + AV_CODEC_ID_TWINVQ,
1297 + AV_CODEC_ID_TRUEHD,
1298 + AV_CODEC_ID_MP4ALS,
1299 + AV_CODEC_ID_ATRAC1,
1300 + AV_CODEC_ID_BINKAUDIO_RDFT,
1301 + AV_CODEC_ID_BINKAUDIO_DCT,
1302 + AV_CODEC_ID_AAC_LATM,
1305 + AV_CODEC_ID_G723_1,
1307 + AV_CODEC_ID_8SVX_EXP,
1308 + AV_CODEC_ID_8SVX_FIB,
1309 + AV_CODEC_ID_BMV_AUDIO,
1314 + AV_CODEC_ID_COMFORT_NOISE,
1316 + AV_CODEC_ID_METASOUND,
1317 + AV_CODEC_ID_PAF_AUDIO,
1318 + AV_CODEC_ID_ON2AVC,
1319 + AV_CODEC_ID_DSS_SP,
1320 + AV_CODEC_ID_CODEC2,
1322 + AV_CODEC_ID_FFWAVESYNTH = 0x15800,
1323 + AV_CODEC_ID_SONIC,
1324 + AV_CODEC_ID_SONIC_LS,
1327 + AV_CODEC_ID_DSD_LSBF,
1328 + AV_CODEC_ID_DSD_MSBF,
1329 + AV_CODEC_ID_DSD_LSBF_PLANAR,
1330 + AV_CODEC_ID_DSD_MSBF_PLANAR,
1332 + AV_CODEC_ID_INTERPLAY_ACM,
1336 + AV_CODEC_ID_ATRAC3AL,
1337 + AV_CODEC_ID_ATRAC3PAL,
1338 + AV_CODEC_ID_DOLBY_E,
1340 + AV_CODEC_ID_APTX_HD,
1343 + /* subtitle codecs */
1344 + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
1345 + AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
1346 + AV_CODEC_ID_DVB_SUBTITLE,
1347 + AV_CODEC_ID_TEXT, ///< raw UTF-8 text
1350 + AV_CODEC_ID_MOV_TEXT,
1351 + AV_CODEC_ID_HDMV_PGS_SUBTITLE,
1352 + AV_CODEC_ID_DVB_TELETEXT,
1355 + AV_CODEC_ID_MICRODVD = 0x17800,
1356 + AV_CODEC_ID_EIA_608,
1357 + AV_CODEC_ID_JACOSUB,
1359 + AV_CODEC_ID_REALTEXT,
1361 + AV_CODEC_ID_SUBVIEWER1,
1362 + AV_CODEC_ID_SUBVIEWER,
1363 + AV_CODEC_ID_SUBRIP,
1364 + AV_CODEC_ID_WEBVTT,
1366 + AV_CODEC_ID_VPLAYER,
1369 + AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
1371 + /* other specific kind of codecs (generally used for attachments) */
1372 + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
1373 + AV_CODEC_ID_TTF = 0x18000,
1375 + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
1376 + AV_CODEC_ID_BINTEXT = 0x18800,
1380 + AV_CODEC_ID_SMPTE_KLV,
1381 + AV_CODEC_ID_DVD_NAV,
1382 + AV_CODEC_ID_TIMED_ID3,
1383 + AV_CODEC_ID_BIN_DATA,
1386 + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
1388 + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
1389 + * stream (only used by libavformat) */
1390 + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
1391 + * stream (only used by libavformat) */
1392 + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
1393 + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
1397 + * This struct describes the properties of a single codec described by an
1399 + * @see avcodec_descriptor_get()
1401 +typedef struct AVCodecDescriptor {
1402 + enum AVCodecID id;
1403 + enum AVMediaType type;
1405 + * Name of the codec described by this descriptor. It is non-empty and
1406 + * unique for each codec descriptor. It should contain alphanumeric
1407 + * characters and '_' only.
1411 + * A more descriptive name for this codec. May be NULL.
1413 + const char *long_name;
1415 + * Codec properties, a combination of AV_CODEC_PROP_* flags.
1419 + * MIME type(s) associated with the codec.
1420 + * May be NULL; if not, a NULL-terminated array of MIME types.
1421 + * The first item is always non-NULL and is the preferred MIME type.
1423 + const char *const *mime_types;
1425 + * If non-NULL, an array of profiles recognized for this codec.
1426 + * Terminated with FF_PROFILE_UNKNOWN.
1428 + const struct AVProfile *profiles;
1429 +} AVCodecDescriptor;
1432 + * Codec uses only intra compression.
1433 + * Video and audio codecs only.
1435 +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
1437 + * Codec supports lossy compression. Audio and video codecs only.
1438 + * @note a codec may support both lossy and lossless
1439 + * compression modes
1441 +#define AV_CODEC_PROP_LOSSY (1 << 1)
1443 + * Codec supports lossless compression. Audio and video codecs only.
1445 +#define AV_CODEC_PROP_LOSSLESS (1 << 2)
1447 + * Codec supports frame reordering. That is, the coded order (the order in which
1448 + * the encoded packets are output by the encoders / stored / input to the
1449 + * decoders) may be different from the presentation order of the corresponding
1452 + * For codecs that do not have this property set, PTS and DTS should always be
1455 +#define AV_CODEC_PROP_REORDER (1 << 3)
1457 + * Subtitle codec is bitmap based
1458 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
1460 +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
1462 + * Subtitle codec is text based.
1463 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
1465 +#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
1468 + * @ingroup lavc_decoding
1469 + * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
1470 + * This is mainly needed because some optimized bitstream readers read
1471 + * 32 or 64 bit at once and could read over the end.<br>
1472 + * Note: If the first 23 bits of the additional bytes are not 0, then damaged
1473 + * MPEG bitstreams could cause overread and segfault.
1475 +#define AV_INPUT_BUFFER_PADDING_SIZE 64
1478 + * @ingroup lavc_encoding
1479 + * minimum encoding buffer size
1480 + * Used to avoid some checks during header writing.
1482 +#define AV_INPUT_BUFFER_MIN_SIZE 16384
1485 + * @ingroup lavc_decoding
1488 + /* We leave some space between them for extensions (drop some
1489 + * keyframes for intra-only or drop just some bidir frames). */
1490 + AVDISCARD_NONE =-16, ///< discard nothing
1491 + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
1492 + AVDISCARD_NONREF = 8, ///< discard all non reference
1493 + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
1494 + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
1495 + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
1496 + AVDISCARD_ALL = 48, ///< discard all
1499 +enum AVAudioServiceType {
1500 + AV_AUDIO_SERVICE_TYPE_MAIN = 0,
1501 + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
1502 + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
1503 + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
1504 + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
1505 + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
1506 + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
1507 + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
1508 + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
1509 + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
1513 + * @ingroup lavc_encoding
1515 +typedef struct RcOverride{
1518 + int qscale; // If this is 0 then quality_factor will be used instead.
1519 + float quality_factor;
1522 +/* encoding support
1523 + These flags can be passed in AVCodecContext.flags before initialization.
1524 + Note: Not everything is supported yet.
1528 + * Allow decoders to produce frames with data planes that are not aligned
1529 + * to CPU requirements (e.g. due to cropping).
1531 +#define AV_CODEC_FLAG_UNALIGNED (1 << 0)
1533 + * Use fixed qscale.
1535 +#define AV_CODEC_FLAG_QSCALE (1 << 1)
1537 + * 4 MV per MB allowed / advanced prediction for H.263.
1539 +#define AV_CODEC_FLAG_4MV (1 << 2)
1541 + * Output even those frames that might be corrupted.
1543 +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)
1547 +#define AV_CODEC_FLAG_QPEL (1 << 4)
1549 + * Use internal 2pass ratecontrol in first pass mode.
1551 +#define AV_CODEC_FLAG_PASS1 (1 << 9)
1553 + * Use internal 2pass ratecontrol in second pass mode.
1555 +#define AV_CODEC_FLAG_PASS2 (1 << 10)
1559 +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)
1561 + * Only decode/encode grayscale.
1563 +#define AV_CODEC_FLAG_GRAY (1 << 13)
1565 + * error[?] variables will be set during encoding.
1567 +#define AV_CODEC_FLAG_PSNR (1 << 15)
1569 + * Input bitstream might be truncated at a random location
1570 + * instead of only at frame boundaries.
1572 +#define AV_CODEC_FLAG_TRUNCATED (1 << 16)
1574 + * Use interlaced DCT.
1576 +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)
1578 + * Force low delay.
1580 +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19)
1582 + * Place global headers in extradata instead of every keyframe.
1584 +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
1586 + * Use only bitexact stuff (except (I)DCT).
1588 +#define AV_CODEC_FLAG_BITEXACT (1 << 23)
1589 +/* Fx : Flag for H.263+ extra options */
1591 + * H.263 advanced intra coding / MPEG-4 AC prediction
1593 +#define AV_CODEC_FLAG_AC_PRED (1 << 24)
1595 + * interlaced motion estimation
1597 +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)
1598 +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31)
1601 + * Allow non spec compliant speedup tricks.
1603 +#define AV_CODEC_FLAG2_FAST (1 << 0)
1605 + * Skip bitstream encoding.
1607 +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)
1609 + * Place global headers at every keyframe instead of in extradata.
1611 +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
1614 + * timecode is in drop frame format. DEPRECATED!!!!
1616 +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
1619 + * Input bitstream might be truncated at a packet boundaries
1620 + * instead of only at frame boundaries.
1622 +#define AV_CODEC_FLAG2_CHUNKS (1 << 15)
1624 + * Discard cropping information from SPS.
1626 +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)
1629 + * Show all frames before the first keyframe
1631 +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22)
1633 + * Export motion vectors through frame side data
1635 +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28)
1637 + * Do not skip samples and export skip information as frame side data
1639 +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29)
1641 + * Do not reset ASS ReadOrder field on flush (subtitles decoding)
1643 +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
1645 +/* Unsupported options :
1646 + * Syntax Arithmetic coding (SAC)
1647 + * Reference Picture Selection
1648 + * Independent Segment Decoding */
1650 +/* codec capabilities */
1653 + * Decoder can use draw_horiz_band callback.
1655 +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
1657 + * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1658 + * If not set, it might not use get_buffer() at all or use operations that
1659 + * assume the buffer was allocated by avcodec_default_get_buffer.
1661 +#define AV_CODEC_CAP_DR1 (1 << 1)
1662 +#define AV_CODEC_CAP_TRUNCATED (1 << 3)
1664 + * Encoder or decoder requires flushing with NULL input at the end in order to
1665 + * give the complete and correct output.
1667 + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1668 + * with NULL data. The user can still send NULL data to the public encode
1669 + * or decode function, but libavcodec will not pass it along to the codec
1670 + * unless this flag is set.
1673 + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1674 + * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1678 + * The encoder needs to be fed with NULL data at the end of encoding until the
1679 + * encoder no longer returns data.
1681 + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1682 + * flag also means that the encoder must set the pts and duration for
1683 + * each output packet. If this flag is not set, the pts and duration will
1684 + * be determined by libavcodec from the input frame.
1686 +#define AV_CODEC_CAP_DELAY (1 << 5)
1688 + * Codec can be fed a final frame with a smaller size.
1689 + * This can be used to prevent truncation of the last audio samples.
1691 +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
1694 + * Codec can output multiple frames per AVPacket
1695 + * Normally demuxers return one frame at a time, demuxers which do not do
1696 + * are connected to a parser to split what they return into proper frames.
1697 + * This flag is reserved to the very rare category of codecs which have a
1698 + * bitstream that cannot be split into frames without timeconsuming
1699 + * operations like full decoding. Demuxers carrying such bitstreams thus
1700 + * may return multiple frames in a packet. This has many disadvantages like
1701 + * prohibiting stream copy in many cases thus it should only be considered
1702 + * as a last resort.
1704 +#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
1706 + * Codec is experimental and is thus avoided in favor of non experimental
1709 +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
1711 + * Codec should fill in channel configuration and samplerate instead of container
1713 +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
1715 + * Codec supports frame-level multithreading.
1717 +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
1719 + * Codec supports slice-based (or partition-based) multithreading.
1721 +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
1723 + * Codec supports changed parameters at any point.
1725 +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
1727 + * Codec supports avctx->thread_count == 0 (auto).
1729 +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15)
1731 + * Audio encoder supports receiving a different number of samples in each call.
1733 +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
1735 + * Decoder is not a preferred choice for probing.
1736 + * This indicates that the decoder is not a good choice for probing.
1737 + * It could for example be an expensive to spin up hardware decoder,
1738 + * or it could simply not provide a lot of useful information about
1740 + * A decoder marked with this flag should only be used as last resort
1741 + * choice for probing.
1743 +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
1745 + * Codec is intra only.
1747 +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000
1749 + * Codec is lossless.
1751 +#define AV_CODEC_CAP_LOSSLESS 0x80000000
1754 + * Codec is backed by a hardware implementation. Typically used to
1755 + * identify a non-hwaccel hardware decoder. For information about hwaccels, use
1756 + * avcodec_get_hw_config() instead.
1758 +#define AV_CODEC_CAP_HARDWARE (1 << 18)
1761 + * Codec is potentially backed by a hardware implementation, but not
1762 + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
1763 + * implementation provides some sort of internal fallback.
1765 +#define AV_CODEC_CAP_HYBRID (1 << 19)
1769 + * This specifies the area which should be displayed.
1770 + * Note there may be multiple such areas for one frame.
1772 +typedef struct AVPanScan {
1775 + * - encoding: Set by user.
1776 + * - decoding: Set by libavcodec.
1781 + * width and height in 1/16 pel
1782 + * - encoding: Set by user.
1783 + * - decoding: Set by libavcodec.
1789 + * position of the top left corner in 1/16 pel for up to 3 fields/frames
1790 + * - encoding: Set by user.
1791 + * - decoding: Set by libavcodec.
1793 + int16_t position[3][2];
1797 + * This structure describes the bitrate properties of an encoded bitstream. It
1798 + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1799 + * parameters for H.264/HEVC.
1801 +typedef struct AVCPBProperties {
1803 + * Maximum bitrate of the stream, in bits per second.
1804 + * Zero if unknown or unspecified.
1808 + * Minimum bitrate of the stream, in bits per second.
1809 + * Zero if unknown or unspecified.
1813 + * Average bitrate of the stream, in bits per second.
1814 + * Zero if unknown or unspecified.
1819 + * The size of the buffer to which the ratecontrol is applied, in bits.
1820 + * Zero if unknown or unspecified.
1825 + * The delay between the time the packet this structure is associated with
1826 + * is received and the time when it should be decoded, in periods of a 27MHz
1829 + * UINT64_MAX when unknown or unspecified.
1831 + uint64_t vbv_delay;
1835 + * The decoder will keep a reference to the frame and may reuse it later.
1837 +#define AV_GET_BUFFER_FLAG_REF (1 << 0)
1840 + * @defgroup lavc_packet AVPacket
1842 + * Types and functions for working with AVPacket.
1845 +enum AVPacketSideDataType {
1847 + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1848 + * bytes worth of palette. This side data signals that a new palette is
1851 + AV_PKT_DATA_PALETTE,
1854 + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1855 + * that the extradata buffer was changed and the receiving side should
1856 + * act upon it appropriately. The new extradata is embedded in the side
1857 + * data buffer and should be immediately used for processing the current
1858 + * frame or packet.
1860 + AV_PKT_DATA_NEW_EXTRADATA,
1863 + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1865 + * u32le param_flags
1866 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1867 + * s32le channel_count
1868 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1869 + * u64le channel_layout
1870 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1871 + * s32le sample_rate
1872 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1877 + AV_PKT_DATA_PARAM_CHANGE,
1880 + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1881 + * structures with info about macroblocks relevant to splitting the
1882 + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1883 + * That is, it does not necessarily contain info about all macroblocks,
1884 + * as long as the distance between macroblocks in the info is smaller
1885 + * than the target payload size.
1886 + * Each MB info structure is 12 bytes, and is laid out as follows:
1888 + * u32le bit offset from the start of the packet
1889 + * u8 current quantizer at the start of the macroblock
1891 + * u16le macroblock address within the GOB
1892 + * u8 horizontal MV predictor
1893 + * u8 vertical MV predictor
1894 + * u8 horizontal MV predictor for block number 3
1895 + * u8 vertical MV predictor for block number 3
1898 + AV_PKT_DATA_H263_MB_INFO,
1901 + * This side data should be associated with an audio stream and contains
1902 + * ReplayGain information in form of the AVReplayGain struct.
1904 + AV_PKT_DATA_REPLAYGAIN,
1907 + * This side data contains a 3x3 transformation matrix describing an affine
1908 + * transformation that needs to be applied to the decoded video frames for
1909 + * correct presentation.
1911 + * See libavutil/display.h for a detailed description of the data.
1913 + AV_PKT_DATA_DISPLAYMATRIX,
1916 + * This side data should be associated with a video stream and contains
1917 + * Stereoscopic 3D information in form of the AVStereo3D struct.
1919 + AV_PKT_DATA_STEREO3D,
1922 + * This side data should be associated with an audio stream and corresponds
1923 + * to enum AVAudioServiceType.
1925 + AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1928 + * This side data contains quality related information from the encoder.
1930 + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1934 + * u64le[error count] sum of squared differences between encoder in and output
1937 + AV_PKT_DATA_QUALITY_STATS,
1940 + * This side data contains an integer value representing the stream index
1941 + * of a "fallback" track. A fallback track indicates an alternate
1942 + * track to use when the current track can not be decoded for some reason.
1943 + * e.g. no decoder available for codec.
1945 + AV_PKT_DATA_FALLBACK_TRACK,
1948 + * This side data corresponds to the AVCPBProperties struct.
1950 + AV_PKT_DATA_CPB_PROPERTIES,
1953 + * Recommmends skipping the specified number of samples
1955 + * u32le number of samples to skip from start of this packet
1956 + * u32le number of samples to skip from end of this packet
1957 + * u8 reason for start skip
1958 + * u8 reason for end skip (0=padding silence, 1=convergence)
1961 + AV_PKT_DATA_SKIP_SAMPLES,
1964 + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1965 + * the packet may contain "dual mono" audio specific to Japanese DTV
1966 + * and if it is true, recommends only the selected channel to be used.
1968 + * u8 selected channels (0=mail/left, 1=sub/right, 2=both)
1971 + AV_PKT_DATA_JP_DUALMONO,
1974 + * A list of zero terminated key/value strings. There is no end marker for
1975 + * the list, so it is required to rely on the side data size to stop.
1977 + AV_PKT_DATA_STRINGS_METADATA,
1980 + * Subtitle event position
1988 + AV_PKT_DATA_SUBTITLE_POSITION,
1991 + * Data found in BlockAdditional element of matroska container. There is
1992 + * no end marker for the data, so it is required to rely on the side data
1993 + * size to recognize the end. 8 byte id (as found in BlockAddId) followed
1996 + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
1999 + * The optional first identifier line of a WebVTT cue.
2001 + AV_PKT_DATA_WEBVTT_IDENTIFIER,
2004 + * The optional settings (rendering instructions) that immediately
2005 + * follow the timestamp specifier of a WebVTT cue.
2007 + AV_PKT_DATA_WEBVTT_SETTINGS,
2010 + * A list of zero terminated key/value strings. There is no end marker for
2011 + * the list, so it is required to rely on the side data size to stop. This
2012 + * side data includes updated metadata which appeared in the stream.
2014 + AV_PKT_DATA_METADATA_UPDATE,
2017 + * MPEGTS stream ID, this is required to pass the stream ID
2018 + * information from the demuxer to the corresponding muxer.
2020 + AV_PKT_DATA_MPEGTS_STREAM_ID,
2023 + * Mastering display metadata (based on SMPTE-2086:2014). This metadata
2024 + * should be associated with a video stream and contains data in the form
2025 + * of the AVMasteringDisplayMetadata struct.
2027 + AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
2030 + * This side data should be associated with a video stream and corresponds
2031 + * to the AVSphericalMapping structure.
2033 + AV_PKT_DATA_SPHERICAL,
2036 + * Content light level (based on CTA-861.3). This metadata should be
2037 + * associated with a video stream and contains data in the form of the
2038 + * AVContentLightMetadata struct.
2040 + AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2043 + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
2044 + * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
2045 + * The number of bytes of CC data is AVPacketSideData.size.
2047 + AV_PKT_DATA_A53_CC,
2050 + * This side data is encryption initialization data.
2051 + * The format is not part of ABI, use av_encryption_init_info_* methods to
2054 + AV_PKT_DATA_ENCRYPTION_INIT_INFO,
2057 + * This side data contains encryption info for how to decrypt the packet.
2058 + * The format is not part of ABI, use av_encryption_info_* methods to access.
2060 + AV_PKT_DATA_ENCRYPTION_INFO,
2063 + * The number of side data types.
2064 + * This is not part of the public API/ABI in the sense that it may
2065 + * change when new side data types are added.
2066 + * This must stay the last enum value.
2067 + * If its value becomes huge, some code using it
2068 + * needs to be updated as it assumes it to be smaller than other limits.
2073 +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
2075 +typedef struct AVPacketSideData {
2078 + enum AVPacketSideDataType type;
2079 +} AVPacketSideData;
2082 + * This structure stores compressed data. It is typically exported by demuxers
2083 + * and then passed as input to decoders, or received as output from encoders and
2084 + * then passed to muxers.
2086 + * For video, it should typically contain one compressed frame. For audio it may
2087 + * contain several compressed frames. Encoders are allowed to output empty
2088 + * packets, with no compressed data, containing only side data
2089 + * (e.g. to update some stream parameters at the end of encoding).
2091 + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
2092 + * ABI. Thus it may be allocated on stack and no new fields can be added to it
2093 + * without libavcodec and libavformat major bump.
2095 + * The semantics of data ownership depends on the buf field.
2096 + * If it is set, the packet data is dynamically allocated and is
2097 + * valid indefinitely until a call to av_packet_unref() reduces the
2098 + * reference count to 0.
2100 + * If the buf field is not set av_packet_ref() would make a copy instead
2101 + * of increasing the reference count.
2103 + * The side data is always allocated with av_malloc(), copied by
2104 + * av_packet_ref() and freed by av_packet_unref().
2106 + * @see av_packet_ref
2107 + * @see av_packet_unref
2109 +typedef struct AVPacket {
2111 + * A reference to the reference-counted buffer where the packet data is
2113 + * May be NULL, then the packet data is not reference-counted.
2117 + * Presentation timestamp in AVStream->time_base units; the time at which
2118 + * the decompressed packet will be presented to the user.
2119 + * Can be AV_NOPTS_VALUE if it is not stored in the file.
2120 + * pts MUST be larger or equal to dts as presentation cannot happen before
2121 + * decompression, unless one wants to view hex dumps. Some formats misuse
2122 + * the terms dts and pts/cts to mean something different. Such timestamps
2123 + * must be converted to true pts/dts before they are stored in AVPacket.
2127 + * Decompression timestamp in AVStream->time_base units; the time at which
2128 + * the packet is decompressed.
2129 + * Can be AV_NOPTS_VALUE if it is not stored in the file.
2136 + * A combination of AV_PKT_FLAG values
2140 + * Additional packet data that can be provided by the container.
2141 + * Packet can contain several types of side information.
2143 + AVPacketSideData *side_data;
2144 + int side_data_elems;
2147 + * Duration of this packet in AVStream->time_base units, 0 if unknown.
2148 + * Equals next_pts - this_pts in presentation order.
2152 + int64_t pos; ///< byte position in stream, -1 if unknown
2154 +#if FF_API_CONVERGENCE_DURATION
2156 + * @deprecated Same as the duration field, but as int64_t. This was required
2157 + * for Matroska subtitles, whose duration values could overflow when the
2158 + * duration field was still an int.
2160 + attribute_deprecated
2161 + int64_t convergence_duration;
2164 +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
2165 +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
2167 + * Flag is used to discard packets which are required to maintain valid
2168 + * decoder state but are not required for output and should be dropped
2171 +#define AV_PKT_FLAG_DISCARD 0x0004
2173 + * The packet comes from a trusted source.
2175 + * Otherwise-unsafe constructs such as arbitrary pointers to data
2176 + * outside the packet may be followed.
2178 +#define AV_PKT_FLAG_TRUSTED 0x0008
2180 + * Flag is used to indicate packets that contain frames that can
2181 + * be discarded by the decoder. I.e. Non-reference frames.
2183 +#define AV_PKT_FLAG_DISPOSABLE 0x0010
2186 +enum AVSideDataParamChangeFlags {
2187 + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
2188 + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2189 + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
2190 + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
2196 +struct AVCodecInternal;
2198 +enum AVFieldOrder {
2200 + AV_FIELD_PROGRESSIVE,
2201 + AV_FIELD_TT, //< Top coded_first, top displayed first
2202 + AV_FIELD_BB, //< Bottom coded first, bottom displayed first
2203 + AV_FIELD_TB, //< Top coded first, bottom displayed first
2204 + AV_FIELD_BT, //< Bottom coded first, top displayed first
2208 + * main external API structure.
2209 + * New fields can be added to the end with minor version bumps.
2210 + * Removal, reordering and changes to existing fields require a major
2212 + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
2214 + * The name string for AVOptions options matches the associated command line
2215 + * parameter name and can be found in libavcodec/options_table.h
2216 + * The AVOption/command line parameter names differ in some cases from the C
2217 + * structure field names for historic reasons or brevity.
2218 + * sizeof(AVCodecContext) must not be used outside libav*.
2220 +typedef struct AVCodecContext {
2222 + * information on struct for av_log
2223 + * - set by avcodec_alloc_context3
2225 + const AVClass *av_class;
2226 + int log_level_offset;
2228 + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
2229 + const struct AVCodec *codec;
2230 + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
2233 + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2234 + * This is used to work around some encoder bugs.
2235 + * A demuxer should set this to what is stored in the field used to identify the codec.
2236 + * If there are multiple such fields in a container then the demuxer should choose the one
2237 + * which maximizes the information about the used codec.
2238 + * If the codec tag field in a container is larger than 32 bits then the demuxer should
2239 + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
2240 + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
2242 + * - encoding: Set by user, if not then the default based on codec_id will be used.
2243 + * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2245 + unsigned int codec_tag;
2250 + * Private context used for internal data.
2252 + * Unlike priv_data, this is not codec-specific. It is used in general
2253 + * libavcodec functions.
2255 + struct AVCodecInternal *internal;
2258 + * Private data of the user, can be used to carry app specific stuff.
2259 + * - encoding: Set by user.
2260 + * - decoding: Set by user.
2265 + * the average bitrate
2266 + * - encoding: Set by user; unused for constant quantizer encoding.
2267 + * - decoding: Set by user, may be overwritten by libavcodec
2268 + * if this info is available in the stream
2273 + * number of bits the bitstream is allowed to diverge from the reference.
2274 + * the reference can be CBR (for CBR pass1) or VBR (for pass2)
2275 + * - encoding: Set by user; unused for constant quantizer encoding.
2276 + * - decoding: unused
2278 + int bit_rate_tolerance;
2281 + * Global quality for codecs which cannot change it per frame.
2282 + * This should be proportional to MPEG-1/2/4 qscale.
2283 + * - encoding: Set by user.
2284 + * - decoding: unused
2286 + int global_quality;
2289 + * - encoding: Set by user.
2290 + * - decoding: unused
2292 + int compression_level;
2293 +#define FF_COMPRESSION_DEFAULT -1
2296 + * AV_CODEC_FLAG_*.
2297 + * - encoding: Set by user.
2298 + * - decoding: Set by user.
2303 + * AV_CODEC_FLAG2_*
2304 + * - encoding: Set by user.
2305 + * - decoding: Set by user.
2310 + * some codecs need / can use extradata like Huffman tables.
2311 + * MJPEG: Huffman tables
2312 + * rv10: additional flags
2313 + * MPEG-4: global headers (they can be in the bitstream or here)
2314 + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
2315 + * than extradata_size to avoid problems if it is read with the bitstream reader.
2316 + * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
2317 + * - encoding: Set/allocated/freed by libavcodec.
2318 + * - decoding: Set/allocated/freed by user.
2320 + uint8_t *extradata;
2321 + int extradata_size;
2324 + * This is the fundamental unit of time (in seconds) in terms
2325 + * of which frame timestamps are represented. For fixed-fps content,
2326 + * timebase should be 1/framerate and timestamp increments should be
2328 + * This often, but not always is the inverse of the frame rate or field rate
2329 + * for video. 1/time_base is not the average frame rate if the frame rate is not
2332 + * Like containers, elementary streams also can store timestamps, 1/time_base
2333 + * is the unit in which these timestamps are specified.
2334 + * As example of such codec time base see ISO/IEC 14496-2:2001(E)
2335 + * vop_time_increment_resolution and fixed_vop_rate
2336 + * (fixed_vop_rate == 0 implies that it is different from the framerate)
2338 + * - encoding: MUST be set by user.
2339 + * - decoding: the use of this field for decoding is deprecated.
2340 + * Use framerate instead.
2342 + AVRational time_base;
2345 + * For some codecs, the time base is closer to the field rate than the frame rate.
2346 + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2347 + * if no telecine is used ...
2349 + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2351 + int ticks_per_frame;
2356 + * Encoding: Number of frames delay there will be from the encoder input to
2357 + * the decoder output. (we assume the decoder matches the spec)
2358 + * Decoding: Number of frames delay in addition to what a standard decoder
2359 + * as specified in the spec would produce.
2362 + * Number of frames the decoded output will be delayed relative to the
2366 + * For encoding, this field is unused (see initial_padding).
2368 + * For decoding, this is the number of samples the decoder needs to
2369 + * output before the decoder's output is valid. When seeking, you should
2370 + * start decoding this many samples prior to your desired seek point.
2372 + * - encoding: Set by libavcodec.
2373 + * - decoding: Set by libavcodec.
2380 + * picture width / height.
2382 + * @note Those fields may not match the values of the last
2383 + * AVFrame output by avcodec_decode_video2 due frame
2386 + * - encoding: MUST be set by user.
2387 + * - decoding: May be set by the user before opening the decoder if known e.g.
2388 + * from the container. Some decoders will require the dimensions
2389 + * to be set by the caller. During decoding, the decoder may
2390 + * overwrite those values as required while parsing the data.
2392 + int width, height;
2395 + * Bitstream width / height, may be different from width/height e.g. when
2396 + * the decoded frame is cropped before being output or lowres is enabled.
2398 + * @note Those field may not match the value of the last
2399 + * AVFrame output by avcodec_receive_frame() due frame
2402 + * - encoding: unused
2403 + * - decoding: May be set by the user before opening the decoder if known
2404 + * e.g. from the container. During decoding, the decoder may
2405 + * overwrite those values as required while parsing the data.
2407 + int coded_width, coded_height;
2410 + * the number of pictures in a group of pictures, or 0 for intra_only
2411 + * - encoding: Set by user.
2412 + * - decoding: unused
2417 + * Pixel format, see AV_PIX_FMT_xxx.
2418 + * May be set by the demuxer if known from headers.
2419 + * May be overridden by the decoder if it knows better.
2421 + * @note This field may not match the value of the last
2422 + * AVFrame output by avcodec_receive_frame() due frame
2425 + * - encoding: Set by user.
2426 + * - decoding: Set by user if known, overridden by libavcodec while
2427 + * parsing the data.
2429 + enum AVPixelFormat pix_fmt;
2432 + * If non NULL, 'draw_horiz_band' is called by the libavcodec
2433 + * decoder to draw a horizontal band. It improves cache usage. Not
2434 + * all codecs can do that. You must check the codec capabilities
2436 + * When multithreading is used, it may be called from multiple threads
2437 + * at the same time; threads might draw different parts of the same AVFrame,
2438 + * or multiple AVFrames, and there is no guarantee that slices will be drawn
2440 + * The function is also used by hardware acceleration APIs.
2441 + * It is called at least once during frame decoding to pass
2442 + * the data needed for hardware render.
2443 + * In that mode instead of pixel data, AVFrame points to
2444 + * a structure specific to the acceleration API. The application
2445 + * reads the structure and can change some fields to indicate progress
2447 + * - encoding: unused
2448 + * - decoding: Set by user.
2449 + * @param height the height of the slice
2450 + * @param y the y position of the slice
2451 + * @param type 1->top field, 2->bottom field, 3->frame
2452 + * @param offset offset into the AVFrame.data from which the slice should be read
2454 + void (*draw_horiz_band)(struct AVCodecContext *s,
2455 + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2456 + int y, int type, int height);
2459 + * callback to negotiate the pixelFormat
2460 + * @param fmt is the list of formats which are supported by the codec,
2461 + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2462 + * The first is always the native one.
2463 + * @note The callback may be called again immediately if initialization for
2464 + * the selected (hardware-accelerated) pixel format failed.
2465 + * @warning Behavior is undefined if the callback returns a value not
2466 + * in the fmt list of formats.
2467 + * @return the chosen format
2468 + * - encoding: unused
2469 + * - decoding: Set by user, if not set the native format will be chosen.
2471 + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2474 + * maximum number of B-frames between non-B-frames
2475 + * Note: The output will be delayed by max_b_frames+1 relative to the input.
2476 + * - encoding: Set by user.
2477 + * - decoding: unused
2482 + * qscale factor between IP and B-frames
2483 + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
2484 + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2485 + * - encoding: Set by user.
2486 + * - decoding: unused
2488 + float b_quant_factor;
2490 +#if FF_API_PRIVATE_OPT
2491 + /** @deprecated use encoder private options instead */
2492 + attribute_deprecated
2493 + int b_frame_strategy;
2497 + * qscale offset between IP and B-frames
2498 + * - encoding: Set by user.
2499 + * - decoding: unused
2501 + float b_quant_offset;
2504 + * Size of the frame reordering buffer in the decoder.
2505 + * For MPEG-2 it is 1 IPB or 0 low delay IP.
2506 + * - encoding: Set by libavcodec.
2507 + * - decoding: Set by libavcodec.
2511 +#if FF_API_PRIVATE_OPT
2512 + /** @deprecated use encoder private options instead */
2513 + attribute_deprecated
2518 + * qscale factor between P- and I-frames
2519 + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
2520 + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2521 + * - encoding: Set by user.
2522 + * - decoding: unused
2524 + float i_quant_factor;
2527 + * qscale offset between P and I-frames
2528 + * - encoding: Set by user.
2529 + * - decoding: unused
2531 + float i_quant_offset;
2534 + * luminance masking (0-> disabled)
2535 + * - encoding: Set by user.
2536 + * - decoding: unused
2538 + float lumi_masking;
2541 + * temporary complexity masking (0-> disabled)
2542 + * - encoding: Set by user.
2543 + * - decoding: unused
2545 + float temporal_cplx_masking;
2548 + * spatial complexity masking (0-> disabled)
2549 + * - encoding: Set by user.
2550 + * - decoding: unused
2552 + float spatial_cplx_masking;
2555 + * p block masking (0-> disabled)
2556 + * - encoding: Set by user.
2557 + * - decoding: unused
2562 + * darkness masking (0-> disabled)
2563 + * - encoding: Set by user.
2564 + * - decoding: unused
2566 + float dark_masking;
2570 + * - encoding: Set by libavcodec.
2571 + * - decoding: Set by user (or 0).
2575 +#if FF_API_PRIVATE_OPT
2576 + /** @deprecated use encoder private options instead */
2577 + attribute_deprecated
2578 + int prediction_method;
2579 +#define FF_PRED_LEFT 0
2580 +#define FF_PRED_PLANE 1
2581 +#define FF_PRED_MEDIAN 2
2585 + * slice offsets in the frame in bytes
2586 + * - encoding: Set/allocated by libavcodec.
2587 + * - decoding: Set/allocated by user (or NULL).
2589 + int *slice_offset;
2592 + * sample aspect ratio (0 if unknown)
2593 + * That is the width of a pixel divided by the height of the pixel.
2594 + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
2595 + * - encoding: Set by user.
2596 + * - decoding: Set by libavcodec.
2598 + AVRational sample_aspect_ratio;
2601 + * motion estimation comparison function
2602 + * - encoding: Set by user.
2603 + * - decoding: unused
2607 + * subpixel motion estimation comparison function
2608 + * - encoding: Set by user.
2609 + * - decoding: unused
2613 + * macroblock comparison function (not supported yet)
2614 + * - encoding: Set by user.
2615 + * - decoding: unused
2619 + * interlaced DCT comparison function
2620 + * - encoding: Set by user.
2621 + * - decoding: unused
2624 +#define FF_CMP_SAD 0
2625 +#define FF_CMP_SSE 1
2626 +#define FF_CMP_SATD 2
2627 +#define FF_CMP_DCT 3
2628 +#define FF_CMP_PSNR 4
2629 +#define FF_CMP_BIT 5
2630 +#define FF_CMP_RD 6
2631 +#define FF_CMP_ZERO 7
2632 +#define FF_CMP_VSAD 8
2633 +#define FF_CMP_VSSE 9
2634 +#define FF_CMP_NSSE 10
2635 +#define FF_CMP_W53 11
2636 +#define FF_CMP_W97 12
2637 +#define FF_CMP_DCTMAX 13
2638 +#define FF_CMP_DCT264 14
2639 +#define FF_CMP_MEDIAN_SAD 15
2640 +#define FF_CMP_CHROMA 256
2643 + * ME diamond size & shape
2644 + * - encoding: Set by user.
2645 + * - decoding: unused
2650 + * amount of previous MV predictors (2a+1 x 2a+1 square)
2651 + * - encoding: Set by user.
2652 + * - decoding: unused
2654 + int last_predictor_count;
2656 +#if FF_API_PRIVATE_OPT
2657 + /** @deprecated use encoder private options instead */
2658 + attribute_deprecated
2663 + * motion estimation prepass comparison function
2664 + * - encoding: Set by user.
2665 + * - decoding: unused
2670 + * ME prepass diamond size & shape
2671 + * - encoding: Set by user.
2672 + * - decoding: unused
2677 + * subpel ME quality
2678 + * - encoding: Set by user.
2679 + * - decoding: unused
2681 + int me_subpel_quality;
2684 + * maximum motion estimation search range in subpel units
2685 + * If 0 then no limit.
2687 + * - encoding: Set by user.
2688 + * - decoding: unused
2694 + * - encoding: unused
2695 + * - decoding: Set by user.
2698 +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
2699 +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
2700 +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2703 + * macroblock decision mode
2704 + * - encoding: Set by user.
2705 + * - decoding: unused
2708 +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
2709 +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
2710 +#define FF_MB_DECISION_RD 2 ///< rate distortion
2713 + * custom intra quantization matrix
2714 + * - encoding: Set by user, can be NULL.
2715 + * - decoding: Set by libavcodec.
2717 + uint16_t *intra_matrix;
2720 + * custom inter quantization matrix
2721 + * - encoding: Set by user, can be NULL.
2722 + * - decoding: Set by libavcodec.
2724 + uint16_t *inter_matrix;
2726 +#if FF_API_PRIVATE_OPT
2727 + /** @deprecated use encoder private options instead */
2728 + attribute_deprecated
2729 + int scenechange_threshold;
2731 + /** @deprecated use encoder private options instead */
2732 + attribute_deprecated
2733 + int noise_reduction;
2737 + * precision of the intra DC coefficient - 8
2738 + * - encoding: Set by user.
2739 + * - decoding: Set by libavcodec
2741 + int intra_dc_precision;
2744 + * Number of macroblock rows at the top which are skipped.
2745 + * - encoding: unused
2746 + * - decoding: Set by user.
2751 + * Number of macroblock rows at the bottom which are skipped.
2752 + * - encoding: unused
2753 + * - decoding: Set by user.
2758 + * minimum MB Lagrange multiplier
2759 + * - encoding: Set by user.
2760 + * - decoding: unused
2765 + * maximum MB Lagrange multiplier
2766 + * - encoding: Set by user.
2767 + * - decoding: unused
2771 +#if FF_API_PRIVATE_OPT
2773 + * @deprecated use encoder private options instead
2775 + attribute_deprecated
2776 + int me_penalty_compensation;
2780 + * - encoding: Set by user.
2781 + * - decoding: unused
2785 +#if FF_API_PRIVATE_OPT
2786 + /** @deprecated use encoder private options instead */
2787 + attribute_deprecated
2792 + * minimum GOP size
2793 + * - encoding: Set by user.
2794 + * - decoding: unused
2799 + * number of reference frames
2800 + * - encoding: Set by user.
2801 + * - decoding: Set by lavc.
2805 +#if FF_API_PRIVATE_OPT
2806 + /** @deprecated use encoder private options instead */
2807 + attribute_deprecated
2812 + * Note: Value depends upon the compare function used for fullpel ME.
2813 + * - encoding: Set by user.
2814 + * - decoding: unused
2816 + int mv0_threshold;
2818 +#if FF_API_PRIVATE_OPT
2819 + /** @deprecated use encoder private options instead */
2820 + attribute_deprecated
2821 + int b_sensitivity;
2825 + * Chromaticity coordinates of the source primaries.
2826 + * - encoding: Set by user
2827 + * - decoding: Set by libavcodec
2829 + enum AVColorPrimaries color_primaries;
2832 + * Color Transfer Characteristic.
2833 + * - encoding: Set by user
2834 + * - decoding: Set by libavcodec
2836 + enum AVColorTransferCharacteristic color_trc;
2839 + * YUV colorspace type.
2840 + * - encoding: Set by user
2841 + * - decoding: Set by libavcodec
2843 + enum AVColorSpace colorspace;
2846 + * MPEG vs JPEG YUV range.
2847 + * - encoding: Set by user
2848 + * - decoding: Set by libavcodec
2850 + enum AVColorRange color_range;
2853 + * This defines the location of chroma samples.
2854 + * - encoding: Set by user
2855 + * - decoding: Set by libavcodec
2857 + enum AVChromaLocation chroma_sample_location;
2860 + * Number of slices.
2861 + * Indicates number of picture subdivisions. Used for parallelized
2863 + * - encoding: Set by user
2864 + * - decoding: unused
2869 + * - encoding: set by libavcodec
2870 + * - decoding: Set by user.
2872 + enum AVFieldOrder field_order;
2875 + int sample_rate; ///< samples per second
2876 + int channels; ///< number of audio channels
2879 + * audio sample format
2880 + * - encoding: Set by user.
2881 + * - decoding: Set by libavcodec.
2883 + enum AVSampleFormat sample_fmt; ///< sample format
2885 + /* The following data should not be initialized. */
2887 + * Number of samples per channel in an audio frame.
2889 + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2890 + * except the last must contain exactly frame_size samples per channel.
2891 + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2892 + * frame size is not restricted.
2893 + * - decoding: may be set by some decoders to indicate constant frame size
2898 + * Frame counter, set by libavcodec.
2900 + * - decoding: total number of frames returned from the decoder so far.
2901 + * - encoding: total number of frames passed to the encoder so far.
2903 + * @note the counter is not incremented if encoding/decoding resulted in
2909 + * number of bytes per packet if constant and known or 0
2910 + * Used by some WAV based audio codecs.
2915 + * Audio cutoff bandwidth (0 means "automatic")
2916 + * - encoding: Set by user.
2917 + * - decoding: unused
2922 + * Audio channel layout.
2923 + * - encoding: set by user.
2924 + * - decoding: set by user, may be overwritten by libavcodec.
2926 + uint64_t channel_layout;
2929 + * Request decoder to use this channel layout if it can (0 for default)
2930 + * - encoding: unused
2931 + * - decoding: Set by user.
2933 + uint64_t request_channel_layout;
2936 + * Type of service that the audio stream conveys.
2937 + * - encoding: Set by user.
2938 + * - decoding: Set by libavcodec.
2940 + enum AVAudioServiceType audio_service_type;
2943 + * desired sample format
2944 + * - encoding: Not used.
2945 + * - decoding: Set by user.
2946 + * Decoder will decode to this format if it can.
2948 + enum AVSampleFormat request_sample_fmt;
2951 + * This callback is called at the beginning of each frame to get data
2952 + * buffer(s) for it. There may be one contiguous buffer for all the data or
2953 + * there may be a buffer per each data plane or anything in between. What
2954 + * this means is, you may set however many entries in buf[] you feel necessary.
2955 + * Each buffer must be reference-counted using the AVBuffer API (see description
2956 + * of buf[] below).
2958 + * The following fields will be set in the frame before this callback is
2961 + * - width, height (video only)
2962 + * - sample_rate, channel_layout, nb_samples (audio only)
2963 + * Their values may differ from the corresponding values in
2964 + * AVCodecContext. This callback must use the frame values, not the codec
2965 + * context values, to calculate the required buffer size.
2967 + * This callback must fill the following fields in the frame:
2970 + * - extended_data:
2971 + * * if the data is planar audio with more than 8 channels, then this
2972 + * callback must allocate and fill extended_data to contain all pointers
2973 + * to all data planes. data[] must hold as many pointers as it can.
2974 + * extended_data must be allocated with av_malloc() and will be freed in
2975 + * av_frame_unref().
2976 + * * otherwise extended_data must point to data
2977 + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2978 + * the frame's data and extended_data pointers must be contained in these. That
2979 + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2980 + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2981 + * and av_buffer_ref().
2982 + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2983 + * this callback and filled with the extra buffers if there are more
2984 + * buffers than buf[] can hold. extended_buf will be freed in
2985 + * av_frame_unref().
2987 + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
2988 + * avcodec_default_get_buffer2() instead of providing buffers allocated by
2989 + * some other means.
2991 + * Each data plane must be aligned to the maximum required by the target
2994 + * @see avcodec_default_get_buffer2()
2998 + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2999 + * (read and/or written to if it is writable) later by libavcodec.
3001 + * avcodec_align_dimensions2() should be used to find the required width and
3002 + * height, as they normally need to be rounded up to the next multiple of 16.
3004 + * Some decoders do not support linesizes changing between frames.
3006 + * If frame multithreading is used and thread_safe_callbacks is set,
3007 + * this callback may be called from a different thread, but not from more
3008 + * than one at once. Does not need to be reentrant.
3010 + * @see avcodec_align_dimensions2()
3014 + * Decoders request a buffer of a particular size by setting
3015 + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
3016 + * however, utilize only part of the buffer by setting AVFrame.nb_samples
3017 + * to a smaller value in the output frame.
3019 + * As a convenience, av_samples_get_buffer_size() and
3020 + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
3021 + * functions to find the required data size and to fill data pointers and
3022 + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
3023 + * since all planes must be the same size.
3025 + * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
3027 + * - encoding: unused
3028 + * - decoding: Set by libavcodec, user can override.
3030 + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
3033 + * If non-zero, the decoded audio and video frames returned from
3034 + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
3035 + * and are valid indefinitely. The caller must free them with
3036 + * av_frame_unref() when they are not needed anymore.
3037 + * Otherwise, the decoded frames must not be freed by the caller and are
3038 + * only valid until the next decode call.
3040 + * This is always automatically enabled if avcodec_receive_frame() is used.
3042 + * - encoding: unused
3043 + * - decoding: set by the caller before avcodec_open2().
3045 + attribute_deprecated
3046 + int refcounted_frames;
3048 + /* - encoding parameters */
3049 + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
3050 + float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
3053 + * minimum quantizer
3054 + * - encoding: Set by user.
3055 + * - decoding: unused
3060 + * maximum quantizer
3061 + * - encoding: Set by user.
3062 + * - decoding: unused
3067 + * maximum quantizer difference between frames
3068 + * - encoding: Set by user.
3069 + * - decoding: unused
3074 + * decoder bitstream buffer size
3075 + * - encoding: Set by user.
3076 + * - decoding: unused
3078 + int rc_buffer_size;
3081 + * ratecontrol override, see RcOverride
3082 + * - encoding: Allocated/set/freed by user.
3083 + * - decoding: unused
3085 + int rc_override_count;
3086 + RcOverride *rc_override;
3090 + * - encoding: Set by user.
3091 + * - decoding: Set by user, may be overwritten by libavcodec.
3093 + int64_t rc_max_rate;
3097 + * - encoding: Set by user.
3098 + * - decoding: unused
3100 + int64_t rc_min_rate;
3103 + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
3104 + * - encoding: Set by user.
3105 + * - decoding: unused.
3107 + float rc_max_available_vbv_use;
3110 + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
3111 + * - encoding: Set by user.
3112 + * - decoding: unused.
3114 + float rc_min_vbv_overflow_use;
3117 + * Number of bits which should be loaded into the rc buffer before decoding starts.
3118 + * - encoding: Set by user.
3119 + * - decoding: unused
3121 + int rc_initial_buffer_occupancy;
3123 +#if FF_API_CODER_TYPE
3124 +#define FF_CODER_TYPE_VLC 0
3125 +#define FF_CODER_TYPE_AC 1
3126 +#define FF_CODER_TYPE_RAW 2
3127 +#define FF_CODER_TYPE_RLE 3
3129 + * @deprecated use encoder private options instead
3131 + attribute_deprecated
3133 +#endif /* FF_API_CODER_TYPE */
3135 +#if FF_API_PRIVATE_OPT
3136 + /** @deprecated use encoder private options instead */
3137 + attribute_deprecated
3138 + int context_model;
3141 +#if FF_API_PRIVATE_OPT
3142 + /** @deprecated use encoder private options instead */
3143 + attribute_deprecated
3144 + int frame_skip_threshold;
3146 + /** @deprecated use encoder private options instead */
3147 + attribute_deprecated
3148 + int frame_skip_factor;
3150 + /** @deprecated use encoder private options instead */
3151 + attribute_deprecated
3152 + int frame_skip_exp;
3154 + /** @deprecated use encoder private options instead */
3155 + attribute_deprecated
3156 + int frame_skip_cmp;
3157 +#endif /* FF_API_PRIVATE_OPT */
3160 + * trellis RD quantization
3161 + * - encoding: Set by user.
3162 + * - decoding: unused
3166 +#if FF_API_PRIVATE_OPT
3167 + /** @deprecated use encoder private options instead */
3168 + attribute_deprecated
3169 + int min_prediction_order;
3171 + /** @deprecated use encoder private options instead */
3172 + attribute_deprecated
3173 + int max_prediction_order;
3175 + /** @deprecated use encoder private options instead */
3176 + attribute_deprecated
3177 + int64_t timecode_frame_start;
3180 +#if FF_API_RTP_CALLBACK
3182 + * @deprecated unused
3184 + /* The RTP callback: This function is called */
3185 + /* every time the encoder has a packet to send. */
3186 + /* It depends on the encoder if the data starts */
3187 + /* with a Start Code (it should). H.263 does. */
3188 + /* mb_nb contains the number of macroblocks */
3189 + /* encoded in the RTP payload. */
3190 + attribute_deprecated
3191 + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3194 +#if FF_API_PRIVATE_OPT
3195 + /** @deprecated use encoder private options instead */
3196 + attribute_deprecated
3197 + int rtp_payload_size; /* The size of the RTP payload: the coder will */
3198 + /* do its best to deliver a chunk with size */
3199 + /* below rtp_payload_size, the chunk will start */
3200 + /* with a start code on some codecs like H.263. */
3201 + /* This doesn't take account of any particular */
3202 + /* headers inside the transmitted RTP payload. */
3205 +#if FF_API_STAT_BITS
3206 + /* statistics, used for 2-pass encoding */
3207 + attribute_deprecated
3209 + attribute_deprecated
3211 + attribute_deprecated
3213 + attribute_deprecated
3215 + attribute_deprecated
3217 + attribute_deprecated
3219 + attribute_deprecated
3221 + attribute_deprecated
3224 + /** @deprecated this field is unused */
3225 + attribute_deprecated
3230 + * pass1 encoding statistics output buffer
3231 + * - encoding: Set by libavcodec.
3232 + * - decoding: unused
3237 + * pass2 encoding statistics input buffer
3238 + * Concatenated stuff from stats_out of pass1 should be placed here.
3239 + * - encoding: Allocated/set/freed by user.
3240 + * - decoding: unused
3245 + * Work around bugs in encoders which sometimes cannot be detected automatically.
3246 + * - encoding: Set by user
3247 + * - decoding: Set by user
3249 + int workaround_bugs;
3250 +#define FF_BUG_AUTODETECT 1 ///< autodetection
3251 +#define FF_BUG_XVID_ILACE 4
3252 +#define FF_BUG_UMP4 8
3253 +#define FF_BUG_NO_PADDING 16
3254 +#define FF_BUG_AMV 32
3255 +#define FF_BUG_QPEL_CHROMA 64
3256 +#define FF_BUG_STD_QPEL 128
3257 +#define FF_BUG_QPEL_CHROMA2 256
3258 +#define FF_BUG_DIRECT_BLOCKSIZE 512
3259 +#define FF_BUG_EDGE 1024
3260 +#define FF_BUG_HPEL_CHROMA 2048
3261 +#define FF_BUG_DC_CLIP 4096
3262 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
3263 +#define FF_BUG_TRUNCATED 16384
3264 +#define FF_BUG_IEDGE 32768
3267 + * strictly follow the standard (MPEG-4, ...).
3268 + * - encoding: Set by user.
3269 + * - decoding: Set by user.
3270 + * Setting this to STRICT or higher means the encoder and decoder will
3271 + * generally do stupid things, whereas setting it to unofficial or lower
3272 + * will mean the encoder might produce output that is not supported by all
3273 + * spec-compliant decoders. Decoders don't differentiate between normal,
3274 + * unofficial and experimental (that is, they always try to decode things
3275 + * when they can) unless they are explicitly asked to behave stupidly
3276 + * (=strictly conform to the specs)
3278 + int strict_std_compliance;
3279 +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
3280 +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
3281 +#define FF_COMPLIANCE_NORMAL 0
3282 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
3283 +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
3286 + * error concealment flags
3287 + * - encoding: unused
3288 + * - decoding: Set by user.
3290 + int error_concealment;
3291 +#define FF_EC_GUESS_MVS 1
3292 +#define FF_EC_DEBLOCK 2
3293 +#define FF_EC_FAVOR_INTER 256
3297 + * - encoding: Set by user.
3298 + * - decoding: Set by user.
3301 +#define FF_DEBUG_PICT_INFO 1
3302 +#define FF_DEBUG_RC 2
3303 +#define FF_DEBUG_BITSTREAM 4
3304 +#define FF_DEBUG_MB_TYPE 8
3305 +#define FF_DEBUG_QP 16
3306 +#if FF_API_DEBUG_MV
3308 + * @deprecated this option does nothing
3310 +#define FF_DEBUG_MV 32
3312 +#define FF_DEBUG_DCT_COEFF 0x00000040
3313 +#define FF_DEBUG_SKIP 0x00000080
3314 +#define FF_DEBUG_STARTCODE 0x00000100
3315 +#define FF_DEBUG_ER 0x00000400
3316 +#define FF_DEBUG_MMCO 0x00000800
3317 +#define FF_DEBUG_BUGS 0x00001000
3318 +#if FF_API_DEBUG_MV
3319 +#define FF_DEBUG_VIS_QP 0x00002000
3320 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000
3322 +#define FF_DEBUG_BUFFERS 0x00008000
3323 +#define FF_DEBUG_THREADS 0x00010000
3324 +#define FF_DEBUG_GREEN_MD 0x00800000
3325 +#define FF_DEBUG_NOMC 0x01000000
3327 +#if FF_API_DEBUG_MV
3330 + * - encoding: Set by user.
3331 + * - decoding: Set by user.
3334 +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
3335 +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
3336 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
3340 + * Error recognition; may misdetect some more or less valid parts as errors.
3341 + * - encoding: unused
3342 + * - decoding: Set by user.
3344 + int err_recognition;
3347 + * Verify checksums embedded in the bitstream (could be of either encoded or
3348 + * decoded data, depending on the codec) and print an error message on mismatch.
3349 + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
3350 + * decoder returning an error.
3352 +#define AV_EF_CRCCHECK (1<<0)
3353 +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
3354 +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length
3355 +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection
3357 +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue
3358 +#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
3359 +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors
3360 +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error
3364 + * opaque 64-bit number (generally a PTS) that will be reordered and
3365 + * output in AVFrame.reordered_opaque
3366 + * - encoding: unused
3367 + * - decoding: Set by user.
3369 + int64_t reordered_opaque;
3372 + * Hardware accelerator in use
3373 + * - encoding: unused.
3374 + * - decoding: Set by libavcodec
3376 + const struct AVHWAccel *hwaccel;
3379 + * Hardware accelerator context.
3380 + * For some hardware accelerators, a global context needs to be
3381 + * provided by the user. In that case, this holds display-dependent
3382 + * data FFmpeg cannot instantiate itself. Please refer to the
3383 + * FFmpeg HW accelerator documentation to know how to fill this
3384 + * is. e.g. for VA API, this is a struct vaapi_context.
3385 + * - encoding: unused
3386 + * - decoding: Set by user
3388 + void *hwaccel_context;
3392 + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
3393 + * - decoding: unused
3395 + uint64_t error[AV_NUM_DATA_POINTERS];
3398 + * DCT algorithm, see FF_DCT_* below
3399 + * - encoding: Set by user.
3400 + * - decoding: unused
3403 +#define FF_DCT_AUTO 0
3404 +#define FF_DCT_FASTINT 1
3405 +#define FF_DCT_INT 2
3406 +#define FF_DCT_MMX 3
3407 +#define FF_DCT_ALTIVEC 5
3408 +#define FF_DCT_FAAN 6
3411 + * IDCT algorithm, see FF_IDCT_* below.
3412 + * - encoding: Set by user.
3413 + * - decoding: Set by user.
3416 +#define FF_IDCT_AUTO 0
3417 +#define FF_IDCT_INT 1
3418 +#define FF_IDCT_SIMPLE 2
3419 +#define FF_IDCT_SIMPLEMMX 3
3420 +#define FF_IDCT_ARM 7
3421 +#define FF_IDCT_ALTIVEC 8
3422 +#define FF_IDCT_SIMPLEARM 10
3423 +#define FF_IDCT_XVID 14
3424 +#define FF_IDCT_SIMPLEARMV5TE 16
3425 +#define FF_IDCT_SIMPLEARMV6 17
3426 +#define FF_IDCT_FAAN 20
3427 +#define FF_IDCT_SIMPLENEON 22
3428 +#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
3429 +#define FF_IDCT_SIMPLEAUTO 128
3432 + * bits per sample/pixel from the demuxer (needed for huffyuv).
3433 + * - encoding: Set by libavcodec.
3434 + * - decoding: Set by user.
3436 + int bits_per_coded_sample;
3439 + * Bits per sample/pixel of internal libavcodec pixel/sample format.
3440 + * - encoding: set by user.
3441 + * - decoding: set by libavcodec.
3443 + int bits_per_raw_sample;
3447 + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3448 + * - encoding: unused
3449 + * - decoding: Set by user.
3454 +#if FF_API_CODED_FRAME
3456 + * the picture in the bitstream
3457 + * - encoding: Set by libavcodec.
3458 + * - decoding: unused
3460 + * @deprecated use the quality factor packet side data instead
3462 + attribute_deprecated AVFrame *coded_frame;
3467 + * is used to decide how many independent tasks should be passed to execute()
3468 + * - encoding: Set by user.
3469 + * - decoding: Set by user.
3474 + * Which multithreading methods to use.
3475 + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
3476 + * so clients which cannot provide future frames should not use it.
3478 + * - encoding: Set by user, otherwise the default is used.
3479 + * - decoding: Set by user, otherwise the default is used.
3482 +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
3483 +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
3486 + * Which multithreading methods are in use by the codec.
3487 + * - encoding: Set by libavcodec.
3488 + * - decoding: Set by libavcodec.
3490 + int active_thread_type;
3493 + * Set by the client if its custom get_buffer() callback can be called
3494 + * synchronously from another thread, which allows faster multithreaded decoding.
3495 + * draw_horiz_band() will be called from other threads regardless of this setting.
3496 + * Ignored if the default get_buffer() is used.
3497 + * - encoding: Set by user.
3498 + * - decoding: Set by user.
3500 + int thread_safe_callbacks;
3503 + * The codec may call this to execute several independent things.
3504 + * It will return only after finishing all tasks.
3505 + * The user may replace this with some multithreaded implementation,
3506 + * the default implementation will execute the parts serially.
3507 + * @param count the number of things to execute
3508 + * - encoding: Set by libavcodec, user can override.
3509 + * - decoding: Set by libavcodec, user can override.
3511 + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3514 + * The codec may call this to execute several independent things.
3515 + * It will return only after finishing all tasks.
3516 + * The user may replace this with some multithreaded implementation,
3517 + * the default implementation will execute the parts serially.
3518 + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
3519 + * @param c context passed also to func
3520 + * @param count the number of things to execute
3521 + * @param arg2 argument passed unchanged to func
3522 + * @param ret return values of executed functions, must have space for "count" values. May be NULL.
3523 + * @param func function that will be called count times, with jobnr from 0 to count-1.
3524 + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
3525 + * two instances of func executing at the same time will have the same threadnr.
3526 + * @return always 0 currently, but code should handle a future improvement where when any call to func
3527 + * returns < 0 no further calls to func may be done and < 0 is returned.
3528 + * - encoding: Set by libavcodec, user can override.
3529 + * - decoding: Set by libavcodec, user can override.
3531 + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3534 + * noise vs. sse weight for the nsse comparison function
3535 + * - encoding: Set by user.
3536 + * - decoding: unused
3542 + * - encoding: Set by user.
3543 + * - decoding: Set by libavcodec.
3546 +#define FF_PROFILE_UNKNOWN -99
3547 +#define FF_PROFILE_RESERVED -100
3549 +#define FF_PROFILE_AAC_MAIN 0
3550 +#define FF_PROFILE_AAC_LOW 1
3551 +#define FF_PROFILE_AAC_SSR 2
3552 +#define FF_PROFILE_AAC_LTP 3
3553 +#define FF_PROFILE_AAC_HE 4
3554 +#define FF_PROFILE_AAC_HE_V2 28
3555 +#define FF_PROFILE_AAC_LD 22
3556 +#define FF_PROFILE_AAC_ELD 38
3557 +#define FF_PROFILE_MPEG2_AAC_LOW 128
3558 +#define FF_PROFILE_MPEG2_AAC_HE 131
3560 +#define FF_PROFILE_DNXHD 0
3561 +#define FF_PROFILE_DNXHR_LB 1
3562 +#define FF_PROFILE_DNXHR_SQ 2
3563 +#define FF_PROFILE_DNXHR_HQ 3
3564 +#define FF_PROFILE_DNXHR_HQX 4
3565 +#define FF_PROFILE_DNXHR_444 5
3567 +#define FF_PROFILE_DTS 20
3568 +#define FF_PROFILE_DTS_ES 30
3569 +#define FF_PROFILE_DTS_96_24 40
3570 +#define FF_PROFILE_DTS_HD_HRA 50
3571 +#define FF_PROFILE_DTS_HD_MA 60
3572 +#define FF_PROFILE_DTS_EXPRESS 70
3574 +#define FF_PROFILE_MPEG2_422 0
3575 +#define FF_PROFILE_MPEG2_HIGH 1
3576 +#define FF_PROFILE_MPEG2_SS 2
3577 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
3578 +#define FF_PROFILE_MPEG2_MAIN 4
3579 +#define FF_PROFILE_MPEG2_SIMPLE 5
3581 +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
3582 +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
3584 +#define FF_PROFILE_H264_BASELINE 66
3585 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3586 +#define FF_PROFILE_H264_MAIN 77
3587 +#define FF_PROFILE_H264_EXTENDED 88
3588 +#define FF_PROFILE_H264_HIGH 100
3589 +#define FF_PROFILE_H264_HIGH_10 110
3590 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
3591 +#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
3592 +#define FF_PROFILE_H264_HIGH_422 122
3593 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
3594 +#define FF_PROFILE_H264_STEREO_HIGH 128
3595 +#define FF_PROFILE_H264_HIGH_444 144
3596 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
3597 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
3598 +#define FF_PROFILE_H264_CAVLC_444 44
3600 +#define FF_PROFILE_VC1_SIMPLE 0
3601 +#define FF_PROFILE_VC1_MAIN 1
3602 +#define FF_PROFILE_VC1_COMPLEX 2
3603 +#define FF_PROFILE_VC1_ADVANCED 3
3605 +#define FF_PROFILE_MPEG4_SIMPLE 0
3606 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
3607 +#define FF_PROFILE_MPEG4_CORE 2
3608 +#define FF_PROFILE_MPEG4_MAIN 3
3609 +#define FF_PROFILE_MPEG4_N_BIT 4
3610 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
3611 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
3612 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
3613 +#define FF_PROFILE_MPEG4_HYBRID 8
3614 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
3615 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
3616 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
3617 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
3618 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3619 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
3620 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
3622 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
3623 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
3624 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
3625 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
3626 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
3628 +#define FF_PROFILE_VP9_0 0
3629 +#define FF_PROFILE_VP9_1 1
3630 +#define FF_PROFILE_VP9_2 2
3631 +#define FF_PROFILE_VP9_3 3
3633 +#define FF_PROFILE_HEVC_MAIN 1
3634 +#define FF_PROFILE_HEVC_MAIN_10 2
3635 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
3636 +#define FF_PROFILE_HEVC_REXT 4
3638 +#define FF_PROFILE_AV1_MAIN 0
3639 +#define FF_PROFILE_AV1_HIGH 1
3640 +#define FF_PROFILE_AV1_PROFESSIONAL 2
3642 +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
3643 +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
3644 +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
3645 +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
3646 +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
3648 +#define FF_PROFILE_SBC_MSBC 1
3652 + * - encoding: Set by user.
3653 + * - decoding: Set by libavcodec.
3656 +#define FF_LEVEL_UNKNOWN -99
3659 + * Skip loop filtering for selected frames.
3660 + * - encoding: unused
3661 + * - decoding: Set by user.
3663 + enum AVDiscard skip_loop_filter;
3666 + * Skip IDCT/dequantization for selected frames.
3667 + * - encoding: unused
3668 + * - decoding: Set by user.
3670 + enum AVDiscard skip_idct;
3673 + * Skip decoding for selected frames.
3674 + * - encoding: unused
3675 + * - decoding: Set by user.
3677 + enum AVDiscard skip_frame;
3680 + * Header containing style information for text subtitles.
3681 + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3682 + * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3683 + * the Format line following. It shouldn't include any Dialogue line.
3684 + * - encoding: Set/allocated/freed by user (before avcodec_open2())
3685 + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3687 + uint8_t *subtitle_header;
3688 + int subtitle_header_size;
3690 +#if FF_API_VBV_DELAY
3692 + * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3693 + * Used for compliant TS muxing.
3694 + * - encoding: Set by libavcodec.
3695 + * - decoding: unused.
3696 + * @deprecated this value is now exported as a part of
3697 + * AV_PKT_DATA_CPB_PROPERTIES packet side data
3699 + attribute_deprecated
3700 + uint64_t vbv_delay;
3703 +#if FF_API_SIDEDATA_ONLY_PKT
3705 + * Encoding only and set by default. Allow encoders to output packets
3706 + * that do not contain any encoded data, only side data.
3708 + * Some encoders need to output such packets, e.g. to update some stream
3709 + * parameters at the end of encoding.
3711 + * @deprecated this field disables the default behaviour and
3712 + * it is kept only for compatibility.
3714 + attribute_deprecated
3715 + int side_data_only_packets;
3719 + * Audio only. The number of "priming" samples (padding) inserted by the
3720 + * encoder at the beginning of the audio. I.e. this number of leading
3721 + * decoded samples must be discarded by the caller to get the original audio
3722 + * without leading padding.
3724 + * - decoding: unused
3725 + * - encoding: Set by libavcodec. The timestamps on the output packets are
3726 + * adjusted by the encoder so that they always refer to the
3727 + * first sample of the data actually contained in the packet,
3728 + * including any added padding. E.g. if the timebase is
3729 + * 1/samplerate and the timestamp of the first input sample is
3730 + * 0, the timestamp of the first output packet will be
3731 + * -initial_padding.
3733 + int initial_padding;
3736 + * - decoding: For codecs that store a framerate value in the compressed
3737 + * bitstream, the decoder may export it here. { 0, 1} when
3739 + * - encoding: May be used to signal the framerate of CFR content to an
3742 + AVRational framerate;
3745 + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3746 + * - encoding: unused.
3747 + * - decoding: Set by libavcodec before calling get_format()
3749 + enum AVPixelFormat sw_pix_fmt;
3752 + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3753 + * - encoding unused.
3754 + * - decoding set by user.
3756 + AVRational pkt_timebase;
3759 + * AVCodecDescriptor
3760 + * - encoding: unused.
3761 + * - decoding: set by libavcodec.
3763 + const AVCodecDescriptor *codec_descriptor;
3767 + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3768 + * - encoding: unused
3769 + * - decoding: Set by user.
3775 + * Current statistics for PTS correction.
3776 + * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3777 + * - encoding: unused
3779 + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3780 + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3781 + int64_t pts_correction_last_pts; /// PTS of the last frame
3782 + int64_t pts_correction_last_dts; /// DTS of the last frame
3785 + * Character encoding of the input subtitles file.
3786 + * - decoding: set by user
3787 + * - encoding: unused
3789 + char *sub_charenc;
3792 + * Subtitles character encoding mode. Formats or codecs might be adjusting
3793 + * this setting (if they are doing the conversion themselves for instance).
3794 + * - decoding: set by libavcodec
3795 + * - encoding: unused
3797 + int sub_charenc_mode;
3798 +#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
3799 +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself
3800 +#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
3801 +#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8
3804 + * Skip processing alpha if supported by codec.
3805 + * Note that if the format uses pre-multiplied alpha (common with VP6,
3806 + * and recommended due to better video quality/compression)
3807 + * the image will look as if alpha-blended onto a black background.
3808 + * However for formats that do not use pre-multiplied alpha
3809 + * there might be serious artefacts (though e.g. libswscale currently
3810 + * assumes pre-multiplied alpha anyway).
3812 + * - decoding: set by user
3813 + * - encoding: unused
3818 + * Number of samples to skip after a discontinuity
3819 + * - decoding: unused
3820 + * - encoding: set by libavcodec
3824 +#if !FF_API_DEBUG_MV
3826 + * debug motion vectors
3827 + * - encoding: Set by user.
3828 + * - decoding: Set by user.
3831 +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
3832 +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
3833 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3837 + * custom intra quantization matrix
3838 + * - encoding: Set by user, can be NULL.
3839 + * - decoding: unused.
3841 + uint16_t *chroma_intra_matrix;
3844 + * dump format separator.
3845 + * can be ", " or "\n " or anything else
3846 + * - encoding: Set by user.
3847 + * - decoding: Set by user.
3849 + uint8_t *dump_separator;
3852 + * ',' separated list of allowed decoders.
3853 + * If NULL then all are allowed
3854 + * - encoding: unused
3855 + * - decoding: set by user
3857 + char *codec_whitelist;
3860 + * Properties of the stream that gets decoded
3861 + * - encoding: unused
3862 + * - decoding: set by libavcodec
3864 + unsigned properties;
3865 +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
3866 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3869 + * Additional data associated with the entire coded stream.
3871 + * - decoding: unused
3872 + * - encoding: may be set by libavcodec after avcodec_open2().
3874 + AVPacketSideData *coded_side_data;
3875 + int nb_coded_side_data;
3878 + * A reference to the AVHWFramesContext describing the input (for encoding)
3879 + * or output (decoding) frames. The reference is set by the caller and
3880 + * afterwards owned (and freed) by libavcodec - it should never be read by
3881 + * the caller after being set.
3883 + * - decoding: This field should be set by the caller from the get_format()
3884 + * callback. The previous reference (if any) will always be
3885 + * unreffed by libavcodec before the get_format() call.
3887 + * If the default get_buffer2() is used with a hwaccel pixel
3888 + * format, then this AVHWFramesContext will be used for
3889 + * allocating the frame buffers.
3891 + * - encoding: For hardware encoders configured to use a hwaccel pixel
3892 + * format, this field should be set by the caller to a reference
3893 + * to the AVHWFramesContext describing input frames.
3894 + * AVHWFramesContext.format must be equal to
3895 + * AVCodecContext.pix_fmt.
3897 + * This field should be set before avcodec_open2() is called.
3899 + AVBufferRef *hw_frames_ctx;
3902 + * Control the form of AVSubtitle.rects[N]->ass
3903 + * - decoding: set by user
3904 + * - encoding: unused
3906 + int sub_text_format;
3907 +#define FF_SUB_TEXT_FMT_ASS 0
3908 +#if FF_API_ASS_TIMING
3909 +#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3913 + * Audio only. The amount of padding (in samples) appended by the encoder to
3914 + * the end of the audio. I.e. this number of decoded samples must be
3915 + * discarded by the caller from the end of the stream to get the original
3916 + * audio without any trailing padding.
3918 + * - decoding: unused
3919 + * - encoding: unused
3921 + int trailing_padding;
3924 + * The number of pixels per image to maximally accept.
3926 + * - decoding: set by user
3927 + * - encoding: set by user
3929 + int64_t max_pixels;
3932 + * A reference to the AVHWDeviceContext describing the device which will
3933 + * be used by a hardware encoder/decoder. The reference is set by the
3934 + * caller and afterwards owned (and freed) by libavcodec.
3936 + * This should be used if either the codec device does not require
3937 + * hardware frames or any that are used are to be allocated internally by
3938 + * libavcodec. If the user wishes to supply any of the frames used as
3939 + * encoder input or decoder output then hw_frames_ctx should be used
3940 + * instead. When hw_frames_ctx is set in get_format() for a decoder, this
3941 + * field will be ignored while decoding the associated stream segment, but
3942 + * may again be used on a following one after another get_format() call.
3944 + * For both encoders and decoders this field should be set before
3945 + * avcodec_open2() is called and must not be written to thereafter.
3947 + * Note that some decoders may require this field to be set initially in
3948 + * order to support hw_frames_ctx at all - in that case, all frames
3949 + * contexts used must be created on the same device.
3951 + AVBufferRef *hw_device_ctx;
3954 + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
3955 + * decoding (if active).
3956 + * - encoding: unused
3957 + * - decoding: Set by user (either before avcodec_open2(), or in the
3958 + * AVCodecContext.get_format callback)
3960 + int hwaccel_flags;
3963 + * Video decoding only. Certain video codecs support cropping, meaning that
3964 + * only a sub-rectangle of the decoded frame is intended for display. This
3965 + * option controls how cropping is handled by libavcodec.
3967 + * When set to 1 (the default), libavcodec will apply cropping internally.
3968 + * I.e. it will modify the output frame width/height fields and offset the
3969 + * data pointers (only by as much as possible while preserving alignment, or
3970 + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3971 + * the frames output by the decoder refer only to the cropped area. The
3972 + * crop_* fields of the output frames will be zero.
3974 + * When set to 0, the width/height fields of the output frames will be set
3975 + * to the coded dimensions and the crop_* fields will describe the cropping
3976 + * rectangle. Applying the cropping is left to the caller.
3978 + * @warning When hardware acceleration with opaque output frames is used,
3979 + * libavcodec is unable to apply cropping from the top/left border.
3981 + * @note when this option is set to zero, the width/height fields of the
3982 + * AVCodecContext and output AVFrames have different meanings. The codec
3983 + * context fields store display dimensions (with the coded dimensions in
3984 + * coded_width/height), while the frame fields store the coded dimensions
3985 + * (with the display dimensions being determined by the crop_* fields).
3987 + int apply_cropping;
3990 + * Video decoding only. Sets the number of extra hardware frames which
3991 + * the decoder will allocate for use by the caller. This must be set
3992 + * before avcodec_open2() is called.
3994 + * Some hardware decoders require all frames that they will use for
3995 + * output to be defined in advance before decoding starts. For such
3996 + * decoders, the hardware frame pool must therefore be of a fixed size.
3997 + * The extra frames set here are on top of any number that the decoder
3998 + * needs internally in order to operate normally (for example, frames
3999 + * used as reference pictures).
4001 + int extra_hw_frames;
4004 +#if FF_API_CODEC_GET_SET
4006 + * Accessors for some AVCodecContext fields. These used to be provided for ABI
4007 + * compatibility, and do not need to be used anymore.
4009 +attribute_deprecated
4010 +AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
4011 +attribute_deprecated
4012 +void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val);
4014 +attribute_deprecated
4015 +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
4016 +attribute_deprecated
4017 +void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
4019 +attribute_deprecated
4020 +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
4023 +attribute_deprecated
4024 +int av_codec_get_lowres(const AVCodecContext *avctx);
4025 +attribute_deprecated
4026 +void av_codec_set_lowres(AVCodecContext *avctx, int val);
4029 +attribute_deprecated
4030 +int av_codec_get_seek_preroll(const AVCodecContext *avctx);
4031 +attribute_deprecated
4032 +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
4034 +attribute_deprecated
4035 +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
4036 +attribute_deprecated
4037 +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
4043 +typedef struct AVProfile {
4045 + const char *name; ///< short name for the profile
4050 + * The codec supports this format via the hw_device_ctx interface.
4052 + * When selecting this format, AVCodecContext.hw_device_ctx should
4053 + * have been set to a device of the specified type before calling
4054 + * avcodec_open2().
4056 + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
4058 + * The codec supports this format via the hw_frames_ctx interface.
4060 + * When selecting this format for a decoder,
4061 + * AVCodecContext.hw_frames_ctx should be set to a suitable frames
4062 + * context inside the get_format() callback. The frames context
4063 + * must have been created on a device of the specified type.
4065 + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
4067 + * The codec supports this format by some internal method.
4069 + * This format can be selected without any additional configuration -
4070 + * no device or frames context is required.
4072 + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
4074 + * The codec supports this format by some ad-hoc method.
4076 + * Additional settings and/or function calls are required. See the
4077 + * codec-specific documentation for details. (Methods requiring
4078 + * this sort of configuration are deprecated and others should be
4079 + * used in preference.)
4081 + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
4084 +typedef struct AVCodecHWConfig {
4086 + * A hardware pixel format which the codec can use.
4088 + enum AVPixelFormat pix_fmt;
4090 + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
4091 + * setup methods which can be used with this configuration.
4095 + * The device type associated with the configuration.
4097 + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
4098 + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
4100 + enum AVHWDeviceType device_type;
4103 +typedef struct AVCodecDefault AVCodecDefault;
4110 +typedef struct AVCodec {
4112 + * Name of the codec implementation.
4113 + * The name is globally unique among encoders and among decoders (but an
4114 + * encoder and a decoder can share the same name).
4115 + * This is the primary way to find a codec from the user perspective.
4119 + * Descriptive name for the codec, meant to be more human readable than name.
4120 + * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
4122 + const char *long_name;
4123 + enum AVMediaType type;
4124 + enum AVCodecID id;
4126 + * Codec capabilities.
4127 + * see AV_CODEC_CAP_*
4130 + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
4131 + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
4132 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
4133 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
4134 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
4135 + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
4136 + const AVClass *priv_class; ///< AVClass for the private context
4137 + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
4140 + * Group name of the codec implementation.
4141 + * This is a short symbolic name of the wrapper backing this codec. A
4142 + * wrapper uses some kind of external implementation for the codec, such
4143 + * as an external library, or a codec implementation provided by the OS or
4145 + * If this field is NULL, this is a builtin, libavcodec native codec.
4146 + * If non-NULL, this will be the suffix in AVCodec.name in most cases
4147 + * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
4149 + const char *wrapper_name;
4151 + /*****************************************************************
4152 + * No fields below this line are part of the public API. They
4153 + * may not be used outside of libavcodec and can be changed and
4154 + * removed at will.
4155 + * New public fields should be added right above.
4156 + *****************************************************************
4158 + int priv_data_size;
4159 + struct AVCodec *next;
4161 + * @name Frame-level threading support functions
4165 + * If defined, called on thread contexts when they are created.
4166 + * If the codec allocates writable tables in init(), re-allocate them here.
4167 + * priv_data will be set to a copy of the original.
4169 + int (*init_thread_copy)(AVCodecContext *);
4171 + * Copy necessary context variables from a previous thread context to the current one.
4172 + * If not defined, the next thread will start automatically; otherwise, the codec
4173 + * must call ff_thread_finish_setup().
4175 + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
4177 + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
4181 + * Private codec-specific defaults.
4183 + const AVCodecDefault *defaults;
4186 + * Initialize codec static data, called from avcodec_register().
4188 + * This is not intended for time consuming operations as it is
4189 + * run for every codec regardless of that codec being used.
4191 + void (*init_static_data)(struct AVCodec *codec);
4193 + int (*init)(AVCodecContext *);
4194 + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
4195 + const struct AVSubtitle *sub);
4197 + * Encode data to an AVPacket.
4199 + * @param avctx codec context
4200 + * @param avpkt output AVPacket (may contain a user-provided buffer)
4201 + * @param[in] frame AVFrame containing the raw data to be encoded
4202 + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
4203 + * non-empty packet was returned in avpkt.
4204 + * @return 0 on success, negative error code on failure
4206 + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
4207 + int *got_packet_ptr);
4208 + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
4209 + int (*close)(AVCodecContext *);
4211 + * Encode API with decoupled packet/frame dataflow. The API is the
4212 + * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
4214 + * - never called if the codec is closed or the wrong type,
4215 + * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
4216 + * - only one drain frame is ever passed down,
4218 + int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
4219 + int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
4222 + * Decode API with decoupled packet/frame dataflow. This function is called
4223 + * to get one output frame. It should call ff_decode_get_packet() to obtain
4226 + int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
4229 + * Will be called when seeking
4231 + void (*flush)(AVCodecContext *);
4233 + * Internal codec capabilities.
4234 + * See FF_CODEC_CAP_* in internal.h
4236 + int caps_internal;
4239 + * Decoding only, a comma-separated list of bitstream filters to apply to
4240 + * packets before decoding.
4245 + * Array of pointers to hardware configurations supported by the codec,
4246 + * or NULL if no hardware supported. The array is terminated by a NULL
4249 + * The user can only access this field via avcodec_get_hw_config().
4251 + const struct AVCodecHWConfigInternal **hw_configs;
4254 +#if FF_API_CODEC_GET_SET
4255 +attribute_deprecated
4256 +int av_codec_get_max_lowres(const AVCodec *codec);
4259 +struct MpegEncContext;
4262 + * Retrieve supported hardware configurations for a codec.
4264 + * Values of index from zero to some maximum return the indexed configuration
4265 + * descriptor; all other values return NULL. If the codec does not support
4266 + * any hardware configurations then it will always return NULL.
4268 +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
4271 + * @defgroup lavc_hwaccel AVHWAccel
4273 + * @note Nothing in this structure should be accessed by the user. At some
4274 + * point in future it will not be externally visible at all.
4278 +typedef struct AVHWAccel {
4280 + * Name of the hardware accelerated codec.
4281 + * The name is globally unique among encoders and among decoders (but an
4282 + * encoder and a decoder can share the same name).
4287 + * Type of codec implemented by the hardware accelerator.
4289 + * See AVMEDIA_TYPE_xxx
4291 + enum AVMediaType type;
4294 + * Codec implemented by the hardware accelerator.
4296 + * See AV_CODEC_ID_xxx
4298 + enum AVCodecID id;
4301 + * Supported pixel format.
4303 + * Only hardware accelerated formats are supported here.
4305 + enum AVPixelFormat pix_fmt;
4308 + * Hardware accelerated codec capabilities.
4309 + * see AV_HWACCEL_CODEC_CAP_*
4313 + /*****************************************************************
4314 + * No fields below this line are part of the public API. They
4315 + * may not be used outside of libavcodec and can be changed and
4316 + * removed at will.
4317 + * New public fields should be added right above.
4318 + *****************************************************************
4322 + * Allocate a custom buffer
4324 + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
4327 + * Called at the beginning of each frame or field picture.
4329 + * Meaningful frame information (codec specific) is guaranteed to
4330 + * be parsed at this point. This function is mandatory.
4332 + * Note that buf can be NULL along with buf_size set to 0.
4333 + * Otherwise, this means the whole frame is available at this point.
4335 + * @param avctx the codec context
4336 + * @param buf the frame data buffer base
4337 + * @param buf_size the size of the frame in bytes
4338 + * @return zero if successful, a negative value otherwise
4340 + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4343 + * Callback for parameter data (SPS/PPS/VPS etc).
4345 + * Useful for hardware decoders which keep persistent state about the
4346 + * video parameters, and need to receive any changes to update that state.
4348 + * @param avctx the codec context
4349 + * @param type the nal unit type
4350 + * @param buf the nal unit data buffer
4351 + * @param buf_size the size of the nal unit in bytes
4352 + * @return zero if successful, a negative value otherwise
4354 + int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
4357 + * Callback for each slice.
4359 + * Meaningful slice information (codec specific) is guaranteed to
4360 + * be parsed at this point. This function is mandatory.
4361 + * The only exception is XvMC, that works on MB level.
4363 + * @param avctx the codec context
4364 + * @param buf the slice data buffer base
4365 + * @param buf_size the size of the slice in bytes
4366 + * @return zero if successful, a negative value otherwise
4368 + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4371 + * Called at the end of each frame or field picture.
4373 + * The whole picture is parsed at this point and can now be sent
4374 + * to the hardware accelerator. This function is mandatory.
4376 + * @param avctx the codec context
4377 + * @return zero if successful, a negative value otherwise
4379 + int (*end_frame)(AVCodecContext *avctx);
4382 + * Size of per-frame hardware accelerator private data.
4384 + * Private data is allocated with av_mallocz() before
4385 + * AVCodecContext.get_buffer() and deallocated after
4386 + * AVCodecContext.release_buffer().
4388 + int frame_priv_data_size;
4391 + * Called for every Macroblock in a slice.
4393 + * XvMC uses it to replace the ff_mpv_reconstruct_mb().
4394 + * Instead of decoding to raw picture, MB parameters are
4395 + * stored in an array provided by the video driver.
4397 + * @param s the mpeg context
4399 + void (*decode_mb)(struct MpegEncContext *s);
4402 + * Initialize the hwaccel private data.
4404 + * This will be called from ff_get_format(), after hwaccel and
4405 + * hwaccel_context are set and the hwaccel private data in AVCodecInternal
4408 + int (*init)(AVCodecContext *avctx);
4411 + * Uninitialize the hwaccel private data.
4413 + * This will be called from get_format() or avcodec_close(), after hwaccel
4414 + * and hwaccel_context are already uninitialized.
4416 + int (*uninit)(AVCodecContext *avctx);
4419 + * Size of the private data to allocate in
4420 + * AVCodecInternal.hwaccel_priv_data.
4422 + int priv_data_size;
4425 + * Internal hwaccel capabilities.
4427 + int caps_internal;
4430 + * Fill the given hw_frames context with current codec parameters. Called
4431 + * from get_format. Refer to avcodec_get_hw_frames_parameters() for
4434 + * This CAN be called before AVHWAccel.init is called, and you must assume
4435 + * that avctx->hwaccel_priv_data is invalid.
4437 + int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
4441 + * HWAccel is experimental and is thus avoided in favor of non experimental
4444 +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
4447 + * Hardware acceleration should be used for decoding even if the codec level
4448 + * used is unknown or higher than the maximum supported level reported by the
4449 + * hardware driver.
4451 + * It's generally a good idea to pass this flag unless you have a specific
4452 + * reason not to, as hardware tends to under-report supported levels.
4454 +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
4457 + * Hardware acceleration can output YUV pixel formats with a different chroma
4458 + * sampling than 4:2:0 and/or other than 8 bits per component.
4460 +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
4463 + * Hardware acceleration should still be attempted for decoding when the
4464 + * codec profile does not match the reported capabilities of the hardware.
4466 + * For example, this can be used to try to decode baseline profile H.264
4467 + * streams in hardware - it will often succeed, because many streams marked
4468 + * as baseline profile actually conform to constrained baseline profile.
4470 + * @warning If the stream is actually not supported then the behaviour is
4471 + * undefined, and may include returning entirely incorrect output
4472 + * while indicating success.
4474 +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
4480 +#if FF_API_AVPICTURE
4482 + * @defgroup lavc_picture AVPicture
4484 + * Functions for working with AVPicture
4489 + * Picture data structure.
4491 + * Up to four components can be stored into it, the last component is
4493 + * @deprecated use AVFrame or imgutils functions instead
4495 +typedef struct AVPicture {
4496 + attribute_deprecated
4497 + uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes
4498 + attribute_deprecated
4499 + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
4507 +enum AVSubtitleType {
4510 + SUBTITLE_BITMAP, ///< A bitmap, pict will be set
4513 + * Plain text, the text field must be set by the decoder and is
4514 + * authoritative. ass and pict fields may contain approximations.
4519 + * Formatted text, the ass field must be set by the decoder and is
4520 + * authoritative. pict and text fields may contain approximations.
4525 +#define AV_SUBTITLE_FLAG_FORCED 0x00000001
4527 +typedef struct AVSubtitleRect {
4528 + int x; ///< top left corner of pict, undefined when pict is not set
4529 + int y; ///< top left corner of pict, undefined when pict is not set
4530 + int w; ///< width of pict, undefined when pict is not set
4531 + int h; ///< height of pict, undefined when pict is not set
4532 + int nb_colors; ///< number of colors in pict, undefined when pict is not set
4534 +#if FF_API_AVPICTURE
4536 + * @deprecated unused
4538 + attribute_deprecated
4542 + * data+linesize for the bitmap of this subtitle.
4543 + * Can be set for text/ass as well once they are rendered.
4548 + enum AVSubtitleType type;
4550 + char *text; ///< 0 terminated plain UTF-8 text
4553 + * 0 terminated ASS/SSA compatible event line.
4554 + * The presentation of this is unaffected by the other values in this
4562 +typedef struct AVSubtitle {
4563 + uint16_t format; /* 0 = graphics */
4564 + uint32_t start_display_time; /* relative to packet pts, in ms */
4565 + uint32_t end_display_time; /* relative to packet pts, in ms */
4566 + unsigned num_rects;
4567 + AVSubtitleRect **rects;
4568 + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
4572 + * This struct describes the properties of an encoded stream.
4574 + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
4575 + * be allocated with avcodec_parameters_alloc() and freed with
4576 + * avcodec_parameters_free().
4578 +typedef struct AVCodecParameters {
4580 + * General type of the encoded data.
4582 + enum AVMediaType codec_type;
4584 + * Specific type of the encoded data (the codec used).
4586 + enum AVCodecID codec_id;
4588 + * Additional information about the codec (corresponds to the AVI FOURCC).
4590 + uint32_t codec_tag;
4593 + * Extra binary data needed for initializing the decoder, codec-dependent.
4595 + * Must be allocated with av_malloc() and will be freed by
4596 + * avcodec_parameters_free(). The allocated size of extradata must be at
4597 + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
4600 + uint8_t *extradata;
4602 + * Size of the extradata content in bytes.
4604 + int extradata_size;
4607 + * - video: the pixel format, the value corresponds to enum AVPixelFormat.
4608 + * - audio: the sample format, the value corresponds to enum AVSampleFormat.
4613 + * The average bitrate of the encoded data (in bits per second).
4618 + * The number of bits per sample in the codedwords.
4620 + * This is basically the bitrate per sample. It is mandatory for a bunch of
4621 + * formats to actually decode them. It's the number of bits for one sample in
4622 + * the actual coded bitstream.
4624 + * This could be for example 4 for ADPCM
4625 + * For PCM formats this matches bits_per_raw_sample
4628 + int bits_per_coded_sample;
4631 + * This is the number of valid bits in each output sample. If the
4632 + * sample format has more bits, the least significant bits are additional
4633 + * padding bits, which are always 0. Use right shifts to reduce the sample
4634 + * to its actual size. For example, audio formats with 24 bit samples will
4635 + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
4636 + * To get the original sample use "(int32_t)sample >> 8"."
4638 + * For ADPCM this might be 12 or 16 or similar
4641 + int bits_per_raw_sample;
4644 + * Codec-specific bitstream restrictions that the stream conforms to.
4650 + * Video only. The dimensions of the video frame in pixels.
4656 + * Video only. The aspect ratio (width / height) which a single pixel
4657 + * should have when displayed.
4659 + * When the aspect ratio is unknown / undefined, the numerator should be
4660 + * set to 0 (the denominator may have any value).
4662 + AVRational sample_aspect_ratio;
4665 + * Video only. The order of the fields in interlaced video.
4667 + enum AVFieldOrder field_order;
4670 + * Video only. Additional colorspace characteristics.
4672 + enum AVColorRange color_range;
4673 + enum AVColorPrimaries color_primaries;
4674 + enum AVColorTransferCharacteristic color_trc;
4675 + enum AVColorSpace color_space;
4676 + enum AVChromaLocation chroma_location;
4679 + * Video only. Number of delayed frames.
4684 + * Audio only. The channel layout bitmask. May be 0 if the channel layout is
4685 + * unknown or unspecified, otherwise the number of bits set must be equal to
4686 + * the channels field.
4688 + uint64_t channel_layout;
4690 + * Audio only. The number of audio channels.
4694 + * Audio only. The number of audio samples per second.
4698 + * Audio only. The number of bytes per coded audio frame, required by some
4701 + * Corresponds to nBlockAlign in WAVEFORMATEX.
4705 + * Audio only. Audio frame size, if known. Required by some formats to be static.
4710 + * Audio only. The amount of padding (in samples) inserted by the encoder at
4711 + * the beginning of the audio. I.e. this number of leading decoded samples
4712 + * must be discarded by the caller to get the original audio without leading
4715 + int initial_padding;
4717 + * Audio only. The amount of padding (in samples) appended by the encoder to
4718 + * the end of the audio. I.e. this number of decoded samples must be
4719 + * discarded by the caller from the end of the stream to get the original
4720 + * audio without any trailing padding.
4722 + int trailing_padding;
4724 + * Audio only. Number of samples to skip after a discontinuity.
4727 +} AVCodecParameters;
4730 + * Iterate over all registered codecs.
4732 + * @param opaque a pointer where libavcodec will store the iteration state. Must
4733 + * point to NULL to start the iteration.
4735 + * @return the next registered codec or NULL when the iteration is
4738 +const AVCodec *av_codec_iterate(void **opaque);
4742 + * If c is NULL, returns the first registered codec,
4743 + * if c is non-NULL, returns the next registered codec after c,
4744 + * or NULL if c is the last one.
4746 +attribute_deprecated
4747 +AVCodec *av_codec_next(const AVCodec *c);
4751 + * Return the LIBAVCODEC_VERSION_INT constant.
4753 +unsigned avcodec_version(void);
4756 + * Return the libavcodec build-time configuration.
4758 +const char *avcodec_configuration(void);
4761 + * Return the libavcodec license.
4763 +const char *avcodec_license(void);
4767 + * Register the codec codec and initialize libavcodec.
4769 + * @warning either this function or avcodec_register_all() must be called
4770 + * before any other libavcodec functions.
4772 + * @see avcodec_register_all()
4774 +attribute_deprecated
4775 +void avcodec_register(AVCodec *codec);
4778 + * Register all the codecs, parsers and bitstream filters which were enabled at
4779 + * configuration time. If you do not call this function you can select exactly
4780 + * which formats you want to support, by using the individual registration
4783 + * @see avcodec_register
4784 + * @see av_register_codec_parser
4785 + * @see av_register_bitstream_filter
4787 +attribute_deprecated
4788 +void avcodec_register_all(void);
4792 + * Allocate an AVCodecContext and set its fields to default values. The
4793 + * resulting struct should be freed with avcodec_free_context().
4795 + * @param codec if non-NULL, allocate private data and initialize defaults
4796 + * for the given codec. It is illegal to then call avcodec_open2()
4797 + * with a different codec.
4798 + * If NULL, then the codec-specific defaults won't be initialized,
4799 + * which may result in suboptimal default settings (this is
4800 + * important mainly for encoders, e.g. libx264).
4802 + * @return An AVCodecContext filled with default values or NULL on failure.
4804 +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
4807 + * Free the codec context and everything associated with it and write NULL to
4808 + * the provided pointer.
4810 +void avcodec_free_context(AVCodecContext **avctx);
4812 +#if FF_API_GET_CONTEXT_DEFAULTS
4814 + * @deprecated This function should not be used, as closing and opening a codec
4815 + * context multiple time is not supported. A new codec context should be
4816 + * allocated for each new use.
4818 +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
4822 + * Get the AVClass for AVCodecContext. It can be used in combination with
4823 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4825 + * @see av_opt_find().
4827 +const AVClass *avcodec_get_class(void);
4829 +#if FF_API_COPY_CONTEXT
4831 + * Get the AVClass for AVFrame. It can be used in combination with
4832 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4834 + * @see av_opt_find().
4836 +const AVClass *avcodec_get_frame_class(void);
4839 + * Get the AVClass for AVSubtitleRect. It can be used in combination with
4840 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4842 + * @see av_opt_find().
4844 +const AVClass *avcodec_get_subtitle_rect_class(void);
4847 + * Copy the settings of the source AVCodecContext into the destination
4848 + * AVCodecContext. The resulting destination codec context will be
4849 + * unopened, i.e. you are required to call avcodec_open2() before you
4850 + * can use this AVCodecContext to decode/encode video/audio data.
4852 + * @param dest target codec context, should be initialized with
4853 + * avcodec_alloc_context3(NULL), but otherwise uninitialized
4854 + * @param src source codec context
4855 + * @return AVERROR() on error (e.g. memory allocation error), 0 on success
4857 + * @deprecated The semantics of this function are ill-defined and it should not
4858 + * be used. If you need to transfer the stream parameters from one codec context
4859 + * to another, use an intermediate AVCodecParameters instance and the
4860 + * avcodec_parameters_from_context() / avcodec_parameters_to_context()
4863 +attribute_deprecated
4864 +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
4868 + * Allocate a new AVCodecParameters and set its fields to default values
4869 + * (unknown/invalid/0). The returned struct must be freed with
4870 + * avcodec_parameters_free().
4872 +AVCodecParameters *avcodec_parameters_alloc(void);
4875 + * Free an AVCodecParameters instance and everything associated with it and
4876 + * write NULL to the supplied pointer.
4878 +void avcodec_parameters_free(AVCodecParameters **par);
4881 + * Copy the contents of src to dst. Any allocated fields in dst are freed and
4882 + * replaced with newly allocated duplicates of the corresponding fields in src.
4884 + * @return >= 0 on success, a negative AVERROR code on failure.
4886 +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
4889 + * Fill the parameters struct based on the values from the supplied codec
4890 + * context. Any allocated fields in par are freed and replaced with duplicates
4891 + * of the corresponding fields in codec.
4893 + * @return >= 0 on success, a negative AVERROR code on failure
4895 +int avcodec_parameters_from_context(AVCodecParameters *par,
4896 + const AVCodecContext *codec);
4899 + * Fill the codec context based on the values from the supplied codec
4900 + * parameters. Any allocated fields in codec that have a corresponding field in
4901 + * par are freed and replaced with duplicates of the corresponding field in par.
4902 + * Fields in codec that do not have a counterpart in par are not touched.
4904 + * @return >= 0 on success, a negative AVERROR code on failure.
4906 +int avcodec_parameters_to_context(AVCodecContext *codec,
4907 + const AVCodecParameters *par);
4910 + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
4911 + * function the context has to be allocated with avcodec_alloc_context3().
4913 + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
4914 + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
4915 + * retrieving a codec.
4917 + * @warning This function is not thread safe!
4919 + * @note Always call this function before using decoding routines (such as
4920 + * @ref avcodec_receive_frame()).
4923 + * avcodec_register_all();
4924 + * av_dict_set(&opts, "b", "2.5M", 0);
4925 + * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
4929 + * context = avcodec_alloc_context3(codec);
4931 + * if (avcodec_open2(context, codec, opts) < 0)
4935 + * @param avctx The context to initialize.
4936 + * @param codec The codec to open this context for. If a non-NULL codec has been
4937 + * previously passed to avcodec_alloc_context3() or
4938 + * for this context, then this parameter MUST be either NULL or
4939 + * equal to the previously passed codec.
4940 + * @param options A dictionary filled with AVCodecContext and codec-private options.
4941 + * On return this object will be filled with options that were not found.
4943 + * @return zero on success, a negative value on error
4944 + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
4945 + * av_dict_set(), av_opt_find().
4947 +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
4950 + * Close a given AVCodecContext and free all the data associated with it
4951 + * (but not the AVCodecContext itself).
4953 + * Calling this function on an AVCodecContext that hasn't been opened will free
4954 + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
4955 + * codec. Subsequent calls will do nothing.
4957 + * @note Do not use this function. Use avcodec_free_context() to destroy a
4958 + * codec context (either open or closed). Opening and closing a codec context
4959 + * multiple times is not supported anymore -- use multiple codec contexts
4962 +int avcodec_close(AVCodecContext *avctx);
4965 + * Free all allocated data in the given subtitle struct.
4967 + * @param sub AVSubtitle to free.
4969 +void avsubtitle_free(AVSubtitle *sub);
4976 + * @addtogroup lavc_packet
4981 + * Allocate an AVPacket and set its fields to default values. The resulting
4982 + * struct must be freed using av_packet_free().
4984 + * @return An AVPacket filled with default values or NULL on failure.
4986 + * @note this only allocates the AVPacket itself, not the data buffers. Those
4987 + * must be allocated through other means such as av_new_packet.
4989 + * @see av_new_packet
4991 +AVPacket *av_packet_alloc(void);
4994 + * Create a new packet that references the same data as src.
4996 + * This is a shortcut for av_packet_alloc()+av_packet_ref().
4998 + * @return newly created AVPacket on success, NULL on error.
5000 + * @see av_packet_alloc
5001 + * @see av_packet_ref
5003 +AVPacket *av_packet_clone(const AVPacket *src);
5006 + * Free the packet, if the packet is reference counted, it will be
5007 + * unreferenced first.
5009 + * @param pkt packet to be freed. The pointer will be set to NULL.
5010 + * @note passing NULL is a no-op.
5012 +void av_packet_free(AVPacket **pkt);
5015 + * Initialize optional fields of a packet with default values.
5017 + * Note, this does not touch the data and size members, which have to be
5018 + * initialized separately.
5020 + * @param pkt packet
5022 +void av_init_packet(AVPacket *pkt);
5025 + * Allocate the payload of a packet and initialize its fields with
5028 + * @param pkt packet
5029 + * @param size wanted payload size
5030 + * @return 0 if OK, AVERROR_xxx otherwise
5032 +int av_new_packet(AVPacket *pkt, int size);
5035 + * Reduce packet size, correctly zeroing padding
5037 + * @param pkt packet
5038 + * @param size new size
5040 +void av_shrink_packet(AVPacket *pkt, int size);
5043 + * Increase packet size, correctly zeroing padding
5045 + * @param pkt packet
5046 + * @param grow_by number of bytes by which to increase the size of the packet
5048 +int av_grow_packet(AVPacket *pkt, int grow_by);
5051 + * Initialize a reference-counted packet from av_malloc()ed data.
5053 + * @param pkt packet to be initialized. This function will set the data, size,
5054 + * buf and destruct fields, all others are left untouched.
5055 + * @param data Data allocated by av_malloc() to be used as packet data. If this
5056 + * function returns successfully, the data is owned by the underlying AVBuffer.
5057 + * The caller may not access the data through other means.
5058 + * @param size size of data in bytes, without the padding. I.e. the full buffer
5059 + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
5061 + * @return 0 on success, a negative AVERROR on error
5063 +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
5065 +#if FF_API_AVPACKET_OLD_API
5067 + * @warning This is a hack - the packet memory allocation stuff is broken. The
5068 + * packet is allocated if it was not really allocated.
5070 + * @deprecated Use av_packet_ref or av_packet_make_refcounted
5072 +attribute_deprecated
5073 +int av_dup_packet(AVPacket *pkt);
5075 + * Copy packet, including contents
5077 + * @return 0 on success, negative AVERROR on fail
5079 + * @deprecated Use av_packet_ref
5081 +attribute_deprecated
5082 +int av_copy_packet(AVPacket *dst, const AVPacket *src);
5085 + * Copy packet side data
5087 + * @return 0 on success, negative AVERROR on fail
5089 + * @deprecated Use av_packet_copy_props
5091 +attribute_deprecated
5092 +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
5097 + * @deprecated Use av_packet_unref
5099 + * @param pkt packet to free
5101 +attribute_deprecated
5102 +void av_free_packet(AVPacket *pkt);
5105 + * Allocate new information of a packet.
5107 + * @param pkt packet
5108 + * @param type side information type
5109 + * @param size side information size
5110 + * @return pointer to fresh allocated data or NULL otherwise
5112 +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5116 + * Wrap an existing array as a packet side data.
5118 + * @param pkt packet
5119 + * @param type side information type
5120 + * @param data the side data array. It must be allocated with the av_malloc()
5121 + * family of functions. The ownership of the data is transferred to
5123 + * @param size side information size
5124 + * @return a non-negative number on success, a negative AVERROR code on
5125 + * failure. On failure, the packet is unchanged and the data remains
5126 + * owned by the caller.
5128 +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5129 + uint8_t *data, size_t size);
5132 + * Shrink the already allocated side data buffer
5134 + * @param pkt packet
5135 + * @param type side information type
5136 + * @param size new side information size
5137 + * @return 0 on success, < 0 on failure
5139 +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5143 + * Get side information from packet.
5145 + * @param pkt packet
5146 + * @param type desired side information type
5147 + * @param size pointer for side information size to store (optional)
5148 + * @return pointer to data if present or NULL otherwise
5150 +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
5153 +#if FF_API_MERGE_SD_API
5154 +attribute_deprecated
5155 +int av_packet_merge_side_data(AVPacket *pkt);
5157 +attribute_deprecated
5158 +int av_packet_split_side_data(AVPacket *pkt);
5161 +const char *av_packet_side_data_name(enum AVPacketSideDataType type);
5164 + * Pack a dictionary for use in side_data.
5166 + * @param dict The dictionary to pack.
5167 + * @param size pointer to store the size of the returned data
5168 + * @return pointer to data if successful, NULL otherwise
5170 +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
5172 + * Unpack a dictionary from side_data.
5174 + * @param data data from side_data
5175 + * @param size size of the data
5176 + * @param dict the metadata storage dictionary
5177 + * @return 0 on success, < 0 on failure
5179 +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
5183 + * Convenience function to free all the side data stored.
5184 + * All the other fields stay untouched.
5186 + * @param pkt packet
5188 +void av_packet_free_side_data(AVPacket *pkt);
5191 + * Setup a new reference to the data described by a given packet
5193 + * If src is reference-counted, setup dst as a new reference to the
5194 + * buffer in src. Otherwise allocate a new buffer in dst and copy the
5195 + * data from src into it.
5197 + * All the other fields are copied from src.
5199 + * @see av_packet_unref
5201 + * @param dst Destination packet
5202 + * @param src Source packet
5204 + * @return 0 on success, a negative AVERROR on error.
5206 +int av_packet_ref(AVPacket *dst, const AVPacket *src);
5209 + * Wipe the packet.
5211 + * Unreference the buffer referenced by the packet and reset the
5212 + * remaining packet fields to their default values.
5214 + * @param pkt The packet to be unreferenced.
5216 +void av_packet_unref(AVPacket *pkt);
5219 + * Move every field in src to dst and reset src.
5221 + * @see av_packet_unref
5223 + * @param src Source packet, will be reset
5224 + * @param dst Destination packet
5226 +void av_packet_move_ref(AVPacket *dst, AVPacket *src);
5229 + * Copy only "properties" fields from src to dst.
5231 + * Properties for the purpose of this function are all the fields
5232 + * beside those related to the packet data (buf, data, size)
5234 + * @param dst Destination packet
5235 + * @param src Source packet
5237 + * @return 0 on success AVERROR on failure.
5239 +int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
5242 + * Ensure the data described by a given packet is reference counted.
5244 + * @note This function does not ensure that the reference will be writable.
5245 + * Use av_packet_make_writable instead for that purpose.
5247 + * @see av_packet_ref
5248 + * @see av_packet_make_writable
5250 + * @param pkt packet whose data should be made reference counted.
5252 + * @return 0 on success, a negative AVERROR on error. On failure, the
5253 + * packet is unchanged.
5255 +int av_packet_make_refcounted(AVPacket *pkt);
5258 + * Create a writable reference for the data described by a given packet,
5259 + * avoiding data copy if possible.
5261 + * @param pkt Packet whose data should be made writable.
5263 + * @return 0 on success, a negative AVERROR on failure. On failure, the
5264 + * packet is unchanged.
5266 +int av_packet_make_writable(AVPacket *pkt);
5269 + * Convert valid timing fields (timestamps / durations) in a packet from one
5270 + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
5273 + * @param pkt packet on which the conversion will be performed
5274 + * @param tb_src source timebase, in which the timing fields in pkt are
5276 + * @param tb_dst destination timebase, to which the timing fields will be
5279 +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
5286 + * @addtogroup lavc_decoding
5291 + * Find a registered decoder with a matching codec ID.
5293 + * @param id AVCodecID of the requested decoder
5294 + * @return A decoder if one was found, NULL otherwise.
5296 +AVCodec *avcodec_find_decoder(enum AVCodecID id);
5299 + * Find a registered decoder with the specified name.
5301 + * @param name name of the requested decoder
5302 + * @return A decoder if one was found, NULL otherwise.
5304 +AVCodec *avcodec_find_decoder_by_name(const char *name);
5307 + * The default callback for AVCodecContext.get_buffer2(). It is made public so
5308 + * it can be called by custom get_buffer2() implementations for decoders without
5309 + * AV_CODEC_CAP_DR1 set.
5311 +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
5314 + * Modify width and height values so that they will result in a memory
5315 + * buffer that is acceptable for the codec if you do not use any horizontal
5318 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5320 +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
5323 + * Modify width and height values so that they will result in a memory
5324 + * buffer that is acceptable for the codec if you also ensure that all
5325 + * line sizes are a multiple of the respective linesize_align[i].
5327 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5329 +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
5330 + int linesize_align[AV_NUM_DATA_POINTERS]);
5333 + * Converts AVChromaLocation to swscale x/y chroma position.
5335 + * The positions represent the chroma (0,0) position in a coordinates system
5336 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5338 + * @param xpos horizontal chroma sample position
5339 + * @param ypos vertical chroma sample position
5341 +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
5344 + * Converts swscale x/y chroma position to AVChromaLocation.
5346 + * The positions represent the chroma (0,0) position in a coordinates system
5347 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5349 + * @param xpos horizontal chroma sample position
5350 + * @param ypos vertical chroma sample position
5352 +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
5355 + * Decode the audio frame of size avpkt->size from avpkt->data into frame.
5357 + * Some decoders may support multiple frames in a single AVPacket. Such
5358 + * decoders would then just decode the first frame and the return value would be
5359 + * less than the packet size. In this case, avcodec_decode_audio4 has to be
5360 + * called again with an AVPacket containing the remaining data in order to
5361 + * decode the second frame, etc... Even if no frames are returned, the packet
5362 + * needs to be fed to the decoder with remaining data until it is completely
5363 + * consumed or an error occurs.
5365 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5366 + * and output. This means that for some packets they will not immediately
5367 + * produce decoded output and need to be flushed at the end of decoding to get
5368 + * all the decoded data. Flushing is done by calling this function with packets
5369 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5370 + * returning samples. It is safe to flush even those decoders that are not
5371 + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
5373 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5374 + * larger than the actual read bytes because some optimized bitstream
5375 + * readers read 32 or 64 bits at once and could read over the end.
5377 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5378 + * before packets may be fed to the decoder.
5380 + * @param avctx the codec context
5381 + * @param[out] frame The AVFrame in which to store decoded audio samples.
5382 + * The decoder will allocate a buffer for the decoded frame by
5383 + * calling the AVCodecContext.get_buffer2() callback.
5384 + * When AVCodecContext.refcounted_frames is set to 1, the frame is
5385 + * reference counted and the returned reference belongs to the
5386 + * caller. The caller must release the frame using av_frame_unref()
5387 + * when the frame is no longer needed. The caller may safely write
5388 + * to the frame if av_frame_is_writable() returns 1.
5389 + * When AVCodecContext.refcounted_frames is set to 0, the returned
5390 + * reference belongs to the decoder and is valid only until the
5391 + * next call to this function or until closing or flushing the
5392 + * decoder. The caller may not write to it.
5393 + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
5394 + * non-zero. Note that this field being set to zero
5395 + * does not mean that an error has occurred. For
5396 + * decoders with AV_CODEC_CAP_DELAY set, no given decode
5397 + * call is guaranteed to produce a frame.
5398 + * @param[in] avpkt The input AVPacket containing the input buffer.
5399 + * At least avpkt->data and avpkt->size should be set. Some
5400 + * decoders might also require additional fields to be set.
5401 + * @return A negative error code is returned if an error occurred during
5402 + * decoding, otherwise the number of bytes consumed from the input
5403 + * AVPacket is returned.
5405 +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5407 +attribute_deprecated
5408 +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
5409 + int *got_frame_ptr, const AVPacket *avpkt);
5412 + * Decode the video frame of size avpkt->size from avpkt->data into picture.
5413 + * Some decoders may support multiple frames in a single AVPacket, such
5414 + * decoders would then just decode the first frame.
5416 + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
5417 + * the actual read bytes because some optimized bitstream readers read 32 or 64
5418 + * bits at once and could read over the end.
5420 + * @warning The end of the input buffer buf should be set to 0 to ensure that
5421 + * no overreading happens for damaged MPEG streams.
5423 + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
5424 + * between input and output, these need to be fed with avpkt->data=NULL,
5425 + * avpkt->size=0 at the end to return the remaining frames.
5427 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5428 + * before packets may be fed to the decoder.
5430 + * @param avctx the codec context
5431 + * @param[out] picture The AVFrame in which the decoded video frame will be stored.
5432 + * Use av_frame_alloc() to get an AVFrame. The codec will
5433 + * allocate memory for the actual bitmap by calling the
5434 + * AVCodecContext.get_buffer2() callback.
5435 + * When AVCodecContext.refcounted_frames is set to 1, the frame is
5436 + * reference counted and the returned reference belongs to the
5437 + * caller. The caller must release the frame using av_frame_unref()
5438 + * when the frame is no longer needed. The caller may safely write
5439 + * to the frame if av_frame_is_writable() returns 1.
5440 + * When AVCodecContext.refcounted_frames is set to 0, the returned
5441 + * reference belongs to the decoder and is valid only until the
5442 + * next call to this function or until closing or flushing the
5443 + * decoder. The caller may not write to it.
5445 + * @param[in] avpkt The input AVPacket containing the input buffer.
5446 + * You can create such packet with av_init_packet() and by then setting
5447 + * data and size, some decoders might in addition need other fields like
5448 + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
5449 + * fields possible.
5450 + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
5451 + * @return On error a negative value is returned, otherwise the number of bytes
5452 + * used or zero if no frame could be decompressed.
5454 + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5456 +attribute_deprecated
5457 +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
5458 + int *got_picture_ptr,
5459 + const AVPacket *avpkt);
5462 + * Decode a subtitle message.
5463 + * Return a negative value on error, otherwise return the number of bytes used.
5464 + * If no subtitle could be decompressed, got_sub_ptr is zero.
5465 + * Otherwise, the subtitle is stored in *sub.
5466 + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
5467 + * simplicity, because the performance difference is expect to be negligible
5468 + * and reusing a get_buffer written for video codecs would probably perform badly
5469 + * due to a potentially very different allocation pattern.
5471 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5472 + * and output. This means that for some packets they will not immediately
5473 + * produce decoded output and need to be flushed at the end of decoding to get
5474 + * all the decoded data. Flushing is done by calling this function with packets
5475 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5476 + * returning subtitles. It is safe to flush even those decoders that are not
5477 + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
5479 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5480 + * before packets may be fed to the decoder.
5482 + * @param avctx the codec context
5483 + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
5484 + * must be freed with avsubtitle_free if *got_sub_ptr is set.
5485 + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
5486 + * @param[in] avpkt The input AVPacket containing the input buffer.
5488 +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
5493 + * Supply raw packet data as input to a decoder.
5495 + * Internally, this call will copy relevant AVCodecContext fields, which can
5496 + * influence decoding per-packet, and apply them when the packet is actually
5497 + * decoded. (For example AVCodecContext.skip_frame, which might direct the
5498 + * decoder to drop the frame contained by the packet sent with this function.)
5500 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5501 + * larger than the actual read bytes because some optimized bitstream
5502 + * readers read 32 or 64 bits at once and could read over the end.
5504 + * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
5505 + * on the same AVCodecContext. It will return unexpected results now
5506 + * or in future libavcodec versions.
5508 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5509 + * before packets may be fed to the decoder.
5511 + * @param avctx codec context
5512 + * @param[in] avpkt The input AVPacket. Usually, this will be a single video
5513 + * frame, or several complete audio frames.
5514 + * Ownership of the packet remains with the caller, and the
5515 + * decoder will not write to the packet. The decoder may create
5516 + * a reference to the packet data (or copy it if the packet is
5517 + * not reference-counted).
5518 + * Unlike with older APIs, the packet is always fully consumed,
5519 + * and if it contains multiple frames (e.g. some audio codecs),
5520 + * will require you to call avcodec_receive_frame() multiple
5521 + * times afterwards before you can send a new packet.
5522 + * It can be NULL (or an AVPacket with data set to NULL and
5523 + * size set to 0); in this case, it is considered a flush
5524 + * packet, which signals the end of the stream. Sending the
5525 + * first flush packet will return success. Subsequent ones are
5526 + * unnecessary and will return AVERROR_EOF. If the decoder
5527 + * still has frames buffered, it will return them after sending
5530 + * @return 0 on success, otherwise negative error code:
5531 + * AVERROR(EAGAIN): input is not accepted in the current state - user
5532 + * must read output with avcodec_receive_frame() (once
5533 + * all output is read, the packet should be resent, and
5534 + * the call will not fail with EAGAIN).
5535 + * AVERROR_EOF: the decoder has been flushed, and no new packets can
5536 + * be sent to it (also returned if more than 1 flush
5538 + * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush
5539 + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
5540 + * other errors: legitimate decoding errors
5542 +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
5545 + * Return decoded output data from a decoder.
5547 + * @param avctx codec context
5548 + * @param frame This will be set to a reference-counted video or audio
5549 + * frame (depending on the decoder type) allocated by the
5550 + * decoder. Note that the function will always call
5551 + * av_frame_unref(frame) before doing anything else.
5554 + * 0: success, a frame was returned
5555 + * AVERROR(EAGAIN): output is not available in this state - user must try
5556 + * to send new input
5557 + * AVERROR_EOF: the decoder has been fully flushed, and there will be
5558 + * no more output frames
5559 + * AVERROR(EINVAL): codec not opened, or it is an encoder
5560 + * other negative values: legitimate decoding errors
5562 +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
5565 + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
5566 + * to retrieve buffered output packets.
5568 + * @param avctx codec context
5569 + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
5570 + * Ownership of the frame remains with the caller, and the
5571 + * encoder will not write to the frame. The encoder may create
5572 + * a reference to the frame data (or copy it if the frame is
5573 + * not reference-counted).
5574 + * It can be NULL, in which case it is considered a flush
5575 + * packet. This signals the end of the stream. If the encoder
5576 + * still has packets buffered, it will return them after this
5577 + * call. Once flushing mode has been entered, additional flush
5578 + * packets are ignored, and sending frames will return
5582 + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
5583 + * can have any number of samples.
5584 + * If it is not set, frame->nb_samples must be equal to
5585 + * avctx->frame_size for all frames except the last.
5586 + * The final frame may be smaller than avctx->frame_size.
5587 + * @return 0 on success, otherwise negative error code:
5588 + * AVERROR(EAGAIN): input is not accepted in the current state - user
5589 + * must read output with avcodec_receive_packet() (once
5590 + * all output is read, the packet should be resent, and
5591 + * the call will not fail with EAGAIN).
5592 + * AVERROR_EOF: the encoder has been flushed, and no new frames can
5594 + * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a
5595 + * decoder, or requires flush
5596 + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
5597 + * other errors: legitimate decoding errors
5599 +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
5602 + * Read encoded data from the encoder.
5604 + * @param avctx codec context
5605 + * @param avpkt This will be set to a reference-counted packet allocated by the
5606 + * encoder. Note that the function will always call
5607 + * av_frame_unref(frame) before doing anything else.
5608 + * @return 0 on success, otherwise negative error code:
5609 + * AVERROR(EAGAIN): output is not available in the current state - user
5610 + * must try to send input
5611 + * AVERROR_EOF: the encoder has been fully flushed, and there will be
5612 + * no more output packets
5613 + * AVERROR(EINVAL): codec not opened, or it is an encoder
5614 + * other errors: legitimate decoding errors
5616 +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
5619 + * Create and return a AVHWFramesContext with values adequate for hardware
5620 + * decoding. This is meant to get called from the get_format callback, and is
5621 + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
5622 + * This API is for decoding with certain hardware acceleration modes/APIs only.
5624 + * The returned AVHWFramesContext is not initialized. The caller must do this
5625 + * with av_hwframe_ctx_init().
5627 + * Calling this function is not a requirement, but makes it simpler to avoid
5628 + * codec or hardware API specific details when manually allocating frames.
5630 + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
5631 + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
5632 + * it unnecessary to call this function or having to care about
5633 + * AVHWFramesContext initialization at all.
5635 + * There are a number of requirements for calling this function:
5637 + * - It must be called from get_format with the same avctx parameter that was
5638 + * passed to get_format. Calling it outside of get_format is not allowed, and
5639 + * can trigger undefined behavior.
5640 + * - The function is not always supported (see description of return values).
5641 + * Even if this function returns successfully, hwaccel initialization could
5642 + * fail later. (The degree to which implementations check whether the stream
5643 + * is actually supported varies. Some do this check only after the user's
5644 + * get_format callback returns.)
5645 + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
5646 + * user decides to use a AVHWFramesContext prepared with this API function,
5647 + * the user must return the same hw_pix_fmt from get_format.
5648 + * - The device_ref passed to this function must support the given hw_pix_fmt.
5649 + * - After calling this API function, it is the user's responsibility to
5650 + * initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
5651 + * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
5652 + * before returning from get_format (this is implied by the normal
5653 + * AVCodecContext.hw_frames_ctx API rules).
5654 + * - The AVHWFramesContext parameters may change every time time get_format is
5655 + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
5656 + * you are inherently required to go through this process again on every
5657 + * get_format call.
5658 + * - It is perfectly possible to call this function without actually using
5659 + * the resulting AVHWFramesContext. One use-case might be trying to reuse a
5660 + * previously initialized AVHWFramesContext, and calling this API function
5661 + * only to test whether the required frame parameters have changed.
5662 + * - Fields that use dynamically allocated values of any kind must not be set
5663 + * by the user unless setting them is explicitly allowed by the documentation.
5664 + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
5665 + * the new free callback must call the potentially set previous free callback.
5666 + * This API call may set any dynamically allocated fields, including the free
5669 + * The function will set at least the following fields on AVHWFramesContext
5670 + * (potentially more, depending on hwaccel API):
5672 + * - All fields set by av_hwframe_ctx_alloc().
5673 + * - Set the format field to hw_pix_fmt.
5674 + * - Set the sw_format field to the most suited and most versatile format. (An
5675 + * implication is that this will prefer generic formats over opaque formats
5676 + * with arbitrary restrictions, if possible.)
5677 + * - Set the width/height fields to the coded frame size, rounded up to the
5678 + * API-specific minimum alignment.
5679 + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
5680 + * field to the number of maximum reference surfaces possible with the codec,
5681 + * plus 1 surface for the user to work (meaning the user can safely reference
5682 + * at most 1 decoded surface at a time), plus additional buffering introduced
5683 + * by frame threading. If the hwaccel does not require pre-allocation, the
5684 + * field is left to 0, and the decoder will allocate new surfaces on demand
5685 + * during decoding.
5686 + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
5689 + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
5690 + * with basic frame parameters set.
5692 + * The function is stateless, and does not change the AVCodecContext or the
5693 + * device_ref AVHWDeviceContext.
5695 + * @param avctx The context which is currently calling get_format, and which
5696 + * implicitly contains all state needed for filling the returned
5697 + * AVHWFramesContext properly.
5698 + * @param device_ref A reference to the AVHWDeviceContext describing the device
5699 + * which will be used by the hardware decoder.
5700 + * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
5701 + * @param out_frames_ref On success, set to a reference to an _uninitialized_
5702 + * AVHWFramesContext, created from the given device_ref.
5703 + * Fields will be set to values required for decoding.
5704 + * Not changed if an error is returned.
5705 + * @return zero on success, a negative value on error. The following error codes
5706 + * have special semantics:
5707 + * AVERROR(ENOENT): the decoder does not support this functionality. Setup
5708 + * is always manual, or it is a decoder which does not
5709 + * support setting AVCodecContext.hw_frames_ctx at all,
5710 + * or it is a software format.
5711 + * AVERROR(EINVAL): it is known that hardware decoding is not supported for
5712 + * this configuration, or the device_ref is not supported
5713 + * for the hwaccel referenced by hw_pix_fmt.
5715 +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
5716 + AVBufferRef *device_ref,
5717 + enum AVPixelFormat hw_pix_fmt,
5718 + AVBufferRef **out_frames_ref);
5723 + * @defgroup lavc_parsing Frame parsing
5727 +enum AVPictureStructure {
5728 + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown
5729 + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field
5730 + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
5731 + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame
5734 +typedef struct AVCodecParserContext {
5736 + struct AVCodecParser *parser;
5737 + int64_t frame_offset; /* offset of the current frame */
5738 + int64_t cur_offset; /* current offset
5739 + (incremented by each av_parser_parse()) */
5740 + int64_t next_frame_offset; /* offset of the next frame */
5742 + int pict_type; /* XXX: Put it back in AVCodecContext. */
5744 + * This field is used for proper frame duration computation in lavf.
5745 + * It signals, how much longer the frame duration of the current frame
5746 + * is compared to normal frame duration.
5748 + * frame_duration = (1 + repeat_pict) * time_base
5750 + * It is used by codecs like H.264 to display telecined material.
5752 + int repeat_pict; /* XXX: Put it back in AVCodecContext. */
5753 + int64_t pts; /* pts of the current frame */
5754 + int64_t dts; /* dts of the current frame */
5756 + /* private data */
5759 + int fetch_timestamp;
5761 +#define AV_PARSER_PTS_NB 4
5762 + int cur_frame_start_index;
5763 + int64_t cur_frame_offset[AV_PARSER_PTS_NB];
5764 + int64_t cur_frame_pts[AV_PARSER_PTS_NB];
5765 + int64_t cur_frame_dts[AV_PARSER_PTS_NB];
5768 +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
5769 +#define PARSER_FLAG_ONCE 0x0002
5770 +/// Set if the parser has a valid file offset
5771 +#define PARSER_FLAG_FETCHED_OFFSET 0x0004
5772 +#define PARSER_FLAG_USE_CODEC_TS 0x1000
5774 + int64_t offset; ///< byte offset from starting packet start
5775 + int64_t cur_frame_end[AV_PARSER_PTS_NB];
5778 + * Set by parser to 1 for key frames and 0 for non-key frames.
5779 + * It is initialized to -1, so if the parser doesn't set this flag,
5780 + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
5785 +#if FF_API_CONVERGENCE_DURATION
5787 + * @deprecated unused
5789 + attribute_deprecated
5790 + int64_t convergence_duration;
5793 + // Timestamp generation support:
5795 + * Synchronization point for start of timestamp generation.
5797 + * Set to >0 for sync point, 0 for no sync point and <0 for undefined
5800 + * For example, this corresponds to presence of H.264 buffering period
5803 + int dts_sync_point;
5806 + * Offset of the current timestamp against last timestamp sync point in
5807 + * units of AVCodecContext.time_base.
5809 + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5810 + * contain a valid timestamp offset.
5812 + * Note that the timestamp of sync point has usually a nonzero
5813 + * dts_ref_dts_delta, which refers to the previous sync point. Offset of
5814 + * the next frame after timestamp sync point will be usually 1.
5816 + * For example, this corresponds to H.264 cpb_removal_delay.
5818 + int dts_ref_dts_delta;
5821 + * Presentation delay of current frame in units of AVCodecContext.time_base.
5823 + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5824 + * contain valid non-negative timestamp delta (presentation time of a frame
5825 + * must not lie in the past).
5827 + * This delay represents the difference between decoding and presentation
5828 + * time of the frame.
5830 + * For example, this corresponds to H.264 dpb_output_delay.
5832 + int pts_dts_delta;
5835 + * Position of the packet in file.
5837 + * Analogous to cur_frame_pts/dts
5839 + int64_t cur_frame_pos[AV_PARSER_PTS_NB];
5842 + * Byte position of currently parsed frame in stream.
5847 + * Previous frame byte position.
5852 + * Duration of the current frame.
5853 + * For audio, this is in units of 1 / AVCodecContext.sample_rate.
5854 + * For all other types, this is in units of AVCodecContext.time_base.
5858 + enum AVFieldOrder field_order;
5861 + * Indicate whether a picture is coded as a frame, top field or bottom field.
5863 + * For example, H.264 field_pic_flag equal to 0 corresponds to
5864 + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
5865 + * equal to 1 and bottom_field_flag equal to 0 corresponds to
5866 + * AV_PICTURE_STRUCTURE_TOP_FIELD.
5868 + enum AVPictureStructure picture_structure;
5871 + * Picture number incremented in presentation or output order.
5872 + * This field may be reinitialized at the first picture of a new sequence.
5874 + * For example, this corresponds to H.264 PicOrderCnt.
5876 + int output_picture_number;
5879 + * Dimensions of the decoded video intended for presentation.
5885 + * Dimensions of the coded video.
5891 + * The format of the coded data, corresponds to enum AVPixelFormat for video
5892 + * and for enum AVSampleFormat for audio.
5894 + * Note that a decoder can have considerable freedom in how exactly it
5895 + * decodes the data, so the format reported here might be different from the
5896 + * one returned by a decoder.
5899 +} AVCodecParserContext;
5901 +typedef struct AVCodecParser {
5902 + int codec_ids[5]; /* several codec IDs are permitted */
5903 + int priv_data_size;
5904 + int (*parser_init)(AVCodecParserContext *s);
5905 + /* This callback never returns an error, a negative value means that
5906 + * the frame start was in a previous packet. */
5907 + int (*parser_parse)(AVCodecParserContext *s,
5908 + AVCodecContext *avctx,
5909 + const uint8_t **poutbuf, int *poutbuf_size,
5910 + const uint8_t *buf, int buf_size);
5911 + void (*parser_close)(AVCodecParserContext *s);
5912 + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
5913 + struct AVCodecParser *next;
5917 + * Iterate over all registered codec parsers.
5919 + * @param opaque a pointer where libavcodec will store the iteration state. Must
5920 + * point to NULL to start the iteration.
5922 + * @return the next registered codec parser or NULL when the iteration is
5925 +const AVCodecParser *av_parser_iterate(void **opaque);
5927 +attribute_deprecated
5928 +AVCodecParser *av_parser_next(const AVCodecParser *c);
5930 +attribute_deprecated
5931 +void av_register_codec_parser(AVCodecParser *parser);
5932 +AVCodecParserContext *av_parser_init(int codec_id);
5937 + * @param s parser context.
5938 + * @param avctx codec context.
5939 + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
5940 + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
5941 + * @param buf input buffer.
5942 + * @param buf_size buffer size in bytes without the padding. I.e. the full buffer
5943 + size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
5944 + To signal EOF, this should be 0 (so that the last frame
5946 + * @param pts input presentation timestamp.
5947 + * @param dts input decoding timestamp.
5948 + * @param pos input byte position in stream.
5949 + * @return the number of bytes of the input bitstream used.
5954 + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
5955 + * in_data, in_len,
5961 + * decode_frame(data, size);
5965 +int av_parser_parse2(AVCodecParserContext *s,
5966 + AVCodecContext *avctx,
5967 + uint8_t **poutbuf, int *poutbuf_size,
5968 + const uint8_t *buf, int buf_size,
5969 + int64_t pts, int64_t dts,
5973 + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
5974 + * @deprecated use AVBitStreamFilter
5976 +int av_parser_change(AVCodecParserContext *s,
5977 + AVCodecContext *avctx,
5978 + uint8_t **poutbuf, int *poutbuf_size,
5979 + const uint8_t *buf, int buf_size, int keyframe);
5980 +void av_parser_close(AVCodecParserContext *s);
5988 + * @addtogroup lavc_encoding
5993 + * Find a registered encoder with a matching codec ID.
5995 + * @param id AVCodecID of the requested encoder
5996 + * @return An encoder if one was found, NULL otherwise.
5998 +AVCodec *avcodec_find_encoder(enum AVCodecID id);
6001 + * Find a registered encoder with the specified name.
6003 + * @param name name of the requested encoder
6004 + * @return An encoder if one was found, NULL otherwise.
6006 +AVCodec *avcodec_find_encoder_by_name(const char *name);
6009 + * Encode a frame of audio.
6011 + * Takes input samples from frame and writes the next output packet, if
6012 + * available, to avpkt. The output packet does not necessarily contain data for
6013 + * the most recent frame, as encoders can delay, split, and combine input frames
6014 + * internally as needed.
6016 + * @param avctx codec context
6017 + * @param avpkt output AVPacket.
6018 + * The user can supply an output buffer by setting
6019 + * avpkt->data and avpkt->size prior to calling the
6020 + * function, but if the size of the user-provided data is not
6021 + * large enough, encoding will fail. If avpkt->data and
6022 + * avpkt->size are set, avpkt->destruct must also be set. All
6023 + * other AVPacket fields will be reset by the encoder using
6024 + * av_init_packet(). If avpkt->data is NULL, the encoder will
6025 + * allocate it. The encoder will set avpkt->size to the size
6026 + * of the output packet.
6028 + * If this function fails or produces no output, avpkt will be
6029 + * freed using av_packet_unref().
6030 + * @param[in] frame AVFrame containing the raw audio data to be encoded.
6031 + * May be NULL when flushing an encoder that has the
6032 + * AV_CODEC_CAP_DELAY capability set.
6033 + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
6034 + * can have any number of samples.
6035 + * If it is not set, frame->nb_samples must be equal to
6036 + * avctx->frame_size for all frames except the last.
6037 + * The final frame may be smaller than avctx->frame_size.
6038 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6039 + * output packet is non-empty, and to 0 if it is
6040 + * empty. If the function returns an error, the
6041 + * packet can be assumed to be invalid, and the
6042 + * value of got_packet_ptr is undefined and should
6044 + * @return 0 on success, negative error code on failure
6046 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6048 +attribute_deprecated
6049 +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
6050 + const AVFrame *frame, int *got_packet_ptr);
6053 + * Encode a frame of video.
6055 + * Takes input raw video data from frame and writes the next output packet, if
6056 + * available, to avpkt. The output packet does not necessarily contain data for
6057 + * the most recent frame, as encoders can delay and reorder input frames
6058 + * internally as needed.
6060 + * @param avctx codec context
6061 + * @param avpkt output AVPacket.
6062 + * The user can supply an output buffer by setting
6063 + * avpkt->data and avpkt->size prior to calling the
6064 + * function, but if the size of the user-provided data is not
6065 + * large enough, encoding will fail. All other AVPacket fields
6066 + * will be reset by the encoder using av_init_packet(). If
6067 + * avpkt->data is NULL, the encoder will allocate it.
6068 + * The encoder will set avpkt->size to the size of the
6069 + * output packet. The returned data (if any) belongs to the
6070 + * caller, he is responsible for freeing it.
6072 + * If this function fails or produces no output, avpkt will be
6073 + * freed using av_packet_unref().
6074 + * @param[in] frame AVFrame containing the raw video data to be encoded.
6075 + * May be NULL when flushing an encoder that has the
6076 + * AV_CODEC_CAP_DELAY capability set.
6077 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6078 + * output packet is non-empty, and to 0 if it is
6079 + * empty. If the function returns an error, the
6080 + * packet can be assumed to be invalid, and the
6081 + * value of got_packet_ptr is undefined and should
6083 + * @return 0 on success, negative error code on failure
6085 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6087 +attribute_deprecated
6088 +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
6089 + const AVFrame *frame, int *got_packet_ptr);
6091 +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
6092 + const AVSubtitle *sub);
6099 +#if FF_API_AVPICTURE
6101 + * @addtogroup lavc_picture
6106 + * @deprecated unused
6108 +attribute_deprecated
6109 +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
6112 + * @deprecated unused
6114 +attribute_deprecated
6115 +void avpicture_free(AVPicture *picture);
6118 + * @deprecated use av_image_fill_arrays() instead.
6120 +attribute_deprecated
6121 +int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
6122 + enum AVPixelFormat pix_fmt, int width, int height);
6125 + * @deprecated use av_image_copy_to_buffer() instead.
6127 +attribute_deprecated
6128 +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
6129 + int width, int height,
6130 + unsigned char *dest, int dest_size);
6133 + * @deprecated use av_image_get_buffer_size() instead.
6135 +attribute_deprecated
6136 +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
6139 + * @deprecated av_image_copy() instead.
6141 +attribute_deprecated
6142 +void av_picture_copy(AVPicture *dst, const AVPicture *src,
6143 + enum AVPixelFormat pix_fmt, int width, int height);
6146 + * @deprecated unused
6148 +attribute_deprecated
6149 +int av_picture_crop(AVPicture *dst, const AVPicture *src,
6150 + enum AVPixelFormat pix_fmt, int top_band, int left_band);
6153 + * @deprecated unused
6155 +attribute_deprecated
6156 +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
6157 + int padtop, int padbottom, int padleft, int padright, int *color);
6165 + * @defgroup lavc_misc Utility functions
6168 + * Miscellaneous utility functions related to both encoding and decoding
6174 + * @defgroup lavc_misc_pixfmt Pixel formats
6176 + * Functions for working with pixel formats.
6180 +#if FF_API_GETCHROMA
6182 + * @deprecated Use av_pix_fmt_get_chroma_sub_sample
6185 +attribute_deprecated
6186 +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
6190 + * Return a value representing the fourCC code associated to the
6191 + * pixel format pix_fmt, or 0 if no associated fourCC code can be
6194 +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
6197 + * @deprecated see av_get_pix_fmt_loss()
6199 +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
6203 + * Find the best pixel format to convert to given a certain source pixel
6204 + * format. When converting from one pixel format to another, information loss
6205 + * may occur. For example, when converting from RGB24 to GRAY, the color
6206 + * information will be lost. Similarly, other losses occur when converting from
6207 + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
6208 + * the given pixel formats should be used to suffer the least amount of loss.
6209 + * The pixel formats from which it chooses one, are determined by the
6210 + * pix_fmt_list parameter.
6213 + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
6214 + * @param[in] src_pix_fmt source pixel format
6215 + * @param[in] has_alpha Whether the source pixel format alpha channel is used.
6216 + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
6217 + * @return The best pixel format to convert to or -1 if none was found.
6219 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
6220 + enum AVPixelFormat src_pix_fmt,
6221 + int has_alpha, int *loss_ptr);
6224 + * @deprecated see av_find_best_pix_fmt_of_2()
6226 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6227 + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6229 +attribute_deprecated
6230 +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6231 + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6233 +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
6239 +#if FF_API_TAG_STRING
6241 + * Put a string representing the codec tag codec_tag in buf.
6243 + * @param buf buffer to place codec tag in
6244 + * @param buf_size size in bytes of buf
6245 + * @param codec_tag codec tag to assign
6246 + * @return the length of the string that would have been generated if
6247 + * enough space had been available, excluding the trailing null
6249 + * @deprecated see av_fourcc_make_string() and av_fourcc2str().
6251 +attribute_deprecated
6252 +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
6255 +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
6258 + * Return a name for the specified profile, if available.
6260 + * @param codec the codec that is searched for the given profile
6261 + * @param profile the profile value for which a name is requested
6262 + * @return A name for the profile if found, NULL otherwise.
6264 +const char *av_get_profile_name(const AVCodec *codec, int profile);
6267 + * Return a name for the specified profile, if available.
6269 + * @param codec_id the ID of the codec to which the requested profile belongs
6270 + * @param profile the profile value for which a name is requested
6271 + * @return A name for the profile if found, NULL otherwise.
6273 + * @note unlike av_get_profile_name(), which searches a list of profiles
6274 + * supported by a specific decoder or encoder implementation, this
6275 + * function searches the list of profiles from the AVCodecDescriptor
6277 +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
6279 +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
6280 +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
6281 +//FIXME func typedef
6284 + * Fill AVFrame audio data and linesize pointers.
6286 + * The buffer buf must be a preallocated buffer with a size big enough
6287 + * to contain the specified samples amount. The filled AVFrame data
6288 + * pointers will point to this buffer.
6290 + * AVFrame extended_data channel pointers are allocated if necessary for
6293 + * @param frame the AVFrame
6294 + * frame->nb_samples must be set prior to calling the
6295 + * function. This function fills in frame->data,
6296 + * frame->extended_data, frame->linesize[0].
6297 + * @param nb_channels channel count
6298 + * @param sample_fmt sample format
6299 + * @param buf buffer to use for frame data
6300 + * @param buf_size size of buffer
6301 + * @param align plane size sample alignment (0 = default)
6302 + * @return >=0 on success, negative error code on failure
6303 + * @todo return the size in bytes required to store the samples in
6304 + * case of success, at the next libavutil bump
6306 +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
6307 + enum AVSampleFormat sample_fmt, const uint8_t *buf,
6308 + int buf_size, int align);
6311 + * Reset the internal decoder state / flush internal buffers. Should be called
6312 + * e.g. when seeking or when switching to a different stream.
6314 + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
6315 + * this invalidates the frames previously returned from the decoder. When
6316 + * refcounted frames are used, the decoder just releases any references it might
6317 + * keep internally, but the caller's reference remains valid.
6319 +void avcodec_flush_buffers(AVCodecContext *avctx);
6322 + * Return codec bits per sample.
6324 + * @param[in] codec_id the codec
6325 + * @return Number of bits per sample or zero if unknown for the given codec.
6327 +int av_get_bits_per_sample(enum AVCodecID codec_id);
6330 + * Return the PCM codec associated with a sample format.
6331 + * @param be endianness, 0 for little, 1 for big,
6332 + * -1 (or anything else) for native
6333 + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
6335 +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
6338 + * Return codec bits per sample.
6339 + * Only return non-zero if the bits per sample is exactly correct, not an
6342 + * @param[in] codec_id the codec
6343 + * @return Number of bits per sample or zero if unknown for the given codec.
6345 +int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
6348 + * Return audio frame duration.
6350 + * @param avctx codec context
6351 + * @param frame_bytes size of the frame, or 0 if unknown
6352 + * @return frame duration, in samples, if known. 0 if not able to
6355 +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
6358 + * This function is the same as av_get_audio_frame_duration(), except it works
6359 + * with AVCodecParameters instead of an AVCodecContext.
6361 +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
6364 +typedef struct AVBitStreamFilterContext {
6366 + const struct AVBitStreamFilter *filter;
6367 + AVCodecParserContext *parser;
6368 + struct AVBitStreamFilterContext *next;
6370 + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
6371 + * Not for access by library users.
6374 +} AVBitStreamFilterContext;
6377 +typedef struct AVBSFInternal AVBSFInternal;
6380 + * The bitstream filter state.
6382 + * This struct must be allocated with av_bsf_alloc() and freed with
6385 + * The fields in the struct will only be changed (by the caller or by the
6386 + * filter) as described in their documentation, and are to be considered
6387 + * immutable otherwise.
6389 +typedef struct AVBSFContext {
6391 + * A class for logging and AVOptions
6393 + const AVClass *av_class;
6396 + * The bitstream filter this context is an instance of.
6398 + const struct AVBitStreamFilter *filter;
6401 + * Opaque libavcodec internal data. Must not be touched by the caller in any
6404 + AVBSFInternal *internal;
6407 + * Opaque filter-specific private data. If filter->priv_class is non-NULL,
6408 + * this is an AVOptions-enabled struct.
6413 + * Parameters of the input stream. This field is allocated in
6414 + * av_bsf_alloc(), it needs to be filled by the caller before
6417 + AVCodecParameters *par_in;
6420 + * Parameters of the output stream. This field is allocated in
6421 + * av_bsf_alloc(), it is set by the filter in av_bsf_init().
6423 + AVCodecParameters *par_out;
6426 + * The timebase used for the timestamps of the input packets. Set by the
6427 + * caller before av_bsf_init().
6429 + AVRational time_base_in;
6432 + * The timebase used for the timestamps of the output packets. Set by the
6433 + * filter in av_bsf_init().
6435 + AVRational time_base_out;
6438 +typedef struct AVBitStreamFilter {
6442 + * A list of codec ids supported by the filter, terminated by
6443 + * AV_CODEC_ID_NONE.
6444 + * May be NULL, in that case the bitstream filter works with any codec id.
6446 + const enum AVCodecID *codec_ids;
6449 + * A class for the private data, used to declare bitstream filter private
6450 + * AVOptions. This field is NULL for bitstream filters that do not declare
6453 + * If this field is non-NULL, the first member of the filter private data
6454 + * must be a pointer to AVClass, which will be set by libavcodec generic
6455 + * code to this class.
6457 + const AVClass *priv_class;
6459 + /*****************************************************************
6460 + * No fields below this line are part of the public API. They
6461 + * may not be used outside of libavcodec and can be changed and
6462 + * removed at will.
6463 + * New public fields should be added right above.
6464 + *****************************************************************
6467 + int priv_data_size;
6468 + int (*init)(AVBSFContext *ctx);
6469 + int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
6470 + void (*close)(AVBSFContext *ctx);
6471 +} AVBitStreamFilter;
6475 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6476 + * is deprecated. Use the new bitstream filtering API (using AVBSFContext).
6478 +attribute_deprecated
6479 +void av_register_bitstream_filter(AVBitStreamFilter *bsf);
6481 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6482 + * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init()
6483 + * from the new bitstream filtering API (using AVBSFContext).
6485 +attribute_deprecated
6486 +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
6488 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6489 + * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the
6490 + * new bitstream filtering API (using AVBSFContext).
6492 +attribute_deprecated
6493 +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
6494 + AVCodecContext *avctx, const char *args,
6495 + uint8_t **poutbuf, int *poutbuf_size,
6496 + const uint8_t *buf, int buf_size, int keyframe);
6498 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6499 + * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using
6502 +attribute_deprecated
6503 +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
6505 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6506 + * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using
6509 +attribute_deprecated
6510 +const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
6514 + * @return a bitstream filter with the specified name or NULL if no such
6515 + * bitstream filter exists.
6517 +const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
6520 + * Iterate over all registered bitstream filters.
6522 + * @param opaque a pointer where libavcodec will store the iteration state. Must
6523 + * point to NULL to start the iteration.
6525 + * @return the next registered bitstream filter or NULL when the iteration is
6528 +const AVBitStreamFilter *av_bsf_iterate(void **opaque);
6530 +attribute_deprecated
6531 +const AVBitStreamFilter *av_bsf_next(void **opaque);
6535 + * Allocate a context for a given bitstream filter. The caller must fill in the
6536 + * context parameters as described in the documentation and then call
6537 + * av_bsf_init() before sending any data to the filter.
6539 + * @param filter the filter for which to allocate an instance.
6540 + * @param ctx a pointer into which the pointer to the newly-allocated context
6541 + * will be written. It must be freed with av_bsf_free() after the
6542 + * filtering is done.
6544 + * @return 0 on success, a negative AVERROR code on failure
6546 +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
6549 + * Prepare the filter for use, after all the parameters and options have been
6552 +int av_bsf_init(AVBSFContext *ctx);
6555 + * Submit a packet for filtering.
6557 + * After sending each packet, the filter must be completely drained by calling
6558 + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
6561 + * @param pkt the packet to filter. The bitstream filter will take ownership of
6562 + * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
6563 + * This parameter may be NULL, which signals the end of the stream (i.e. no more
6564 + * packets will be sent). That will cause the filter to output any packets it
6565 + * may have buffered internally.
6567 + * @return 0 on success, a negative AVERROR on error.
6569 +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
6572 + * Retrieve a filtered packet.
6574 + * @param[out] pkt this struct will be filled with the contents of the filtered
6575 + * packet. It is owned by the caller and must be freed using
6576 + * av_packet_unref() when it is no longer needed.
6577 + * This parameter should be "clean" (i.e. freshly allocated
6578 + * with av_packet_alloc() or unreffed with av_packet_unref())
6579 + * when this function is called. If this function returns
6580 + * successfully, the contents of pkt will be completely
6581 + * overwritten by the returned data. On failure, pkt is not
6584 + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the
6585 + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there
6586 + * will be no further output from the filter. Another negative AVERROR value if
6587 + * an error occurs.
6589 + * @note one input packet may result in several output packets, so after sending
6590 + * a packet with av_bsf_send_packet(), this function needs to be called
6591 + * repeatedly until it stops returning 0. It is also possible for a filter to
6592 + * output fewer packets than were sent to it, so this function may return
6593 + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
6595 +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
6598 + * Free a bitstream filter context and everything associated with it; write NULL
6599 + * into the supplied pointer.
6601 +void av_bsf_free(AVBSFContext **ctx);
6604 + * Get the AVClass for AVBSFContext. It can be used in combination with
6605 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
6607 + * @see av_opt_find().
6609 +const AVClass *av_bsf_get_class(void);
6612 + * Structure for chain/list of bitstream filters.
6613 + * Empty list can be allocated by av_bsf_list_alloc().
6615 +typedef struct AVBSFList AVBSFList;
6618 + * Allocate empty list of bitstream filters.
6619 + * The list must be later freed by av_bsf_list_free()
6620 + * or finalized by av_bsf_list_finalize().
6622 + * @return Pointer to @ref AVBSFList on success, NULL in case of failure
6624 +AVBSFList *av_bsf_list_alloc(void);
6627 + * Free list of bitstream filters.
6629 + * @param lst Pointer to pointer returned by av_bsf_list_alloc()
6631 +void av_bsf_list_free(AVBSFList **lst);
6634 + * Append bitstream filter to the list of bitstream filters.
6636 + * @param lst List to append to
6637 + * @param bsf Filter context to be appended
6639 + * @return >=0 on success, negative AVERROR in case of failure
6641 +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
6644 + * Construct new bitstream filter context given it's name and options
6645 + * and append it to the list of bitstream filters.
6647 + * @param lst List to append to
6648 + * @param bsf_name Name of the bitstream filter
6649 + * @param options Options for the bitstream filter, can be set to NULL
6651 + * @return >=0 on success, negative AVERROR in case of failure
6653 +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
6655 + * Finalize list of bitstream filters.
6657 + * This function will transform @ref AVBSFList to single @ref AVBSFContext,
6658 + * so the whole chain of bitstream filters can be treated as single filter
6659 + * freshly allocated by av_bsf_alloc().
6660 + * If the call is successful, @ref AVBSFList structure is freed and lst
6661 + * will be set to NULL. In case of failure, caller is responsible for
6662 + * freeing the structure by av_bsf_list_free()
6664 + * @param lst Filter list structure to be transformed
6665 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6666 + * representing the chain of bitstream filters
6668 + * @return >=0 on success, negative AVERROR in case of failure
6670 +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
6673 + * Parse string describing list of bitstream filters and create single
6674 + * @ref AVBSFContext describing the whole chain of bitstream filters.
6675 + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
6676 + * allocated by av_bsf_alloc().
6678 + * @param str String describing chain of bitstream filters in format
6679 + * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
6680 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6681 + * representing the chain of bitstream filters
6683 + * @return >=0 on success, negative AVERROR in case of failure
6685 +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
6688 + * Get null/pass-through bitstream filter.
6690 + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
6694 +int av_bsf_get_null_filter(AVBSFContext **bsf);
6699 + * Same behaviour av_fast_malloc but the buffer has additional
6700 + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
6702 + * In addition the whole buffer will initially and after resizes
6703 + * be 0-initialized so that no uninitialized data will ever appear.
6705 +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
6708 + * Same behaviour av_fast_padded_malloc except that buffer will always
6709 + * be 0-initialized after call.
6711 +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
6714 + * Encode extradata length to a buffer. Used by xiph codecs.
6716 + * @param s buffer to write to; must be at least (v/255+1) bytes long
6717 + * @param v size of extradata in bytes
6718 + * @return number of bytes written to the buffer.
6720 +unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
6722 +#if FF_API_USER_VISIBLE_AVHWACCEL
6724 + * Register the hardware accelerator hwaccel.
6726 + * @deprecated This function doesn't do anything.
6728 +attribute_deprecated
6729 +void av_register_hwaccel(AVHWAccel *hwaccel);
6732 + * If hwaccel is NULL, returns the first registered hardware accelerator,
6733 + * if hwaccel is non-NULL, returns the next registered hardware accelerator
6734 + * after hwaccel, or NULL if hwaccel is the last one.
6736 + * @deprecated AVHWaccel structures contain no user-serviceable parts, so
6737 + * this function should not be used.
6739 +attribute_deprecated
6740 +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
6745 + * Lock operation used by lockmgr
6747 + * @deprecated Deprecated together with av_lockmgr_register().
6750 + AV_LOCK_CREATE, ///< Create a mutex
6751 + AV_LOCK_OBTAIN, ///< Lock the mutex
6752 + AV_LOCK_RELEASE, ///< Unlock the mutex
6753 + AV_LOCK_DESTROY, ///< Free mutex resources
6757 + * Register a user provided lock manager supporting the operations
6758 + * specified by AVLockOp. The "mutex" argument to the function points
6759 + * to a (void *) where the lockmgr should store/get a pointer to a user
6760 + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
6761 + * value left by the last call for all other ops. If the lock manager is
6762 + * unable to perform the op then it should leave the mutex in the same
6763 + * state as when it was called and return a non-zero value. However,
6764 + * when called with AV_LOCK_DESTROY the mutex will always be assumed to
6765 + * have been successfully destroyed. If av_lockmgr_register succeeds
6766 + * it will return a non-negative value, if it fails it will return a
6767 + * negative value and destroy all mutex and unregister all callbacks.
6768 + * av_lockmgr_register is not thread-safe, it must be called from a
6769 + * single thread before any calls which make use of locking are used.
6771 + * @param cb User defined callback. av_lockmgr_register invokes calls
6772 + * to this callback and the previously registered callback.
6773 + * The callback will be used to create more than one mutex
6774 + * each of which must be backed by its own underlying locking
6775 + * mechanism (i.e. do not use a single static object to
6776 + * implement your lock manager). If cb is set to NULL the
6777 + * lockmgr will be unregistered.
6779 + * @deprecated This function does nothing, and always returns 0. Be sure to
6780 + * build with thread support to get basic thread safety.
6782 +attribute_deprecated
6783 +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
6787 + * Get the type of the given codec.
6789 +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
6792 + * Get the name of a codec.
6793 + * @return a static string identifying the codec; never NULL
6795 +const char *avcodec_get_name(enum AVCodecID id);
6798 + * @return a positive value if s is open (i.e. avcodec_open2() was called on it
6799 + * with no corresponding avcodec_close()), 0 otherwise.
6801 +int avcodec_is_open(AVCodecContext *s);
6804 + * @return a non-zero number if codec is an encoder, zero otherwise
6806 +int av_codec_is_encoder(const AVCodec *codec);
6809 + * @return a non-zero number if codec is a decoder, zero otherwise
6811 +int av_codec_is_decoder(const AVCodec *codec);
6814 + * @return descriptor for given codec ID or NULL if no descriptor exists.
6816 +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
6819 + * Iterate over all codec descriptors known to libavcodec.
6821 + * @param prev previous descriptor. NULL to get the first descriptor.
6823 + * @return next descriptor or NULL after the last descriptor
6825 +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
6828 + * @return codec descriptor with the given name or NULL if no such descriptor
6831 +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
6834 + * Allocate a CPB properties structure and initialize its fields to default
6837 + * @param size if non-NULL, the size of the allocated struct will be written
6838 + * here. This is useful for embedding it in side data.
6840 + * @return the newly allocated struct or NULL on failure
6842 +AVCPBProperties *av_cpb_properties_alloc(size_t *size);
6848 +#endif /* AVCODEC_AVCODEC_H */
6849 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6850 new file mode 100644
6852 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6855 + * This file is part of FFmpeg.
6857 + * FFmpeg is free software; you can redistribute it and/or
6858 + * modify it under the terms of the GNU Lesser General Public
6859 + * License as published by the Free Software Foundation; either
6860 + * version 2.1 of the License, or (at your option) any later version.
6862 + * FFmpeg is distributed in the hope that it will be useful,
6863 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6864 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6865 + * Lesser General Public License for more details.
6867 + * You should have received a copy of the GNU Lesser General Public
6868 + * License along with FFmpeg; if not, write to the Free Software
6869 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6872 +#ifndef AVCODEC_AVFFT_H
6873 +#define AVCODEC_AVFFT_H
6877 + * @ingroup lavc_fft
6882 + * @defgroup lavc_fft FFT functions
6883 + * @ingroup lavc_misc
6888 +typedef float FFTSample;
6890 +typedef struct FFTComplex {
6894 +typedef struct FFTContext FFTContext;
6897 + * Set up a complex FFT.
6898 + * @param nbits log2 of the length of the input array
6899 + * @param inverse if 0 perform the forward transform, if 1 perform the inverse
6901 +FFTContext *av_fft_init(int nbits, int inverse);
6904 + * Do the permutation needed BEFORE calling ff_fft_calc().
6906 +void av_fft_permute(FFTContext *s, FFTComplex *z);
6909 + * Do a complex FFT with the parameters defined in av_fft_init(). The
6910 + * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
6912 +void av_fft_calc(FFTContext *s, FFTComplex *z);
6914 +void av_fft_end(FFTContext *s);
6916 +FFTContext *av_mdct_init(int nbits, int inverse, double scale);
6917 +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6918 +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
6919 +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6920 +void av_mdct_end(FFTContext *s);
6922 +/* Real Discrete Fourier Transform */
6924 +enum RDFTransformType {
6931 +typedef struct RDFTContext RDFTContext;
6934 + * Set up a real FFT.
6935 + * @param nbits log2 of the length of the input array
6936 + * @param trans the type of transform
6938 +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
6939 +void av_rdft_calc(RDFTContext *s, FFTSample *data);
6940 +void av_rdft_end(RDFTContext *s);
6942 +/* Discrete Cosine Transform */
6944 +typedef struct DCTContext DCTContext;
6946 +enum DCTTransformType {
6956 + * @param nbits size of the input array:
6957 + * (1 << nbits) for DCT-II, DCT-III and DST-I
6958 + * (1 << nbits) + 1 for DCT-I
6959 + * @param type the type of transform
6961 + * @note the first element of the input of DST-I is ignored
6963 +DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
6964 +void av_dct_calc(DCTContext *s, FFTSample *data);
6965 +void av_dct_end (DCTContext *s);
6971 +#endif /* AVCODEC_AVFFT_H */
6972 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6973 new file mode 100644
6975 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6978 + * Video Acceleration API (shared data between FFmpeg and the video player)
6979 + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
6981 + * Copyright (C) 2008-2009 Splitted-Desktop Systems
6983 + * This file is part of FFmpeg.
6985 + * FFmpeg is free software; you can redistribute it and/or
6986 + * modify it under the terms of the GNU Lesser General Public
6987 + * License as published by the Free Software Foundation; either
6988 + * version 2.1 of the License, or (at your option) any later version.
6990 + * FFmpeg is distributed in the hope that it will be useful,
6991 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6992 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6993 + * Lesser General Public License for more details.
6995 + * You should have received a copy of the GNU Lesser General Public
6996 + * License along with FFmpeg; if not, write to the Free Software
6997 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7000 +#ifndef AVCODEC_VAAPI_H
7001 +#define AVCODEC_VAAPI_H
7005 + * @ingroup lavc_codec_hwaccel_vaapi
7006 + * Public libavcodec VA API header.
7009 +#include <stdint.h>
7010 +#include "libavutil/attributes.h"
7011 +#include "version.h"
7013 +#if FF_API_STRUCT_VAAPI_CONTEXT
7016 + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
7017 + * @ingroup lavc_codec_hwaccel
7022 + * This structure is used to share data between the FFmpeg library and
7023 + * the client video application.
7024 + * This shall be zero-allocated and available as
7025 + * AVCodecContext.hwaccel_context. All user members can be set once
7026 + * during initialization or through each AVCodecContext.get_buffer()
7027 + * function call. In any case, they must be valid prior to calling
7028 + * decoding functions.
7030 + * Deprecated: use AVCodecContext.hw_frames_ctx instead.
7032 +struct attribute_deprecated vaapi_context {
7034 + * Window system dependent data
7036 + * - encoding: unused
7037 + * - decoding: Set by user
7042 + * Configuration ID
7044 + * - encoding: unused
7045 + * - decoding: Set by user
7047 + uint32_t config_id;
7050 + * Context ID (video decode pipeline)
7052 + * - encoding: unused
7053 + * - decoding: Set by user
7055 + uint32_t context_id;
7060 +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
7062 +#endif /* AVCODEC_VAAPI_H */
7063 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7064 new file mode 100644
7066 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7069 + * The Video Decode and Presentation API for UNIX (VDPAU) is used for
7070 + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
7072 + * Copyright (C) 2008 NVIDIA
7074 + * This file is part of FFmpeg.
7076 + * FFmpeg is free software; you can redistribute it and/or
7077 + * modify it under the terms of the GNU Lesser General Public
7078 + * License as published by the Free Software Foundation; either
7079 + * version 2.1 of the License, or (at your option) any later version.
7081 + * FFmpeg is distributed in the hope that it will be useful,
7082 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7083 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7084 + * Lesser General Public License for more details.
7086 + * You should have received a copy of the GNU Lesser General Public
7087 + * License along with FFmpeg; if not, write to the Free Software
7088 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7091 +#ifndef AVCODEC_VDPAU_H
7092 +#define AVCODEC_VDPAU_H
7096 + * @ingroup lavc_codec_hwaccel_vdpau
7097 + * Public libavcodec VDPAU header.
7102 + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
7103 + * @ingroup lavc_codec_hwaccel
7105 + * VDPAU hardware acceleration has two modules
7106 + * - VDPAU decoding
7107 + * - VDPAU presentation
7109 + * The VDPAU decoding module parses all headers using FFmpeg
7110 + * parsing mechanisms and uses VDPAU for the actual decoding.
7112 + * As per the current implementation, the actual decoding
7113 + * and rendering (API calls) are done as part of the VDPAU
7114 + * presentation (vo_vdpau.c) module.
7119 +#include <vdpau/vdpau.h>
7121 +#include "libavutil/avconfig.h"
7122 +#include "libavutil/attributes.h"
7124 +#include "avcodec.h"
7125 +#include "version.h"
7127 +struct AVCodecContext;
7130 +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
7131 + const VdpPictureInfo *, uint32_t,
7132 + const VdpBitstreamBuffer *);
7135 + * This structure is used to share data between the libavcodec library and
7136 + * the client video application.
7137 + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
7138 + * function and make it available as
7139 + * AVCodecContext.hwaccel_context. Members can be set by the user once
7140 + * during initialization or through each AVCodecContext.get_buffer()
7141 + * function call. In any case, they must be valid prior to calling
7142 + * decoding functions.
7144 + * The size of this structure is not a part of the public ABI and must not
7145 + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
7148 +typedef struct AVVDPAUContext {
7150 + * VDPAU decoder handle
7154 + VdpDecoder decoder;
7157 + * VDPAU decoder render callback
7159 + * Set by the user.
7161 + VdpDecoderRender *render;
7163 + AVVDPAU_Render2 render2;
7167 + * @brief allocation function for AVVDPAUContext
7169 + * Allows extending the struct without breaking API/ABI
7171 +AVVDPAUContext *av_alloc_vdpaucontext(void);
7173 +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
7174 +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
7177 + * Associate a VDPAU device with a codec context for hardware acceleration.
7178 + * This function is meant to be called from the get_format() codec callback,
7179 + * or earlier. It can also be called after avcodec_flush_buffers() to change
7180 + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
7181 + * display preemption).
7183 + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
7186 + * @param avctx decoding context whose get_format() callback is invoked
7187 + * @param device VDPAU device handle to use for hardware acceleration
7188 + * @param get_proc_address VDPAU device driver
7189 + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
7191 + * @return 0 on success, an AVERROR code on failure.
7193 +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
7194 + VdpGetProcAddress *get_proc_address, unsigned flags);
7197 + * Gets the parameters to create an adequate VDPAU video surface for the codec
7198 + * context using VDPAU hardware decoding acceleration.
7200 + * @note Behavior is undefined if the context was not successfully bound to a
7201 + * VDPAU device using av_vdpau_bind_context().
7203 + * @param avctx the codec context being used for decoding the stream
7204 + * @param type storage space for the VDPAU video surface chroma type
7205 + * (or NULL to ignore)
7206 + * @param width storage space for the VDPAU video surface pixel width
7207 + * (or NULL to ignore)
7208 + * @param height storage space for the VDPAU video surface pixel height
7209 + * (or NULL to ignore)
7211 + * @return 0 on success, a negative AVERROR code on failure.
7213 +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
7214 + uint32_t *width, uint32_t *height);
7217 + * Allocate an AVVDPAUContext.
7219 + * @return Newly-allocated AVVDPAUContext or NULL on failure.
7221 +AVVDPAUContext *av_vdpau_alloc_context(void);
7223 +#if FF_API_VDPAU_PROFILE
7225 + * Get a decoder profile that should be used for initializing a VDPAU decoder.
7226 + * Should be called from the AVCodecContext.get_format() callback.
7228 + * @deprecated Use av_vdpau_bind_context() instead.
7230 + * @param avctx the codec context being used for decoding the stream
7231 + * @param profile a pointer into which the result will be written on success.
7232 + * The contents of profile are undefined if this function returns
7235 + * @return 0 on success (non-negative), a negative AVERROR on failure.
7237 +attribute_deprecated
7238 +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
7243 +#endif /* AVCODEC_VDPAU_H */
7244 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7245 new file mode 100644
7247 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7250 + * This file is part of FFmpeg.
7252 + * FFmpeg is free software; you can redistribute it and/or
7253 + * modify it under the terms of the GNU Lesser General Public
7254 + * License as published by the Free Software Foundation; either
7255 + * version 2.1 of the License, or (at your option) any later version.
7257 + * FFmpeg is distributed in the hope that it will be useful,
7258 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7259 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7260 + * Lesser General Public License for more details.
7262 + * You should have received a copy of the GNU Lesser General Public
7263 + * License along with FFmpeg; if not, write to the Free Software
7264 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7267 +#ifndef AVCODEC_VERSION_H
7268 +#define AVCODEC_VERSION_H
7273 + * Libavcodec version macros.
7276 +#include "libavutil/version.h"
7278 +#define LIBAVCODEC_VERSION_MAJOR 58
7279 +#define LIBAVCODEC_VERSION_MINOR 18
7280 +#define LIBAVCODEC_VERSION_MICRO 100
7282 +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
7283 + LIBAVCODEC_VERSION_MINOR, \
7284 + LIBAVCODEC_VERSION_MICRO)
7285 +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
7286 + LIBAVCODEC_VERSION_MINOR, \
7287 + LIBAVCODEC_VERSION_MICRO)
7288 +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
7290 +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
7293 + * FF_API_* defines may be placed below to indicate public API that will be
7294 + * dropped at a future version bump. The defines themselves are not part of
7295 + * the public API and may change, break or disappear at any time.
7297 + * @note, when bumping the major version it is recommended to manually
7298 + * disable each FF_API_* in its own commit instead of disabling them all
7299 + * at once through the bump. This improves the git bisect-ability of the change.
7302 +#ifndef FF_API_LOWRES
7303 +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
7305 +#ifndef FF_API_DEBUG_MV
7306 +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
7308 +#ifndef FF_API_AVCTX_TIMEBASE
7309 +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
7311 +#ifndef FF_API_CODED_FRAME
7312 +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59)
7314 +#ifndef FF_API_SIDEDATA_ONLY_PKT
7315 +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
7317 +#ifndef FF_API_VDPAU_PROFILE
7318 +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59)
7320 +#ifndef FF_API_CONVERGENCE_DURATION
7321 +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
7323 +#ifndef FF_API_AVPICTURE
7324 +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59)
7326 +#ifndef FF_API_AVPACKET_OLD_API
7327 +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7329 +#ifndef FF_API_RTP_CALLBACK
7330 +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59)
7332 +#ifndef FF_API_VBV_DELAY
7333 +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59)
7335 +#ifndef FF_API_CODER_TYPE
7336 +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59)
7338 +#ifndef FF_API_STAT_BITS
7339 +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
7341 +#ifndef FF_API_PRIVATE_OPT
7342 +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
7344 +#ifndef FF_API_ASS_TIMING
7345 +#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
7347 +#ifndef FF_API_OLD_BSF
7348 +#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
7350 +#ifndef FF_API_COPY_CONTEXT
7351 +#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7353 +#ifndef FF_API_GET_CONTEXT_DEFAULTS
7354 +#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
7356 +#ifndef FF_API_NVENC_OLD_NAME
7357 +#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
7359 +#ifndef FF_API_STRUCT_VAAPI_CONTEXT
7360 +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7362 +#ifndef FF_API_MERGE_SD_API
7363 +#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7365 +#ifndef FF_API_TAG_STRING
7366 +#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59)
7368 +#ifndef FF_API_GETCHROMA
7369 +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59)
7371 +#ifndef FF_API_CODEC_GET_SET
7372 +#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59)
7374 +#ifndef FF_API_USER_VISIBLE_AVHWACCEL
7375 +#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
7377 +#ifndef FF_API_LOCKMGR
7378 +#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
7380 +#ifndef FF_API_NEXT
7381 +#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7385 +#endif /* AVCODEC_VERSION_H */
7386 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7387 new file mode 100644
7389 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7392 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7394 + * This file is part of FFmpeg.
7396 + * FFmpeg is free software; you can redistribute it and/or
7397 + * modify it under the terms of the GNU Lesser General Public
7398 + * License as published by the Free Software Foundation; either
7399 + * version 2.1 of the License, or (at your option) any later version.
7401 + * FFmpeg is distributed in the hope that it will be useful,
7402 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7403 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7404 + * Lesser General Public License for more details.
7406 + * You should have received a copy of the GNU Lesser General Public
7407 + * License along with FFmpeg; if not, write to the Free Software
7408 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7413 + * Macro definitions for various function/variable attributes
7416 +#ifndef AVUTIL_ATTRIBUTES_H
7417 +#define AVUTIL_ATTRIBUTES_H
7420 +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
7421 +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
7423 +# define AV_GCC_VERSION_AT_LEAST(x,y) 0
7424 +# define AV_GCC_VERSION_AT_MOST(x,y) 0
7427 +#ifndef av_always_inline
7428 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7429 +# define av_always_inline __attribute__((always_inline)) inline
7430 +#elif defined(_MSC_VER)
7431 +# define av_always_inline __forceinline
7433 +# define av_always_inline inline
7437 +#ifndef av_extern_inline
7438 +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
7439 +# define av_extern_inline extern inline
7441 +# define av_extern_inline inline
7445 +#if AV_GCC_VERSION_AT_LEAST(3,4)
7446 +# define av_warn_unused_result __attribute__((warn_unused_result))
7448 +# define av_warn_unused_result
7451 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7452 +# define av_noinline __attribute__((noinline))
7453 +#elif defined(_MSC_VER)
7454 +# define av_noinline __declspec(noinline)
7456 +# define av_noinline
7459 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7460 +# define av_pure __attribute__((pure))
7465 +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
7466 +# define av_const __attribute__((const))
7471 +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
7472 +# define av_cold __attribute__((cold))
7477 +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
7478 +# define av_flatten __attribute__((flatten))
7480 +# define av_flatten
7483 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7484 +# define attribute_deprecated __attribute__((deprecated))
7485 +#elif defined(_MSC_VER)
7486 +# define attribute_deprecated __declspec(deprecated)
7488 +# define attribute_deprecated
7492 + * Disable warnings about deprecated features
7493 + * This is useful for sections of code kept for backward compatibility and
7494 + * scheduled for removal.
7496 +#ifndef AV_NOWARN_DEPRECATED
7497 +#if AV_GCC_VERSION_AT_LEAST(4,6)
7498 +# define AV_NOWARN_DEPRECATED(code) \
7499 + _Pragma("GCC diagnostic push") \
7500 + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
7502 + _Pragma("GCC diagnostic pop")
7503 +#elif defined(_MSC_VER)
7504 +# define AV_NOWARN_DEPRECATED(code) \
7505 + __pragma(warning(push)) \
7506 + __pragma(warning(disable : 4996)) \
7508 + __pragma(warning(pop))
7510 +# define AV_NOWARN_DEPRECATED(code) code
7514 +#if defined(__GNUC__) || defined(__clang__)
7515 +# define av_unused __attribute__((unused))
7521 + * Mark a variable as used and prevent the compiler from optimizing it
7522 + * away. This is useful for variables accessed only from inline
7523 + * assembler without the compiler being aware.
7525 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7526 +# define av_used __attribute__((used))
7531 +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
7532 +# define av_alias __attribute__((may_alias))
7537 +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
7538 +# define av_uninit(x) x=x
7540 +# define av_uninit(x) x
7543 +#if defined(__GNUC__) || defined(__clang__)
7544 +# define av_builtin_constant_p __builtin_constant_p
7545 +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
7547 +# define av_builtin_constant_p(x) 0
7548 +# define av_printf_format(fmtpos, attrpos)
7551 +#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
7552 +# define av_noreturn __attribute__((noreturn))
7554 +# define av_noreturn
7557 +#endif /* AVUTIL_ATTRIBUTES_H */
7558 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7559 new file mode 100644
7561 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7563 +/* Generated by ffmpeg configure */
7564 +#ifndef AVUTIL_AVCONFIG_H
7565 +#define AVUTIL_AVCONFIG_H
7566 +#define AV_HAVE_BIGENDIAN 0
7567 +#define AV_HAVE_FAST_UNALIGNED 1
7568 +#endif /* AVUTIL_AVCONFIG_H */
7569 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7570 new file mode 100644
7572 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7575 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7577 + * This file is part of FFmpeg.
7579 + * FFmpeg is free software; you can redistribute it and/or
7580 + * modify it under the terms of the GNU Lesser General Public
7581 + * License as published by the Free Software Foundation; either
7582 + * version 2.1 of the License, or (at your option) any later version.
7584 + * FFmpeg is distributed in the hope that it will be useful,
7585 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7586 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7587 + * Lesser General Public License for more details.
7589 + * You should have received a copy of the GNU Lesser General Public
7590 + * License along with FFmpeg; if not, write to the Free Software
7591 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7594 +#ifndef AVUTIL_AVUTIL_H
7595 +#define AVUTIL_AVUTIL_H
7600 + * Convenience header that includes @ref lavu "libavutil"'s core.
7606 + * @section ffmpeg_intro Introduction
7608 + * This document describes the usage of the different libraries
7609 + * provided by FFmpeg.
7611 + * @li @ref libavc "libavcodec" encoding/decoding library
7612 + * @li @ref lavfi "libavfilter" graph-based frame editing library
7613 + * @li @ref libavf "libavformat" I/O and muxing/demuxing library
7614 + * @li @ref lavd "libavdevice" special devices muxing/demuxing library
7615 + * @li @ref lavu "libavutil" common utility library
7616 + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
7617 + * @li @ref lpp "libpostproc" post processing library
7618 + * @li @ref libsws "libswscale" color conversion and scaling library
7620 + * @section ffmpeg_versioning Versioning and compatibility
7622 + * Each of the FFmpeg libraries contains a version.h header, which defines a
7623 + * major, minor and micro version number with the
7624 + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
7625 + * number is incremented with backward incompatible changes - e.g. removing
7626 + * parts of the public API, reordering public struct members, etc. The minor
7627 + * version number is incremented for backward compatible API changes or major
7628 + * new features - e.g. adding a new public function or a new decoder. The micro
7629 + * version number is incremented for smaller changes that a calling program
7630 + * might still want to check for - e.g. changing behavior in a previously
7631 + * unspecified situation.
7633 + * FFmpeg guarantees backward API and ABI compatibility for each library as long
7634 + * as its major version number is unchanged. This means that no public symbols
7635 + * will be removed or renamed. Types and names of the public struct members and
7636 + * values of public macros and enums will remain the same (unless they were
7637 + * explicitly declared as not part of the public API). Documented behavior will
7640 + * In other words, any correct program that works with a given FFmpeg snapshot
7641 + * should work just as well without any changes with any later snapshot with the
7642 + * same major versions. This applies to both rebuilding the program against new
7643 + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
7646 + * However, new public symbols may be added and new members may be appended to
7647 + * public structs whose size is not part of public ABI (most public structs in
7648 + * FFmpeg). New macros and enum values may be added. Behavior in undocumented
7649 + * situations may change slightly (and be documented). All those are accompanied
7650 + * by an entry in doc/APIchanges and incrementing either the minor or micro
7655 + * @defgroup lavu libavutil
7656 + * Common code shared across all FFmpeg libraries.
7659 + * libavutil is designed to be modular. In most cases, in order to use the
7660 + * functions provided by one component of libavutil you must explicitly include
7661 + * the specific header containing that feature. If you are only using
7662 + * media-related components, you could simply include libavutil/avutil.h, which
7663 + * brings in most of the "core" components.
7667 + * @defgroup lavu_crypto Crypto and Hashing
7672 + * @defgroup lavu_math Mathematics
7677 + * @defgroup lavu_string String Manipulation
7683 + * @defgroup lavu_mem Memory Management
7689 + * @defgroup lavu_data Data Structures
7694 + * @defgroup lavu_video Video related
7700 + * @defgroup lavu_audio Audio related
7706 + * @defgroup lavu_error Error Codes
7712 + * @defgroup lavu_log Logging Facility
7718 + * @defgroup lavu_misc Other
7722 + * @defgroup preproc_misc Preprocessor String Macros
7728 + * @defgroup version_utils Library Version Macros
7737 + * @addtogroup lavu_ver
7742 + * Return the LIBAVUTIL_VERSION_INT constant.
7744 +unsigned avutil_version(void);
7747 + * Return an informative version string. This usually is the actual release
7748 + * version number or a git commit description. This string has no fixed format
7749 + * and can change any time. It should never be parsed by code.
7751 +const char *av_version_info(void);
7754 + * Return the libavutil build-time configuration.
7756 +const char *avutil_configuration(void);
7759 + * Return the libavutil license.
7761 +const char *avutil_license(void);
7768 + * @addtogroup lavu_media Media Type
7769 + * @brief Media Type
7773 + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
7774 + AVMEDIA_TYPE_VIDEO,
7775 + AVMEDIA_TYPE_AUDIO,
7776 + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
7777 + AVMEDIA_TYPE_SUBTITLE,
7778 + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
7783 + * Return a string describing the media_type enum, NULL if media_type
7786 +const char *av_get_media_type_string(enum AVMediaType media_type);
7789 + * @defgroup lavu_const Constants
7792 + * @defgroup lavu_enc Encoding specific
7794 + * @note those definition should move to avcodec
7798 +#define FF_LAMBDA_SHIFT 7
7799 +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
7800 +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
7801 +#define FF_LAMBDA_MAX (256*128-1)
7803 +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
7807 + * @defgroup lavu_time Timestamp specific
7809 + * FFmpeg internal timebase and timestamp definitions
7815 + * @brief Undefined timestamp value
7817 + * Usually reported by demuxer that work on containers that do not provide
7818 + * either pts or dts.
7821 +#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
7824 + * Internal time base represented as integer
7827 +#define AV_TIME_BASE 1000000
7830 + * Internal time base represented as fractional value
7833 +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
7838 + * @defgroup lavu_picture Image related
7840 + * AVPicture types, pixel formats and basic image planes manipulation.
7845 +enum AVPictureType {
7846 + AV_PICTURE_TYPE_NONE = 0, ///< Undefined
7847 + AV_PICTURE_TYPE_I, ///< Intra
7848 + AV_PICTURE_TYPE_P, ///< Predicted
7849 + AV_PICTURE_TYPE_B, ///< Bi-dir predicted
7850 + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
7851 + AV_PICTURE_TYPE_SI, ///< Switching Intra
7852 + AV_PICTURE_TYPE_SP, ///< Switching Predicted
7853 + AV_PICTURE_TYPE_BI, ///< BI type
7857 + * Return a single letter to describe the given picture type
7860 + * @param[in] pict_type the picture type @return a single character
7861 + * representing the picture type, '?' if pict_type is unknown
7863 +char av_get_picture_type_char(enum AVPictureType pict_type);
7869 +#include "common.h"
7871 +#include "rational.h"
7872 +#include "version.h"
7873 +#include "macros.h"
7874 +#include "mathematics.h"
7876 +#include "pixfmt.h"
7879 + * Return x default pointer in case p is NULL.
7881 +static inline void *av_x_if_null(const void *p, const void *x)
7883 + return (void *)(intptr_t)(p ? p : x);
7887 + * Compute the length of an integer list.
7889 + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
7890 + * @param term list terminator (usually 0 or -1)
7891 + * @param list pointer to the list
7892 + * @return length of the list, in elements, not counting the terminator
7894 +unsigned av_int_list_length_for_size(unsigned elsize,
7895 + const void *list, uint64_t term) av_pure;
7898 + * Compute the length of an integer list.
7900 + * @param term list terminator (usually 0 or -1)
7901 + * @param list pointer to the list
7902 + * @return length of the list, in elements, not counting the terminator
7904 +#define av_int_list_length(list, term) \
7905 + av_int_list_length_for_size(sizeof(*(list)), list, term)
7908 + * Open a file using a UTF-8 filename.
7909 + * The API of this function matches POSIX fopen(), errors are returned through
7912 +FILE *av_fopen_utf8(const char *path, const char *mode);
7915 + * Return the fractional representation of the internal time base.
7917 +AVRational av_get_time_base_q(void);
7919 +#define AV_FOURCC_MAX_STRING_SIZE 32
7921 +#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
7924 + * Fill the provided buffer with a string containing a FourCC (four-character
7925 + * code) representation.
7927 + * @param buf a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
7928 + * @param fourcc the fourcc to represent
7929 + * @return the buffer in input
7931 +char *av_fourcc_make_string(char *buf, uint32_t fourcc);
7938 +#endif /* AVUTIL_AVUTIL_H */
7939 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7940 new file mode 100644
7942 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7945 + * This file is part of FFmpeg.
7947 + * FFmpeg is free software; you can redistribute it and/or
7948 + * modify it under the terms of the GNU Lesser General Public
7949 + * License as published by the Free Software Foundation; either
7950 + * version 2.1 of the License, or (at your option) any later version.
7952 + * FFmpeg is distributed in the hope that it will be useful,
7953 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7954 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7955 + * Lesser General Public License for more details.
7957 + * You should have received a copy of the GNU Lesser General Public
7958 + * License along with FFmpeg; if not, write to the Free Software
7959 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7964 + * @ingroup lavu_buffer
7965 + * refcounted data buffer API
7968 +#ifndef AVUTIL_BUFFER_H
7969 +#define AVUTIL_BUFFER_H
7971 +#include <stdint.h>
7974 + * @defgroup lavu_buffer AVBuffer
7975 + * @ingroup lavu_data
7978 + * AVBuffer is an API for reference-counted data buffers.
7980 + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
7981 + * represents the data buffer itself; it is opaque and not meant to be accessed
7982 + * by the caller directly, but only through AVBufferRef. However, the caller may
7983 + * e.g. compare two AVBuffer pointers to check whether two different references
7984 + * are describing the same data buffer. AVBufferRef represents a single
7985 + * reference to an AVBuffer and it is the object that may be manipulated by the
7986 + * caller directly.
7988 + * There are two functions provided for creating a new AVBuffer with a single
7989 + * reference -- av_buffer_alloc() to just allocate a new buffer, and
7990 + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
7991 + * reference, additional references may be created with av_buffer_ref().
7992 + * Use av_buffer_unref() to free a reference (this will automatically free the
7993 + * data once all the references are freed).
7995 + * The convention throughout this API and the rest of FFmpeg is such that the
7996 + * buffer is considered writable if there exists only one reference to it (and
7997 + * it has not been marked as read-only). The av_buffer_is_writable() function is
7998 + * provided to check whether this is true and av_buffer_make_writable() will
7999 + * automatically create a new writable buffer when necessary.
8000 + * Of course nothing prevents the calling code from violating this convention,
8001 + * however that is safe only when all the existing references are under its
8004 + * @note Referencing and unreferencing the buffers is thread-safe and thus
8005 + * may be done from multiple threads simultaneously without any need for
8006 + * additional locking.
8008 + * @note Two different references to the same buffer can point to different
8009 + * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
8013 + * A reference counted buffer type. It is opaque and is meant to be used through
8014 + * references (AVBufferRef).
8016 +typedef struct AVBuffer AVBuffer;
8019 + * A reference to a data buffer.
8021 + * The size of this struct is not a part of the public ABI and it is not meant
8022 + * to be allocated directly.
8024 +typedef struct AVBufferRef {
8028 + * The data buffer. It is considered writable if and only if
8029 + * this is the only reference to the buffer, in which case
8030 + * av_buffer_is_writable() returns 1.
8034 + * Size of data in bytes.
8040 + * Allocate an AVBuffer of the given size using av_malloc().
8042 + * @return an AVBufferRef of given size or NULL when out of memory
8044 +AVBufferRef *av_buffer_alloc(int size);
8047 + * Same as av_buffer_alloc(), except the returned buffer will be initialized
8050 +AVBufferRef *av_buffer_allocz(int size);
8053 + * Always treat the buffer as read-only, even when it has only one
8056 +#define AV_BUFFER_FLAG_READONLY (1 << 0)
8059 + * Create an AVBuffer from an existing array.
8061 + * If this function is successful, data is owned by the AVBuffer. The caller may
8062 + * only access data through the returned AVBufferRef and references derived from
8064 + * If this function fails, data is left untouched.
8065 + * @param data data array
8066 + * @param size size of data in bytes
8067 + * @param free a callback for freeing this buffer's data
8068 + * @param opaque parameter to be got for processing or passed to free
8069 + * @param flags a combination of AV_BUFFER_FLAG_*
8071 + * @return an AVBufferRef referring to data on success, NULL on failure.
8073 +AVBufferRef *av_buffer_create(uint8_t *data, int size,
8074 + void (*free)(void *opaque, uint8_t *data),
8075 + void *opaque, int flags);
8078 + * Default free callback, which calls av_free() on the buffer data.
8079 + * This function is meant to be passed to av_buffer_create(), not called
8082 +void av_buffer_default_free(void *opaque, uint8_t *data);
8085 + * Create a new reference to an AVBuffer.
8087 + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
8090 +AVBufferRef *av_buffer_ref(AVBufferRef *buf);
8093 + * Free a given reference and automatically free the buffer if there are no more
8094 + * references to it.
8096 + * @param buf the reference to be freed. The pointer is set to NULL on return.
8098 +void av_buffer_unref(AVBufferRef **buf);
8101 + * @return 1 if the caller may write to the data referred to by buf (which is
8102 + * true if and only if buf is the only reference to the underlying AVBuffer).
8103 + * Return 0 otherwise.
8104 + * A positive answer is valid until av_buffer_ref() is called on buf.
8106 +int av_buffer_is_writable(const AVBufferRef *buf);
8109 + * @return the opaque parameter set by av_buffer_create.
8111 +void *av_buffer_get_opaque(const AVBufferRef *buf);
8113 +int av_buffer_get_ref_count(const AVBufferRef *buf);
8116 + * Create a writable reference from a given buffer reference, avoiding data copy
8119 + * @param buf buffer reference to make writable. On success, buf is either left
8120 + * untouched, or it is unreferenced and a new writable AVBufferRef is
8121 + * written in its place. On failure, buf is left untouched.
8122 + * @return 0 on success, a negative AVERROR on failure.
8124 +int av_buffer_make_writable(AVBufferRef **buf);
8127 + * Reallocate a given buffer.
8129 + * @param buf a buffer reference to reallocate. On success, buf will be
8130 + * unreferenced and a new reference with the required size will be
8131 + * written in its place. On failure buf will be left untouched. *buf
8132 + * may be NULL, then a new buffer is allocated.
8133 + * @param size required new buffer size.
8134 + * @return 0 on success, a negative AVERROR on failure.
8136 + * @note the buffer is actually reallocated with av_realloc() only if it was
8137 + * initially allocated through av_buffer_realloc(NULL) and there is only one
8138 + * reference to it (i.e. the one passed to this function). In all other cases
8139 + * a new buffer is allocated and the data is copied.
8141 +int av_buffer_realloc(AVBufferRef **buf, int size);
8148 + * @defgroup lavu_bufferpool AVBufferPool
8149 + * @ingroup lavu_data
8152 + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
8154 + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
8155 + * meant to solve this in cases when the caller needs a set of buffers of the
8156 + * same size (the most obvious use case being buffers for raw video or audio
8159 + * At the beginning, the user must call av_buffer_pool_init() to create the
8160 + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
8161 + * get a reference to a new buffer, similar to av_buffer_alloc(). This new
8162 + * reference works in all aspects the same way as the one created by
8163 + * av_buffer_alloc(). However, when the last reference to this buffer is
8164 + * unreferenced, it is returned to the pool instead of being freed and will be
8165 + * reused for subsequent av_buffer_pool_get() calls.
8167 + * When the caller is done with the pool and no longer needs to allocate any new
8168 + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
8169 + * Once all the buffers are released, it will automatically be freed.
8171 + * Allocating and releasing buffers with this API is thread-safe as long as
8172 + * either the default alloc callback is used, or the user-supplied one is
8177 + * The buffer pool. This structure is opaque and not meant to be accessed
8178 + * directly. It is allocated with av_buffer_pool_init() and freed with
8179 + * av_buffer_pool_uninit().
8181 +typedef struct AVBufferPool AVBufferPool;
8184 + * Allocate and initialize a buffer pool.
8186 + * @param size size of each buffer in this pool
8187 + * @param alloc a function that will be used to allocate new buffers when the
8188 + * pool is empty. May be NULL, then the default allocator will be used
8189 + * (av_buffer_alloc()).
8190 + * @return newly created buffer pool on success, NULL on error.
8192 +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
8195 + * Allocate and initialize a buffer pool with a more complex allocator.
8197 + * @param size size of each buffer in this pool
8198 + * @param opaque arbitrary user data used by the allocator
8199 + * @param alloc a function that will be used to allocate new buffers when the
8201 + * @param pool_free a function that will be called immediately before the pool
8202 + * is freed. I.e. after av_buffer_pool_uninit() is called
8203 + * by the caller and all the frames are returned to the pool
8204 + * and freed. It is intended to uninitialize the user opaque
8206 + * @return newly created buffer pool on success, NULL on error.
8208 +AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
8209 + AVBufferRef* (*alloc)(void *opaque, int size),
8210 + void (*pool_free)(void *opaque));
8213 + * Mark the pool as being available for freeing. It will actually be freed only
8214 + * once all the allocated buffers associated with the pool are released. Thus it
8215 + * is safe to call this function while some of the allocated buffers are still
8218 + * @param pool pointer to the pool to be freed. It will be set to NULL.
8220 +void av_buffer_pool_uninit(AVBufferPool **pool);
8223 + * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
8224 + * This function may be called simultaneously from multiple threads.
8226 + * @return a reference to the new buffer on success, NULL on error.
8228 +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
8234 +#endif /* AVUTIL_BUFFER_H */
8235 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8236 new file mode 100644
8238 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8241 + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8242 + * Copyright (c) 2008 Peter Ross
8244 + * This file is part of FFmpeg.
8246 + * FFmpeg is free software; you can redistribute it and/or
8247 + * modify it under the terms of the GNU Lesser General Public
8248 + * License as published by the Free Software Foundation; either
8249 + * version 2.1 of the License, or (at your option) any later version.
8251 + * FFmpeg is distributed in the hope that it will be useful,
8252 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8253 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8254 + * Lesser General Public License for more details.
8256 + * You should have received a copy of the GNU Lesser General Public
8257 + * License along with FFmpeg; if not, write to the Free Software
8258 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8261 +#ifndef AVUTIL_CHANNEL_LAYOUT_H
8262 +#define AVUTIL_CHANNEL_LAYOUT_H
8264 +#include <stdint.h>
8268 + * audio channel layout utility functions
8272 + * @addtogroup lavu_audio
8277 + * @defgroup channel_masks Audio channel masks
8279 + * A channel layout is a 64-bits integer with a bit set for every channel.
8280 + * The number of bits set must be equal to the number of channels.
8281 + * The value 0 means that the channel layout is not known.
8282 + * @note this data structure is not powerful enough to handle channels
8283 + * combinations that have the same channel multiple times, such as
8288 +#define AV_CH_FRONT_LEFT 0x00000001
8289 +#define AV_CH_FRONT_RIGHT 0x00000002
8290 +#define AV_CH_FRONT_CENTER 0x00000004
8291 +#define AV_CH_LOW_FREQUENCY 0x00000008
8292 +#define AV_CH_BACK_LEFT 0x00000010
8293 +#define AV_CH_BACK_RIGHT 0x00000020
8294 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
8295 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
8296 +#define AV_CH_BACK_CENTER 0x00000100
8297 +#define AV_CH_SIDE_LEFT 0x00000200
8298 +#define AV_CH_SIDE_RIGHT 0x00000400
8299 +#define AV_CH_TOP_CENTER 0x00000800
8300 +#define AV_CH_TOP_FRONT_LEFT 0x00001000
8301 +#define AV_CH_TOP_FRONT_CENTER 0x00002000
8302 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000
8303 +#define AV_CH_TOP_BACK_LEFT 0x00008000
8304 +#define AV_CH_TOP_BACK_CENTER 0x00010000
8305 +#define AV_CH_TOP_BACK_RIGHT 0x00020000
8306 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
8307 +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
8308 +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
8309 +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
8310 +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
8311 +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
8312 +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
8314 +/** Channel mask value used for AVCodecContext.request_channel_layout
8315 + to indicate that the user requests the channel order of the decoder output
8316 + to be the native codec channel order. */
8317 +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
8321 + * @defgroup channel_mask_c Audio channel layouts
8324 +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
8325 +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
8326 +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
8327 +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
8328 +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
8329 +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
8330 +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
8331 +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
8332 +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8333 +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8334 +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8335 +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
8336 +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8337 +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
8338 +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
8339 +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8340 +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
8341 +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
8342 +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
8343 +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
8344 +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8345 +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8346 +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8347 +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8348 +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8349 +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
8350 +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
8351 +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
8353 +enum AVMatrixEncoding {
8354 + AV_MATRIX_ENCODING_NONE,
8355 + AV_MATRIX_ENCODING_DOLBY,
8356 + AV_MATRIX_ENCODING_DPLII,
8357 + AV_MATRIX_ENCODING_DPLIIX,
8358 + AV_MATRIX_ENCODING_DPLIIZ,
8359 + AV_MATRIX_ENCODING_DOLBYEX,
8360 + AV_MATRIX_ENCODING_DOLBYHEADPHONE,
8361 + AV_MATRIX_ENCODING_NB
8365 + * Return a channel layout id that matches name, or 0 if no match is found.
8367 + * name can be one or several of the following notations,
8368 + * separated by '+' or '|':
8369 + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
8370 + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
8371 + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
8372 + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
8373 + * - a number of channels, in decimal, followed by 'c', yielding
8374 + * the default channel layout for that number of channels (@see
8375 + * av_get_default_channel_layout);
8376 + * - a channel layout mask, in hexadecimal starting with "0x" (see the
8377 + * AV_CH_* macros).
8379 + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
8381 +uint64_t av_get_channel_layout(const char *name);
8384 + * Return a channel layout and the number of channels based on the specified name.
8386 + * This function is similar to (@see av_get_channel_layout), but can also parse
8387 + * unknown channel layout specifications.
8389 + * @param[in] name channel layout specification string
8390 + * @param[out] channel_layout parsed channel layout (0 if unknown)
8391 + * @param[out] nb_channels number of channels
8393 + * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
8395 +int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
8398 + * Return a description of a channel layout.
8399 + * If nb_channels is <= 0, it is guessed from the channel_layout.
8401 + * @param buf put here the string containing the channel layout
8402 + * @param buf_size size in bytes of the buffer
8404 +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
8408 + * Append a description of a channel layout to a bprint buffer.
8410 +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
8413 + * Return the number of channels in the channel layout.
8415 +int av_get_channel_layout_nb_channels(uint64_t channel_layout);
8418 + * Return default channel layout for a given number of channels.
8420 +int64_t av_get_default_channel_layout(int nb_channels);
8423 + * Get the index of a channel in channel_layout.
8425 + * @param channel a channel layout describing exactly one channel which must be
8426 + * present in channel_layout.
8428 + * @return index of channel in channel_layout on success, a negative AVERROR
8431 +int av_get_channel_layout_channel_index(uint64_t channel_layout,
8432 + uint64_t channel);
8435 + * Get the channel with the given index in channel_layout.
8437 +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
8440 + * Get the name of a given channel.
8442 + * @return channel name on success, NULL on error.
8444 +const char *av_get_channel_name(uint64_t channel);
8447 + * Get the description of a given channel.
8449 + * @param channel a channel layout with a single channel
8450 + * @return channel description on success, NULL on error
8452 +const char *av_get_channel_description(uint64_t channel);
8455 + * Get the value and name of a standard channel layout.
8457 + * @param[in] index index in an internal list, starting at 0
8458 + * @param[out] layout channel layout mask
8459 + * @param[out] name name of the layout
8460 + * @return 0 if the layout exists,
8461 + * <0 if index is beyond the limits
8463 +int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
8464 + const char **name);
8471 +#endif /* AVUTIL_CHANNEL_LAYOUT_H */
8472 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8473 new file mode 100644
8475 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8478 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8480 + * This file is part of FFmpeg.
8482 + * FFmpeg is free software; you can redistribute it and/or
8483 + * modify it under the terms of the GNU Lesser General Public
8484 + * License as published by the Free Software Foundation; either
8485 + * version 2.1 of the License, or (at your option) any later version.
8487 + * FFmpeg is distributed in the hope that it will be useful,
8488 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8489 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8490 + * Lesser General Public License for more details.
8492 + * You should have received a copy of the GNU Lesser General Public
8493 + * License along with FFmpeg; if not, write to the Free Software
8494 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8499 + * common internal and external API header
8502 +#ifndef AVUTIL_COMMON_H
8503 +#define AVUTIL_COMMON_H
8505 +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
8506 +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
8510 +#include <inttypes.h>
8511 +#include <limits.h>
8513 +#include <stdint.h>
8515 +#include <stdlib.h>
8516 +#include <string.h>
8518 +#include "attributes.h"
8519 +#include "macros.h"
8520 +#include "version.h"
8521 +#include "libavutil/avconfig.h"
8523 +#if AV_HAVE_BIGENDIAN
8524 +# define AV_NE(be, le) (be)
8526 +# define AV_NE(be, le) (le)
8529 +//rounded division & shift
8530 +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
8532 +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
8533 +/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
8534 +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
8535 + : ((a) + (1<<(b)) - 1) >> (b))
8536 +/* Backwards compat. */
8537 +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
8539 +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
8540 +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
8543 + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
8544 + * are not representable as absolute values of their type. This is the same
8548 +#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
8549 +#define FFSIGN(a) ((a) > 0 ? 1 : -1)
8552 + * Negative Absolute value.
8553 + * this works for all integers of all types.
8554 + * As with many macros, this evaluates its argument twice, it thus must not have
8555 + * a sideeffect, that is FFNABS(x++) has undefined behavior.
8557 +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
8561 + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
8562 + * if x == y. This is useful for instance in a qsort comparator callback.
8563 + * Furthermore, compilers are able to optimize this to branchless code, and
8564 + * there is no risk of overflow with signed types.
8565 + * As with many macros, this evaluates its argument multiple times, it thus
8566 + * must not have a side-effect.
8568 +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
8570 +#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
8571 +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
8572 +#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
8573 +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
8575 +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
8576 +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
8578 +/* misc math functions */
8580 +#ifdef HAVE_AV_CONFIG_H
8581 +# include "config.h"
8582 +# include "intmath.h"
8585 +/* Pull in unguarded fallback defines at the end of this file. */
8586 +#include "common.h"
8589 +av_const int av_log2(unsigned v);
8592 +#ifndef av_log2_16bit
8593 +av_const int av_log2_16bit(unsigned v);
8597 + * Clip a signed integer value into the amin-amax range.
8598 + * @param a value to clip
8599 + * @param amin minimum value of the clip range
8600 + * @param amax maximum value of the clip range
8601 + * @return clipped value
8603 +static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
8605 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8606 + if (amin > amax) abort();
8608 + if (a < amin) return amin;
8609 + else if (a > amax) return amax;
8614 + * Clip a signed 64bit integer value into the amin-amax range.
8615 + * @param a value to clip
8616 + * @param amin minimum value of the clip range
8617 + * @param amax maximum value of the clip range
8618 + * @return clipped value
8620 +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
8622 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8623 + if (amin > amax) abort();
8625 + if (a < amin) return amin;
8626 + else if (a > amax) return amax;
8631 + * Clip a signed integer value into the 0-255 range.
8632 + * @param a value to clip
8633 + * @return clipped value
8635 +static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
8637 + if (a&(~0xFF)) return (~a)>>31;
8642 + * Clip a signed integer value into the -128,127 range.
8643 + * @param a value to clip
8644 + * @return clipped value
8646 +static av_always_inline av_const int8_t av_clip_int8_c(int a)
8648 + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
8653 + * Clip a signed integer value into the 0-65535 range.
8654 + * @param a value to clip
8655 + * @return clipped value
8657 +static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
8659 + if (a&(~0xFFFF)) return (~a)>>31;
8664 + * Clip a signed integer value into the -32768,32767 range.
8665 + * @param a value to clip
8666 + * @return clipped value
8668 +static av_always_inline av_const int16_t av_clip_int16_c(int a)
8670 + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
8675 + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
8676 + * @param a value to clip
8677 + * @return clipped value
8679 +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
8681 + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
8682 + else return (int32_t)a;
8686 + * Clip a signed integer into the -(2^p),(2^p-1) range.
8687 + * @param a value to clip
8688 + * @param p bit position to clip at
8689 + * @return clipped value
8691 +static av_always_inline av_const int av_clip_intp2_c(int a, int p)
8693 + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
8694 + return (a >> 31) ^ ((1 << p) - 1);
8700 + * Clip a signed integer to an unsigned power of two range.
8701 + * @param a value to clip
8702 + * @param p bit position to clip at
8703 + * @return clipped value
8705 +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
8707 + if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
8712 + * Clear high bits from an unsigned integer starting with specific bit position
8713 + * @param a value to clip
8714 + * @param p bit position to clip at
8715 + * @return clipped value
8717 +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
8719 + return a & ((1 << p) - 1);
8723 + * Add two signed 32-bit values with saturation.
8725 + * @param a one value
8726 + * @param b another value
8727 + * @return sum with signed saturation
8729 +static av_always_inline int av_sat_add32_c(int a, int b)
8731 + return av_clipl_int32((int64_t)a + b);
8735 + * Add a doubled value to another value with saturation at both stages.
8737 + * @param a first value
8738 + * @param b value doubled and added to a
8739 + * @return sum sat(a + sat(2*b)) with signed saturation
8741 +static av_always_inline int av_sat_dadd32_c(int a, int b)
8743 + return av_sat_add32(a, av_sat_add32(b, b));
8747 + * Subtract two signed 32-bit values with saturation.
8749 + * @param a one value
8750 + * @param b another value
8751 + * @return difference with signed saturation
8753 +static av_always_inline int av_sat_sub32_c(int a, int b)
8755 + return av_clipl_int32((int64_t)a - b);
8759 + * Subtract a doubled value from another value with saturation at both stages.
8761 + * @param a first value
8762 + * @param b value doubled and subtracted from a
8763 + * @return difference sat(a - sat(2*b)) with signed saturation
8765 +static av_always_inline int av_sat_dsub32_c(int a, int b)
8767 + return av_sat_sub32(a, av_sat_add32(b, b));
8771 + * Clip a float value into the amin-amax range.
8772 + * @param a value to clip
8773 + * @param amin minimum value of the clip range
8774 + * @param amax maximum value of the clip range
8775 + * @return clipped value
8777 +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
8779 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8780 + if (amin > amax) abort();
8782 + if (a < amin) return amin;
8783 + else if (a > amax) return amax;
8788 + * Clip a double value into the amin-amax range.
8789 + * @param a value to clip
8790 + * @param amin minimum value of the clip range
8791 + * @param amax maximum value of the clip range
8792 + * @return clipped value
8794 +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
8796 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8797 + if (amin > amax) abort();
8799 + if (a < amin) return amin;
8800 + else if (a > amax) return amax;
8804 +/** Compute ceil(log2(x)).
8805 + * @param x value used to compute ceil(log2(x))
8806 + * @return computed ceiling of log2(x)
8808 +static av_always_inline av_const int av_ceil_log2_c(int x)
8810 + return av_log2((x - 1) << 1);
8814 + * Count number of bits set to one in x
8815 + * @param x value to count bits of
8816 + * @return the number of bits set to one in x
8818 +static av_always_inline av_const int av_popcount_c(uint32_t x)
8820 + x -= (x >> 1) & 0x55555555;
8821 + x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
8822 + x = (x + (x >> 4)) & 0x0F0F0F0F;
8824 + return (x + (x >> 16)) & 0x3F;
8828 + * Count number of bits set to one in x
8829 + * @param x value to count bits of
8830 + * @return the number of bits set to one in x
8832 +static av_always_inline av_const int av_popcount64_c(uint64_t x)
8834 + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
8837 +static av_always_inline av_const int av_parity_c(uint32_t v)
8839 + return av_popcount(v) & 1;
8842 +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
8843 +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
8846 + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
8848 + * @param val Output value, must be an lvalue of type uint32_t.
8849 + * @param GET_BYTE Expression reading one byte from the input.
8850 + * Evaluated up to 7 times (4 for the currently
8851 + * assigned Unicode range). With a memory buffer
8852 + * input, this could be *ptr++.
8853 + * @param ERROR Expression to be evaluated on invalid input,
8854 + * typically a goto statement.
8856 + * @warning ERROR should not contain a loop control statement which
8857 + * could interact with the internal while loop, and should force an
8858 + * exit from the macro code (e.g. through a goto or a return) in order
8859 + * to prevent undefined results.
8861 +#define GET_UTF8(val, GET_BYTE, ERROR)\
8864 + uint32_t top = (val & 128) >> 1;\
8865 + if ((val & 0xc0) == 0x80 || val >= 0xFE)\
8867 + while (val & top) {\
8868 + int tmp= (GET_BYTE) - 128;\
8871 + val= (val<<6) + tmp;\
8874 + val &= (top << 1) - 1;\
8878 + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
8880 + * @param val Output value, must be an lvalue of type uint32_t.
8881 + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
8882 + * to native byte order. Evaluated one or two times.
8883 + * @param ERROR Expression to be evaluated on invalid input,
8884 + * typically a goto statement.
8886 +#define GET_UTF16(val, GET_16BIT, ERROR)\
8889 + unsigned int hi = val - 0xD800;\
8890 + if (hi < 0x800) {\
8891 + val = GET_16BIT - 0xDC00;\
8892 + if (val > 0x3FFU || hi > 0x3FFU)\
8894 + val += (hi<<10) + 0x10000;\
8899 + * @def PUT_UTF8(val, tmp, PUT_BYTE)
8900 + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
8901 + * @param val is an input-only argument and should be of type uint32_t. It holds
8902 + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
8903 + * val is given as a function it is executed only once.
8904 + * @param tmp is a temporary variable and should be of type uint8_t. It
8905 + * represents an intermediate value during conversion that is to be
8906 + * output by PUT_BYTE.
8907 + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
8908 + * It could be a function or a statement, and uses tmp as the input byte.
8909 + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
8910 + * executed up to 4 times for values in the valid UTF-8 range and up to
8911 + * 7 times in the general case, depending on the length of the converted
8912 + * Unicode character.
8914 +#define PUT_UTF8(val, tmp, PUT_BYTE)\
8916 + int bytes, shift;\
8917 + uint32_t in = val;\
8922 + bytes = (av_log2(in) + 4) / 5;\
8923 + shift = (bytes - 1) * 6;\
8924 + tmp = (256 - (256 >> bytes)) | (in >> shift);\
8926 + while (shift >= 6) {\
8928 + tmp = 0x80 | ((in >> shift) & 0x3f);\
8935 + * @def PUT_UTF16(val, tmp, PUT_16BIT)
8936 + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
8937 + * @param val is an input-only argument and should be of type uint32_t. It holds
8938 + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
8939 + * val is given as a function it is executed only once.
8940 + * @param tmp is a temporary variable and should be of type uint16_t. It
8941 + * represents an intermediate value during conversion that is to be
8942 + * output by PUT_16BIT.
8943 + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
8944 + * in desired endianness. It could be a function or a statement, and uses tmp
8945 + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
8946 + * PUT_BYTE will be executed 1 or 2 times depending on input character.
8948 +#define PUT_UTF16(val, tmp, PUT_16BIT)\
8950 + uint32_t in = val;\
8951 + if (in < 0x10000) {\
8955 + tmp = 0xD800 | ((in - 0x10000) >> 10);\
8957 + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
8966 +#ifdef HAVE_AV_CONFIG_H
8967 +# include "internal.h"
8968 +#endif /* HAVE_AV_CONFIG_H */
8970 +#endif /* AVUTIL_COMMON_H */
8973 + * The following definitions are outside the multiple inclusion guard
8974 + * to ensure they are immediately available in intmath.h.
8977 +#ifndef av_ceil_log2
8978 +# define av_ceil_log2 av_ceil_log2_c
8981 +# define av_clip av_clip_c
8984 +# define av_clip64 av_clip64_c
8986 +#ifndef av_clip_uint8
8987 +# define av_clip_uint8 av_clip_uint8_c
8989 +#ifndef av_clip_int8
8990 +# define av_clip_int8 av_clip_int8_c
8992 +#ifndef av_clip_uint16
8993 +# define av_clip_uint16 av_clip_uint16_c
8995 +#ifndef av_clip_int16
8996 +# define av_clip_int16 av_clip_int16_c
8998 +#ifndef av_clipl_int32
8999 +# define av_clipl_int32 av_clipl_int32_c
9001 +#ifndef av_clip_intp2
9002 +# define av_clip_intp2 av_clip_intp2_c
9004 +#ifndef av_clip_uintp2
9005 +# define av_clip_uintp2 av_clip_uintp2_c
9007 +#ifndef av_mod_uintp2
9008 +# define av_mod_uintp2 av_mod_uintp2_c
9010 +#ifndef av_sat_add32
9011 +# define av_sat_add32 av_sat_add32_c
9013 +#ifndef av_sat_dadd32
9014 +# define av_sat_dadd32 av_sat_dadd32_c
9016 +#ifndef av_sat_sub32
9017 +# define av_sat_sub32 av_sat_sub32_c
9019 +#ifndef av_sat_dsub32
9020 +# define av_sat_dsub32 av_sat_dsub32_c
9023 +# define av_clipf av_clipf_c
9026 +# define av_clipd av_clipd_c
9028 +#ifndef av_popcount
9029 +# define av_popcount av_popcount_c
9031 +#ifndef av_popcount64
9032 +# define av_popcount64 av_popcount64_c
9035 +# define av_parity av_parity_c
9037 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9038 new file mode 100644
9040 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9043 + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
9045 + * This file is part of FFmpeg.
9047 + * FFmpeg is free software; you can redistribute it and/or
9048 + * modify it under the terms of the GNU Lesser General Public
9049 + * License as published by the Free Software Foundation; either
9050 + * version 2.1 of the License, or (at your option) any later version.
9052 + * FFmpeg is distributed in the hope that it will be useful,
9053 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9054 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9055 + * Lesser General Public License for more details.
9057 + * You should have received a copy of the GNU Lesser General Public
9058 + * License along with FFmpeg; if not, write to the Free Software
9059 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9062 +#ifndef AVUTIL_CPU_H
9063 +#define AVUTIL_CPU_H
9065 +#include <stddef.h>
9067 +#include "attributes.h"
9069 +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
9071 + /* lower 16 bits - CPU features */
9072 +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
9073 +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
9074 +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
9075 +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
9076 +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
9077 +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
9078 +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
9079 + ///< than regular MMX/SSE (e.g. Core1)
9080 +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
9081 +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
9082 +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
9083 + ///< than regular MMX/SSE (e.g. Core1)
9084 +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
9085 +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
9086 +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
9087 +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
9088 +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
9089 +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
9090 +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
9091 +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
9092 +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
9093 +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
9094 +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
9095 +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
9096 +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
9097 +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
9098 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
9099 +#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
9101 +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
9102 +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
9103 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
9105 +#define AV_CPU_FLAG_ARMV5TE (1 << 0)
9106 +#define AV_CPU_FLAG_ARMV6 (1 << 1)
9107 +#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
9108 +#define AV_CPU_FLAG_VFP (1 << 3)
9109 +#define AV_CPU_FLAG_VFPV3 (1 << 4)
9110 +#define AV_CPU_FLAG_NEON (1 << 5)
9111 +#define AV_CPU_FLAG_ARMV8 (1 << 6)
9112 +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
9113 +#define AV_CPU_FLAG_SETEND (1 <<16)
9116 + * Return the flags which specify extensions supported by the CPU.
9117 + * The returned value is affected by av_force_cpu_flags() if that was used
9118 + * before. So av_get_cpu_flags() can easily be used in an application to
9119 + * detect the enabled cpu flags.
9121 +int av_get_cpu_flags(void);
9124 + * Disables cpu detection and forces the specified flags.
9125 + * -1 is a special case that disables forcing of specific flags.
9127 +void av_force_cpu_flags(int flags);
9130 + * Set a mask on flags returned by av_get_cpu_flags().
9131 + * This function is mainly useful for testing.
9132 + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
9134 +attribute_deprecated void av_set_cpu_flags_mask(int mask);
9137 + * Parse CPU flags from a string.
9139 + * The returned flags contain the specified flags as well as related unspecified flags.
9141 + * This function exists only for compatibility with libav.
9142 + * Please use av_parse_cpu_caps() when possible.
9143 + * @return a combination of AV_CPU_* flags, negative on error.
9145 +attribute_deprecated
9146 +int av_parse_cpu_flags(const char *s);
9149 + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
9151 + * @return negative on error.
9153 +int av_parse_cpu_caps(unsigned *flags, const char *s);
9156 + * @return the number of logical CPU cores present.
9158 +int av_cpu_count(void);
9161 + * Get the maximum data alignment that may be required by FFmpeg.
9163 + * Note that this is affected by the build configuration and the CPU flags mask,
9164 + * so e.g. if the CPU supports AVX, but libavutil has been built with
9165 + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
9166 + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
9169 +size_t av_cpu_max_align(void);
9171 +#endif /* AVUTIL_CPU_H */
9172 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9173 new file mode 100644
9175 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9178 + * This file is part of FFmpeg.
9180 + * FFmpeg is free software; you can redistribute it and/or
9181 + * modify it under the terms of the GNU Lesser General Public
9182 + * License as published by the Free Software Foundation; either
9183 + * version 2.1 of the License, or (at your option) any later version.
9185 + * FFmpeg is distributed in the hope that it will be useful,
9186 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9187 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9188 + * Lesser General Public License for more details.
9190 + * You should have received a copy of the GNU Lesser General Public
9191 + * License along with FFmpeg; if not, write to the Free Software
9192 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9197 + * Public dictionary API.
9199 + * AVDictionary is provided for compatibility with libav. It is both in
9200 + * implementation as well as API inefficient. It does not scale and is
9201 + * extremely slow with large dictionaries.
9202 + * It is recommended that new code uses our tree container from tree.c/h
9203 + * where applicable, which uses AVL trees to achieve O(log n) performance.
9206 +#ifndef AVUTIL_DICT_H
9207 +#define AVUTIL_DICT_H
9209 +#include <stdint.h>
9211 +#include "version.h"
9214 + * @addtogroup lavu_dict AVDictionary
9215 + * @ingroup lavu_data
9217 + * @brief Simple key:value store
9220 + * Dictionaries are used for storing key:value pairs. To create
9221 + * an AVDictionary, simply pass an address of a NULL pointer to
9222 + * av_dict_set(). NULL can be used as an empty dictionary wherever
9223 + * a pointer to an AVDictionary is required.
9224 + * Use av_dict_get() to retrieve an entry or iterate over all
9225 + * entries and finally av_dict_free() to free the dictionary
9226 + * and all its contents.
9229 + AVDictionary *d = NULL; // "create" an empty dictionary
9230 + AVDictionaryEntry *t = NULL;
9232 + av_dict_set(&d, "foo", "bar", 0); // add an entry
9234 + char *k = av_strdup("key"); // if your strings are already allocated,
9235 + char *v = av_strdup("value"); // you can avoid copying them like this
9236 + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
9238 + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
9239 + <....> // iterate over all entries in d
9245 +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
9246 +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
9247 + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
9248 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
9249 + allocated with av_malloc() or another memory allocation function. */
9250 +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
9251 + allocated with av_malloc() or another memory allocation function. */
9252 +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
9253 +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
9254 + delimiter is added, the strings are simply concatenated. */
9255 +#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
9257 +typedef struct AVDictionaryEntry {
9260 +} AVDictionaryEntry;
9262 +typedef struct AVDictionary AVDictionary;
9265 + * Get a dictionary entry with matching key.
9267 + * The returned entry key or value must not be changed, or it will
9268 + * cause undefined behavior.
9270 + * To iterate through all the dictionary entries, you can set the matching key
9271 + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
9273 + * @param prev Set to the previous matching element to find the next.
9274 + * If set to NULL the first matching element is returned.
9275 + * @param key matching key
9276 + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
9277 + * @return found entry or NULL in case no matching entry was found in the dictionary
9279 +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
9280 + const AVDictionaryEntry *prev, int flags);
9283 + * Get number of entries in dictionary.
9285 + * @param m dictionary
9286 + * @return number of entries in dictionary
9288 +int av_dict_count(const AVDictionary *m);
9291 + * Set the given entry in *pm, overwriting an existing entry.
9293 + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
9294 + * these arguments will be freed on error.
9296 + * Warning: Adding a new entry to a dictionary invalidates all existing entries
9297 + * previously returned with av_dict_get.
9299 + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
9300 + * a dictionary struct is allocated and put in *pm.
9301 + * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
9302 + * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
9303 + * Passing a NULL value will cause an existing entry to be deleted.
9304 + * @return >= 0 on success otherwise an error code <0
9306 +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
9309 + * Convenience wrapper for av_dict_set that converts the value to a string
9312 + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
9314 +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
9317 + * Parse the key/value pairs list and add the parsed entries to a dictionary.
9319 + * In case of failure, all the successfully set entries are stored in
9320 + * *pm. You may need to manually free the created dictionary.
9322 + * @param key_val_sep a 0-terminated list of characters used to separate
9324 + * @param pairs_sep a 0-terminated list of characters used to separate
9325 + * two pairs from each other
9326 + * @param flags flags to use when adding to dictionary.
9327 + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
9328 + * are ignored since the key/value tokens will always
9330 + * @return 0 on success, negative AVERROR code on failure
9332 +int av_dict_parse_string(AVDictionary **pm, const char *str,
9333 + const char *key_val_sep, const char *pairs_sep,
9337 + * Copy entries from one AVDictionary struct into another.
9338 + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
9339 + * this function will allocate a struct for you and put it in *dst
9340 + * @param src pointer to source AVDictionary struct
9341 + * @param flags flags to use when setting entries in *dst
9342 + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
9343 + * @return 0 on success, negative AVERROR code on failure. If dst was allocated
9344 + * by this function, callers should free the associated memory.
9346 +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
9349 + * Free all the memory allocated for an AVDictionary struct
9350 + * and all keys and values.
9352 +void av_dict_free(AVDictionary **m);
9355 + * Get dictionary entries as a string.
9357 + * Create a string containing dictionary's entries.
9358 + * Such string may be passed back to av_dict_parse_string().
9359 + * @note String is escaped with backslashes ('\').
9361 + * @param[in] m dictionary
9362 + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
9363 + * Buffer must be freed by the caller when is no longer needed.
9364 + * @param[in] key_val_sep character used to separate key from value
9365 + * @param[in] pairs_sep character used to separate two pairs from each other
9366 + * @return >= 0 on success, negative on error
9367 + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
9369 +int av_dict_get_string(const AVDictionary *m, char **buffer,
9370 + const char key_val_sep, const char pairs_sep);
9376 +#endif /* AVUTIL_DICT_H */
9377 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9378 new file mode 100644
9380 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9383 + * This file is part of FFmpeg.
9385 + * FFmpeg is free software; you can redistribute it and/or
9386 + * modify it under the terms of the GNU Lesser General Public
9387 + * License as published by the Free Software Foundation; either
9388 + * version 2.1 of the License, or (at your option) any later version.
9390 + * FFmpeg is distributed in the hope that it will be useful,
9391 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9392 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9393 + * Lesser General Public License for more details.
9395 + * You should have received a copy of the GNU Lesser General Public
9396 + * License along with FFmpeg; if not, write to the Free Software
9397 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9402 + * error code definitions
9405 +#ifndef AVUTIL_ERROR_H
9406 +#define AVUTIL_ERROR_H
9409 +#include <stddef.h>
9412 + * @addtogroup lavu_error
9418 +/* error handling */
9420 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
9421 +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
9423 +/* Some platforms have E* and errno already negated. */
9424 +#define AVERROR(e) (e)
9425 +#define AVUNERROR(e) (e)
9428 +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
9430 +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
9431 +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
9432 +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
9433 +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
9434 +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
9435 +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
9436 +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
9437 +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
9438 +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
9439 +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
9440 +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
9441 +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
9442 +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
9443 +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
9444 +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
9446 +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
9448 + * This is semantically identical to AVERROR_BUG
9449 + * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
9451 +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
9452 +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
9453 +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
9454 +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
9455 +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
9456 +/* HTTP & RTSP errors */
9457 +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0')
9458 +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
9459 +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
9460 +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
9461 +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
9462 +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')
9464 +#define AV_ERROR_MAX_STRING_SIZE 64
9467 + * Put a description of the AVERROR code errnum in errbuf.
9468 + * In case of failure the global variable errno is set to indicate the
9469 + * error. Even in case of failure av_strerror() will print a generic
9470 + * error message indicating the errnum provided to errbuf.
9472 + * @param errnum error code to describe
9473 + * @param errbuf buffer to which description is written
9474 + * @param errbuf_size the size in bytes of errbuf
9475 + * @return 0 on success, a negative value if a description for errnum
9478 +int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
9481 + * Fill the provided buffer with a string containing an error string
9482 + * corresponding to the AVERROR code errnum.
9484 + * @param errbuf a buffer
9485 + * @param errbuf_size size in bytes of errbuf
9486 + * @param errnum error code to describe
9487 + * @return the buffer in input, filled with the error description
9488 + * @see av_strerror()
9490 +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
9492 + av_strerror(errnum, errbuf, errbuf_size);
9497 + * Convenience macro, the return value should be used only directly in
9498 + * function arguments but never stand-alone.
9500 +#define av_err2str(errnum) \
9501 + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
9507 +#endif /* AVUTIL_ERROR_H */
9508 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9509 new file mode 100644
9511 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9514 + * This file is part of FFmpeg.
9516 + * FFmpeg is free software; you can redistribute it and/or
9517 + * modify it under the terms of the GNU Lesser General Public
9518 + * License as published by the Free Software Foundation; either
9519 + * version 2.1 of the License, or (at your option) any later version.
9521 + * FFmpeg is distributed in the hope that it will be useful,
9522 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9523 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9524 + * Lesser General Public License for more details.
9526 + * You should have received a copy of the GNU Lesser General Public
9527 + * License along with FFmpeg; if not, write to the Free Software
9528 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9533 + * @ingroup lavu_frame
9534 + * reference-counted frame API
9537 +#ifndef AVUTIL_FRAME_H
9538 +#define AVUTIL_FRAME_H
9540 +#include <stddef.h>
9541 +#include <stdint.h>
9543 +#include "avutil.h"
9544 +#include "buffer.h"
9546 +#include "rational.h"
9547 +#include "samplefmt.h"
9548 +#include "pixfmt.h"
9549 +#include "version.h"
9553 + * @defgroup lavu_frame AVFrame
9554 + * @ingroup lavu_data
9557 + * AVFrame is an abstraction for reference-counted raw multimedia data.
9560 +enum AVFrameSideDataType {
9562 + * The data is the AVPanScan struct defined in libavcodec.
9564 + AV_FRAME_DATA_PANSCAN,
9566 + * ATSC A53 Part 4 Closed Captions.
9567 + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
9568 + * The number of bytes of CC data is AVFrameSideData.size.
9570 + AV_FRAME_DATA_A53_CC,
9572 + * Stereoscopic 3d metadata.
9573 + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
9575 + AV_FRAME_DATA_STEREO3D,
9577 + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
9579 + AV_FRAME_DATA_MATRIXENCODING,
9581 + * Metadata relevant to a downmix procedure.
9582 + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
9584 + AV_FRAME_DATA_DOWNMIX_INFO,
9586 + * ReplayGain information in the form of the AVReplayGain struct.
9588 + AV_FRAME_DATA_REPLAYGAIN,
9590 + * This side data contains a 3x3 transformation matrix describing an affine
9591 + * transformation that needs to be applied to the frame for correct
9594 + * See libavutil/display.h for a detailed description of the data.
9596 + AV_FRAME_DATA_DISPLAYMATRIX,
9598 + * Active Format Description data consisting of a single byte as specified
9599 + * in ETSI TS 101 154 using AVActiveFormatDescription enum.
9601 + AV_FRAME_DATA_AFD,
9603 + * Motion vectors exported by some codecs (on demand through the export_mvs
9604 + * flag set in the libavcodec AVCodecContext flags2 option).
9605 + * The data is the AVMotionVector struct defined in
9606 + * libavutil/motion_vector.h.
9608 + AV_FRAME_DATA_MOTION_VECTORS,
9610 + * Recommmends skipping the specified number of samples. This is exported
9611 + * only if the "skip_manual" AVOption is set in libavcodec.
9612 + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
9614 + * u32le number of samples to skip from start of this packet
9615 + * u32le number of samples to skip from end of this packet
9616 + * u8 reason for start skip
9617 + * u8 reason for end skip (0=padding silence, 1=convergence)
9620 + AV_FRAME_DATA_SKIP_SAMPLES,
9622 + * This side data must be associated with an audio frame and corresponds to
9623 + * enum AVAudioServiceType defined in avcodec.h.
9625 + AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
9627 + * Mastering display metadata associated with a video frame. The payload is
9628 + * an AVMasteringDisplayMetadata type and contains information about the
9629 + * mastering display color volume.
9631 + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
9633 + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
9634 + * This is set on the first frame of a GOP that has a temporal reference of 0.
9636 + AV_FRAME_DATA_GOP_TIMECODE,
9639 + * The data represents the AVSphericalMapping structure defined in
9640 + * libavutil/spherical.h.
9642 + AV_FRAME_DATA_SPHERICAL,
9645 + * Content light level (based on CTA-861.3). This payload contains data in
9646 + * the form of the AVContentLightMetadata struct.
9648 + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
9651 + * The data contains an ICC profile as an opaque octet buffer following the
9652 + * format described by ISO 15076-1 with an optional name defined in the
9653 + * metadata key entry "name".
9655 + AV_FRAME_DATA_ICC_PROFILE,
9657 +#if FF_API_FRAME_QP
9659 + * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
9660 + * The contents of this side data are undocumented and internal; use
9661 + * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
9662 + * meaningful way instead.
9664 + AV_FRAME_DATA_QP_TABLE_PROPERTIES,
9667 + * Raw QP table data. Its format is described by
9668 + * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
9669 + * av_frame_get_qp_table() to access this instead.
9671 + AV_FRAME_DATA_QP_TABLE_DATA,
9675 +enum AVActiveFormatDescription {
9680 + AV_AFD_4_3_SP_14_9 = 13,
9681 + AV_AFD_16_9_SP_14_9 = 14,
9682 + AV_AFD_SP_4_3 = 15,
9687 + * Structure to hold side data for an AVFrame.
9689 + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
9690 + * to the end with a minor bump.
9692 +typedef struct AVFrameSideData {
9693 + enum AVFrameSideDataType type;
9696 + AVDictionary *metadata;
9701 + * This structure describes decoded (raw) audio or video data.
9703 + * AVFrame must be allocated using av_frame_alloc(). Note that this only
9704 + * allocates the AVFrame itself, the buffers for the data must be managed
9705 + * through other means (see below).
9706 + * AVFrame must be freed with av_frame_free().
9708 + * AVFrame is typically allocated once and then reused multiple times to hold
9709 + * different data (e.g. a single AVFrame to hold frames received from a
9710 + * decoder). In such a case, av_frame_unref() will free any references held by
9711 + * the frame and reset it to its original clean state before it
9712 + * is reused again.
9714 + * The data described by an AVFrame is usually reference counted through the
9715 + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
9716 + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
9717 + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
9718 + * every single data plane must be contained in one of the buffers in
9719 + * AVFrame.buf or AVFrame.extended_buf.
9720 + * There may be a single buffer for all the data, or one separate buffer for
9721 + * each plane, or anything in between.
9723 + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
9724 + * to the end with a minor bump.
9726 + * Fields can be accessed through AVOptions, the name string used, matches the
9727 + * C structure field name for fields accessible through AVOptions. The AVClass
9728 + * for AVFrame can be obtained from avcodec_get_frame_class()
9730 +typedef struct AVFrame {
9731 +#define AV_NUM_DATA_POINTERS 8
9733 + * pointer to the picture/channel planes.
9734 + * This might be different from the first allocated byte
9736 + * Some decoders access areas outside 0,0 - width,height, please
9737 + * see avcodec_align_dimensions2(). Some filters and swscale can read
9738 + * up to 16 bytes beyond the planes, if these filters are to be used,
9739 + * then 16 extra bytes must be allocated.
9741 + * NOTE: Except for hwaccel formats, pointers not needed by the format
9742 + * MUST be set to NULL.
9744 + uint8_t *data[AV_NUM_DATA_POINTERS];
9747 + * For video, size in bytes of each picture line.
9748 + * For audio, size in bytes of each plane.
9750 + * For audio, only linesize[0] may be set. For planar audio, each channel
9751 + * plane must be the same size.
9753 + * For video the linesizes should be multiples of the CPUs alignment
9754 + * preference, this is 16 or 32 for modern desktop CPUs.
9755 + * Some code requires such alignment other code can be slower without
9756 + * correct alignment, for yet other it makes no difference.
9758 + * @note The linesize may be larger than the size of usable data -- there
9759 + * may be extra padding present for performance reasons.
9761 + int linesize[AV_NUM_DATA_POINTERS];
9764 + * pointers to the data planes/channels.
9766 + * For video, this should simply point to data[].
9768 + * For planar audio, each channel has a separate data pointer, and
9769 + * linesize[0] contains the size of each channel buffer.
9770 + * For packed audio, there is just one data pointer, and linesize[0]
9771 + * contains the total size of the buffer for all channels.
9773 + * Note: Both data and extended_data should always be set in a valid frame,
9774 + * but for planar audio with more channels that can fit in data,
9775 + * extended_data must be used in order to access all channels.
9777 + uint8_t **extended_data;
9780 + * @name Video dimensions
9781 + * Video frames only. The coded dimensions (in pixels) of the video frame,
9782 + * i.e. the size of the rectangle that contains some well-defined values.
9784 + * @note The part of the frame intended for display/presentation is further
9785 + * restricted by the @ref cropping "Cropping rectangle".
9788 + int width, height;
9794 + * number of audio samples (per channel) described by this frame
9799 + * format of the frame, -1 if unknown or unset
9800 + * Values correspond to enum AVPixelFormat for video frames,
9801 + * enum AVSampleFormat for audio)
9806 + * 1 -> keyframe, 0-> not
9811 + * Picture type of the frame.
9813 + enum AVPictureType pict_type;
9816 + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
9818 + AVRational sample_aspect_ratio;
9821 + * Presentation timestamp in time_base units (time when frame should be shown to user).
9827 + * PTS copied from the AVPacket that was decoded to produce this frame.
9828 + * @deprecated use the pts field instead
9830 + attribute_deprecated
9835 + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
9836 + * This is also the Presentation time of this AVFrame calculated from
9837 + * only AVPacket.dts values without pts values.
9842 + * picture number in bitstream order
9844 + int coded_picture_number;
9846 + * picture number in display order
9848 + int display_picture_number;
9851 + * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
9856 + * for some private data of the user
9860 +#if FF_API_ERROR_FRAME
9862 + * @deprecated unused
9864 + attribute_deprecated
9865 + uint64_t error[AV_NUM_DATA_POINTERS];
9869 + * When decoding, this signals how much the picture must be delayed.
9870 + * extra_delay = repeat_pict / (2*fps)
9875 + * The content of the picture is interlaced.
9877 + int interlaced_frame;
9880 + * If the content is interlaced, is top field displayed first.
9882 + int top_field_first;
9885 + * Tell user application that palette has changed from previous frame.
9887 + int palette_has_changed;
9890 + * reordered opaque 64 bits (generally an integer or a double precision float
9891 + * PTS but can be anything).
9892 + * The user sets AVCodecContext.reordered_opaque to represent the input at
9894 + * the decoder reorders values as needed and sets AVFrame.reordered_opaque
9895 + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
9896 + * @deprecated in favor of pkt_pts
9898 + int64_t reordered_opaque;
9901 + * Sample rate of the audio data.
9906 + * Channel layout of the audio data.
9908 + uint64_t channel_layout;
9911 + * AVBuffer references backing the data for this frame. If all elements of
9912 + * this array are NULL, then this frame is not reference counted. This array
9913 + * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
9914 + * also be non-NULL for all j < i.
9916 + * There may be at most one AVBuffer per data plane, so for video this array
9917 + * always contains all the references. For planar audio with more than
9918 + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
9919 + * this array. Then the extra AVBufferRef pointers are stored in the
9920 + * extended_buf array.
9922 + AVBufferRef *buf[AV_NUM_DATA_POINTERS];
9925 + * For planar audio which requires more than AV_NUM_DATA_POINTERS
9926 + * AVBufferRef pointers, this array will hold all the references which
9927 + * cannot fit into AVFrame.buf.
9929 + * Note that this is different from AVFrame.extended_data, which always
9930 + * contains all the pointers. This array only contains the extra pointers,
9931 + * which cannot fit into AVFrame.buf.
9933 + * This array is always allocated using av_malloc() by whoever constructs
9934 + * the frame. It is freed in av_frame_unref().
9936 + AVBufferRef **extended_buf;
9938 + * Number of elements in extended_buf.
9940 + int nb_extended_buf;
9942 + AVFrameSideData **side_data;
9946 + * @defgroup lavu_frame_flags AV_FRAME_FLAGS
9947 + * @ingroup lavu_frame
9948 + * Flags describing additional frame properties.
9954 + * The frame data may be corrupted, e.g. due to decoding errors.
9956 +#define AV_FRAME_FLAG_CORRUPT (1 << 0)
9958 + * A flag to mark the frames which need to be decoded, but shouldn't be output.
9960 +#define AV_FRAME_FLAG_DISCARD (1 << 2)
9966 + * Frame flags, a combination of @ref lavu_frame_flags
9971 + * MPEG vs JPEG YUV range.
9972 + * - encoding: Set by user
9973 + * - decoding: Set by libavcodec
9975 + enum AVColorRange color_range;
9977 + enum AVColorPrimaries color_primaries;
9979 + enum AVColorTransferCharacteristic color_trc;
9982 + * YUV colorspace type.
9983 + * - encoding: Set by user
9984 + * - decoding: Set by libavcodec
9986 + enum AVColorSpace colorspace;
9988 + enum AVChromaLocation chroma_location;
9991 + * frame timestamp estimated using various heuristics, in stream time base
9992 + * - encoding: unused
9993 + * - decoding: set by libavcodec, read by user.
9995 + int64_t best_effort_timestamp;
9998 + * reordered pos from the last AVPacket that has been input into the decoder
9999 + * - encoding: unused
10000 + * - decoding: Read by user.
10005 + * duration of the corresponding packet, expressed in
10006 + * AVStream->time_base units, 0 if unknown.
10007 + * - encoding: unused
10008 + * - decoding: Read by user.
10010 + int64_t pkt_duration;
10014 + * - encoding: Set by user.
10015 + * - decoding: Set by libavcodec.
10017 + AVDictionary *metadata;
10020 + * decode error flags of the frame, set to a combination of
10021 + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
10022 + * were errors during the decoding.
10023 + * - encoding: unused
10024 + * - decoding: set by libavcodec, read by user.
10026 + int decode_error_flags;
10027 +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
10028 +#define FF_DECODE_ERROR_MISSING_REFERENCE 2
10031 + * number of audio channels, only used for audio.
10032 + * - encoding: unused
10033 + * - decoding: Read by user.
10038 + * size of the corresponding packet containing the compressed
10040 + * It is set to a negative value if unknown.
10041 + * - encoding: unused
10042 + * - decoding: set by libavcodec, read by user.
10046 +#if FF_API_FRAME_QP
10050 + attribute_deprecated
10051 + int8_t *qscale_table;
10053 + * QP store stride
10055 + attribute_deprecated
10058 + attribute_deprecated
10061 + attribute_deprecated
10062 + AVBufferRef *qp_table_buf;
10065 + * For hwaccel-format frames, this should be a reference to the
10066 + * AVHWFramesContext describing the frame.
10068 + AVBufferRef *hw_frames_ctx;
10071 + * AVBufferRef for free use by the API user. FFmpeg will never check the
10072 + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
10073 + * the frame is unreferenced. av_frame_copy_props() calls create a new
10074 + * reference with av_buffer_ref() for the target frame's opaque_ref field.
10076 + * This is unrelated to the opaque field, although it serves a similar
10079 + AVBufferRef *opaque_ref;
10082 + * @anchor cropping
10084 + * Video frames only. The number of pixels to discard from the the
10085 + * top/bottom/left/right border of the frame to obtain the sub-rectangle of
10086 + * the frame intended for presentation.
10090 + size_t crop_bottom;
10091 + size_t crop_left;
10092 + size_t crop_right;
10098 + * AVBufferRef for internal use by a single libav* library.
10099 + * Must not be used to transfer data between libraries.
10100 + * Has to be NULL when ownership of the frame leaves the respective library.
10102 + * Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
10104 + * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
10105 + * av_frame_copy_props() calls create a new reference with av_buffer_ref()
10106 + * for the target frame's private_ref field.
10108 + AVBufferRef *private_ref;
10111 +#if FF_API_FRAME_GET_SET
10113 + * Accessors for some AVFrame fields. These used to be provided for ABI
10114 + * compatibility, and do not need to be used anymore.
10116 +attribute_deprecated
10117 +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
10118 +attribute_deprecated
10119 +void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
10120 +attribute_deprecated
10121 +int64_t av_frame_get_pkt_duration (const AVFrame *frame);
10122 +attribute_deprecated
10123 +void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
10124 +attribute_deprecated
10125 +int64_t av_frame_get_pkt_pos (const AVFrame *frame);
10126 +attribute_deprecated
10127 +void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
10128 +attribute_deprecated
10129 +int64_t av_frame_get_channel_layout (const AVFrame *frame);
10130 +attribute_deprecated
10131 +void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
10132 +attribute_deprecated
10133 +int av_frame_get_channels (const AVFrame *frame);
10134 +attribute_deprecated
10135 +void av_frame_set_channels (AVFrame *frame, int val);
10136 +attribute_deprecated
10137 +int av_frame_get_sample_rate (const AVFrame *frame);
10138 +attribute_deprecated
10139 +void av_frame_set_sample_rate (AVFrame *frame, int val);
10140 +attribute_deprecated
10141 +AVDictionary *av_frame_get_metadata (const AVFrame *frame);
10142 +attribute_deprecated
10143 +void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
10144 +attribute_deprecated
10145 +int av_frame_get_decode_error_flags (const AVFrame *frame);
10146 +attribute_deprecated
10147 +void av_frame_set_decode_error_flags (AVFrame *frame, int val);
10148 +attribute_deprecated
10149 +int av_frame_get_pkt_size(const AVFrame *frame);
10150 +attribute_deprecated
10151 +void av_frame_set_pkt_size(AVFrame *frame, int val);
10152 +#if FF_API_FRAME_QP
10153 +attribute_deprecated
10154 +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
10155 +attribute_deprecated
10156 +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
10158 +attribute_deprecated
10159 +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
10160 +attribute_deprecated
10161 +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
10162 +attribute_deprecated
10163 +enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
10164 +attribute_deprecated
10165 +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
10169 + * Get the name of a colorspace.
10170 + * @return a static string identifying the colorspace; can be NULL.
10172 +const char *av_get_colorspace_name(enum AVColorSpace val);
10175 + * Allocate an AVFrame and set its fields to default values. The resulting
10176 + * struct must be freed using av_frame_free().
10178 + * @return An AVFrame filled with default values or NULL on failure.
10180 + * @note this only allocates the AVFrame itself, not the data buffers. Those
10181 + * must be allocated through other means, e.g. with av_frame_get_buffer() or
10184 +AVFrame *av_frame_alloc(void);
10187 + * Free the frame and any dynamically allocated objects in it,
10188 + * e.g. extended_data. If the frame is reference counted, it will be
10189 + * unreferenced first.
10191 + * @param frame frame to be freed. The pointer will be set to NULL.
10193 +void av_frame_free(AVFrame **frame);
10196 + * Set up a new reference to the data described by the source frame.
10198 + * Copy frame properties from src to dst and create a new reference for each
10199 + * AVBufferRef from src.
10201 + * If src is not reference counted, new buffers are allocated and the data is
10204 + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
10205 + * or newly allocated with av_frame_alloc() before calling this
10206 + * function, or undefined behavior will occur.
10208 + * @return 0 on success, a negative AVERROR on error
10210 +int av_frame_ref(AVFrame *dst, const AVFrame *src);
10213 + * Create a new frame that references the same data as src.
10215 + * This is a shortcut for av_frame_alloc()+av_frame_ref().
10217 + * @return newly created AVFrame on success, NULL on error.
10219 +AVFrame *av_frame_clone(const AVFrame *src);
10222 + * Unreference all the buffers referenced by frame and reset the frame fields.
10224 +void av_frame_unref(AVFrame *frame);
10227 + * Move everything contained in src to dst and reset src.
10229 + * @warning: dst is not unreferenced, but directly overwritten without reading
10230 + * or deallocating its contents. Call av_frame_unref(dst) manually
10231 + * before calling this function to ensure that no memory is leaked.
10233 +void av_frame_move_ref(AVFrame *dst, AVFrame *src);
10236 + * Allocate new buffer(s) for audio or video data.
10238 + * The following fields must be set on frame before calling this function:
10239 + * - format (pixel format for video, sample format for audio)
10240 + * - width and height for video
10241 + * - nb_samples and channel_layout for audio
10243 + * This function will fill AVFrame.data and AVFrame.buf arrays and, if
10244 + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
10245 + * For planar formats, one buffer will be allocated for each plane.
10247 + * @warning: if frame already has been allocated, calling this function will
10248 + * leak memory. In addition, undefined behavior can occur in certain
10251 + * @param frame frame in which to store the new buffers.
10252 + * @param align Required buffer size alignment. If equal to 0, alignment will be
10253 + * chosen automatically for the current CPU. It is highly
10254 + * recommended to pass 0 here unless you know what you are doing.
10256 + * @return 0 on success, a negative AVERROR on error.
10258 +int av_frame_get_buffer(AVFrame *frame, int align);
10261 + * Check if the frame data is writable.
10263 + * @return A positive value if the frame data is writable (which is true if and
10264 + * only if each of the underlying buffers has only one reference, namely the one
10265 + * stored in this frame). Return 0 otherwise.
10267 + * If 1 is returned the answer is valid until av_buffer_ref() is called on any
10268 + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
10270 + * @see av_frame_make_writable(), av_buffer_is_writable()
10272 +int av_frame_is_writable(AVFrame *frame);
10275 + * Ensure that the frame data is writable, avoiding data copy if possible.
10277 + * Do nothing if the frame is writable, allocate new buffers and copy the data
10280 + * @return 0 on success, a negative AVERROR on error.
10282 + * @see av_frame_is_writable(), av_buffer_is_writable(),
10283 + * av_buffer_make_writable()
10285 +int av_frame_make_writable(AVFrame *frame);
10288 + * Copy the frame data from src to dst.
10290 + * This function does not allocate anything, dst must be already initialized and
10291 + * allocated with the same parameters as src.
10293 + * This function only copies the frame data (i.e. the contents of the data /
10294 + * extended data arrays), not any other properties.
10296 + * @return >= 0 on success, a negative AVERROR on error.
10298 +int av_frame_copy(AVFrame *dst, const AVFrame *src);
10301 + * Copy only "metadata" fields from src to dst.
10303 + * Metadata for the purpose of this function are those fields that do not affect
10304 + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
10305 + * aspect ratio (for video), but not width/height or channel layout.
10306 + * Side data is also copied.
10308 +int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
10311 + * Get the buffer reference a given data plane is stored in.
10313 + * @param plane index of the data plane of interest in frame->extended_data.
10315 + * @return the buffer reference that contains the plane or NULL if the input
10316 + * frame is not valid.
10318 +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
10321 + * Add a new side data to a frame.
10323 + * @param frame a frame to which the side data should be added
10324 + * @param type type of the added side data
10325 + * @param size size of the side data
10327 + * @return newly added side data on success, NULL on error
10329 +AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
10330 + enum AVFrameSideDataType type,
10334 + * Add a new side data to a frame from an existing AVBufferRef
10336 + * @param frame a frame to which the side data should be added
10337 + * @param type the type of the added side data
10338 + * @param buf an AVBufferRef to add as side data. The ownership of
10339 + * the reference is transferred to the frame.
10341 + * @return newly added side data on success, NULL on error. On failure
10342 + * the frame is unchanged and the AVBufferRef remains owned by
10345 +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
10346 + enum AVFrameSideDataType type,
10347 + AVBufferRef *buf);
10350 + * @return a pointer to the side data of a given type on success, NULL if there
10351 + * is no side data with such type in this frame.
10353 +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
10354 + enum AVFrameSideDataType type);
10357 + * If side data of the supplied type exists in the frame, free it and remove it
10358 + * from the frame.
10360 +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
10364 + * Flags for frame cropping.
10368 + * Apply the maximum possible cropping, even if it requires setting the
10369 + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
10370 + * to FFmpeg API is generally not allowed, and causes undefined behavior
10371 + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
10372 + * are explicitly documented to accept it. Use this flag only if you
10373 + * absolutely know what you are doing.
10375 + AV_FRAME_CROP_UNALIGNED = 1 << 0,
10379 + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
10380 + * crop_bottom fields. If cropping is successful, the function will adjust the
10381 + * data pointers and the width/height fields, and set the crop fields to 0.
10383 + * In all cases, the cropping boundaries will be rounded to the inherent
10384 + * alignment of the pixel format. In some cases, such as for opaque hwaccel
10385 + * formats, the left/top cropping is ignored. The crop fields are set to 0 even
10386 + * if the cropping was rounded or ignored.
10388 + * @param frame the frame which should be cropped
10389 + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
10391 + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
10392 + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
10394 +int av_frame_apply_cropping(AVFrame *frame, int flags);
10397 + * @return a string identifying the side data type
10399 +const char *av_frame_side_data_name(enum AVFrameSideDataType type);
10405 +#endif /* AVUTIL_FRAME_H */
10406 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10407 new file mode 100644
10409 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10412 + * This file is part of FFmpeg.
10414 + * FFmpeg is free software; you can redistribute it and/or
10415 + * modify it under the terms of the GNU Lesser General Public
10416 + * License as published by the Free Software Foundation; either
10417 + * version 2.1 of the License, or (at your option) any later version.
10419 + * FFmpeg is distributed in the hope that it will be useful,
10420 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10421 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10422 + * Lesser General Public License for more details.
10424 + * You should have received a copy of the GNU Lesser General Public
10425 + * License along with FFmpeg; if not, write to the Free Software
10426 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
10429 +#ifndef AVUTIL_HWCONTEXT_H
10430 +#define AVUTIL_HWCONTEXT_H
10432 +#include "buffer.h"
10433 +#include "frame.h"
10435 +#include "pixfmt.h"
10437 +enum AVHWDeviceType {
10438 + AV_HWDEVICE_TYPE_NONE,
10439 + AV_HWDEVICE_TYPE_VDPAU,
10440 + AV_HWDEVICE_TYPE_CUDA,
10441 + AV_HWDEVICE_TYPE_VAAPI,
10442 + AV_HWDEVICE_TYPE_DXVA2,
10443 + AV_HWDEVICE_TYPE_QSV,
10444 + AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
10445 + AV_HWDEVICE_TYPE_D3D11VA,
10446 + AV_HWDEVICE_TYPE_DRM,
10447 + AV_HWDEVICE_TYPE_OPENCL,
10448 + AV_HWDEVICE_TYPE_MEDIACODEC,
10451 +typedef struct AVHWDeviceInternal AVHWDeviceInternal;
10454 + * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
10455 + * i.e. state that is not tied to a concrete processing configuration.
10456 + * E.g., in an API that supports hardware-accelerated encoding and decoding,
10457 + * this struct will (if possible) wrap the state that is common to both encoding
10458 + * and decoding and from which specific instances of encoders or decoders can be
10461 + * This struct is reference-counted with the AVBuffer mechanism. The
10462 + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
10463 + * points to the actual AVHWDeviceContext. Further objects derived from
10464 + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
10465 + * specific properties) will hold an internal reference to it. After all the
10466 + * references are released, the AVHWDeviceContext itself will be freed,
10467 + * optionally invoking a user-specified callback for uninitializing the hardware
10470 +typedef struct AVHWDeviceContext {
10472 + * A class for logging. Set by av_hwdevice_ctx_alloc().
10474 + const AVClass *av_class;
10477 + * Private data used internally by libavutil. Must not be accessed in any
10478 + * way by the caller.
10480 + AVHWDeviceInternal *internal;
10483 + * This field identifies the underlying API used for hardware access.
10485 + * This field is set when this struct is allocated and never changed
10488 + enum AVHWDeviceType type;
10491 + * The format-specific data, allocated and freed by libavutil along with
10494 + * Should be cast by the user to the format-specific context defined in the
10495 + * corresponding header (hwcontext_*.h) and filled as described in the
10496 + * documentation before calling av_hwdevice_ctx_init().
10498 + * After calling av_hwdevice_ctx_init() this struct should not be modified
10504 + * This field may be set by the caller before calling av_hwdevice_ctx_init().
10506 + * If non-NULL, this callback will be called when the last reference to
10507 + * this context is unreferenced, immediately before it is freed.
10509 + * @note when other objects (e.g an AVHWFramesContext) are derived from this
10510 + * struct, this callback will be invoked after all such child objects
10511 + * are fully uninitialized and their respective destructors invoked.
10513 + void (*free)(struct AVHWDeviceContext *ctx);
10516 + * Arbitrary user data, to be used e.g. by the free() callback.
10518 + void *user_opaque;
10519 +} AVHWDeviceContext;
10521 +typedef struct AVHWFramesInternal AVHWFramesInternal;
10524 + * This struct describes a set or pool of "hardware" frames (i.e. those with
10525 + * data not located in normal system memory). All the frames in the pool are
10526 + * assumed to be allocated in the same way and interchangeable.
10528 + * This struct is reference-counted with the AVBuffer mechanism and tied to a
10529 + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
10530 + * yields a reference, whose data field points to the actual AVHWFramesContext
10533 +typedef struct AVHWFramesContext {
10535 + * A class for logging.
10537 + const AVClass *av_class;
10540 + * Private data used internally by libavutil. Must not be accessed in any
10541 + * way by the caller.
10543 + AVHWFramesInternal *internal;
10546 + * A reference to the parent AVHWDeviceContext. This reference is owned and
10547 + * managed by the enclosing AVHWFramesContext, but the caller may derive
10548 + * additional references from it.
10550 + AVBufferRef *device_ref;
10553 + * The parent AVHWDeviceContext. This is simply a pointer to
10554 + * device_ref->data provided for convenience.
10556 + * Set by libavutil in av_hwframe_ctx_init().
10558 + AVHWDeviceContext *device_ctx;
10561 + * The format-specific data, allocated and freed automatically along with
10564 + * Should be cast by the user to the format-specific context defined in the
10565 + * corresponding header (hwframe_*.h) and filled as described in the
10566 + * documentation before calling av_hwframe_ctx_init().
10568 + * After any frames using this context are created, the contents of this
10569 + * struct should not be modified by the caller.
10574 + * This field may be set by the caller before calling av_hwframe_ctx_init().
10576 + * If non-NULL, this callback will be called when the last reference to
10577 + * this context is unreferenced, immediately before it is freed.
10579 + void (*free)(struct AVHWFramesContext *ctx);
10582 + * Arbitrary user data, to be used e.g. by the free() callback.
10584 + void *user_opaque;
10587 + * A pool from which the frames are allocated by av_hwframe_get_buffer().
10588 + * This field may be set by the caller before calling av_hwframe_ctx_init().
10589 + * The buffers returned by calling av_buffer_pool_get() on this pool must
10590 + * have the properties described in the documentation in the corresponding hw
10591 + * type's header (hwcontext_*.h). The pool will be freed strictly before
10592 + * this struct's free() callback is invoked.
10594 + * This field may be NULL, then libavutil will attempt to allocate a pool
10595 + * internally. Note that certain device types enforce pools allocated at
10596 + * fixed size (frame count), which cannot be extended dynamically. In such a
10597 + * case, initial_pool_size must be set appropriately.
10599 + AVBufferPool *pool;
10602 + * Initial size of the frame pool. If a device type does not support
10603 + * dynamically resizing the pool, then this is also the maximum pool size.
10605 + * May be set by the caller before calling av_hwframe_ctx_init(). Must be
10606 + * set if pool is NULL and the device type does not support dynamic pools.
10608 + int initial_pool_size;
10611 + * The pixel format identifying the underlying HW surface type.
10613 + * Must be a hwaccel format, i.e. the corresponding descriptor must have the
10614 + * AV_PIX_FMT_FLAG_HWACCEL flag set.
10616 + * Must be set by the user before calling av_hwframe_ctx_init().
10618 + enum AVPixelFormat format;
10621 + * The pixel format identifying the actual data layout of the hardware
10624 + * Must be set by the caller before calling av_hwframe_ctx_init().
10626 + * @note when the underlying API does not provide the exact data layout, but
10627 + * only the colorspace/bit depth, this field should be set to the fully
10628 + * planar version of that format (e.g. for 8-bit 420 YUV it should be
10629 + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
10631 + enum AVPixelFormat sw_format;
10634 + * The allocated dimensions of the frames in this pool.
10636 + * Must be set by the user before calling av_hwframe_ctx_init().
10638 + int width, height;
10639 +} AVHWFramesContext;
10642 + * Look up an AVHWDeviceType by name.
10644 + * @param name String name of the device type (case-insensitive).
10645 + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
10648 +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
10650 +/** Get the string name of an AVHWDeviceType.
10652 + * @param type Type from enum AVHWDeviceType.
10653 + * @return Pointer to a static string containing the name, or NULL if the type
10656 +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
10659 + * Iterate over supported device types.
10661 + * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
10662 + * returned by this function in subsequent iterations.
10663 + * @return The next usable device type from enum AVHWDeviceType, or
10664 + * AV_HWDEVICE_TYPE_NONE if there are no more.
10666 +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
10669 + * Allocate an AVHWDeviceContext for a given hardware type.
10671 + * @param type the type of the hardware device to allocate.
10672 + * @return a reference to the newly created AVHWDeviceContext on success or NULL
10675 +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
10678 + * Finalize the device context before use. This function must be called after
10679 + * the context is filled with all the required information and before it is
10680 + * used in any way.
10682 + * @param ref a reference to the AVHWDeviceContext
10683 + * @return 0 on success, a negative AVERROR code on failure
10685 +int av_hwdevice_ctx_init(AVBufferRef *ref);
10688 + * Open a device of the specified type and create an AVHWDeviceContext for it.
10690 + * This is a convenience function intended to cover the simple cases. Callers
10691 + * who need to fine-tune device creation/management should open the device
10692 + * manually and then wrap it in an AVHWDeviceContext using
10693 + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
10695 + * The returned context is already initialized and ready for use, the caller
10696 + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
10697 + * the created AVHWDeviceContext are set by this function and should not be
10698 + * touched by the caller.
10700 + * @param device_ctx On success, a reference to the newly-created device context
10701 + * will be written here. The reference is owned by the caller
10702 + * and must be released with av_buffer_unref() when no longer
10703 + * needed. On failure, NULL will be written to this pointer.
10704 + * @param type The type of the device to create.
10705 + * @param device A type-specific string identifying the device to open.
10706 + * @param opts A dictionary of additional (type-specific) options to use in
10707 + * opening the device. The dictionary remains owned by the caller.
10708 + * @param flags currently unused
10710 + * @return 0 on success, a negative AVERROR code on failure.
10712 +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
10713 + const char *device, AVDictionary *opts, int flags);
10716 + * Create a new device of the specified type from an existing device.
10718 + * If the source device is a device of the target type or was originally
10719 + * derived from such a device (possibly through one or more intermediate
10720 + * devices of other types), then this will return a reference to the
10721 + * existing device of the same type as is requested.
10723 + * Otherwise, it will attempt to derive a new device from the given source
10724 + * device. If direct derivation to the new type is not implemented, it will
10725 + * attempt the same derivation from each ancestor of the source device in
10726 + * turn looking for an implemented derivation method.
10728 + * @param dst_ctx On success, a reference to the newly-created
10729 + * AVHWDeviceContext.
10730 + * @param type The type of the new device to create.
10731 + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
10732 + * used to create the new device.
10733 + * @param flags Currently unused; should be set to zero.
10734 + * @return Zero on success, a negative AVERROR code on failure.
10736 +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
10737 + enum AVHWDeviceType type,
10738 + AVBufferRef *src_ctx, int flags);
10742 + * Allocate an AVHWFramesContext tied to a given device context.
10744 + * @param device_ctx a reference to a AVHWDeviceContext. This function will make
10745 + * a new reference for internal use, the one passed to the
10746 + * function remains owned by the caller.
10747 + * @return a reference to the newly created AVHWFramesContext on success or NULL
10750 +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
10753 + * Finalize the context before use. This function must be called after the
10754 + * context is filled with all the required information and before it is attached
10757 + * @param ref a reference to the AVHWFramesContext
10758 + * @return 0 on success, a negative AVERROR code on failure
10760 +int av_hwframe_ctx_init(AVBufferRef *ref);
10763 + * Allocate a new frame attached to the given AVHWFramesContext.
10765 + * @param hwframe_ctx a reference to an AVHWFramesContext
10766 + * @param frame an empty (freshly allocated or unreffed) frame to be filled with
10767 + * newly allocated buffers.
10768 + * @param flags currently unused, should be set to zero
10769 + * @return 0 on success, a negative AVERROR code on failure
10771 +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
10774 + * Copy data to or from a hw surface. At least one of dst/src must have an
10775 + * AVHWFramesContext attached.
10777 + * If src has an AVHWFramesContext attached, then the format of dst (if set)
10778 + * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
10779 + * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
10780 + * If dst has an AVHWFramesContext attached, then the format of src must use one
10781 + * of the formats returned by av_hwframe_transfer_get_formats(dst,
10782 + * AV_HWFRAME_TRANSFER_DIRECTION_TO)
10784 + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
10785 + * data buffers will be allocated by this function using av_frame_get_buffer().
10786 + * If dst->format is set, then this format will be used, otherwise (when
10787 + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
10789 + * The two frames must have matching allocated dimensions (i.e. equal to
10790 + * AVHWFramesContext.width/height), since not all device types support
10791 + * transferring a sub-rectangle of the whole surface. The display dimensions
10792 + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
10793 + * also have to be equal for both frames. When the display dimensions are
10794 + * smaller than the allocated dimensions, the content of the padding in the
10795 + * destination frame is unspecified.
10797 + * @param dst the destination frame. dst is not touched on failure.
10798 + * @param src the source frame.
10799 + * @param flags currently unused, should be set to zero
10800 + * @return 0 on success, a negative AVERROR error code on failure.
10802 +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
10804 +enum AVHWFrameTransferDirection {
10806 + * Transfer the data from the queried hw frame.
10808 + AV_HWFRAME_TRANSFER_DIRECTION_FROM,
10811 + * Transfer the data to the queried hw frame.
10813 + AV_HWFRAME_TRANSFER_DIRECTION_TO,
10817 + * Get a list of possible source or target formats usable in
10818 + * av_hwframe_transfer_data().
10820 + * @param hwframe_ctx the frame context to obtain the information for
10821 + * @param dir the direction of the transfer
10822 + * @param formats the pointer to the output format list will be written here.
10823 + * The list is terminated with AV_PIX_FMT_NONE and must be freed
10824 + * by the caller when no longer needed using av_free().
10825 + * If this function returns successfully, the format list will
10826 + * have at least one item (not counting the terminator).
10827 + * On failure, the contents of this pointer are unspecified.
10828 + * @param flags currently unused, should be set to zero
10829 + * @return 0 on success, a negative AVERROR code on failure.
10831 +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
10832 + enum AVHWFrameTransferDirection dir,
10833 + enum AVPixelFormat **formats, int flags);
10837 + * This struct describes the constraints on hardware frames attached to
10838 + * a given device with a hardware-specific configuration. This is returned
10839 + * by av_hwdevice_get_hwframe_constraints() and must be freed by
10840 + * av_hwframe_constraints_free() after use.
10842 +typedef struct AVHWFramesConstraints {
10844 + * A list of possible values for format in the hw_frames_ctx,
10845 + * terminated by AV_PIX_FMT_NONE. This member will always be filled.
10847 + enum AVPixelFormat *valid_hw_formats;
10850 + * A list of possible values for sw_format in the hw_frames_ctx,
10851 + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
10854 + enum AVPixelFormat *valid_sw_formats;
10857 + * The minimum size of frames in this hw_frames_ctx.
10858 + * (Zero if not known.)
10864 + * The maximum size of frames in this hw_frames_ctx.
10865 + * (INT_MAX if not known / no limit.)
10869 +} AVHWFramesConstraints;
10872 + * Allocate a HW-specific configuration structure for a given HW device.
10873 + * After use, the user must free all members as required by the specific
10874 + * hardware structure being used, then free the structure itself with
10877 + * @param device_ctx a reference to the associated AVHWDeviceContext.
10878 + * @return The newly created HW-specific configuration structure on
10879 + * success or NULL on failure.
10881 +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
10884 + * Get the constraints on HW frames given a device and the HW-specific
10885 + * configuration to be used with that device. If no HW-specific
10886 + * configuration is provided, returns the maximum possible capabilities
10889 + * @param ref a reference to the associated AVHWDeviceContext.
10890 + * @param hwconfig a filled HW-specific configuration structure, or NULL
10891 + * to return the maximum possible capabilities of the device.
10892 + * @return AVHWFramesConstraints structure describing the constraints
10893 + * on the device, or NULL if not available.
10895 +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
10896 + const void *hwconfig);
10899 + * Free an AVHWFrameConstraints structure.
10901 + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
10903 +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
10907 + * Flags to apply to frame mappings.
10911 + * The mapping must be readable.
10913 + AV_HWFRAME_MAP_READ = 1 << 0,
10915 + * The mapping must be writeable.
10917 + AV_HWFRAME_MAP_WRITE = 1 << 1,
10919 + * The mapped frame will be overwritten completely in subsequent
10920 + * operations, so the current frame data need not be loaded. Any values
10921 + * which are not overwritten are unspecified.
10923 + AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
10925 + * The mapping must be direct. That is, there must not be any copying in
10926 + * the map or unmap steps. Note that performance of direct mappings may
10927 + * be much lower than normal memory.
10929 + AV_HWFRAME_MAP_DIRECT = 1 << 3,
10933 + * Map a hardware frame.
10935 + * This has a number of different possible effects, depending on the format
10936 + * and origin of the src and dst frames. On input, src should be a usable
10937 + * frame with valid buffers and dst should be blank (typically as just created
10938 + * by av_frame_alloc()). src should have an associated hwframe context, and
10939 + * dst may optionally have a format and associated hwframe context.
10941 + * If src was created by mapping a frame from the hwframe context of dst,
10942 + * then this function undoes the mapping - dst is replaced by a reference to
10943 + * the frame that src was originally mapped from.
10945 + * If both src and dst have an associated hwframe context, then this function
10946 + * attempts to map the src frame from its hardware context to that of dst and
10947 + * then fill dst with appropriate data to be usable there. This will only be
10948 + * possible if the hwframe contexts and associated devices are compatible -
10949 + * given compatible devices, av_hwframe_ctx_create_derived() can be used to
10950 + * create a hwframe context for dst in which mapping should be possible.
10952 + * If src has a hwframe context but dst does not, then the src frame is
10953 + * mapped to normal memory and should thereafter be usable as a normal frame.
10954 + * If the format is set on dst, then the mapping will attempt to create dst
10955 + * with that format and fail if it is not possible. If format is unset (is
10956 + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
10957 + * format to use is (probably the sw_format of the src hwframe context).
10959 + * A return value of AVERROR(ENOSYS) indicates that the mapping is not
10960 + * possible with the given arguments and hwframe setup, while other return
10961 + * values indicate that it failed somehow.
10963 + * @param dst Destination frame, to contain the mapping.
10964 + * @param src Source frame, to be mapped.
10965 + * @param flags Some combination of AV_HWFRAME_MAP_* flags.
10966 + * @return Zero on success, negative AVERROR code on failure.
10968 +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
10972 + * Create and initialise an AVHWFramesContext as a mapping of another existing
10973 + * AVHWFramesContext on a different device.
10975 + * av_hwframe_ctx_init() should not be called after this.
10977 + * @param derived_frame_ctx On success, a reference to the newly created
10978 + * AVHWFramesContext.
10979 + * @param derived_device_ctx A reference to the device to create the new
10980 + * AVHWFramesContext on.
10981 + * @param source_frame_ctx A reference to an existing AVHWFramesContext
10982 + * which will be mapped to the derived context.
10983 + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the
10984 + * mapping parameters to apply to frames which are allocated
10985 + * in the derived device.
10986 + * @return Zero on success, negative AVERROR code on failure.
10988 +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
10989 + enum AVPixelFormat format,
10990 + AVBufferRef *derived_device_ctx,
10991 + AVBufferRef *source_frame_ctx,
10994 +#endif /* AVUTIL_HWCONTEXT_H */
10995 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
10996 new file mode 100644
10998 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
11001 + * Copyright (c) 2011 Mans Rullgard
11003 + * This file is part of FFmpeg.
11005 + * FFmpeg is free software; you can redistribute it and/or
11006 + * modify it under the terms of the GNU Lesser General Public
11007 + * License as published by the Free Software Foundation; either
11008 + * version 2.1 of the License, or (at your option) any later version.
11010 + * FFmpeg is distributed in the hope that it will be useful,
11011 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11012 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11013 + * Lesser General Public License for more details.
11015 + * You should have received a copy of the GNU Lesser General Public
11016 + * License along with FFmpeg; if not, write to the Free Software
11017 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11020 +#ifndef AVUTIL_INTFLOAT_H
11021 +#define AVUTIL_INTFLOAT_H
11023 +#include <stdint.h>
11024 +#include "attributes.h"
11026 +union av_intfloat32 {
11031 +union av_intfloat64 {
11037 + * Reinterpret a 32-bit integer as a float.
11039 +static av_always_inline float av_int2float(uint32_t i)
11041 + union av_intfloat32 v;
11047 + * Reinterpret a float as a 32-bit integer.
11049 +static av_always_inline uint32_t av_float2int(float f)
11051 + union av_intfloat32 v;
11057 + * Reinterpret a 64-bit integer as a double.
11059 +static av_always_inline double av_int2double(uint64_t i)
11061 + union av_intfloat64 v;
11067 + * Reinterpret a double as a 64-bit integer.
11069 +static av_always_inline uint64_t av_double2int(double f)
11071 + union av_intfloat64 v;
11076 +#endif /* AVUTIL_INTFLOAT_H */
11077 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11078 new file mode 100644
11080 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11083 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11085 + * This file is part of FFmpeg.
11087 + * FFmpeg is free software; you can redistribute it and/or
11088 + * modify it under the terms of the GNU Lesser General Public
11089 + * License as published by the Free Software Foundation; either
11090 + * version 2.1 of the License, or (at your option) any later version.
11092 + * FFmpeg is distributed in the hope that it will be useful,
11093 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11094 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11095 + * Lesser General Public License for more details.
11097 + * You should have received a copy of the GNU Lesser General Public
11098 + * License along with FFmpeg; if not, write to the Free Software
11099 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11102 +#ifndef AVUTIL_LOG_H
11103 +#define AVUTIL_LOG_H
11105 +#include <stdarg.h>
11106 +#include "avutil.h"
11107 +#include "attributes.h"
11108 +#include "version.h"
11111 + AV_CLASS_CATEGORY_NA = 0,
11112 + AV_CLASS_CATEGORY_INPUT,
11113 + AV_CLASS_CATEGORY_OUTPUT,
11114 + AV_CLASS_CATEGORY_MUXER,
11115 + AV_CLASS_CATEGORY_DEMUXER,
11116 + AV_CLASS_CATEGORY_ENCODER,
11117 + AV_CLASS_CATEGORY_DECODER,
11118 + AV_CLASS_CATEGORY_FILTER,
11119 + AV_CLASS_CATEGORY_BITSTREAM_FILTER,
11120 + AV_CLASS_CATEGORY_SWSCALER,
11121 + AV_CLASS_CATEGORY_SWRESAMPLER,
11122 + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
11123 + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
11124 + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
11125 + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
11126 + AV_CLASS_CATEGORY_DEVICE_OUTPUT,
11127 + AV_CLASS_CATEGORY_DEVICE_INPUT,
11128 + AV_CLASS_CATEGORY_NB ///< not part of ABI/API
11131 +#define AV_IS_INPUT_DEVICE(category) \
11132 + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
11133 + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
11134 + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
11136 +#define AV_IS_OUTPUT_DEVICE(category) \
11137 + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
11138 + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
11139 + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
11141 +struct AVOptionRanges;
11144 + * Describe the class of an AVClass context structure. That is an
11145 + * arbitrary struct of which the first field is a pointer to an
11146 + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
11148 +typedef struct AVClass {
11150 + * The name of the class; usually it is the same name as the
11151 + * context structure type to which the AVClass is associated.
11153 + const char* class_name;
11156 + * A pointer to a function which returns the name of a context
11157 + * instance ctx associated with the class.
11159 + const char* (*item_name)(void* ctx);
11162 + * a pointer to the first option specified in the class if any or NULL
11164 + * @see av_set_default_options()
11166 + const struct AVOption *option;
11169 + * LIBAVUTIL_VERSION with which this structure was created.
11170 + * This is used to allow fields to be added without requiring major
11171 + * version bumps everywhere.
11177 + * Offset in the structure where log_level_offset is stored.
11178 + * 0 means there is no such variable
11180 + int log_level_offset_offset;
11183 + * Offset in the structure where a pointer to the parent context for
11184 + * logging is stored. For example a decoder could pass its AVCodecContext
11185 + * to eval as such a parent context, which an av_log() implementation
11186 + * could then leverage to display the parent context.
11187 + * The offset can be NULL.
11189 + int parent_log_context_offset;
11192 + * Return next AVOptions-enabled child or NULL
11194 + void* (*child_next)(void *obj, void *prev);
11197 + * Return an AVClass corresponding to the next potential
11198 + * AVOptions-enabled child.
11200 + * The difference between child_next and this is that
11201 + * child_next iterates over _already existing_ objects, while
11202 + * child_class_next iterates over _all possible_ children.
11204 + const struct AVClass* (*child_class_next)(const struct AVClass *prev);
11207 + * Category used for visualization (like color)
11208 + * This is only set if the category is equal for all objects using this class.
11209 + * available since version (51 << 16 | 56 << 8 | 100)
11211 + AVClassCategory category;
11214 + * Callback to return the category.
11215 + * available since version (51 << 16 | 59 << 8 | 100)
11217 + AVClassCategory (*get_category)(void* ctx);
11220 + * Callback to return the supported/allowed ranges.
11221 + * available since version (52.12)
11223 + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
11227 + * @addtogroup lavu_log
11231 + * @defgroup lavu_log_constants Logging Constants
11237 + * Print no output.
11239 +#define AV_LOG_QUIET -8
11242 + * Something went really wrong and we will crash now.
11244 +#define AV_LOG_PANIC 0
11247 + * Something went wrong and recovery is not possible.
11248 + * For example, no header was found for a format which depends
11249 + * on headers or an illegal combination of parameters is used.
11251 +#define AV_LOG_FATAL 8
11254 + * Something went wrong and cannot losslessly be recovered.
11255 + * However, not all future data is affected.
11257 +#define AV_LOG_ERROR 16
11260 + * Something somehow does not look correct. This may or may not
11261 + * lead to problems. An example would be the use of '-vstrict -2'.
11263 +#define AV_LOG_WARNING 24
11266 + * Standard information.
11268 +#define AV_LOG_INFO 32
11271 + * Detailed information.
11273 +#define AV_LOG_VERBOSE 40
11276 + * Stuff which is only useful for libav* developers.
11278 +#define AV_LOG_DEBUG 48
11281 + * Extremely verbose debugging, useful for libav* development.
11283 +#define AV_LOG_TRACE 56
11285 +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
11292 + * Sets additional colors for extended debugging sessions.
11294 + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
11296 + * Requires 256color terminal support. Uses outside debugging is not
11299 +#define AV_LOG_C(x) ((x) << 8)
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
11306 + * @see av_log_set_callback
11308 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11309 + * pointer to an AVClass struct or NULL if general log.
11310 + * @param level The importance level of the message expressed using a @ref
11311 + * lavu_log_constants "Logging Constant".
11312 + * @param fmt The format string (printf-compatible) that specifies how
11313 + * subsequent arguments are converted to output.
11315 +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
11319 + * Send the specified message to the log if the level is less than or equal
11320 + * to the current av_log_level. By default, all logging messages are sent to
11321 + * stderr. This behavior can be altered by setting a different logging callback
11323 + * @see av_log_set_callback
11325 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11326 + * pointer to an AVClass struct.
11327 + * @param level The importance level of the message expressed using a @ref
11328 + * lavu_log_constants "Logging Constant".
11329 + * @param fmt The format string (printf-compatible) that specifies how
11330 + * subsequent arguments are converted to output.
11331 + * @param vl The arguments referenced by the format string.
11333 +void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
11336 + * Get the current log level
11338 + * @see lavu_log_constants
11340 + * @return Current log level
11342 +int av_log_get_level(void);
11345 + * Set the log level
11347 + * @see lavu_log_constants
11349 + * @param level Logging level
11351 +void av_log_set_level(int level);
11354 + * Set the logging callback
11356 + * @note The callback must be thread safe, even if the application does not use
11357 + * threads itself as some codecs are multithreaded.
11359 + * @see av_log_default_callback
11361 + * @param callback A logging function with a compatible signature.
11363 +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
11366 + * Default logging callback
11368 + * It prints the message to stderr, optionally colorizing it.
11370 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11371 + * pointer to an AVClass struct.
11372 + * @param level The importance level of the message expressed using a @ref
11373 + * lavu_log_constants "Logging Constant".
11374 + * @param fmt The format string (printf-compatible) that specifies how
11375 + * subsequent arguments are converted to output.
11376 + * @param vl The arguments referenced by the format string.
11378 +void av_log_default_callback(void *avcl, int level, const char *fmt,
11382 + * Return the context name
11384 + * @param ctx The AVClass context
11386 + * @return The AVClass class_name
11388 +const char* av_default_item_name(void* ctx);
11389 +AVClassCategory av_default_get_category(void *ptr);
11392 + * Format a line of log the same way as the default callback.
11393 + * @param line buffer to receive the formatted line
11394 + * @param line_size size of the buffer
11395 + * @param print_prefix used to store whether the prefix must be printed;
11396 + * must point to a persistent integer initially set to 1
11398 +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
11399 + char *line, int line_size, int *print_prefix);
11402 + * Format a line of log the same way as the default callback.
11403 + * @param line buffer to receive the formatted line;
11404 + * may be NULL if line_size is 0
11405 + * @param line_size size of the buffer; at most line_size-1 characters will
11406 + * be written to the buffer, plus one null terminator
11407 + * @param print_prefix used to store whether the prefix must be printed;
11408 + * must point to a persistent integer initially set to 1
11409 + * @return Returns a negative value if an error occurred, otherwise returns
11410 + * the number of characters that would have been written for a
11411 + * sufficiently large buffer, not including the terminating null
11412 + * character. If the return value is not less than line_size, it means
11413 + * that the log message was truncated to fit the buffer.
11415 +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
11416 + char *line, int line_size, int *print_prefix);
11419 + * Skip repeated messages, this requires the user app to use av_log() instead of
11420 + * (f)printf as the 2 would otherwise interfere and lead to
11421 + * "Last message repeated x times" messages below (f)printf messages with some
11423 + * Also to receive the last, "last repeated" line if any, the user app must
11424 + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
11426 +#define AV_LOG_SKIP_REPEATED 1
11429 + * Include the log severity in messages originating from codecs.
11431 + * Results in messages such as:
11432 + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
11434 +#define AV_LOG_PRINT_LEVEL 2
11436 +void av_log_set_flags(int arg);
11437 +int av_log_get_flags(void);
11443 +#endif /* AVUTIL_LOG_H */
11444 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11445 new file mode 100644
11447 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11450 + * This file is part of FFmpeg.
11452 + * FFmpeg is free software; you can redistribute it and/or
11453 + * modify it under the terms of the GNU Lesser General Public
11454 + * License as published by the Free Software Foundation; either
11455 + * version 2.1 of the License, or (at your option) any later version.
11457 + * FFmpeg is distributed in the hope that it will be useful,
11458 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11459 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11460 + * Lesser General Public License for more details.
11462 + * You should have received a copy of the GNU Lesser General Public
11463 + * License along with FFmpeg; if not, write to the Free Software
11464 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11470 + * Utility Preprocessor macros
11473 +#ifndef AVUTIL_MACROS_H
11474 +#define AVUTIL_MACROS_H
11477 + * @addtogroup preproc_misc Preprocessor String Macros
11479 + * String manipulation macros
11484 +#define AV_STRINGIFY(s) AV_TOSTRING(s)
11485 +#define AV_TOSTRING(s) #s
11487 +#define AV_GLUE(a, b) a ## b
11488 +#define AV_JOIN(a, b) AV_GLUE(a, b)
11494 +#define AV_PRAGMA(s) _Pragma(#s)
11496 +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
11498 +#endif /* AVUTIL_MACROS_H */
11499 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11500 new file mode 100644
11502 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11505 + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
11507 + * This file is part of FFmpeg.
11509 + * FFmpeg is free software; you can redistribute it and/or
11510 + * modify it under the terms of the GNU Lesser General Public
11511 + * License as published by the Free Software Foundation; either
11512 + * version 2.1 of the License, or (at your option) any later version.
11514 + * FFmpeg is distributed in the hope that it will be useful,
11515 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11516 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11517 + * Lesser General Public License for more details.
11519 + * You should have received a copy of the GNU Lesser General Public
11520 + * License along with FFmpeg; if not, write to the Free Software
11521 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11526 + * @addtogroup lavu_math
11527 + * Mathematical utilities for working with timestamp and time base.
11530 +#ifndef AVUTIL_MATHEMATICS_H
11531 +#define AVUTIL_MATHEMATICS_H
11533 +#include <stdint.h>
11535 +#include "attributes.h"
11536 +#include "rational.h"
11537 +#include "intfloat.h"
11540 +#define M_E 2.7182818284590452354 /* e */
11543 +#define M_LN2 0.69314718055994530942 /* log_e 2 */
11546 +#define M_LN10 2.30258509299404568402 /* log_e 10 */
11549 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
11552 +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
11555 +#define M_PI 3.14159265358979323846 /* pi */
11558 +#define M_PI_2 1.57079632679489661923 /* pi/2 */
11561 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
11564 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
11567 +#define NAN av_int2float(0x7fc00000)
11570 +#define INFINITY av_int2float(0x7f800000)
11574 + * @addtogroup lavu_math
11580 + * Rounding methods.
11583 + AV_ROUND_ZERO = 0, ///< Round toward zero.
11584 + AV_ROUND_INF = 1, ///< Round away from zero.
11585 + AV_ROUND_DOWN = 2, ///< Round toward -infinity.
11586 + AV_ROUND_UP = 3, ///< Round toward +infinity.
11587 + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
11589 + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
11590 + * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
11592 + * Unlike other values of the enumeration AVRounding, this value is a
11593 + * bitmask that must be used in conjunction with another value of the
11594 + * enumeration through a bitwise OR, in order to set behavior for normal
11598 + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11599 + * // Rescaling 3:
11600 + * // Calculating 3 * 1 / 2
11601 + * // 3 / 2 is rounded up to 2
11604 + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11605 + * // Rescaling AV_NOPTS_VALUE:
11606 + * // AV_NOPTS_VALUE == INT64_MIN
11607 + * // AV_NOPTS_VALUE is passed through
11608 + * // => AV_NOPTS_VALUE
11611 + AV_ROUND_PASS_MINMAX = 8192,
11615 + * Compute the greatest common divisor of two integer operands.
11617 + * @param a,b Operands
11618 + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
11619 + * if a == 0 and b == 0, returns 0.
11621 +int64_t av_const av_gcd(int64_t a, int64_t b);
11624 + * Rescale a 64-bit integer with rounding to nearest.
11626 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11627 + * directly can overflow.
11629 + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
11631 + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
11633 +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
11636 + * Rescale a 64-bit integer with specified rounding.
11638 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11639 + * directly can overflow, and does not support different rounding methods.
11641 + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
11643 +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
11646 + * Rescale a 64-bit integer by 2 rational numbers.
11648 + * The operation is mathematically equivalent to `a * bq / cq`.
11650 + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
11652 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
11654 +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
11657 + * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
11659 + * The operation is mathematically equivalent to `a * bq / cq`.
11661 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
11663 +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
11664 + enum AVRounding rnd) av_const;
11667 + * Compare two timestamps each in its own time base.
11669 + * @return One of the following values:
11670 + * - -1 if `ts_a` is before `ts_b`
11671 + * - 1 if `ts_a` is after `ts_b`
11672 + * - 0 if they represent the same position
11675 + * The result of the function is undefined if one of the timestamps is outside
11676 + * the `int64_t` range when represented in the other's timebase.
11678 +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
11681 + * Compare the remainders of two integer operands divided by a common divisor.
11683 + * In other words, compare the least significant `log2(mod)` bits of integers
11687 + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2)
11688 + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
11691 + * @param a,b Operands
11692 + * @param mod Divisor; must be a power of 2
11694 + * - a negative value if `a % mod < b % mod`
11695 + * - a positive value if `a % mod > b % mod`
11696 + * - zero if `a % mod == b % mod`
11698 +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
11701 + * Rescale a timestamp while preserving known durations.
11703 + * This function is designed to be called per audio packet to scale the input
11704 + * timestamp to a different time base. Compared to a simple av_rescale_q()
11705 + * call, this function is robust against possible inconsistent frame durations.
11707 + * The `last` parameter is a state variable that must be preserved for all
11708 + * subsequent calls for the same stream. For the first call, `*last` should be
11709 + * initialized to #AV_NOPTS_VALUE.
11711 + * @param[in] in_tb Input time base
11712 + * @param[in] in_ts Input timestamp
11713 + * @param[in] fs_tb Duration time base; typically this is finer-grained
11714 + * (greater) than `in_tb` and `out_tb`
11715 + * @param[in] duration Duration till the next call to this function (i.e.
11716 + * duration of the current packet/frame)
11717 + * @param[in,out] last Pointer to a timestamp expressed in terms of
11718 + * `fs_tb`, acting as a state variable
11719 + * @param[in] out_tb Output timebase
11720 + * @return Timestamp expressed in terms of `out_tb`
11722 + * @note In the context of this function, "duration" is in term of samples, not
11725 +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
11728 + * Add a value to a timestamp.
11730 + * This function guarantees that when the same value is repeatly added that
11731 + * no accumulation of rounding errors occurs.
11733 + * @param[in] ts Input timestamp
11734 + * @param[in] ts_tb Input timestamp time base
11735 + * @param[in] inc Value to be added
11736 + * @param[in] inc_tb Time base of `inc`
11738 +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
11745 +#endif /* AVUTIL_MATHEMATICS_H */
11746 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11747 new file mode 100644
11749 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11752 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11754 + * This file is part of FFmpeg.
11756 + * FFmpeg is free software; you can redistribute it and/or
11757 + * modify it under the terms of the GNU Lesser General Public
11758 + * License as published by the Free Software Foundation; either
11759 + * version 2.1 of the License, or (at your option) any later version.
11761 + * FFmpeg is distributed in the hope that it will be useful,
11762 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11763 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11764 + * Lesser General Public License for more details.
11766 + * You should have received a copy of the GNU Lesser General Public
11767 + * License along with FFmpeg; if not, write to the Free Software
11768 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11773 + * @ingroup lavu_mem
11774 + * Memory handling functions
11777 +#ifndef AVUTIL_MEM_H
11778 +#define AVUTIL_MEM_H
11780 +#include <limits.h>
11781 +#include <stdint.h>
11783 +#include "attributes.h"
11784 +#include "error.h"
11785 +#include "avutil.h"
11788 + * @addtogroup lavu_mem
11789 + * Utilities for manipulating memory.
11791 + * FFmpeg has several applications of memory that are not required of a typical
11792 + * program. For example, the computing-heavy components like video decoding and
11793 + * encoding can be sped up significantly through the use of aligned memory.
11795 + * However, for each of FFmpeg's applications of memory, there might not be a
11796 + * recognized or standardized API for that specific use. Memory alignment, for
11797 + * instance, varies wildly depending on operating systems, architectures, and
11798 + * compilers. Hence, this component of @ref libavutil is created to make
11799 + * dealing with memory consistently possible on all platforms.
11803 + * @defgroup lavu_mem_macros Alignment Macros
11804 + * Helper macros for declaring aligned variables.
11809 + * @def DECLARE_ALIGNED(n,t,v)
11810 + * Declare a variable that is aligned in memory.
11813 + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
11814 + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
11816 + * // The default-alignment equivalent would be
11817 + * uint16_t aligned_int = 42;
11818 + * uint8_t aligned_array[128];
11821 + * @param n Minimum alignment in bytes
11822 + * @param t Type of the variable (or array element)
11823 + * @param v Name of the variable
11827 + * @def DECLARE_ASM_ALIGNED(n,t,v)
11828 + * Declare an aligned variable appropriate for use in inline assembly code.
11831 + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11834 + * @param n Minimum alignment in bytes
11835 + * @param t Type of the variable (or array element)
11836 + * @param v Name of the variable
11840 + * @def DECLARE_ASM_CONST(n,t,v)
11841 + * Declare a static constant aligned variable appropriate for use in inline
11845 + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11848 + * @param n Minimum alignment in bytes
11849 + * @param t Type of the variable (or array element)
11850 + * @param v Name of the variable
11853 +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
11854 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11855 + #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11856 + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
11857 +#elif defined(__DJGPP__)
11858 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
11859 + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11860 + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11861 +#elif defined(__GNUC__) || defined(__clang__)
11862 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11863 + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
11864 + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
11865 +#elif defined(_MSC_VER)
11866 + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
11867 + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
11868 + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
11870 + #define DECLARE_ALIGNED(n,t,v) t v
11871 + #define DECLARE_ASM_ALIGNED(n,t,v) t v
11872 + #define DECLARE_ASM_CONST(n,t,v) static const t v
11880 + * @defgroup lavu_mem_attrs Function Attributes
11881 + * Function attributes applicable to memory handling functions.
11883 + * These function attributes can help compilers emit more useful warnings, or
11884 + * generate better code.
11889 + * @def av_malloc_attrib
11890 + * Function attribute denoting a malloc-like function.
11892 + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251">Function attribute `malloc` in GCC's documentation</a>
11895 +#if AV_GCC_VERSION_AT_LEAST(3,1)
11896 + #define av_malloc_attrib __attribute__((__malloc__))
11898 + #define av_malloc_attrib
11902 + * @def av_alloc_size(...)
11903 + * Function attribute used on a function that allocates memory, whose size is
11904 + * given by the specified parameter(s).
11907 + * void *av_malloc(size_t size) av_alloc_size(1);
11908 + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
11911 + * @param ... One or two parameter indexes, separated by a comma
11913 + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220">Function attribute `alloc_size` in GCC's documentation</a>
11916 +#if AV_GCC_VERSION_AT_LEAST(4,3)
11917 + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
11919 + #define av_alloc_size(...)
11927 + * @defgroup lavu_mem_funcs Heap Management
11928 + * Functions responsible for allocating, freeing, and copying memory.
11930 + * All memory allocation functions have a built-in upper limit of `INT_MAX`
11931 + * bytes. This may be changed with av_max_alloc(), although exercise extreme
11932 + * caution when doing so.
11938 + * Allocate a memory block with alignment suitable for all memory accesses
11939 + * (including vectors if available on the CPU).
11941 + * @param size Size in bytes for the memory block to be allocated
11942 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11944 + * @see av_mallocz()
11946 +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
11949 + * Allocate a memory block with alignment suitable for all memory accesses
11950 + * (including vectors if available on the CPU) and zero all the bytes of the
11953 + * @param size Size in bytes for the memory block to be allocated
11954 + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
11955 + * @see av_malloc()
11957 +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
11960 + * Allocate a memory block for an array with av_malloc().
11962 + * The allocated memory will have size `size * nmemb` bytes.
11964 + * @param nmemb Number of element
11965 + * @param size Size of a single element
11966 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11968 + * @see av_malloc()
11970 +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
11973 + * Allocate a memory block for an array with av_mallocz().
11975 + * The allocated memory will have size `size * nmemb` bytes.
11977 + * @param nmemb Number of elements
11978 + * @param size Size of the single element
11979 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11982 + * @see av_mallocz()
11983 + * @see av_malloc_array()
11985 +av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
11988 + * Non-inlined equivalent of av_mallocz_array().
11990 + * Created for symmetry with the calloc() C function.
11992 +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
11995 + * Allocate, reallocate, or free a block of memory.
11997 + * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
11998 + * zero, free the memory block pointed to by `ptr`. Otherwise, expand or
11999 + * shrink that block of memory according to `size`.
12001 + * @param ptr Pointer to a memory block already allocated with
12002 + * av_realloc() or `NULL`
12003 + * @param size Size in bytes of the memory block to be allocated or
12006 + * @return Pointer to a newly-reallocated block or `NULL` if the block
12007 + * cannot be reallocated or the function is used to free the memory block
12009 + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
12010 + * correctly aligned.
12011 + * @see av_fast_realloc()
12012 + * @see av_reallocp()
12014 +void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
12017 + * Allocate, reallocate, or free a block of memory through a pointer to a
12020 + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
12021 + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
12022 + * shrink that block of memory according to `size`.
12024 + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated
12025 + * with av_realloc(), or a pointer to `NULL`. The pointer
12026 + * is updated on success, or freed on failure.
12027 + * @param[in] size Size in bytes for the memory block to be allocated or
12030 + * @return Zero on success, an AVERROR error code on failure
12032 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12033 + * correctly aligned.
12035 +av_warn_unused_result
12036 +int av_reallocp(void *ptr, size_t size);
12039 + * Allocate, reallocate, or free a block of memory.
12041 + * This function does the same thing as av_realloc(), except:
12042 + * - It takes two size arguments and allocates `nelem * elsize` bytes,
12043 + * after checking the result of the multiplication for integer overflow.
12044 + * - It frees the input block in case of failure, thus avoiding the memory
12045 + * leak with the classic
12047 + * buf = realloc(buf);
12053 +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
12056 + * Allocate, reallocate, or free an array.
12058 + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
12059 + * `nmemb` is zero, free the memory block pointed to by `ptr`.
12061 + * @param ptr Pointer to a memory block already allocated with
12062 + * av_realloc() or `NULL`
12063 + * @param nmemb Number of elements in the array
12064 + * @param size Size of the single element of the array
12066 + * @return Pointer to a newly-reallocated block or NULL if the block
12067 + * cannot be reallocated or the function is used to free the memory block
12069 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12070 + * correctly aligned.
12071 + * @see av_reallocp_array()
12073 +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
12076 + * Allocate, reallocate, or free an array through a pointer to a pointer.
12078 + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
12079 + * zero, free the memory block pointed to by `*ptr`.
12081 + * @param[in,out] ptr Pointer to a pointer to a memory block already
12082 + * allocated with av_realloc(), or a pointer to `NULL`.
12083 + * The pointer is updated on success, or freed on failure.
12084 + * @param[in] nmemb Number of elements
12085 + * @param[in] size Size of the single element
12087 + * @return Zero on success, an AVERROR error code on failure
12089 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12090 + * correctly aligned.
12092 +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
12095 + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
12097 + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
12099 + * If the given buffer is not large enough, and reallocation fails, `NULL` is
12100 + * returned and `*size` is set to 0, but the original buffer is not changed or
12103 + * A typical use pattern follows:
12106 + * uint8_t *buf = ...;
12107 + * uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed);
12108 + * if (!new_buf) {
12109 + * // Allocation failed; clean up original buffer
12110 + * av_freep(&buf);
12111 + * return AVERROR(ENOMEM);
12115 + * @param[in,out] ptr Already allocated buffer, or `NULL`
12116 + * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
12117 + * changed to `min_size` in case of success or 0 in
12118 + * case of failure
12119 + * @param[in] min_size New size of buffer `ptr`
12120 + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
12121 + * buffer if the buffer was not large enough, or `NULL` in case of
12123 + * @see av_realloc()
12124 + * @see av_fast_malloc()
12126 +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
12129 + * Allocate a buffer, reusing the given one if large enough.
12131 + * Contrary to av_fast_realloc(), the current buffer contents might not be
12132 + * preserved and on error the old buffer is freed, thus no special handling to
12133 + * avoid memleaks is necessary.
12135 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12136 + * `size_needed` is greater than 0.
12139 + * uint8_t *buf = ...;
12140 + * av_fast_malloc(&buf, ¤t_size, size_needed);
12142 + * // Allocation failed; buf already freed
12143 + * return AVERROR(ENOMEM);
12147 + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
12148 + * `*ptr` will be overwritten with pointer to new
12149 + * buffer on success or `NULL` on failure
12150 + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
12151 + * changed to `min_size` in case of success or 0 in
12152 + * case of failure
12153 + * @param[in] min_size New size of buffer `*ptr`
12154 + * @see av_realloc()
12155 + * @see av_fast_mallocz()
12157 +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
12160 + * Allocate and clear a buffer, reusing the given one if large enough.
12162 + * Like av_fast_malloc(), but all newly allocated space is initially cleared.
12163 + * Reused buffer is not cleared.
12165 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12166 + * `size_needed` is greater than 0.
12168 + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
12169 + * `*ptr` will be overwritten with pointer to new
12170 + * buffer on success or `NULL` on failure
12171 + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
12172 + * changed to `min_size` in case of success or 0 in
12173 + * case of failure
12174 + * @param[in] min_size New size of buffer `*ptr`
12175 + * @see av_fast_malloc()
12177 +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
12180 + * Free a memory block which has been allocated with a function of av_malloc()
12181 + * or av_realloc() family.
12183 + * @param ptr Pointer to the memory block which should be freed.
12185 + * @note `ptr = NULL` is explicitly allowed.
12186 + * @note It is recommended that you use av_freep() instead, to prevent leaving
12187 + * behind dangling pointers.
12188 + * @see av_freep()
12190 +void av_free(void *ptr);
12193 + * Free a memory block which has been allocated with a function of av_malloc()
12194 + * or av_realloc() family, and set the pointer pointing to it to `NULL`.
12197 + * uint8_t *buf = av_malloc(16);
12199 + * // buf now contains a dangling pointer to freed memory, and accidental
12200 + * // dereference of buf will result in a use-after-free, which may be a
12201 + * // security risk.
12203 + * uint8_t *buf = av_malloc(16);
12204 + * av_freep(&buf);
12205 + * // buf is now NULL, and accidental dereference will only result in a
12206 + * // NULL-pointer dereference.
12209 + * @param ptr Pointer to the pointer to the memory block which should be freed
12210 + * @note `*ptr = NULL` is safe and leads to no action.
12213 +void av_freep(void *ptr);
12216 + * Duplicate a string.
12218 + * @param s String to be duplicated
12219 + * @return Pointer to a newly-allocated string containing a
12220 + * copy of `s` or `NULL` if the string cannot be allocated
12221 + * @see av_strndup()
12223 +char *av_strdup(const char *s) av_malloc_attrib;
12226 + * Duplicate a substring of a string.
12228 + * @param s String to be duplicated
12229 + * @param len Maximum length of the resulting string (not counting the
12230 + * terminating byte)
12231 + * @return Pointer to a newly-allocated string containing a
12232 + * substring of `s` or `NULL` if the string cannot be allocated
12234 +char *av_strndup(const char *s, size_t len) av_malloc_attrib;
12237 + * Duplicate a buffer with av_malloc().
12239 + * @param p Buffer to be duplicated
12240 + * @param size Size in bytes of the buffer copied
12241 + * @return Pointer to a newly allocated buffer containing a
12242 + * copy of `p` or `NULL` if the buffer cannot be allocated
12244 +void *av_memdup(const void *p, size_t size);
12247 + * Overlapping memcpy() implementation.
12249 + * @param dst Destination buffer
12250 + * @param back Number of bytes back to start copying (i.e. the initial size of
12251 + * the overlapping window); must be > 0
12252 + * @param cnt Number of bytes to copy; must be >= 0
12254 + * @note `cnt > back` is valid, this will copy the bytes we just copied,
12255 + * thus creating a repeating pattern with a period length of `back`.
12257 +void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
12264 + * @defgroup lavu_mem_dynarray Dynamic Array
12266 + * Utilities to make an array grow when needed.
12268 + * Sometimes, the programmer would want to have an array that can grow when
12269 + * needed. The libavutil dynamic array utilities fill that need.
12271 + * libavutil supports two systems of appending elements onto a dynamically
12272 + * allocated array, the first one storing the pointer to the value in the
12273 + * array, and the second storing the value directly. In both systems, the
12274 + * caller is responsible for maintaining a variable containing the length of
12275 + * the array, as well as freeing of the array after use.
12277 + * The first system stores pointers to values in a block of dynamically
12278 + * allocated memory. Since only pointers are stored, the function does not need
12279 + * to know the size of the type. Both av_dynarray_add() and
12280 + * av_dynarray_add_nofree() implement this system.
12283 + * type **array = NULL; //< an array of pointers to values
12284 + * int nb = 0; //< a variable to keep track of the length of the array
12286 + * type to_be_added = ...;
12287 + * type to_be_added2 = ...;
12289 + * av_dynarray_add(&array, &nb, &to_be_added);
12291 + * return AVERROR(ENOMEM);
12293 + * av_dynarray_add(&array, &nb, &to_be_added2);
12295 + * return AVERROR(ENOMEM);
12299 + * // &to_be_added == array[0]
12300 + * // &to_be_added2 == array[1]
12302 + * av_freep(&array);
12305 + * The second system stores the value directly in a block of memory. As a
12306 + * result, the function has to know the size of the type. av_dynarray2_add()
12307 + * implements this mechanism.
12310 + * type *array = NULL; //< an array of values
12311 + * int nb = 0; //< a variable to keep track of the length of the array
12313 + * type to_be_added = ...;
12314 + * type to_be_added2 = ...;
12316 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
12318 + * return AVERROR(ENOMEM);
12319 + * memcpy(addr, &to_be_added, sizeof(to_be_added));
12321 + * // Shortcut of the above.
12322 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
12323 + * (const void *)&to_be_added2);
12325 + * return AVERROR(ENOMEM);
12329 + * // to_be_added == array[0]
12330 + * // to_be_added2 == array[1]
12332 + * av_freep(&array);
12339 + * Add the pointer to an element to a dynamic array.
12341 + * The array to grow is supposed to be an array of pointers to
12342 + * structures, and the element to add must be a pointer to an already
12343 + * allocated structure.
12345 + * The array is reallocated when its size reaches powers of 2.
12346 + * Therefore, the amortized cost of adding an element is constant.
12348 + * In case of success, the pointer to the array is updated in order to
12349 + * point to the new grown array, and the number pointed to by `nb_ptr`
12350 + * is incremented.
12351 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12352 + * `*nb_ptr` is set to 0.
12354 + * @param[in,out] tab_ptr Pointer to the array to grow
12355 + * @param[in,out] nb_ptr Pointer to the number of elements in the array
12356 + * @param[in] elem Element to add
12357 + * @see av_dynarray_add_nofree(), av_dynarray2_add()
12359 +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
12362 + * Add an element to a dynamic array.
12364 + * Function has the same functionality as av_dynarray_add(),
12365 + * but it doesn't free memory on fails. It returns error code
12366 + * instead and leave current buffer untouched.
12368 + * @return >=0 on success, negative otherwise
12369 + * @see av_dynarray_add(), av_dynarray2_add()
12371 +av_warn_unused_result
12372 +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
12375 + * Add an element of size `elem_size` to a dynamic array.
12377 + * The array is reallocated when its number of elements reaches powers of 2.
12378 + * Therefore, the amortized cost of adding an element is constant.
12380 + * In case of success, the pointer to the array is updated in order to
12381 + * point to the new grown array, and the number pointed to by `nb_ptr`
12382 + * is incremented.
12383 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12384 + * `*nb_ptr` is set to 0.
12386 + * @param[in,out] tab_ptr Pointer to the array to grow
12387 + * @param[in,out] nb_ptr Pointer to the number of elements in the array
12388 + * @param[in] elem_size Size in bytes of an element in the array
12389 + * @param[in] elem_data Pointer to the data of the element to add. If
12390 + * `NULL`, the space of the newly added element is
12391 + * allocated but left uninitialized.
12393 + * @return Pointer to the data of the element to copy in the newly allocated
12395 + * @see av_dynarray_add(), av_dynarray_add_nofree()
12397 +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
12398 + const uint8_t *elem_data);
12405 + * @defgroup lavu_mem_misc Miscellaneous Functions
12407 + * Other functions related to memory allocation.
12413 + * Multiply two `size_t` values checking for overflow.
12415 + * @param[in] a,b Operands of multiplication
12416 + * @param[out] r Pointer to the result of the operation
12417 + * @return 0 on success, AVERROR(EINVAL) on overflow
12419 +static inline int av_size_mult(size_t a, size_t b, size_t *r)
12421 + size_t t = a * b;
12422 + /* Hack inspired from glibc: don't try the division if nelem and elsize
12423 + * are both less than sqrt(SIZE_MAX). */
12424 + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
12425 + return AVERROR(EINVAL);
12431 + * Set the maximum size that may be allocated in one block.
12433 + * The value specified with this function is effective for all libavutil's @ref
12434 + * lavu_mem_funcs "heap management functions."
12436 + * By default, the max value is defined as `INT_MAX`.
12438 + * @param max Value to be set as the new maximum size
12440 + * @warning Exercise extreme caution when using this function. Don't touch
12441 + * this if you do not understand the full consequence of doing so.
12443 +void av_max_alloc(size_t max);
12450 +#endif /* AVUTIL_MEM_H */
12451 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12452 new file mode 100644
12454 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12457 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
12459 + * This file is part of FFmpeg.
12461 + * FFmpeg is free software; you can redistribute it and/or
12462 + * modify it under the terms of the GNU Lesser General Public
12463 + * License as published by the Free Software Foundation; either
12464 + * version 2.1 of the License, or (at your option) any later version.
12466 + * FFmpeg is distributed in the hope that it will be useful,
12467 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12468 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12469 + * Lesser General Public License for more details.
12471 + * You should have received a copy of the GNU Lesser General Public
12472 + * License along with FFmpeg; if not, write to the Free Software
12473 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12476 +#ifndef AVUTIL_PIXFMT_H
12477 +#define AVUTIL_PIXFMT_H
12481 + * pixel format definitions
12484 +#include "libavutil/avconfig.h"
12485 +#include "version.h"
12487 +#define AVPALETTE_SIZE 1024
12488 +#define AVPALETTE_COUNT 256
12494 + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
12495 + * color is put together as:
12496 + * (A << 24) | (R << 16) | (G << 8) | B
12497 + * This is stored as BGRA on little-endian CPU architectures and ARGB on
12498 + * big-endian CPUs.
12501 + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
12502 + * image data is stored in AVFrame.data[0]. The palette is transported in
12503 + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
12504 + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
12505 + * also endian-specific). Note also that the individual RGB32 palette
12506 + * components stored in AVFrame.data[1] should be in the range 0..255.
12507 + * This is important as many custom PAL8 video codecs that were designed
12508 + * to run on the IBM VGA graphics adapter use 6-bit palette components.
12511 + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
12512 + * for pal8. This palette is filled in automatically by the function
12513 + * allocating the picture.
12515 +enum AVPixelFormat {
12516 + AV_PIX_FMT_NONE = -1,
12517 + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
12518 + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
12519 + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
12520 + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
12521 + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12522 + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
12523 + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
12524 + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
12525 + AV_PIX_FMT_GRAY8, ///< Y , 8bpp
12526 + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
12527 + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
12528 + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
12529 + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
12530 + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
12531 + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
12532 + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
12533 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
12534 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
12535 + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
12536 + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
12537 + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
12538 + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
12539 + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
12540 + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
12541 + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
12543 + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
12544 + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
12545 + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
12546 + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
12548 + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
12549 + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
12550 + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
12551 + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
12552 + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
12553 + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
12554 + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
12556 + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
12557 + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
12558 + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
12559 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
12561 + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
12562 + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
12563 + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
12564 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
12567 + /** @name Deprecated pixel formats */
12569 + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
12570 + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
12571 + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
12573 + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
12576 + * Hardware acceleration through VA-API, data[3] contains a
12579 + AV_PIX_FMT_VAAPI,
12582 + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12583 + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12584 + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12585 + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12586 + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12587 + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12588 + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
12590 + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
12591 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
12592 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
12593 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
12594 + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
12596 + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12597 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12599 + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
12600 + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
12603 + * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
12604 + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
12605 + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
12607 + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12608 + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12609 + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12610 + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12611 + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12612 + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12613 + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12614 + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12615 + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12616 + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12617 + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12618 + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12619 + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
12620 + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
12621 + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
12622 + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
12623 + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
12624 + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
12625 + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
12626 + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
12627 + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
12628 + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
12629 + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
12630 + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
12631 + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
12632 + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
12633 + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12634 + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12635 + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12636 + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12637 + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12638 + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12639 + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12640 + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12641 + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12642 + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12643 + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12644 + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12645 + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12646 + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12648 + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
12650 + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0
12651 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0
12652 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12653 + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12654 + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12656 + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
12657 + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
12658 + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
12659 + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
12661 + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
12663 + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
12664 + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
12666 + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
12667 + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
12668 + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
12670 + * HW acceleration through QSV, data[3] contains a pointer to the
12671 + * mfxFrameSurface1 structure.
12675 + * HW acceleration though MMAL, data[3] contains a pointer to the
12676 + * MMAL_BUFFER_HEADER_T structure.
12680 + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
12683 + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
12684 + * exactly as for system memory frames.
12688 + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
12689 + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
12690 + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
12691 + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
12693 + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12694 + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12695 + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12696 + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12697 + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12698 + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12699 + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12700 + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12701 + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12702 + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12703 + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12704 + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12705 + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian
12706 + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
12707 + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
12708 + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
12709 + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range
12711 + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
12712 + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
12713 + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
12714 + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
12715 + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
12716 + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
12717 + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
12718 + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
12719 + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
12720 + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
12721 + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
12722 + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
12724 + AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
12726 + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12727 + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12728 + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12729 + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12730 + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12731 + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12733 + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
12735 + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
12736 + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
12738 + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
12739 + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian
12741 + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
12742 + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
12744 + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
12746 + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian
12747 + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian
12748 + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian
12749 + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian
12751 + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
12752 + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
12755 + * Hardware surfaces for Direct3D11.
12757 + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
12758 + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
12760 + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
12761 + * texture array index of the frame as intptr_t if the ID3D11Texture2D is
12762 + * an array texture (or always 0 if it's a normal texture).
12764 + AV_PIX_FMT_D3D11,
12766 + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian
12767 + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian
12769 + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian
12770 + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian
12771 + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
12772 + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
12775 + * DRM-managed buffers exposed through PRIME buffer sharing.
12777 + * data[0] points to an AVDRMFrameDescriptor.
12779 + AV_PIX_FMT_DRM_PRIME,
12781 + * Hardware surfaces for OpenCL.
12783 + * data[i] contain 2D image objects (typed in C as cl_mem, used
12784 + * in OpenCL as image2d_t) for each plane of the surface.
12786 + AV_PIX_FMT_OPENCL,
12788 + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
12791 +#if AV_HAVE_BIGENDIAN
12792 +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
12794 +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
12797 +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
12798 +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
12799 +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
12800 +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
12801 +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
12802 +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
12804 +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE)
12805 +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
12806 +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
12807 +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
12808 +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
12809 +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
12810 +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
12811 +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
12812 +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
12813 +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
12814 +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
12815 +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
12816 +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
12817 +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
12818 +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
12820 +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
12821 +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
12822 +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
12823 +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
12824 +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
12825 +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
12826 +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
12827 +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
12828 +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
12829 +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
12830 +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
12831 +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
12832 +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
12833 +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
12834 +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
12835 +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
12836 +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
12838 +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
12839 +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
12840 +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
12841 +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
12842 +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
12843 +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
12844 +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
12845 +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
12847 +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
12848 +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
12849 +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
12850 +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
12852 +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
12853 +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
12855 +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
12856 +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
12857 +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
12858 +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
12859 +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
12860 +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
12861 +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
12862 +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
12863 +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
12865 +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
12866 +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
12867 +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
12868 +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
12869 +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
12872 + * Chromaticity coordinates of the source primaries.
12873 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
12875 +enum AVColorPrimaries {
12876 + AVCOL_PRI_RESERVED0 = 0,
12877 + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
12878 + AVCOL_PRI_UNSPECIFIED = 2,
12879 + AVCOL_PRI_RESERVED = 3,
12880 + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12882 + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
12883 + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12884 + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
12885 + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
12886 + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
12887 + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
12888 + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
12889 + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
12890 + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
12891 + AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
12892 + AVCOL_PRI_NB ///< Not part of ABI
12896 + * Color Transfer Characteristic.
12897 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
12899 +enum AVColorTransferCharacteristic {
12900 + AVCOL_TRC_RESERVED0 = 0,
12901 + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
12902 + AVCOL_TRC_UNSPECIFIED = 2,
12903 + AVCOL_TRC_RESERVED = 3,
12904 + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
12905 + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
12906 + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
12907 + AVCOL_TRC_SMPTE240M = 7,
12908 + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
12909 + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
12910 + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
12911 + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
12912 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
12913 + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
12914 + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
12915 + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
12916 + AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
12917 + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084,
12918 + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
12919 + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
12920 + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
12921 + AVCOL_TRC_NB ///< Not part of ABI
12925 + * YUV colorspace type.
12926 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
12928 +enum AVColorSpace {
12929 + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
12930 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
12931 + AVCOL_SPC_UNSPECIFIED = 2,
12932 + AVCOL_SPC_RESERVED = 3,
12933 + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12934 + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
12935 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12936 + AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
12937 + AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
12938 + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
12939 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
12940 + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
12941 + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
12942 + AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
12943 + AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
12944 + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
12945 + AVCOL_SPC_NB ///< Not part of ABI
12949 + * MPEG vs JPEG YUV range.
12951 +enum AVColorRange {
12952 + AVCOL_RANGE_UNSPECIFIED = 0,
12953 + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
12954 + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
12955 + AVCOL_RANGE_NB ///< Not part of ABI
12959 + * Location of chroma samples.
12961 + * Illustration showing the location of the first (top left) chroma sample of the
12962 + * image, the left shows only luma, the right
12963 + * shows the location of the chroma sample, the 2 could be imagined to overlay
12964 + * each other but are drawn separately due to limitations of ASCII
12966 + * 1st 2nd 1st 2nd horizontal luma sample positions
12969 + *1st luma line > |X X ... |3 4 X ... X are luma samples,
12970 + * | |1 2 1-6 are possible chroma positions
12971 + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
12973 +enum AVChromaLocation {
12974 + AVCHROMA_LOC_UNSPECIFIED = 0,
12975 + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
12976 + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
12977 + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
12978 + AVCHROMA_LOC_TOP = 4,
12979 + AVCHROMA_LOC_BOTTOMLEFT = 5,
12980 + AVCHROMA_LOC_BOTTOM = 6,
12981 + AVCHROMA_LOC_NB ///< Not part of ABI
12984 +#endif /* AVUTIL_PIXFMT_H */
12985 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12986 new file mode 100644
12988 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
12991 + * rational numbers
12992 + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
12994 + * This file is part of FFmpeg.
12996 + * FFmpeg is free software; you can redistribute it and/or
12997 + * modify it under the terms of the GNU Lesser General Public
12998 + * License as published by the Free Software Foundation; either
12999 + * version 2.1 of the License, or (at your option) any later version.
13001 + * FFmpeg is distributed in the hope that it will be useful,
13002 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13003 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13004 + * Lesser General Public License for more details.
13006 + * You should have received a copy of the GNU Lesser General Public
13007 + * License along with FFmpeg; if not, write to the Free Software
13008 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13013 + * @ingroup lavu_math_rational
13014 + * Utilties for rational number calculation.
13015 + * @author Michael Niedermayer <michaelni@gmx.at>
13018 +#ifndef AVUTIL_RATIONAL_H
13019 +#define AVUTIL_RATIONAL_H
13021 +#include <stdint.h>
13022 +#include <limits.h>
13023 +#include "attributes.h"
13026 + * @defgroup lavu_math_rational AVRational
13027 + * @ingroup lavu_math
13028 + * Rational number calculation.
13030 + * While rational numbers can be expressed as floating-point numbers, the
13031 + * conversion process is a lossy one, so are floating-point operations. On the
13032 + * other hand, the nature of FFmpeg demands highly accurate calculation of
13033 + * timestamps. This set of rational number utilities serves as a generic
13034 + * interface for manipulating rational numbers as pairs of numerators and
13037 + * Many of the functions that operate on AVRational's have the suffix `_q`, in
13038 + * reference to the mathematical symbol "â„š" (Q) which denotes the set of all
13039 + * rational numbers.
13045 + * Rational number (pair of numerator and denominator).
13047 +typedef struct AVRational{
13048 + int num; ///< Numerator
13049 + int den; ///< Denominator
13053 + * Create an AVRational.
13055 + * Useful for compilers that do not support compound literals.
13057 + * @note The return value is not reduced.
13058 + * @see av_reduce()
13060 +static inline AVRational av_make_q(int num, int den)
13062 + AVRational r = { num, den };
13067 + * Compare two rationals.
13069 + * @param a First rational
13070 + * @param b Second rational
13072 + * @return One of the following values:
13073 + * - 0 if `a == b`
13075 + * - -1 if `a < b`
13076 + * - `INT_MIN` if one of the values is of the form `0 / 0`
13078 +static inline int av_cmp_q(AVRational a, AVRational b){
13079 + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
13081 + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
13082 + else if(b.den && a.den) return 0;
13083 + else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
13084 + else return INT_MIN;
13088 + * Convert an AVRational to a `double`.
13089 + * @param a AVRational to convert
13090 + * @return `a` in floating-point form
13093 +static inline double av_q2d(AVRational a){
13094 + return a.num / (double) a.den;
13098 + * Reduce a fraction.
13100 + * This is useful for framerate calculations.
13102 + * @param[out] dst_num Destination numerator
13103 + * @param[out] dst_den Destination denominator
13104 + * @param[in] num Source numerator
13105 + * @param[in] den Source denominator
13106 + * @param[in] max Maximum allowed values for `dst_num` & `dst_den`
13107 + * @return 1 if the operation is exact, 0 otherwise
13109 +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
13112 + * Multiply two rationals.
13113 + * @param b First rational
13114 + * @param c Second rational
13117 +AVRational av_mul_q(AVRational b, AVRational c) av_const;
13120 + * Divide one rational by another.
13121 + * @param b First rational
13122 + * @param c Second rational
13125 +AVRational av_div_q(AVRational b, AVRational c) av_const;
13128 + * Add two rationals.
13129 + * @param b First rational
13130 + * @param c Second rational
13133 +AVRational av_add_q(AVRational b, AVRational c) av_const;
13136 + * Subtract one rational from another.
13137 + * @param b First rational
13138 + * @param c Second rational
13141 +AVRational av_sub_q(AVRational b, AVRational c) av_const;
13144 + * Invert a rational.
13148 +static av_always_inline AVRational av_inv_q(AVRational q)
13150 + AVRational r = { q.den, q.num };
13155 + * Convert a double precision floating point number to a rational.
13157 + * In case of infinity, the returned value is expressed as `{1, 0}` or
13158 + * `{-1, 0}` depending on the sign.
13160 + * @param d `double` to convert
13161 + * @param max Maximum allowed numerator and denominator
13162 + * @return `d` in AVRational form
13165 +AVRational av_d2q(double d, int max) av_const;
13168 + * Find which of the two rationals is closer to another rational.
13170 + * @param q Rational to be compared against
13171 + * @param q1,q2 Rationals to be tested
13172 + * @return One of the following values:
13173 + * - 1 if `q1` is nearer to `q` than `q2`
13174 + * - -1 if `q2` is nearer to `q` than `q1`
13175 + * - 0 if they have the same distance
13177 +int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
13180 + * Find the value in a list of rationals nearest a given reference rational.
13182 + * @param q Reference rational
13183 + * @param q_list Array of rationals terminated by `{0, 0}`
13184 + * @return Index of the nearest value found in the array
13186 +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
13189 + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
13192 + * @param q Rational to be converted
13193 + * @return Equivalent floating-point value, expressed as an unsigned 32-bit
13195 + * @note The returned value is platform-indepedant.
13197 +uint32_t av_q2intfloat(AVRational q);
13203 +#endif /* AVUTIL_RATIONAL_H */
13204 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13205 new file mode 100644
13207 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13210 + * This file is part of FFmpeg.
13212 + * FFmpeg is free software; you can redistribute it and/or
13213 + * modify it under the terms of the GNU Lesser General Public
13214 + * License as published by the Free Software Foundation; either
13215 + * version 2.1 of the License, or (at your option) any later version.
13217 + * FFmpeg is distributed in the hope that it will be useful,
13218 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13219 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13220 + * Lesser General Public License for more details.
13222 + * You should have received a copy of the GNU Lesser General Public
13223 + * License along with FFmpeg; if not, write to the Free Software
13224 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13227 +#ifndef AVUTIL_SAMPLEFMT_H
13228 +#define AVUTIL_SAMPLEFMT_H
13230 +#include <stdint.h>
13232 +#include "avutil.h"
13233 +#include "attributes.h"
13236 + * @addtogroup lavu_audio
13239 + * @defgroup lavu_sampfmts Audio sample formats
13241 + * Audio sample format enumeration and related convenience functions.
13246 + * Audio sample formats
13248 + * - The data described by the sample format is always in native-endian order.
13249 + * Sample values can be expressed by native C types, hence the lack of a signed
13250 + * 24-bit sample format even though it is a common raw audio data format.
13252 + * - The floating-point formats are based on full volume being in the range
13253 + * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
13255 + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
13256 + * (such as AVFrame in libavcodec) is as follows:
13259 + * For planar sample formats, each audio channel is in a separate data plane,
13260 + * and linesize is the buffer size, in bytes, for a single plane. All data
13261 + * planes must be the same size. For packed sample formats, only the first data
13262 + * plane is used, and samples for each channel are interleaved. In this case,
13263 + * linesize is the buffer size, in bytes, for the 1 plane.
13266 +enum AVSampleFormat {
13267 + AV_SAMPLE_FMT_NONE = -1,
13268 + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
13269 + AV_SAMPLE_FMT_S16, ///< signed 16 bits
13270 + AV_SAMPLE_FMT_S32, ///< signed 32 bits
13271 + AV_SAMPLE_FMT_FLT, ///< float
13272 + AV_SAMPLE_FMT_DBL, ///< double
13274 + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
13275 + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
13276 + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
13277 + AV_SAMPLE_FMT_FLTP, ///< float, planar
13278 + AV_SAMPLE_FMT_DBLP, ///< double, planar
13279 + AV_SAMPLE_FMT_S64, ///< signed 64 bits
13280 + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
13282 + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
13286 + * Return the name of sample_fmt, or NULL if sample_fmt is not
13289 +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
13292 + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
13295 +enum AVSampleFormat av_get_sample_fmt(const char *name);
13298 + * Return the planar<->packed alternative form of the given sample format, or
13299 + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
13300 + * requested planar/packed format, the format returned is the same as the
13303 +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
13306 + * Get the packed alternative form of the given sample format.
13308 + * If the passed sample_fmt is already in packed format, the format returned is
13309 + * the same as the input.
13311 + * @return the packed alternative form of the given sample format or
13312 + AV_SAMPLE_FMT_NONE on error.
13314 +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
13317 + * Get the planar alternative form of the given sample format.
13319 + * If the passed sample_fmt is already in planar format, the format returned is
13320 + * the same as the input.
13322 + * @return the planar alternative form of the given sample format or
13323 + AV_SAMPLE_FMT_NONE on error.
13325 +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
13328 + * Generate a string corresponding to the sample format with
13329 + * sample_fmt, or a header if sample_fmt is negative.
13331 + * @param buf the buffer where to write the string
13332 + * @param buf_size the size of buf
13333 + * @param sample_fmt the number of the sample format to print the
13334 + * corresponding info string, or a negative value to print the
13335 + * corresponding header.
13336 + * @return the pointer to the filled buffer or NULL if sample_fmt is
13337 + * unknown or in case of other errors
13339 +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
13342 + * Return number of bytes per sample.
13344 + * @param sample_fmt the sample format
13345 + * @return number of bytes per sample or zero if unknown for the given
13348 +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
13351 + * Check if the sample format is planar.
13353 + * @param sample_fmt the sample format to inspect
13354 + * @return 1 if the sample format is planar, 0 if it is interleaved
13356 +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
13359 + * Get the required buffer size for the given audio parameters.
13361 + * @param[out] linesize calculated linesize, may be NULL
13362 + * @param nb_channels the number of channels
13363 + * @param nb_samples the number of samples in a single channel
13364 + * @param sample_fmt the sample format
13365 + * @param align buffer size alignment (0 = default, 1 = no alignment)
13366 + * @return required buffer size, or negative error code on failure
13368 +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
13369 + enum AVSampleFormat sample_fmt, int align);
13374 + * @defgroup lavu_sampmanip Samples manipulation
13376 + * Functions that manipulate audio samples
13381 + * Fill plane data pointers and linesize for samples with sample
13382 + * format sample_fmt.
13384 + * The audio_data array is filled with the pointers to the samples data planes:
13385 + * for planar, set the start point of each channel's data within the buffer,
13386 + * for packed, set the start point of the entire buffer only.
13388 + * The value pointed to by linesize is set to the aligned size of each
13389 + * channel's data buffer for planar layout, or to the aligned size of the
13390 + * buffer for all channels for packed layout.
13392 + * The buffer in buf must be big enough to contain all the samples
13393 + * (use av_samples_get_buffer_size() to compute its minimum size),
13394 + * otherwise the audio_data pointers will point to invalid data.
13396 + * @see enum AVSampleFormat
13397 + * The documentation for AVSampleFormat describes the data layout.
13399 + * @param[out] audio_data array to be filled with the pointer for each channel
13400 + * @param[out] linesize calculated linesize, may be NULL
13401 + * @param buf the pointer to a buffer containing the samples
13402 + * @param nb_channels the number of channels
13403 + * @param nb_samples the number of samples in a single channel
13404 + * @param sample_fmt the sample format
13405 + * @param align buffer size alignment (0 = default, 1 = no alignment)
13406 + * @return >=0 on success or a negative error code on failure
13407 + * @todo return minimum size in bytes required for the buffer in case
13408 + * of success at the next bump
13410 +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
13411 + const uint8_t *buf,
13412 + int nb_channels, int nb_samples,
13413 + enum AVSampleFormat sample_fmt, int align);
13416 + * Allocate a samples buffer for nb_samples samples, and fill data pointers and
13417 + * linesize accordingly.
13418 + * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
13419 + * Allocated data will be initialized to silence.
13421 + * @see enum AVSampleFormat
13422 + * The documentation for AVSampleFormat describes the data layout.
13424 + * @param[out] audio_data array to be filled with the pointer for each channel
13425 + * @param[out] linesize aligned size for audio buffer(s), may be NULL
13426 + * @param nb_channels number of audio channels
13427 + * @param nb_samples number of samples per channel
13428 + * @param align buffer size alignment (0 = default, 1 = no alignment)
13429 + * @return >=0 on success or a negative error code on failure
13430 + * @todo return the size of the allocated buffer in case of success at the next bump
13431 + * @see av_samples_fill_arrays()
13432 + * @see av_samples_alloc_array_and_samples()
13434 +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
13435 + int nb_samples, enum AVSampleFormat sample_fmt, int align);
13438 + * Allocate a data pointers array, samples buffer for nb_samples
13439 + * samples, and fill data pointers and linesize accordingly.
13441 + * This is the same as av_samples_alloc(), but also allocates the data
13442 + * pointers array.
13444 + * @see av_samples_alloc()
13446 +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
13447 + int nb_samples, enum AVSampleFormat sample_fmt, int align);
13450 + * Copy samples from src to dst.
13452 + * @param dst destination array of pointers to data planes
13453 + * @param src source array of pointers to data planes
13454 + * @param dst_offset offset in samples at which the data will be written to dst
13455 + * @param src_offset offset in samples at which the data will be read from src
13456 + * @param nb_samples number of samples to be copied
13457 + * @param nb_channels number of audio channels
13458 + * @param sample_fmt audio sample format
13460 +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
13461 + int src_offset, int nb_samples, int nb_channels,
13462 + enum AVSampleFormat sample_fmt);
13465 + * Fill an audio buffer with silence.
13467 + * @param audio_data array of pointers to data planes
13468 + * @param offset offset in samples at which to start filling
13469 + * @param nb_samples number of samples to fill
13470 + * @param nb_channels number of audio channels
13471 + * @param sample_fmt audio sample format
13473 +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
13474 + int nb_channels, enum AVSampleFormat sample_fmt);
13480 +#endif /* AVUTIL_SAMPLEFMT_H */
13481 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13482 new file mode 100644
13484 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13487 + * copyright (c) 2003 Fabrice Bellard
13489 + * This file is part of FFmpeg.
13491 + * FFmpeg is free software; you can redistribute it and/or
13492 + * modify it under the terms of the GNU Lesser General Public
13493 + * License as published by the Free Software Foundation; either
13494 + * version 2.1 of the License, or (at your option) any later version.
13496 + * FFmpeg is distributed in the hope that it will be useful,
13497 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13498 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13499 + * Lesser General Public License for more details.
13501 + * You should have received a copy of the GNU Lesser General Public
13502 + * License along with FFmpeg; if not, write to the Free Software
13503 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13509 + * Libavutil version macros
13512 +#ifndef AVUTIL_VERSION_H
13513 +#define AVUTIL_VERSION_H
13515 +#include "macros.h"
13518 + * @addtogroup version_utils
13520 + * Useful to check and match library version in order to maintain
13521 + * backward compatibility.
13523 + * The FFmpeg libraries follow a versioning sheme very similar to
13524 + * Semantic Versioning (http://semver.org/)
13525 + * The difference is that the component called PATCH is called MICRO in FFmpeg
13526 + * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
13527 + * Also we do not increase MICRO for every bugfix or change in git master.
13529 + * Prior to FFmpeg 3.2 point releases did not change any lib version number to
13530 + * avoid aliassing different git master checkouts.
13531 + * Starting with FFmpeg 3.2, the released library versions will occupy
13532 + * a separate MAJOR.MINOR that is not used on the master development branch.
13533 + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
13534 + * for the release and master will continue at 55.12.100 after it. Each new
13535 + * point release will then bump the MICRO improving the usefulness of the lib
13541 +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
13542 +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
13543 +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
13546 + * Extract version components from the full ::AV_VERSION_INT int as returned
13547 + * by functions like ::avformat_version() and ::avcodec_version()
13549 +#define AV_VERSION_MAJOR(a) ((a) >> 16)
13550 +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
13551 +#define AV_VERSION_MICRO(a) ((a) & 0xFF)
13558 + * @defgroup lavu_ver Version and Build diagnostics
13560 + * Macros and function useful to check at compiletime and at runtime
13561 + * which version of libavutil is in use.
13566 +#define LIBAVUTIL_VERSION_MAJOR 56
13567 +#define LIBAVUTIL_VERSION_MINOR 14
13568 +#define LIBAVUTIL_VERSION_MICRO 100
13570 +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
13571 + LIBAVUTIL_VERSION_MINOR, \
13572 + LIBAVUTIL_VERSION_MICRO)
13573 +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
13574 + LIBAVUTIL_VERSION_MINOR, \
13575 + LIBAVUTIL_VERSION_MICRO)
13576 +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
13578 +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
13581 + * @defgroup lavu_depr_guards Deprecation Guards
13582 + * FF_API_* defines may be placed below to indicate public API that will be
13583 + * dropped at a future version bump. The defines themselves are not part of
13584 + * the public API and may change, break or disappear at any time.
13586 + * @note, when bumping the major version it is recommended to manually
13587 + * disable each FF_API_* in its own commit instead of disabling them all
13588 + * at once through the bump. This improves the git bisect-ability of the change.
13593 +#ifndef FF_API_VAAPI
13594 +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57)
13596 +#ifndef FF_API_FRAME_QP
13597 +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57)
13599 +#ifndef FF_API_PLUS1_MINUS1
13600 +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)
13602 +#ifndef FF_API_ERROR_FRAME
13603 +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57)
13605 +#ifndef FF_API_PKT_PTS
13606 +#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57)
13608 +#ifndef FF_API_CRYPTO_SIZE_T
13609 +#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
13611 +#ifndef FF_API_FRAME_GET_SET
13612 +#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
13614 +#ifndef FF_API_PSEUDOPAL
13615 +#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
13624 +#endif /* AVUTIL_VERSION_H */
13625 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/moz.build b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13626 new file mode 100644
13628 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13630 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
13631 +# vim: set filetype=python:
13632 +# This Source Code Form is subject to the terms of the Mozilla Public
13633 +# License, v. 2.0. If a copy of the MPL was not distributed with this
13634 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
13636 +UNIFIED_SOURCES += [
13637 + '../FFmpegAudioDecoder.cpp',
13638 + '../FFmpegDataDecoder.cpp',
13639 + '../FFmpegDecoderModule.cpp',
13640 + '../FFmpegVideoDecoder.cpp',
13642 +LOCAL_INCLUDES += [
13647 +if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
13648 + CXXFLAGS += [ '-Wno-deprecated-declarations' ]
13649 +if CONFIG['CC_TYPE'] == 'clang':
13651 + '-Wno-unknown-attributes',
13654 +FINAL_LIBRARY = 'xul'
13655 diff --git a/dom/media/platforms/ffmpeg/moz.build b/dom/media/platforms/ffmpeg/moz.build
13656 --- a/dom/media/platforms/ffmpeg/moz.build
13657 +++ b/dom/media/platforms/ffmpeg/moz.build
13658 @@ -8,15 +8,16 @@ EXPORTS += [
13659 'FFmpegRuntimeLinker.h',
13670 UNIFIED_SOURCES += [
13671 'FFmpegRuntimeLinker.cpp',
13674 FINAL_LIBRARY = 'xul'