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 mLib->avcodec_close(mCodecContext);
41 mLib->av_freep(&mCodecContext);
42 return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
43 RESULT_DETAIL("Couldn't initialise ffmpeg decoder"));
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();
115 if (MOZ_LOG_TEST(sPDMLog, LogLevel::Debug)) {
116 av_log_set_level(AV_LOG_DEBUG);
117 } else if (MOZ_LOG_TEST(sPDMLog, LogLevel::Info)) {
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,18 +22,20 @@ 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 #define AV_CODEC_FLAG_LOW_DELAY CODEC_FLAG_LOW_DELAY
134 -typedef CodecID AVCodecID;
138 enum { LIBAV_VER = FFVPX_VERSION };
140 enum { LIBAV_VER = LIBAVCODEC_VERSION_MAJOR };
143 diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
144 --- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
145 +++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
146 @@ -21,22 +21,25 @@ template <int V> class FFmpegDecoderModu
148 static already_AddRefed<PlatformDecoderModule> Create(FFmpegLibWrapper*);
151 static FFmpegLibWrapper sLibAV;
153 static const char* sLibs[] = {
154 #if defined(XP_DARWIN)
155 + "libavcodec.58.dylib",
156 "libavcodec.57.dylib",
157 "libavcodec.56.dylib",
158 "libavcodec.55.dylib",
159 "libavcodec.54.dylib",
160 "libavcodec.53.dylib",
162 + "libavcodec.so.58",
163 + "libavcodec-ffmpeg.so.58",
164 "libavcodec-ffmpeg.so.57",
165 "libavcodec-ffmpeg.so.56",
172 @@ -129,16 +132,17 @@ FFmpegRuntimeLinker::CreateDecoderModule
174 RefPtr<PlatformDecoderModule> module;
175 switch (sLibAV.mVersion) {
176 case 53: module = FFmpegDecoderModule<53>::Create(&sLibAV); break;
177 case 54: module = FFmpegDecoderModule<54>::Create(&sLibAV); break;
179 case 56: module = FFmpegDecoderModule<55>::Create(&sLibAV); break;
180 case 57: module = FFmpegDecoderModule<57>::Create(&sLibAV); break;
181 + case 58: module = FFmpegDecoderModule<58>::Create(&sLibAV); break;
182 default: module = nullptr;
184 return module.forget();
187 /* static */ const char*
188 FFmpegRuntimeLinker::LinkStatusString()
190 diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
191 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
192 +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
193 @@ -161,17 +161,17 @@ FFmpegVideoDecoder<LIBAV_VER>::InitCodec
195 } else if (mInfo.mDisplay.width >= 1024) {
197 } else if (mInfo.mDisplay.width >= 320) {
202 - mCodecContext->flags |= CODEC_FLAG_LOW_DELAY;
203 + mCodecContext->flags |= AV_CODEC_FLAG_LOW_DELAY;
204 // ffvp9 and ffvp8 at this stage do not support slice threading, but it may
205 // help with the h264 decoder if there's ever one.
206 mCodecContext->thread_type = FF_THREAD_SLICE;
208 decode_threads = std::min(decode_threads, PR_GetNumberOfProcessors() - 1);
209 decode_threads = std::max(decode_threads, 1);
210 mCodecContext->thread_count = decode_threads;
211 if (decode_threads > 1) {
212 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
215 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
217 + GNU LESSER GENERAL PUBLIC LICENSE
218 + Version 2.1, February 1999
220 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
221 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
222 + Everyone is permitted to copy and distribute verbatim copies
223 + of this license document, but changing it is not allowed.
225 +[This is the first released version of the Lesser GPL. It also counts
226 + as the successor of the GNU Library Public License, version 2, hence
227 + the version number 2.1.]
231 + The licenses for most software are designed to take away your
232 +freedom to share and change it. By contrast, the GNU General Public
233 +Licenses are intended to guarantee your freedom to share and change
234 +free software--to make sure the software is free for all its users.
236 + This license, the Lesser General Public License, applies to some
237 +specially designated software packages--typically libraries--of the
238 +Free Software Foundation and other authors who decide to use it. You
239 +can use it too, but we suggest you first think carefully about whether
240 +this license or the ordinary General Public License is the better
241 +strategy to use in any particular case, based on the explanations below.
243 + When we speak of free software, we are referring to freedom of use,
244 +not price. Our General Public Licenses are designed to make sure that
245 +you have the freedom to distribute copies of free software (and charge
246 +for this service if you wish); that you receive source code or can get
247 +it if you want it; that you can change the software and use pieces of
248 +it in new free programs; and that you are informed that you can do
251 + To protect your rights, we need to make restrictions that forbid
252 +distributors to deny you these rights or to ask you to surrender these
253 +rights. These restrictions translate to certain responsibilities for
254 +you if you distribute copies of the library or if you modify it.
256 + For example, if you distribute copies of the library, whether gratis
257 +or for a fee, you must give the recipients all the rights that we gave
258 +you. You must make sure that they, too, receive or can get the source
259 +code. If you link other code with the library, you must provide
260 +complete object files to the recipients, so that they can relink them
261 +with the library after making changes to the library and recompiling
262 +it. And you must show them these terms so they know their rights.
264 + We protect your rights with a two-step method: (1) we copyright the
265 +library, and (2) we offer you this license, which gives you legal
266 +permission to copy, distribute and/or modify the library.
268 + To protect each distributor, we want to make it very clear that
269 +there is no warranty for the free library. Also, if the library is
270 +modified by someone else and passed on, the recipients should know
271 +that what they have is not the original version, so that the original
272 +author's reputation will not be affected by problems that might be
273 +introduced by others.
275 + Finally, software patents pose a constant threat to the existence of
276 +any free program. We wish to make sure that a company cannot
277 +effectively restrict the users of a free program by obtaining a
278 +restrictive license from a patent holder. Therefore, we insist that
279 +any patent license obtained for a version of the library must be
280 +consistent with the full freedom of use specified in this license.
282 + Most GNU software, including some libraries, is covered by the
283 +ordinary GNU General Public License. This license, the GNU Lesser
284 +General Public License, applies to certain designated libraries, and
285 +is quite different from the ordinary General Public License. We use
286 +this license for certain libraries in order to permit linking those
287 +libraries into non-free programs.
289 + When a program is linked with a library, whether statically or using
290 +a shared library, the combination of the two is legally speaking a
291 +combined work, a derivative of the original library. The ordinary
292 +General Public License therefore permits such linking only if the
293 +entire combination fits its criteria of freedom. The Lesser General
294 +Public License permits more lax criteria for linking other code with
297 + We call this license the "Lesser" General Public License because it
298 +does Less to protect the user's freedom than the ordinary General
299 +Public License. It also provides other free software developers Less
300 +of an advantage over competing non-free programs. These disadvantages
301 +are the reason we use the ordinary General Public License for many
302 +libraries. However, the Lesser license provides advantages in certain
303 +special circumstances.
305 + For example, on rare occasions, there may be a special need to
306 +encourage the widest possible use of a certain library, so that it becomes
307 +a de-facto standard. To achieve this, non-free programs must be
308 +allowed to use the library. A more frequent case is that a free
309 +library does the same job as widely used non-free libraries. In this
310 +case, there is little to gain by limiting the free library to free
311 +software only, so we use the Lesser General Public License.
313 + In other cases, permission to use a particular library in non-free
314 +programs enables a greater number of people to use a large body of
315 +free software. For example, permission to use the GNU C Library in
316 +non-free programs enables many more people to use the whole GNU
317 +operating system, as well as its variant, the GNU/Linux operating
320 + Although the Lesser General Public License is Less protective of the
321 +users' freedom, it does ensure that the user of a program that is
322 +linked with the Library has the freedom and the wherewithal to run
323 +that program using a modified version of the Library.
325 + The precise terms and conditions for copying, distribution and
326 +modification follow. Pay close attention to the difference between a
327 +"work based on the library" and a "work that uses the library". The
328 +former contains code derived from the library, whereas the latter must
329 +be combined with the library in order to run.
331 + GNU LESSER GENERAL PUBLIC LICENSE
332 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
334 + 0. This License Agreement applies to any software library or other
335 +program which contains a notice placed by the copyright holder or
336 +other authorized party saying it may be distributed under the terms of
337 +this Lesser General Public License (also called "this License").
338 +Each licensee is addressed as "you".
340 + A "library" means a collection of software functions and/or data
341 +prepared so as to be conveniently linked with application programs
342 +(which use some of those functions and data) to form executables.
344 + The "Library", below, refers to any such software library or work
345 +which has been distributed under these terms. A "work based on the
346 +Library" means either the Library or any derivative work under
347 +copyright law: that is to say, a work containing the Library or a
348 +portion of it, either verbatim or with modifications and/or translated
349 +straightforwardly into another language. (Hereinafter, translation is
350 +included without limitation in the term "modification".)
352 + "Source code" for a work means the preferred form of the work for
353 +making modifications to it. For a library, complete source code means
354 +all the source code for all modules it contains, plus any associated
355 +interface definition files, plus the scripts used to control compilation
356 +and installation of the library.
358 + Activities other than copying, distribution and modification are not
359 +covered by this License; they are outside its scope. The act of
360 +running a program using the Library is not restricted, and output from
361 +such a program is covered only if its contents constitute a work based
362 +on the Library (independent of the use of the Library in a tool for
363 +writing it). Whether that is true depends on what the Library does
364 +and what the program that uses the Library does.
366 + 1. You may copy and distribute verbatim copies of the Library's
367 +complete source code as you receive it, in any medium, provided that
368 +you conspicuously and appropriately publish on each copy an
369 +appropriate copyright notice and disclaimer of warranty; keep intact
370 +all the notices that refer to this License and to the absence of any
371 +warranty; and distribute a copy of this License along with the
374 + You may charge a fee for the physical act of transferring a copy,
375 +and you may at your option offer warranty protection in exchange for a
378 + 2. You may modify your copy or copies of the Library or any portion
379 +of it, thus forming a work based on the Library, and copy and
380 +distribute such modifications or work under the terms of Section 1
381 +above, provided that you also meet all of these conditions:
383 + a) The modified work must itself be a software library.
385 + b) You must cause the files modified to carry prominent notices
386 + stating that you changed the files and the date of any change.
388 + c) You must cause the whole of the work to be licensed at no
389 + charge to all third parties under the terms of this License.
391 + d) If a facility in the modified Library refers to a function or a
392 + table of data to be supplied by an application program that uses
393 + the facility, other than as an argument passed when the facility
394 + is invoked, then you must make a good faith effort to ensure that,
395 + in the event an application does not supply such function or
396 + table, the facility still operates, and performs whatever part of
397 + its purpose remains meaningful.
399 + (For example, a function in a library to compute square roots has
400 + a purpose that is entirely well-defined independent of the
401 + application. Therefore, Subsection 2d requires that any
402 + application-supplied function or table used by this function must
403 + be optional: if the application does not supply it, the square
404 + root function must still compute square roots.)
406 +These requirements apply to the modified work as a whole. If
407 +identifiable sections of that work are not derived from the Library,
408 +and can be reasonably considered independent and separate works in
409 +themselves, then this License, and its terms, do not apply to those
410 +sections when you distribute them as separate works. But when you
411 +distribute the same sections as part of a whole which is a work based
412 +on the Library, the distribution of the whole must be on the terms of
413 +this License, whose permissions for other licensees extend to the
414 +entire whole, and thus to each and every part regardless of who wrote
417 +Thus, it is not the intent of this section to claim rights or contest
418 +your rights to work written entirely by you; rather, the intent is to
419 +exercise the right to control the distribution of derivative or
420 +collective works based on the Library.
422 +In addition, mere aggregation of another work not based on the Library
423 +with the Library (or with a work based on the Library) on a volume of
424 +a storage or distribution medium does not bring the other work under
425 +the scope of this License.
427 + 3. You may opt to apply the terms of the ordinary GNU General Public
428 +License instead of this License to a given copy of the Library. To do
429 +this, you must alter all the notices that refer to this License, so
430 +that they refer to the ordinary GNU General Public License, version 2,
431 +instead of to this License. (If a newer version than version 2 of the
432 +ordinary GNU General Public License has appeared, then you can specify
433 +that version instead if you wish.) Do not make any other change in
436 + Once this change is made in a given copy, it is irreversible for
437 +that copy, so the ordinary GNU General Public License applies to all
438 +subsequent copies and derivative works made from that copy.
440 + This option is useful when you wish to copy part of the code of
441 +the Library into a program that is not a library.
443 + 4. You may copy and distribute the Library (or a portion or
444 +derivative of it, under Section 2) in object code or executable form
445 +under the terms of Sections 1 and 2 above provided that you accompany
446 +it with the complete corresponding machine-readable source code, which
447 +must be distributed under the terms of Sections 1 and 2 above on a
448 +medium customarily used for software interchange.
450 + If distribution of object code is made by offering access to copy
451 +from a designated place, then offering equivalent access to copy the
452 +source code from the same place satisfies the requirement to
453 +distribute the source code, even though third parties are not
454 +compelled to copy the source along with the object code.
456 + 5. A program that contains no derivative of any portion of the
457 +Library, but is designed to work with the Library by being compiled or
458 +linked with it, is called a "work that uses the Library". Such a
459 +work, in isolation, is not a derivative work of the Library, and
460 +therefore falls outside the scope of this License.
462 + However, linking a "work that uses the Library" with the Library
463 +creates an executable that is a derivative of the Library (because it
464 +contains portions of the Library), rather than a "work that uses the
465 +library". The executable is therefore covered by this License.
466 +Section 6 states terms for distribution of such executables.
468 + When a "work that uses the Library" uses material from a header file
469 +that is part of the Library, the object code for the work may be a
470 +derivative work of the Library even though the source code is not.
471 +Whether this is true is especially significant if the work can be
472 +linked without the Library, or if the work is itself a library. The
473 +threshold for this to be true is not precisely defined by law.
475 + If such an object file uses only numerical parameters, data
476 +structure layouts and accessors, and small macros and small inline
477 +functions (ten lines or less in length), then the use of the object
478 +file is unrestricted, regardless of whether it is legally a derivative
479 +work. (Executables containing this object code plus portions of the
480 +Library will still fall under Section 6.)
482 + Otherwise, if the work is a derivative of the Library, you may
483 +distribute the object code for the work under the terms of Section 6.
484 +Any executables containing that work also fall under Section 6,
485 +whether or not they are linked directly with the Library itself.
487 + 6. As an exception to the Sections above, you may also combine or
488 +link a "work that uses the Library" with the Library to produce a
489 +work containing portions of the Library, and distribute that work
490 +under terms of your choice, provided that the terms permit
491 +modification of the work for the customer's own use and reverse
492 +engineering for debugging such modifications.
494 + You must give prominent notice with each copy of the work that the
495 +Library is used in it and that the Library and its use are covered by
496 +this License. You must supply a copy of this License. If the work
497 +during execution displays copyright notices, you must include the
498 +copyright notice for the Library among them, as well as a reference
499 +directing the user to the copy of this License. Also, you must do one
502 + a) Accompany the work with the complete corresponding
503 + machine-readable source code for the Library including whatever
504 + changes were used in the work (which must be distributed under
505 + Sections 1 and 2 above); and, if the work is an executable linked
506 + with the Library, with the complete machine-readable "work that
507 + uses the Library", as object code and/or source code, so that the
508 + user can modify the Library and then relink to produce a modified
509 + executable containing the modified Library. (It is understood
510 + that the user who changes the contents of definitions files in the
511 + Library will not necessarily be able to recompile the application
512 + to use the modified definitions.)
514 + b) Use a suitable shared library mechanism for linking with the
515 + Library. A suitable mechanism is one that (1) uses at run time a
516 + copy of the library already present on the user's computer system,
517 + rather than copying library functions into the executable, and (2)
518 + will operate properly with a modified version of the library, if
519 + the user installs one, as long as the modified version is
520 + interface-compatible with the version that the work was made with.
522 + c) Accompany the work with a written offer, valid for at
523 + least three years, to give the same user the materials
524 + specified in Subsection 6a, above, for a charge no more
525 + than the cost of performing this distribution.
527 + d) If distribution of the work is made by offering access to copy
528 + from a designated place, offer equivalent access to copy the above
529 + specified materials from the same place.
531 + e) Verify that the user has already received a copy of these
532 + materials or that you have already sent this user a copy.
534 + For an executable, the required form of the "work that uses the
535 +Library" must include any data and utility programs needed for
536 +reproducing the executable from it. However, as a special exception,
537 +the materials to be distributed need not include anything that is
538 +normally distributed (in either source or binary form) with the major
539 +components (compiler, kernel, and so on) of the operating system on
540 +which the executable runs, unless that component itself accompanies
543 + It may happen that this requirement contradicts the license
544 +restrictions of other proprietary libraries that do not normally
545 +accompany the operating system. Such a contradiction means you cannot
546 +use both them and the Library together in an executable that you
549 + 7. You may place library facilities that are a work based on the
550 +Library side-by-side in a single library together with other library
551 +facilities not covered by this License, and distribute such a combined
552 +library, provided that the separate distribution of the work based on
553 +the Library and of the other library facilities is otherwise
554 +permitted, and provided that you do these two things:
556 + a) Accompany the combined library with a copy of the same work
557 + based on the Library, uncombined with any other library
558 + facilities. This must be distributed under the terms of the
561 + b) Give prominent notice with the combined library of the fact
562 + that part of it is a work based on the Library, and explaining
563 + where to find the accompanying uncombined form of the same work.
565 + 8. You may not copy, modify, sublicense, link with, or distribute
566 +the Library except as expressly provided under this License. Any
567 +attempt otherwise to copy, modify, sublicense, link with, or
568 +distribute the Library is void, and will automatically terminate your
569 +rights under this License. However, parties who have received copies,
570 +or rights, from you under this License will not have their licenses
571 +terminated so long as such parties remain in full compliance.
573 + 9. You are not required to accept this License, since you have not
574 +signed it. However, nothing else grants you permission to modify or
575 +distribute the Library or its derivative works. These actions are
576 +prohibited by law if you do not accept this License. Therefore, by
577 +modifying or distributing the Library (or any work based on the
578 +Library), you indicate your acceptance of this License to do so, and
579 +all its terms and conditions for copying, distributing or modifying
580 +the Library or works based on it.
582 + 10. Each time you redistribute the Library (or any work based on the
583 +Library), the recipient automatically receives a license from the
584 +original licensor to copy, distribute, link with or modify the Library
585 +subject to these terms and conditions. You may not impose any further
586 +restrictions on the recipients' exercise of the rights granted herein.
587 +You are not responsible for enforcing compliance by third parties with
590 + 11. If, as a consequence of a court judgment or allegation of patent
591 +infringement or for any other reason (not limited to patent issues),
592 +conditions are imposed on you (whether by court order, agreement or
593 +otherwise) that contradict the conditions of this License, they do not
594 +excuse you from the conditions of this License. If you cannot
595 +distribute so as to satisfy simultaneously your obligations under this
596 +License and any other pertinent obligations, then as a consequence you
597 +may not distribute the Library at all. For example, if a patent
598 +license would not permit royalty-free redistribution of the Library by
599 +all those who receive copies directly or indirectly through you, then
600 +the only way you could satisfy both it and this License would be to
601 +refrain entirely from distribution of the Library.
603 +If any portion of this section is held invalid or unenforceable under any
604 +particular circumstance, the balance of the section is intended to apply,
605 +and the section as a whole is intended to apply in other circumstances.
607 +It is not the purpose of this section to induce you to infringe any
608 +patents or other property right claims or to contest validity of any
609 +such claims; this section has the sole purpose of protecting the
610 +integrity of the free software distribution system which is
611 +implemented by public license practices. Many people have made
612 +generous contributions to the wide range of software distributed
613 +through that system in reliance on consistent application of that
614 +system; it is up to the author/donor to decide if he or she is willing
615 +to distribute software through any other system and a licensee cannot
618 +This section is intended to make thoroughly clear what is believed to
619 +be a consequence of the rest of this License.
621 + 12. If the distribution and/or use of the Library is restricted in
622 +certain countries either by patents or by copyrighted interfaces, the
623 +original copyright holder who places the Library under this License may add
624 +an explicit geographical distribution limitation excluding those countries,
625 +so that distribution is permitted only in or among countries not thus
626 +excluded. In such case, this License incorporates the limitation as if
627 +written in the body of this License.
629 + 13. The Free Software Foundation may publish revised and/or new
630 +versions of the Lesser General Public License from time to time.
631 +Such new versions will be similar in spirit to the present version,
632 +but may differ in detail to address new problems or concerns.
634 +Each version is given a distinguishing version number. If the Library
635 +specifies a version number of this License which applies to it and
636 +"any later version", you have the option of following the terms and
637 +conditions either of that version or of any later version published by
638 +the Free Software Foundation. If the Library does not specify a
639 +license version number, you may choose any version ever published by
640 +the Free Software Foundation.
642 + 14. If you wish to incorporate parts of the Library into other free
643 +programs whose distribution conditions are incompatible with these,
644 +write to the author to ask for permission. For software which is
645 +copyrighted by the Free Software Foundation, write to the Free
646 +Software Foundation; we sometimes make exceptions for this. Our
647 +decision will be guided by the two goals of preserving the free status
648 +of all derivatives of our free software and of promoting the sharing
649 +and reuse of software generally.
653 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
654 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
655 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
656 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
657 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
658 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
659 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
660 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
661 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
663 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
664 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
665 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
666 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
667 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
668 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
669 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
670 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
671 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
674 + END OF TERMS AND CONDITIONS
676 + How to Apply These Terms to Your New Libraries
678 + If you develop a new library, and you want it to be of the greatest
679 +possible use to the public, we recommend making it free software that
680 +everyone can redistribute and change. You can do so by permitting
681 +redistribution under these terms (or, alternatively, under the terms of the
682 +ordinary General Public License).
684 + To apply these terms, attach the following notices to the library. It is
685 +safest to attach them to the start of each source file to most effectively
686 +convey the exclusion of warranty; and each file should have at least the
687 +"copyright" line and a pointer to where the full notice is found.
689 + <one line to give the library's name and a brief idea of what it does.>
690 + Copyright (C) <year> <name of author>
692 + This library is free software; you can redistribute it and/or
693 + modify it under the terms of the GNU Lesser General Public
694 + License as published by the Free Software Foundation; either
695 + version 2.1 of the License, or (at your option) any later version.
697 + This library is distributed in the hope that it will be useful,
698 + but WITHOUT ANY WARRANTY; without even the implied warranty of
699 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
700 + Lesser General Public License for more details.
702 + You should have received a copy of the GNU Lesser General Public
703 + License along with this library; if not, write to the Free Software
704 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
706 +Also add information on how to contact you by electronic and paper mail.
708 +You should also get your employer (if you work as a programmer) or your
709 +school, if any, to sign a "copyright disclaimer" for the library, if
710 +necessary. Here is a sample; alter the names:
712 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
713 + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
715 + <signature of Ty Coon>, 1 April 1990
716 + Ty Coon, President of Vice
718 +That's all there is to it!
721 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
724 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
727 + * copyright (c) 2001 Fabrice Bellard
729 + * This file is part of FFmpeg.
731 + * FFmpeg is free software; you can redistribute it and/or
732 + * modify it under the terms of the GNU Lesser General Public
733 + * License as published by the Free Software Foundation; either
734 + * version 2.1 of the License, or (at your option) any later version.
736 + * FFmpeg is distributed in the hope that it will be useful,
737 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
738 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
739 + * Lesser General Public License for more details.
741 + * You should have received a copy of the GNU Lesser General Public
742 + * License along with FFmpeg; if not, write to the Free Software
743 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
746 +#ifndef AVCODEC_AVCODEC_H
747 +#define AVCODEC_AVCODEC_H
752 + * Libavcodec external API header
756 +#include "libavutil/samplefmt.h"
757 +#include "libavutil/attributes.h"
758 +#include "libavutil/avutil.h"
759 +#include "libavutil/buffer.h"
760 +#include "libavutil/cpu.h"
761 +#include "libavutil/channel_layout.h"
762 +#include "libavutil/dict.h"
763 +#include "libavutil/frame.h"
764 +#include "libavutil/hwcontext.h"
765 +#include "libavutil/log.h"
766 +#include "libavutil/pixfmt.h"
767 +#include "libavutil/rational.h"
769 +#include "version.h"
772 + * @defgroup libavc libavcodec
773 + * Encoding/Decoding Library
777 + * @defgroup lavc_decoding Decoding
781 + * @defgroup lavc_encoding Encoding
785 + * @defgroup lavc_codec Codecs
787 + * @defgroup lavc_codec_native Native Codecs
790 + * @defgroup lavc_codec_wrappers External library wrappers
793 + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
797 + * @defgroup lavc_internal Internal
805 + * @defgroup lavc_encdec send/receive encoding and decoding API overview
808 + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
809 + * avcodec_receive_packet() functions provide an encode/decode API, which
810 + * decouples input and output.
812 + * The API is very similar for encoding/decoding and audio/video, and works as
814 + * - Set up and open the AVCodecContext as usual.
815 + * - Send valid input:
816 + * - For decoding, call avcodec_send_packet() to give the decoder raw
817 + * compressed data in an AVPacket.
818 + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
819 + * containing uncompressed audio or video.
820 + * In both cases, it is recommended that AVPackets and AVFrames are
821 + * refcounted, or libavcodec might have to copy the input data. (libavformat
822 + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates
823 + * refcounted AVFrames.)
824 + * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
825 + * functions and process their output:
826 + * - For decoding, call avcodec_receive_frame(). On success, it will return
827 + * an AVFrame containing uncompressed audio or video data.
828 + * - For encoding, call avcodec_receive_packet(). On success, it will return
829 + * an AVPacket with a compressed frame.
830 + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The
831 + * AVERROR(EAGAIN) return value means that new input data is required to
832 + * return new output. In this case, continue with sending input. For each
833 + * input frame/packet, the codec will typically return 1 output frame/packet,
834 + * but it can also be 0 or more than 1.
836 + * At the beginning of decoding or encoding, the codec might accept multiple
837 + * input frames/packets without returning a frame, until its internal buffers
838 + * are filled. This situation is handled transparently if you follow the steps
841 + * In theory, sending input can result in EAGAIN - this should happen only if
842 + * not all output was received. You can use this to structure alternative decode
843 + * or encode loops other than the one suggested above. For example, you could
844 + * try sending new input on each iteration, and try to receive output if that
847 + * End of stream situations. These require "flushing" (aka draining) the codec,
848 + * as the codec might buffer multiple frames or packets internally for
849 + * performance or out of necessity (consider B-frames).
850 + * This is handled as follows:
851 + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
852 + * or avcodec_send_frame() (encoding) functions. This will enter draining
854 + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
855 + * (encoding) in a loop until AVERROR_EOF is returned. The functions will
856 + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
857 + * - Before decoding can be resumed again, the codec has to be reset with
858 + * avcodec_flush_buffers().
860 + * Using the API as outlined above is highly recommended. But it is also
861 + * possible to call functions outside of this rigid schema. For example, you can
862 + * call avcodec_send_packet() repeatedly without calling
863 + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
864 + * until the codec's internal buffer has been filled up (which is typically of
865 + * size 1 per output frame, after initial input), and then reject input with
866 + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
867 + * read at least some output.
869 + * Not all codecs will follow a rigid and predictable dataflow; the only
870 + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
871 + * one end implies that a receive/send call on the other end will succeed, or
872 + * at least will not fail with AVERROR(EAGAIN). In general, no codec will
873 + * permit unlimited buffering of input or output.
875 + * This API replaces the following legacy functions:
876 + * - avcodec_decode_video2() and avcodec_decode_audio4():
877 + * Use avcodec_send_packet() to feed input to the decoder, then use
878 + * avcodec_receive_frame() to receive decoded frames after each packet.
879 + * Unlike with the old video decoding API, multiple frames might result from
880 + * a packet. For audio, splitting the input packet into frames by partially
881 + * decoding packets becomes transparent to the API user. You never need to
882 + * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
883 + * no data was read from the packet).
884 + * Additionally, sending a flush/draining packet is required only once.
885 + * - avcodec_encode_video2()/avcodec_encode_audio2():
886 + * Use avcodec_send_frame() to feed input to the encoder, then use
887 + * avcodec_receive_packet() to receive encoded packets.
888 + * Providing user-allocated buffers for avcodec_receive_packet() is not
890 + * - The new API does not handle subtitles yet.
892 + * Mixing new and old function calls on the same AVCodecContext is not allowed,
893 + * and will result in undefined behavior.
895 + * Some codecs might require using the new API; using the old API will return
896 + * an error when calling it. All codecs support the new API.
898 + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
899 + * would be an invalid state, which could put the codec user into an endless
900 + * loop. The API has no concept of time either: it cannot happen that trying to
901 + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
902 + * later accepts the packet (with no other receive/flush API calls involved).
903 + * The API is a strict state machine, and the passage of time is not supposed
904 + * to influence it. Some timing-dependent behavior might still be deemed
905 + * acceptable in certain cases. But it must never result in both send/receive
906 + * returning EAGAIN at the same time at any point. It must also absolutely be
907 + * avoided that the current state is "unstable" and can "flip-flop" between
908 + * the send/receive APIs allowing progress. For example, it's not allowed that
909 + * the codec randomly decides that it actually wants to consume a packet now
910 + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
911 + * avcodec_send_packet() call.
916 + * @defgroup lavc_core Core functions/structures.
919 + * Basic definitions, functions for querying libavcodec capabilities,
920 + * allocating core structures, etc.
926 + * Identify the syntax and semantics of the bitstream.
927 + * The principle is roughly:
928 + * Two decoders with the same ID can decode the same streams.
929 + * Two encoders with the same ID can encode compatible streams.
930 + * There may be slight deviations from the principle due to implementation
933 + * If you add a codec ID to this list, add it so that
934 + * 1. no value of an existing codec ID changes (that would break ABI),
935 + * 2. it is as close as possible to similar codecs
937 + * After adding new codec IDs, do not forget to add an entry to the codec
938 + * descriptor list and bump libavcodec minor version.
944 + AV_CODEC_ID_MPEG1VIDEO,
945 + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
951 + AV_CODEC_ID_MJPEGB,
954 + AV_CODEC_ID_JPEGLS,
956 + AV_CODEC_ID_RAWVIDEO,
957 + AV_CODEC_ID_MSMPEG4V1,
958 + AV_CODEC_ID_MSMPEG4V2,
959 + AV_CODEC_ID_MSMPEG4V3,
967 + AV_CODEC_ID_DVVIDEO,
968 + AV_CODEC_ID_HUFFYUV,
971 + AV_CODEC_ID_INDEO3,
973 + AV_CODEC_ID_THEORA,
982 + AV_CODEC_ID_INTERPLAY_VIDEO,
983 + AV_CODEC_ID_XAN_WC3,
984 + AV_CODEC_ID_XAN_WC4,
986 + AV_CODEC_ID_CINEPAK,
987 + AV_CODEC_ID_WS_VQA,
989 + AV_CODEC_ID_MSVIDEO1,
994 + AV_CODEC_ID_TRUEMOTION1,
995 + AV_CODEC_ID_VMDVIDEO,
1001 + AV_CODEC_ID_QDRAW,
1008 + AV_CODEC_ID_PGMYUV,
1010 + AV_CODEC_ID_FFVHUFF,
1018 + AV_CODEC_ID_INDEO2,
1019 + AV_CODEC_ID_FRAPS,
1020 + AV_CODEC_ID_TRUEMOTION2,
1023 + AV_CODEC_ID_MMVIDEO,
1026 + AV_CODEC_ID_SMACKVIDEO,
1029 + AV_CODEC_ID_FLASHSV,
1031 + AV_CODEC_ID_JPEG2000,
1036 + AV_CODEC_ID_TARGA,
1037 + AV_CODEC_ID_DSICINVIDEO,
1038 + AV_CODEC_ID_TIERTEXSEQVIDEO,
1042 + AV_CODEC_ID_DNXHD,
1046 + AV_CODEC_ID_BETHSOFTVID,
1053 + AV_CODEC_ID_SUNRAST,
1054 + AV_CODEC_ID_INDEO4,
1055 + AV_CODEC_ID_INDEO5,
1056 + AV_CODEC_ID_MIMIC,
1058 + AV_CODEC_ID_ESCAPE124,
1059 + AV_CODEC_ID_DIRAC,
1062 + AV_CODEC_ID_MOTIONPIXELS,
1067 + AV_CODEC_ID_AURA2,
1068 + AV_CODEC_ID_V210X,
1074 + AV_CODEC_ID_FLASHSV2,
1075 + AV_CODEC_ID_CDGRAPHICS,
1078 + AV_CODEC_ID_BINKVIDEO,
1079 + AV_CODEC_ID_IFF_ILBM,
1080 +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1084 + AV_CODEC_ID_PICTOR,
1086 + AV_CODEC_ID_A64_MULTI,
1087 + AV_CODEC_ID_A64_MULTI5,
1089 + AV_CODEC_ID_MXPEG,
1090 + AV_CODEC_ID_LAGARITH,
1091 + AV_CODEC_ID_PRORES,
1094 + AV_CODEC_ID_WMV3IMAGE,
1095 + AV_CODEC_ID_VC1IMAGE,
1096 + AV_CODEC_ID_UTVIDEO,
1097 + AV_CODEC_ID_BMV_VIDEO,
1099 + AV_CODEC_ID_DXTORY,
1104 + AV_CODEC_ID_ZEROCODEC,
1107 + AV_CODEC_ID_TSCC2,
1113 + AV_CODEC_ID_ESCAPE130,
1116 + AV_CODEC_ID_HNM4_VIDEO,
1118 +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1120 + AV_CODEC_ID_ALIAS_PIX,
1121 + AV_CODEC_ID_BRENDER_PIX,
1122 + AV_CODEC_ID_PAF_VIDEO,
1126 + AV_CODEC_ID_SGIRLE,
1131 + AV_CODEC_ID_HQ_HQA,
1135 + AV_CODEC_ID_SCREENPRESSO,
1138 + AV_CODEC_ID_Y41P = 0x8000,
1143 + AV_CODEC_ID_TARGA_Y216,
1149 + AV_CODEC_ID_XFACE,
1151 + AV_CODEC_ID_SMVJPEG,
1153 + AV_CODEC_ID_DAALA,
1155 + AV_CODEC_ID_TRUEMOTION2RT,
1157 + AV_CODEC_ID_MAGICYUV,
1158 + AV_CODEC_ID_SHEERVIDEO,
1161 + AV_CODEC_ID_PIXLET,
1162 + AV_CODEC_ID_SPEEDHQ,
1165 + AV_CODEC_ID_CLEARVIDEO,
1168 + AV_CODEC_ID_BITPACKED,
1175 + /* various PCM "codecs" */
1176 + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
1177 + AV_CODEC_ID_PCM_S16LE = 0x10000,
1178 + AV_CODEC_ID_PCM_S16BE,
1179 + AV_CODEC_ID_PCM_U16LE,
1180 + AV_CODEC_ID_PCM_U16BE,
1181 + AV_CODEC_ID_PCM_S8,
1182 + AV_CODEC_ID_PCM_U8,
1183 + AV_CODEC_ID_PCM_MULAW,
1184 + AV_CODEC_ID_PCM_ALAW,
1185 + AV_CODEC_ID_PCM_S32LE,
1186 + AV_CODEC_ID_PCM_S32BE,
1187 + AV_CODEC_ID_PCM_U32LE,
1188 + AV_CODEC_ID_PCM_U32BE,
1189 + AV_CODEC_ID_PCM_S24LE,
1190 + AV_CODEC_ID_PCM_S24BE,
1191 + AV_CODEC_ID_PCM_U24LE,
1192 + AV_CODEC_ID_PCM_U24BE,
1193 + AV_CODEC_ID_PCM_S24DAUD,
1194 + AV_CODEC_ID_PCM_ZORK,
1195 + AV_CODEC_ID_PCM_S16LE_PLANAR,
1196 + AV_CODEC_ID_PCM_DVD,
1197 + AV_CODEC_ID_PCM_F32BE,
1198 + AV_CODEC_ID_PCM_F32LE,
1199 + AV_CODEC_ID_PCM_F64BE,
1200 + AV_CODEC_ID_PCM_F64LE,
1201 + AV_CODEC_ID_PCM_BLURAY,
1202 + AV_CODEC_ID_PCM_LXF,
1203 + AV_CODEC_ID_S302M,
1204 + AV_CODEC_ID_PCM_S8_PLANAR,
1205 + AV_CODEC_ID_PCM_S24LE_PLANAR,
1206 + AV_CODEC_ID_PCM_S32LE_PLANAR,
1207 + AV_CODEC_ID_PCM_S16BE_PLANAR,
1209 + AV_CODEC_ID_PCM_S64LE = 0x10800,
1210 + AV_CODEC_ID_PCM_S64BE,
1211 + AV_CODEC_ID_PCM_F16LE,
1212 + AV_CODEC_ID_PCM_F24LE,
1214 + /* various ADPCM codecs */
1215 + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
1216 + AV_CODEC_ID_ADPCM_IMA_WAV,
1217 + AV_CODEC_ID_ADPCM_IMA_DK3,
1218 + AV_CODEC_ID_ADPCM_IMA_DK4,
1219 + AV_CODEC_ID_ADPCM_IMA_WS,
1220 + AV_CODEC_ID_ADPCM_IMA_SMJPEG,
1221 + AV_CODEC_ID_ADPCM_MS,
1222 + AV_CODEC_ID_ADPCM_4XM,
1223 + AV_CODEC_ID_ADPCM_XA,
1224 + AV_CODEC_ID_ADPCM_ADX,
1225 + AV_CODEC_ID_ADPCM_EA,
1226 + AV_CODEC_ID_ADPCM_G726,
1227 + AV_CODEC_ID_ADPCM_CT,
1228 + AV_CODEC_ID_ADPCM_SWF,
1229 + AV_CODEC_ID_ADPCM_YAMAHA,
1230 + AV_CODEC_ID_ADPCM_SBPRO_4,
1231 + AV_CODEC_ID_ADPCM_SBPRO_3,
1232 + AV_CODEC_ID_ADPCM_SBPRO_2,
1233 + AV_CODEC_ID_ADPCM_THP,
1234 + AV_CODEC_ID_ADPCM_IMA_AMV,
1235 + AV_CODEC_ID_ADPCM_EA_R1,
1236 + AV_CODEC_ID_ADPCM_EA_R3,
1237 + AV_CODEC_ID_ADPCM_EA_R2,
1238 + AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
1239 + AV_CODEC_ID_ADPCM_IMA_EA_EACS,
1240 + AV_CODEC_ID_ADPCM_EA_XAS,
1241 + AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
1242 + AV_CODEC_ID_ADPCM_IMA_ISS,
1243 + AV_CODEC_ID_ADPCM_G722,
1244 + AV_CODEC_ID_ADPCM_IMA_APC,
1245 + AV_CODEC_ID_ADPCM_VIMA,
1247 + AV_CODEC_ID_ADPCM_AFC = 0x11800,
1248 + AV_CODEC_ID_ADPCM_IMA_OKI,
1249 + AV_CODEC_ID_ADPCM_DTK,
1250 + AV_CODEC_ID_ADPCM_IMA_RAD,
1251 + AV_CODEC_ID_ADPCM_G726LE,
1252 + AV_CODEC_ID_ADPCM_THP_LE,
1253 + AV_CODEC_ID_ADPCM_PSX,
1254 + AV_CODEC_ID_ADPCM_AICA,
1255 + AV_CODEC_ID_ADPCM_IMA_DAT4,
1256 + AV_CODEC_ID_ADPCM_MTAF,
1259 + AV_CODEC_ID_AMR_NB = 0x12000,
1260 + AV_CODEC_ID_AMR_WB,
1262 + /* RealAudio codecs*/
1263 + AV_CODEC_ID_RA_144 = 0x13000,
1264 + AV_CODEC_ID_RA_288,
1266 + /* various DPCM codecs */
1267 + AV_CODEC_ID_ROQ_DPCM = 0x14000,
1268 + AV_CODEC_ID_INTERPLAY_DPCM,
1269 + AV_CODEC_ID_XAN_DPCM,
1270 + AV_CODEC_ID_SOL_DPCM,
1272 + AV_CODEC_ID_SDX2_DPCM = 0x14800,
1273 + AV_CODEC_ID_GREMLIN_DPCM,
1275 + /* audio codecs */
1276 + AV_CODEC_ID_MP2 = 0x15000,
1277 + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
1281 + AV_CODEC_ID_VORBIS,
1282 + AV_CODEC_ID_DVAUDIO,
1283 + AV_CODEC_ID_WMAV1,
1284 + AV_CODEC_ID_WMAV2,
1285 + AV_CODEC_ID_MACE3,
1286 + AV_CODEC_ID_MACE6,
1287 + AV_CODEC_ID_VMDAUDIO,
1289 + AV_CODEC_ID_MP3ADU,
1290 + AV_CODEC_ID_MP3ON4,
1291 + AV_CODEC_ID_SHORTEN,
1293 + AV_CODEC_ID_WESTWOOD_SND1,
1294 + AV_CODEC_ID_GSM, ///< as in Berlin toast format
1297 + AV_CODEC_ID_TRUESPEECH,
1299 + AV_CODEC_ID_SMACKAUDIO,
1300 + AV_CODEC_ID_QCELP,
1301 + AV_CODEC_ID_WAVPACK,
1302 + AV_CODEC_ID_DSICINAUDIO,
1304 + AV_CODEC_ID_MUSEPACK7,
1306 + AV_CODEC_ID_GSM_MS, /* as found in WAV */
1307 + AV_CODEC_ID_ATRAC3,
1309 + AV_CODEC_ID_NELLYMOSER,
1310 + AV_CODEC_ID_MUSEPACK8,
1311 + AV_CODEC_ID_SPEEX,
1312 + AV_CODEC_ID_WMAVOICE,
1313 + AV_CODEC_ID_WMAPRO,
1314 + AV_CODEC_ID_WMALOSSLESS,
1315 + AV_CODEC_ID_ATRAC3P,
1319 + AV_CODEC_ID_TWINVQ,
1320 + AV_CODEC_ID_TRUEHD,
1321 + AV_CODEC_ID_MP4ALS,
1322 + AV_CODEC_ID_ATRAC1,
1323 + AV_CODEC_ID_BINKAUDIO_RDFT,
1324 + AV_CODEC_ID_BINKAUDIO_DCT,
1325 + AV_CODEC_ID_AAC_LATM,
1328 + AV_CODEC_ID_G723_1,
1330 + AV_CODEC_ID_8SVX_EXP,
1331 + AV_CODEC_ID_8SVX_FIB,
1332 + AV_CODEC_ID_BMV_AUDIO,
1337 + AV_CODEC_ID_COMFORT_NOISE,
1339 + AV_CODEC_ID_METASOUND,
1340 + AV_CODEC_ID_PAF_AUDIO,
1341 + AV_CODEC_ID_ON2AVC,
1342 + AV_CODEC_ID_DSS_SP,
1343 + AV_CODEC_ID_CODEC2,
1345 + AV_CODEC_ID_FFWAVESYNTH = 0x15800,
1346 + AV_CODEC_ID_SONIC,
1347 + AV_CODEC_ID_SONIC_LS,
1350 + AV_CODEC_ID_DSD_LSBF,
1351 + AV_CODEC_ID_DSD_MSBF,
1352 + AV_CODEC_ID_DSD_LSBF_PLANAR,
1353 + AV_CODEC_ID_DSD_MSBF_PLANAR,
1355 + AV_CODEC_ID_INTERPLAY_ACM,
1359 + AV_CODEC_ID_ATRAC3AL,
1360 + AV_CODEC_ID_ATRAC3PAL,
1361 + AV_CODEC_ID_DOLBY_E,
1363 + AV_CODEC_ID_APTX_HD,
1366 + /* subtitle codecs */
1367 + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
1368 + AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
1369 + AV_CODEC_ID_DVB_SUBTITLE,
1370 + AV_CODEC_ID_TEXT, ///< raw UTF-8 text
1373 + AV_CODEC_ID_MOV_TEXT,
1374 + AV_CODEC_ID_HDMV_PGS_SUBTITLE,
1375 + AV_CODEC_ID_DVB_TELETEXT,
1378 + AV_CODEC_ID_MICRODVD = 0x17800,
1379 + AV_CODEC_ID_EIA_608,
1380 + AV_CODEC_ID_JACOSUB,
1382 + AV_CODEC_ID_REALTEXT,
1384 + AV_CODEC_ID_SUBVIEWER1,
1385 + AV_CODEC_ID_SUBVIEWER,
1386 + AV_CODEC_ID_SUBRIP,
1387 + AV_CODEC_ID_WEBVTT,
1389 + AV_CODEC_ID_VPLAYER,
1392 + AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
1394 + /* other specific kind of codecs (generally used for attachments) */
1395 + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
1396 + AV_CODEC_ID_TTF = 0x18000,
1398 + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
1399 + AV_CODEC_ID_BINTEXT = 0x18800,
1403 + AV_CODEC_ID_SMPTE_KLV,
1404 + AV_CODEC_ID_DVD_NAV,
1405 + AV_CODEC_ID_TIMED_ID3,
1406 + AV_CODEC_ID_BIN_DATA,
1409 + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
1411 + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
1412 + * stream (only used by libavformat) */
1413 + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
1414 + * stream (only used by libavformat) */
1415 + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
1416 + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
1420 + * This struct describes the properties of a single codec described by an
1422 + * @see avcodec_descriptor_get()
1424 +typedef struct AVCodecDescriptor {
1425 + enum AVCodecID id;
1426 + enum AVMediaType type;
1428 + * Name of the codec described by this descriptor. It is non-empty and
1429 + * unique for each codec descriptor. It should contain alphanumeric
1430 + * characters and '_' only.
1434 + * A more descriptive name for this codec. May be NULL.
1436 + const char *long_name;
1438 + * Codec properties, a combination of AV_CODEC_PROP_* flags.
1442 + * MIME type(s) associated with the codec.
1443 + * May be NULL; if not, a NULL-terminated array of MIME types.
1444 + * The first item is always non-NULL and is the preferred MIME type.
1446 + const char *const *mime_types;
1448 + * If non-NULL, an array of profiles recognized for this codec.
1449 + * Terminated with FF_PROFILE_UNKNOWN.
1451 + const struct AVProfile *profiles;
1452 +} AVCodecDescriptor;
1455 + * Codec uses only intra compression.
1456 + * Video and audio codecs only.
1458 +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
1460 + * Codec supports lossy compression. Audio and video codecs only.
1461 + * @note a codec may support both lossy and lossless
1462 + * compression modes
1464 +#define AV_CODEC_PROP_LOSSY (1 << 1)
1466 + * Codec supports lossless compression. Audio and video codecs only.
1468 +#define AV_CODEC_PROP_LOSSLESS (1 << 2)
1470 + * Codec supports frame reordering. That is, the coded order (the order in which
1471 + * the encoded packets are output by the encoders / stored / input to the
1472 + * decoders) may be different from the presentation order of the corresponding
1475 + * For codecs that do not have this property set, PTS and DTS should always be
1478 +#define AV_CODEC_PROP_REORDER (1 << 3)
1480 + * Subtitle codec is bitmap based
1481 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
1483 +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
1485 + * Subtitle codec is text based.
1486 + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
1488 +#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
1491 + * @ingroup lavc_decoding
1492 + * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
1493 + * This is mainly needed because some optimized bitstream readers read
1494 + * 32 or 64 bit at once and could read over the end.<br>
1495 + * Note: If the first 23 bits of the additional bytes are not 0, then damaged
1496 + * MPEG bitstreams could cause overread and segfault.
1498 +#define AV_INPUT_BUFFER_PADDING_SIZE 64
1501 + * @ingroup lavc_encoding
1502 + * minimum encoding buffer size
1503 + * Used to avoid some checks during header writing.
1505 +#define AV_INPUT_BUFFER_MIN_SIZE 16384
1508 + * @ingroup lavc_decoding
1511 + /* We leave some space between them for extensions (drop some
1512 + * keyframes for intra-only or drop just some bidir frames). */
1513 + AVDISCARD_NONE =-16, ///< discard nothing
1514 + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
1515 + AVDISCARD_NONREF = 8, ///< discard all non reference
1516 + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
1517 + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
1518 + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
1519 + AVDISCARD_ALL = 48, ///< discard all
1522 +enum AVAudioServiceType {
1523 + AV_AUDIO_SERVICE_TYPE_MAIN = 0,
1524 + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
1525 + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
1526 + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
1527 + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
1528 + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
1529 + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
1530 + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
1531 + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
1532 + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
1536 + * @ingroup lavc_encoding
1538 +typedef struct RcOverride{
1541 + int qscale; // If this is 0 then quality_factor will be used instead.
1542 + float quality_factor;
1545 +/* encoding support
1546 + These flags can be passed in AVCodecContext.flags before initialization.
1547 + Note: Not everything is supported yet.
1551 + * Allow decoders to produce frames with data planes that are not aligned
1552 + * to CPU requirements (e.g. due to cropping).
1554 +#define AV_CODEC_FLAG_UNALIGNED (1 << 0)
1556 + * Use fixed qscale.
1558 +#define AV_CODEC_FLAG_QSCALE (1 << 1)
1560 + * 4 MV per MB allowed / advanced prediction for H.263.
1562 +#define AV_CODEC_FLAG_4MV (1 << 2)
1564 + * Output even those frames that might be corrupted.
1566 +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)
1570 +#define AV_CODEC_FLAG_QPEL (1 << 4)
1572 + * Use internal 2pass ratecontrol in first pass mode.
1574 +#define AV_CODEC_FLAG_PASS1 (1 << 9)
1576 + * Use internal 2pass ratecontrol in second pass mode.
1578 +#define AV_CODEC_FLAG_PASS2 (1 << 10)
1582 +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)
1584 + * Only decode/encode grayscale.
1586 +#define AV_CODEC_FLAG_GRAY (1 << 13)
1588 + * error[?] variables will be set during encoding.
1590 +#define AV_CODEC_FLAG_PSNR (1 << 15)
1592 + * Input bitstream might be truncated at a random location
1593 + * instead of only at frame boundaries.
1595 +#define AV_CODEC_FLAG_TRUNCATED (1 << 16)
1597 + * Use interlaced DCT.
1599 +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)
1601 + * Force low delay.
1603 +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19)
1605 + * Place global headers in extradata instead of every keyframe.
1607 +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
1609 + * Use only bitexact stuff (except (I)DCT).
1611 +#define AV_CODEC_FLAG_BITEXACT (1 << 23)
1612 +/* Fx : Flag for H.263+ extra options */
1614 + * H.263 advanced intra coding / MPEG-4 AC prediction
1616 +#define AV_CODEC_FLAG_AC_PRED (1 << 24)
1618 + * interlaced motion estimation
1620 +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)
1621 +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31)
1624 + * Allow non spec compliant speedup tricks.
1626 +#define AV_CODEC_FLAG2_FAST (1 << 0)
1628 + * Skip bitstream encoding.
1630 +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)
1632 + * Place global headers at every keyframe instead of in extradata.
1634 +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
1637 + * timecode is in drop frame format. DEPRECATED!!!!
1639 +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
1642 + * Input bitstream might be truncated at a packet boundaries
1643 + * instead of only at frame boundaries.
1645 +#define AV_CODEC_FLAG2_CHUNKS (1 << 15)
1647 + * Discard cropping information from SPS.
1649 +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)
1652 + * Show all frames before the first keyframe
1654 +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22)
1656 + * Export motion vectors through frame side data
1658 +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28)
1660 + * Do not skip samples and export skip information as frame side data
1662 +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29)
1664 + * Do not reset ASS ReadOrder field on flush (subtitles decoding)
1666 +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
1668 +/* Unsupported options :
1669 + * Syntax Arithmetic coding (SAC)
1670 + * Reference Picture Selection
1671 + * Independent Segment Decoding */
1673 +/* codec capabilities */
1676 + * Decoder can use draw_horiz_band callback.
1678 +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
1680 + * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1681 + * If not set, it might not use get_buffer() at all or use operations that
1682 + * assume the buffer was allocated by avcodec_default_get_buffer.
1684 +#define AV_CODEC_CAP_DR1 (1 << 1)
1685 +#define AV_CODEC_CAP_TRUNCATED (1 << 3)
1687 + * Encoder or decoder requires flushing with NULL input at the end in order to
1688 + * give the complete and correct output.
1690 + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1691 + * with NULL data. The user can still send NULL data to the public encode
1692 + * or decode function, but libavcodec will not pass it along to the codec
1693 + * unless this flag is set.
1696 + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1697 + * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1701 + * The encoder needs to be fed with NULL data at the end of encoding until the
1702 + * encoder no longer returns data.
1704 + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1705 + * flag also means that the encoder must set the pts and duration for
1706 + * each output packet. If this flag is not set, the pts and duration will
1707 + * be determined by libavcodec from the input frame.
1709 +#define AV_CODEC_CAP_DELAY (1 << 5)
1711 + * Codec can be fed a final frame with a smaller size.
1712 + * This can be used to prevent truncation of the last audio samples.
1714 +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
1717 + * Codec can output multiple frames per AVPacket
1718 + * Normally demuxers return one frame at a time, demuxers which do not do
1719 + * are connected to a parser to split what they return into proper frames.
1720 + * This flag is reserved to the very rare category of codecs which have a
1721 + * bitstream that cannot be split into frames without timeconsuming
1722 + * operations like full decoding. Demuxers carrying such bitstreams thus
1723 + * may return multiple frames in a packet. This has many disadvantages like
1724 + * prohibiting stream copy in many cases thus it should only be considered
1725 + * as a last resort.
1727 +#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
1729 + * Codec is experimental and is thus avoided in favor of non experimental
1732 +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
1734 + * Codec should fill in channel configuration and samplerate instead of container
1736 +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
1738 + * Codec supports frame-level multithreading.
1740 +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
1742 + * Codec supports slice-based (or partition-based) multithreading.
1744 +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
1746 + * Codec supports changed parameters at any point.
1748 +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
1750 + * Codec supports avctx->thread_count == 0 (auto).
1752 +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15)
1754 + * Audio encoder supports receiving a different number of samples in each call.
1756 +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
1758 + * Decoder is not a preferred choice for probing.
1759 + * This indicates that the decoder is not a good choice for probing.
1760 + * It could for example be an expensive to spin up hardware decoder,
1761 + * or it could simply not provide a lot of useful information about
1763 + * A decoder marked with this flag should only be used as last resort
1764 + * choice for probing.
1766 +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
1768 + * Codec is intra only.
1770 +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000
1772 + * Codec is lossless.
1774 +#define AV_CODEC_CAP_LOSSLESS 0x80000000
1777 + * Codec is backed by a hardware implementation. Typically used to
1778 + * identify a non-hwaccel hardware decoder. For information about hwaccels, use
1779 + * avcodec_get_hw_config() instead.
1781 +#define AV_CODEC_CAP_HARDWARE (1 << 18)
1784 + * Codec is potentially backed by a hardware implementation, but not
1785 + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
1786 + * implementation provides some sort of internal fallback.
1788 +#define AV_CODEC_CAP_HYBRID (1 << 19)
1792 + * This specifies the area which should be displayed.
1793 + * Note there may be multiple such areas for one frame.
1795 +typedef struct AVPanScan {
1798 + * - encoding: Set by user.
1799 + * - decoding: Set by libavcodec.
1804 + * width and height in 1/16 pel
1805 + * - encoding: Set by user.
1806 + * - decoding: Set by libavcodec.
1812 + * position of the top left corner in 1/16 pel for up to 3 fields/frames
1813 + * - encoding: Set by user.
1814 + * - decoding: Set by libavcodec.
1816 + int16_t position[3][2];
1820 + * This structure describes the bitrate properties of an encoded bitstream. It
1821 + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1822 + * parameters for H.264/HEVC.
1824 +typedef struct AVCPBProperties {
1826 + * Maximum bitrate of the stream, in bits per second.
1827 + * Zero if unknown or unspecified.
1831 + * Minimum bitrate of the stream, in bits per second.
1832 + * Zero if unknown or unspecified.
1836 + * Average bitrate of the stream, in bits per second.
1837 + * Zero if unknown or unspecified.
1842 + * The size of the buffer to which the ratecontrol is applied, in bits.
1843 + * Zero if unknown or unspecified.
1848 + * The delay between the time the packet this structure is associated with
1849 + * is received and the time when it should be decoded, in periods of a 27MHz
1852 + * UINT64_MAX when unknown or unspecified.
1854 + uint64_t vbv_delay;
1858 + * The decoder will keep a reference to the frame and may reuse it later.
1860 +#define AV_GET_BUFFER_FLAG_REF (1 << 0)
1863 + * @defgroup lavc_packet AVPacket
1865 + * Types and functions for working with AVPacket.
1868 +enum AVPacketSideDataType {
1870 + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1871 + * bytes worth of palette. This side data signals that a new palette is
1874 + AV_PKT_DATA_PALETTE,
1877 + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1878 + * that the extradata buffer was changed and the receiving side should
1879 + * act upon it appropriately. The new extradata is embedded in the side
1880 + * data buffer and should be immediately used for processing the current
1881 + * frame or packet.
1883 + AV_PKT_DATA_NEW_EXTRADATA,
1886 + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1888 + * u32le param_flags
1889 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1890 + * s32le channel_count
1891 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1892 + * u64le channel_layout
1893 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1894 + * s32le sample_rate
1895 + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1900 + AV_PKT_DATA_PARAM_CHANGE,
1903 + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1904 + * structures with info about macroblocks relevant to splitting the
1905 + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1906 + * That is, it does not necessarily contain info about all macroblocks,
1907 + * as long as the distance between macroblocks in the info is smaller
1908 + * than the target payload size.
1909 + * Each MB info structure is 12 bytes, and is laid out as follows:
1911 + * u32le bit offset from the start of the packet
1912 + * u8 current quantizer at the start of the macroblock
1914 + * u16le macroblock address within the GOB
1915 + * u8 horizontal MV predictor
1916 + * u8 vertical MV predictor
1917 + * u8 horizontal MV predictor for block number 3
1918 + * u8 vertical MV predictor for block number 3
1921 + AV_PKT_DATA_H263_MB_INFO,
1924 + * This side data should be associated with an audio stream and contains
1925 + * ReplayGain information in form of the AVReplayGain struct.
1927 + AV_PKT_DATA_REPLAYGAIN,
1930 + * This side data contains a 3x3 transformation matrix describing an affine
1931 + * transformation that needs to be applied to the decoded video frames for
1932 + * correct presentation.
1934 + * See libavutil/display.h for a detailed description of the data.
1936 + AV_PKT_DATA_DISPLAYMATRIX,
1939 + * This side data should be associated with a video stream and contains
1940 + * Stereoscopic 3D information in form of the AVStereo3D struct.
1942 + AV_PKT_DATA_STEREO3D,
1945 + * This side data should be associated with an audio stream and corresponds
1946 + * to enum AVAudioServiceType.
1948 + AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1951 + * This side data contains quality related information from the encoder.
1953 + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1957 + * u64le[error count] sum of squared differences between encoder in and output
1960 + AV_PKT_DATA_QUALITY_STATS,
1963 + * This side data contains an integer value representing the stream index
1964 + * of a "fallback" track. A fallback track indicates an alternate
1965 + * track to use when the current track can not be decoded for some reason.
1966 + * e.g. no decoder available for codec.
1968 + AV_PKT_DATA_FALLBACK_TRACK,
1971 + * This side data corresponds to the AVCPBProperties struct.
1973 + AV_PKT_DATA_CPB_PROPERTIES,
1976 + * Recommmends skipping the specified number of samples
1978 + * u32le number of samples to skip from start of this packet
1979 + * u32le number of samples to skip from end of this packet
1980 + * u8 reason for start skip
1981 + * u8 reason for end skip (0=padding silence, 1=convergence)
1984 + AV_PKT_DATA_SKIP_SAMPLES,
1987 + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1988 + * the packet may contain "dual mono" audio specific to Japanese DTV
1989 + * and if it is true, recommends only the selected channel to be used.
1991 + * u8 selected channels (0=mail/left, 1=sub/right, 2=both)
1994 + AV_PKT_DATA_JP_DUALMONO,
1997 + * A list of zero terminated key/value strings. There is no end marker for
1998 + * the list, so it is required to rely on the side data size to stop.
2000 + AV_PKT_DATA_STRINGS_METADATA,
2003 + * Subtitle event position
2011 + AV_PKT_DATA_SUBTITLE_POSITION,
2014 + * Data found in BlockAdditional element of matroska container. There is
2015 + * no end marker for the data, so it is required to rely on the side data
2016 + * size to recognize the end. 8 byte id (as found in BlockAddId) followed
2019 + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
2022 + * The optional first identifier line of a WebVTT cue.
2024 + AV_PKT_DATA_WEBVTT_IDENTIFIER,
2027 + * The optional settings (rendering instructions) that immediately
2028 + * follow the timestamp specifier of a WebVTT cue.
2030 + AV_PKT_DATA_WEBVTT_SETTINGS,
2033 + * A list of zero terminated key/value strings. There is no end marker for
2034 + * the list, so it is required to rely on the side data size to stop. This
2035 + * side data includes updated metadata which appeared in the stream.
2037 + AV_PKT_DATA_METADATA_UPDATE,
2040 + * MPEGTS stream ID, this is required to pass the stream ID
2041 + * information from the demuxer to the corresponding muxer.
2043 + AV_PKT_DATA_MPEGTS_STREAM_ID,
2046 + * Mastering display metadata (based on SMPTE-2086:2014). This metadata
2047 + * should be associated with a video stream and contains data in the form
2048 + * of the AVMasteringDisplayMetadata struct.
2050 + AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
2053 + * This side data should be associated with a video stream and corresponds
2054 + * to the AVSphericalMapping structure.
2056 + AV_PKT_DATA_SPHERICAL,
2059 + * Content light level (based on CTA-861.3). This metadata should be
2060 + * associated with a video stream and contains data in the form of the
2061 + * AVContentLightMetadata struct.
2063 + AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2066 + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
2067 + * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
2068 + * The number of bytes of CC data is AVPacketSideData.size.
2070 + AV_PKT_DATA_A53_CC,
2073 + * This side data is encryption initialization data.
2074 + * The format is not part of ABI, use av_encryption_init_info_* methods to
2077 + AV_PKT_DATA_ENCRYPTION_INIT_INFO,
2080 + * This side data contains encryption info for how to decrypt the packet.
2081 + * The format is not part of ABI, use av_encryption_info_* methods to access.
2083 + AV_PKT_DATA_ENCRYPTION_INFO,
2086 + * The number of side data types.
2087 + * This is not part of the public API/ABI in the sense that it may
2088 + * change when new side data types are added.
2089 + * This must stay the last enum value.
2090 + * If its value becomes huge, some code using it
2091 + * needs to be updated as it assumes it to be smaller than other limits.
2096 +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
2098 +typedef struct AVPacketSideData {
2101 + enum AVPacketSideDataType type;
2102 +} AVPacketSideData;
2105 + * This structure stores compressed data. It is typically exported by demuxers
2106 + * and then passed as input to decoders, or received as output from encoders and
2107 + * then passed to muxers.
2109 + * For video, it should typically contain one compressed frame. For audio it may
2110 + * contain several compressed frames. Encoders are allowed to output empty
2111 + * packets, with no compressed data, containing only side data
2112 + * (e.g. to update some stream parameters at the end of encoding).
2114 + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
2115 + * ABI. Thus it may be allocated on stack and no new fields can be added to it
2116 + * without libavcodec and libavformat major bump.
2118 + * The semantics of data ownership depends on the buf field.
2119 + * If it is set, the packet data is dynamically allocated and is
2120 + * valid indefinitely until a call to av_packet_unref() reduces the
2121 + * reference count to 0.
2123 + * If the buf field is not set av_packet_ref() would make a copy instead
2124 + * of increasing the reference count.
2126 + * The side data is always allocated with av_malloc(), copied by
2127 + * av_packet_ref() and freed by av_packet_unref().
2129 + * @see av_packet_ref
2130 + * @see av_packet_unref
2132 +typedef struct AVPacket {
2134 + * A reference to the reference-counted buffer where the packet data is
2136 + * May be NULL, then the packet data is not reference-counted.
2140 + * Presentation timestamp in AVStream->time_base units; the time at which
2141 + * the decompressed packet will be presented to the user.
2142 + * Can be AV_NOPTS_VALUE if it is not stored in the file.
2143 + * pts MUST be larger or equal to dts as presentation cannot happen before
2144 + * decompression, unless one wants to view hex dumps. Some formats misuse
2145 + * the terms dts and pts/cts to mean something different. Such timestamps
2146 + * must be converted to true pts/dts before they are stored in AVPacket.
2150 + * Decompression timestamp in AVStream->time_base units; the time at which
2151 + * the packet is decompressed.
2152 + * Can be AV_NOPTS_VALUE if it is not stored in the file.
2159 + * A combination of AV_PKT_FLAG values
2163 + * Additional packet data that can be provided by the container.
2164 + * Packet can contain several types of side information.
2166 + AVPacketSideData *side_data;
2167 + int side_data_elems;
2170 + * Duration of this packet in AVStream->time_base units, 0 if unknown.
2171 + * Equals next_pts - this_pts in presentation order.
2175 + int64_t pos; ///< byte position in stream, -1 if unknown
2177 +#if FF_API_CONVERGENCE_DURATION
2179 + * @deprecated Same as the duration field, but as int64_t. This was required
2180 + * for Matroska subtitles, whose duration values could overflow when the
2181 + * duration field was still an int.
2183 + attribute_deprecated
2184 + int64_t convergence_duration;
2187 +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
2188 +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
2190 + * Flag is used to discard packets which are required to maintain valid
2191 + * decoder state but are not required for output and should be dropped
2194 +#define AV_PKT_FLAG_DISCARD 0x0004
2196 + * The packet comes from a trusted source.
2198 + * Otherwise-unsafe constructs such as arbitrary pointers to data
2199 + * outside the packet may be followed.
2201 +#define AV_PKT_FLAG_TRUSTED 0x0008
2203 + * Flag is used to indicate packets that contain frames that can
2204 + * be discarded by the decoder. I.e. Non-reference frames.
2206 +#define AV_PKT_FLAG_DISPOSABLE 0x0010
2209 +enum AVSideDataParamChangeFlags {
2210 + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
2211 + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2212 + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
2213 + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
2219 +struct AVCodecInternal;
2221 +enum AVFieldOrder {
2223 + AV_FIELD_PROGRESSIVE,
2224 + AV_FIELD_TT, //< Top coded_first, top displayed first
2225 + AV_FIELD_BB, //< Bottom coded first, bottom displayed first
2226 + AV_FIELD_TB, //< Top coded first, bottom displayed first
2227 + AV_FIELD_BT, //< Bottom coded first, top displayed first
2231 + * main external API structure.
2232 + * New fields can be added to the end with minor version bumps.
2233 + * Removal, reordering and changes to existing fields require a major
2235 + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
2237 + * The name string for AVOptions options matches the associated command line
2238 + * parameter name and can be found in libavcodec/options_table.h
2239 + * The AVOption/command line parameter names differ in some cases from the C
2240 + * structure field names for historic reasons or brevity.
2241 + * sizeof(AVCodecContext) must not be used outside libav*.
2243 +typedef struct AVCodecContext {
2245 + * information on struct for av_log
2246 + * - set by avcodec_alloc_context3
2248 + const AVClass *av_class;
2249 + int log_level_offset;
2251 + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
2252 + const struct AVCodec *codec;
2253 + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
2256 + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2257 + * This is used to work around some encoder bugs.
2258 + * A demuxer should set this to what is stored in the field used to identify the codec.
2259 + * If there are multiple such fields in a container then the demuxer should choose the one
2260 + * which maximizes the information about the used codec.
2261 + * If the codec tag field in a container is larger than 32 bits then the demuxer should
2262 + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
2263 + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
2265 + * - encoding: Set by user, if not then the default based on codec_id will be used.
2266 + * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2268 + unsigned int codec_tag;
2273 + * Private context used for internal data.
2275 + * Unlike priv_data, this is not codec-specific. It is used in general
2276 + * libavcodec functions.
2278 + struct AVCodecInternal *internal;
2281 + * Private data of the user, can be used to carry app specific stuff.
2282 + * - encoding: Set by user.
2283 + * - decoding: Set by user.
2288 + * the average bitrate
2289 + * - encoding: Set by user; unused for constant quantizer encoding.
2290 + * - decoding: Set by user, may be overwritten by libavcodec
2291 + * if this info is available in the stream
2296 + * number of bits the bitstream is allowed to diverge from the reference.
2297 + * the reference can be CBR (for CBR pass1) or VBR (for pass2)
2298 + * - encoding: Set by user; unused for constant quantizer encoding.
2299 + * - decoding: unused
2301 + int bit_rate_tolerance;
2304 + * Global quality for codecs which cannot change it per frame.
2305 + * This should be proportional to MPEG-1/2/4 qscale.
2306 + * - encoding: Set by user.
2307 + * - decoding: unused
2309 + int global_quality;
2312 + * - encoding: Set by user.
2313 + * - decoding: unused
2315 + int compression_level;
2316 +#define FF_COMPRESSION_DEFAULT -1
2319 + * AV_CODEC_FLAG_*.
2320 + * - encoding: Set by user.
2321 + * - decoding: Set by user.
2326 + * AV_CODEC_FLAG2_*
2327 + * - encoding: Set by user.
2328 + * - decoding: Set by user.
2333 + * some codecs need / can use extradata like Huffman tables.
2334 + * MJPEG: Huffman tables
2335 + * rv10: additional flags
2336 + * MPEG-4: global headers (they can be in the bitstream or here)
2337 + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
2338 + * than extradata_size to avoid problems if it is read with the bitstream reader.
2339 + * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
2340 + * - encoding: Set/allocated/freed by libavcodec.
2341 + * - decoding: Set/allocated/freed by user.
2343 + uint8_t *extradata;
2344 + int extradata_size;
2347 + * This is the fundamental unit of time (in seconds) in terms
2348 + * of which frame timestamps are represented. For fixed-fps content,
2349 + * timebase should be 1/framerate and timestamp increments should be
2351 + * This often, but not always is the inverse of the frame rate or field rate
2352 + * for video. 1/time_base is not the average frame rate if the frame rate is not
2355 + * Like containers, elementary streams also can store timestamps, 1/time_base
2356 + * is the unit in which these timestamps are specified.
2357 + * As example of such codec time base see ISO/IEC 14496-2:2001(E)
2358 + * vop_time_increment_resolution and fixed_vop_rate
2359 + * (fixed_vop_rate == 0 implies that it is different from the framerate)
2361 + * - encoding: MUST be set by user.
2362 + * - decoding: the use of this field for decoding is deprecated.
2363 + * Use framerate instead.
2365 + AVRational time_base;
2368 + * For some codecs, the time base is closer to the field rate than the frame rate.
2369 + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2370 + * if no telecine is used ...
2372 + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2374 + int ticks_per_frame;
2379 + * Encoding: Number of frames delay there will be from the encoder input to
2380 + * the decoder output. (we assume the decoder matches the spec)
2381 + * Decoding: Number of frames delay in addition to what a standard decoder
2382 + * as specified in the spec would produce.
2385 + * Number of frames the decoded output will be delayed relative to the
2389 + * For encoding, this field is unused (see initial_padding).
2391 + * For decoding, this is the number of samples the decoder needs to
2392 + * output before the decoder's output is valid. When seeking, you should
2393 + * start decoding this many samples prior to your desired seek point.
2395 + * - encoding: Set by libavcodec.
2396 + * - decoding: Set by libavcodec.
2403 + * picture width / height.
2405 + * @note Those fields may not match the values of the last
2406 + * AVFrame output by avcodec_decode_video2 due frame
2409 + * - encoding: MUST be set by user.
2410 + * - decoding: May be set by the user before opening the decoder if known e.g.
2411 + * from the container. Some decoders will require the dimensions
2412 + * to be set by the caller. During decoding, the decoder may
2413 + * overwrite those values as required while parsing the data.
2415 + int width, height;
2418 + * Bitstream width / height, may be different from width/height e.g. when
2419 + * the decoded frame is cropped before being output or lowres is enabled.
2421 + * @note Those field may not match the value of the last
2422 + * AVFrame output by avcodec_receive_frame() due frame
2425 + * - encoding: unused
2426 + * - decoding: May be set by the user before opening the decoder if known
2427 + * e.g. from the container. During decoding, the decoder may
2428 + * overwrite those values as required while parsing the data.
2430 + int coded_width, coded_height;
2433 + * the number of pictures in a group of pictures, or 0 for intra_only
2434 + * - encoding: Set by user.
2435 + * - decoding: unused
2440 + * Pixel format, see AV_PIX_FMT_xxx.
2441 + * May be set by the demuxer if known from headers.
2442 + * May be overridden by the decoder if it knows better.
2444 + * @note This field may not match the value of the last
2445 + * AVFrame output by avcodec_receive_frame() due frame
2448 + * - encoding: Set by user.
2449 + * - decoding: Set by user if known, overridden by libavcodec while
2450 + * parsing the data.
2452 + enum AVPixelFormat pix_fmt;
2455 + * If non NULL, 'draw_horiz_band' is called by the libavcodec
2456 + * decoder to draw a horizontal band. It improves cache usage. Not
2457 + * all codecs can do that. You must check the codec capabilities
2459 + * When multithreading is used, it may be called from multiple threads
2460 + * at the same time; threads might draw different parts of the same AVFrame,
2461 + * or multiple AVFrames, and there is no guarantee that slices will be drawn
2463 + * The function is also used by hardware acceleration APIs.
2464 + * It is called at least once during frame decoding to pass
2465 + * the data needed for hardware render.
2466 + * In that mode instead of pixel data, AVFrame points to
2467 + * a structure specific to the acceleration API. The application
2468 + * reads the structure and can change some fields to indicate progress
2470 + * - encoding: unused
2471 + * - decoding: Set by user.
2472 + * @param height the height of the slice
2473 + * @param y the y position of the slice
2474 + * @param type 1->top field, 2->bottom field, 3->frame
2475 + * @param offset offset into the AVFrame.data from which the slice should be read
2477 + void (*draw_horiz_band)(struct AVCodecContext *s,
2478 + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2479 + int y, int type, int height);
2482 + * callback to negotiate the pixelFormat
2483 + * @param fmt is the list of formats which are supported by the codec,
2484 + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2485 + * The first is always the native one.
2486 + * @note The callback may be called again immediately if initialization for
2487 + * the selected (hardware-accelerated) pixel format failed.
2488 + * @warning Behavior is undefined if the callback returns a value not
2489 + * in the fmt list of formats.
2490 + * @return the chosen format
2491 + * - encoding: unused
2492 + * - decoding: Set by user, if not set the native format will be chosen.
2494 + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2497 + * maximum number of B-frames between non-B-frames
2498 + * Note: The output will be delayed by max_b_frames+1 relative to the input.
2499 + * - encoding: Set by user.
2500 + * - decoding: unused
2505 + * qscale factor between IP and B-frames
2506 + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
2507 + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2508 + * - encoding: Set by user.
2509 + * - decoding: unused
2511 + float b_quant_factor;
2513 +#if FF_API_PRIVATE_OPT
2514 + /** @deprecated use encoder private options instead */
2515 + attribute_deprecated
2516 + int b_frame_strategy;
2520 + * qscale offset between IP and B-frames
2521 + * - encoding: Set by user.
2522 + * - decoding: unused
2524 + float b_quant_offset;
2527 + * Size of the frame reordering buffer in the decoder.
2528 + * For MPEG-2 it is 1 IPB or 0 low delay IP.
2529 + * - encoding: Set by libavcodec.
2530 + * - decoding: Set by libavcodec.
2534 +#if FF_API_PRIVATE_OPT
2535 + /** @deprecated use encoder private options instead */
2536 + attribute_deprecated
2541 + * qscale factor between P- and I-frames
2542 + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
2543 + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2544 + * - encoding: Set by user.
2545 + * - decoding: unused
2547 + float i_quant_factor;
2550 + * qscale offset between P and I-frames
2551 + * - encoding: Set by user.
2552 + * - decoding: unused
2554 + float i_quant_offset;
2557 + * luminance masking (0-> disabled)
2558 + * - encoding: Set by user.
2559 + * - decoding: unused
2561 + float lumi_masking;
2564 + * temporary complexity masking (0-> disabled)
2565 + * - encoding: Set by user.
2566 + * - decoding: unused
2568 + float temporal_cplx_masking;
2571 + * spatial complexity masking (0-> disabled)
2572 + * - encoding: Set by user.
2573 + * - decoding: unused
2575 + float spatial_cplx_masking;
2578 + * p block masking (0-> disabled)
2579 + * - encoding: Set by user.
2580 + * - decoding: unused
2585 + * darkness masking (0-> disabled)
2586 + * - encoding: Set by user.
2587 + * - decoding: unused
2589 + float dark_masking;
2593 + * - encoding: Set by libavcodec.
2594 + * - decoding: Set by user (or 0).
2598 +#if FF_API_PRIVATE_OPT
2599 + /** @deprecated use encoder private options instead */
2600 + attribute_deprecated
2601 + int prediction_method;
2602 +#define FF_PRED_LEFT 0
2603 +#define FF_PRED_PLANE 1
2604 +#define FF_PRED_MEDIAN 2
2608 + * slice offsets in the frame in bytes
2609 + * - encoding: Set/allocated by libavcodec.
2610 + * - decoding: Set/allocated by user (or NULL).
2612 + int *slice_offset;
2615 + * sample aspect ratio (0 if unknown)
2616 + * That is the width of a pixel divided by the height of the pixel.
2617 + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
2618 + * - encoding: Set by user.
2619 + * - decoding: Set by libavcodec.
2621 + AVRational sample_aspect_ratio;
2624 + * motion estimation comparison function
2625 + * - encoding: Set by user.
2626 + * - decoding: unused
2630 + * subpixel motion estimation comparison function
2631 + * - encoding: Set by user.
2632 + * - decoding: unused
2636 + * macroblock comparison function (not supported yet)
2637 + * - encoding: Set by user.
2638 + * - decoding: unused
2642 + * interlaced DCT comparison function
2643 + * - encoding: Set by user.
2644 + * - decoding: unused
2647 +#define FF_CMP_SAD 0
2648 +#define FF_CMP_SSE 1
2649 +#define FF_CMP_SATD 2
2650 +#define FF_CMP_DCT 3
2651 +#define FF_CMP_PSNR 4
2652 +#define FF_CMP_BIT 5
2653 +#define FF_CMP_RD 6
2654 +#define FF_CMP_ZERO 7
2655 +#define FF_CMP_VSAD 8
2656 +#define FF_CMP_VSSE 9
2657 +#define FF_CMP_NSSE 10
2658 +#define FF_CMP_W53 11
2659 +#define FF_CMP_W97 12
2660 +#define FF_CMP_DCTMAX 13
2661 +#define FF_CMP_DCT264 14
2662 +#define FF_CMP_MEDIAN_SAD 15
2663 +#define FF_CMP_CHROMA 256
2666 + * ME diamond size & shape
2667 + * - encoding: Set by user.
2668 + * - decoding: unused
2673 + * amount of previous MV predictors (2a+1 x 2a+1 square)
2674 + * - encoding: Set by user.
2675 + * - decoding: unused
2677 + int last_predictor_count;
2679 +#if FF_API_PRIVATE_OPT
2680 + /** @deprecated use encoder private options instead */
2681 + attribute_deprecated
2686 + * motion estimation prepass comparison function
2687 + * - encoding: Set by user.
2688 + * - decoding: unused
2693 + * ME prepass diamond size & shape
2694 + * - encoding: Set by user.
2695 + * - decoding: unused
2700 + * subpel ME quality
2701 + * - encoding: Set by user.
2702 + * - decoding: unused
2704 + int me_subpel_quality;
2707 + * maximum motion estimation search range in subpel units
2708 + * If 0 then no limit.
2710 + * - encoding: Set by user.
2711 + * - decoding: unused
2717 + * - encoding: unused
2718 + * - decoding: Set by user.
2721 +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
2722 +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
2723 +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2726 + * macroblock decision mode
2727 + * - encoding: Set by user.
2728 + * - decoding: unused
2731 +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
2732 +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
2733 +#define FF_MB_DECISION_RD 2 ///< rate distortion
2736 + * custom intra quantization matrix
2737 + * - encoding: Set by user, can be NULL.
2738 + * - decoding: Set by libavcodec.
2740 + uint16_t *intra_matrix;
2743 + * custom inter quantization matrix
2744 + * - encoding: Set by user, can be NULL.
2745 + * - decoding: Set by libavcodec.
2747 + uint16_t *inter_matrix;
2749 +#if FF_API_PRIVATE_OPT
2750 + /** @deprecated use encoder private options instead */
2751 + attribute_deprecated
2752 + int scenechange_threshold;
2754 + /** @deprecated use encoder private options instead */
2755 + attribute_deprecated
2756 + int noise_reduction;
2760 + * precision of the intra DC coefficient - 8
2761 + * - encoding: Set by user.
2762 + * - decoding: Set by libavcodec
2764 + int intra_dc_precision;
2767 + * Number of macroblock rows at the top which are skipped.
2768 + * - encoding: unused
2769 + * - decoding: Set by user.
2774 + * Number of macroblock rows at the bottom which are skipped.
2775 + * - encoding: unused
2776 + * - decoding: Set by user.
2781 + * minimum MB Lagrange multiplier
2782 + * - encoding: Set by user.
2783 + * - decoding: unused
2788 + * maximum MB Lagrange multiplier
2789 + * - encoding: Set by user.
2790 + * - decoding: unused
2794 +#if FF_API_PRIVATE_OPT
2796 + * @deprecated use encoder private options instead
2798 + attribute_deprecated
2799 + int me_penalty_compensation;
2803 + * - encoding: Set by user.
2804 + * - decoding: unused
2808 +#if FF_API_PRIVATE_OPT
2809 + /** @deprecated use encoder private options instead */
2810 + attribute_deprecated
2815 + * minimum GOP size
2816 + * - encoding: Set by user.
2817 + * - decoding: unused
2822 + * number of reference frames
2823 + * - encoding: Set by user.
2824 + * - decoding: Set by lavc.
2828 +#if FF_API_PRIVATE_OPT
2829 + /** @deprecated use encoder private options instead */
2830 + attribute_deprecated
2835 + * Note: Value depends upon the compare function used for fullpel ME.
2836 + * - encoding: Set by user.
2837 + * - decoding: unused
2839 + int mv0_threshold;
2841 +#if FF_API_PRIVATE_OPT
2842 + /** @deprecated use encoder private options instead */
2843 + attribute_deprecated
2844 + int b_sensitivity;
2848 + * Chromaticity coordinates of the source primaries.
2849 + * - encoding: Set by user
2850 + * - decoding: Set by libavcodec
2852 + enum AVColorPrimaries color_primaries;
2855 + * Color Transfer Characteristic.
2856 + * - encoding: Set by user
2857 + * - decoding: Set by libavcodec
2859 + enum AVColorTransferCharacteristic color_trc;
2862 + * YUV colorspace type.
2863 + * - encoding: Set by user
2864 + * - decoding: Set by libavcodec
2866 + enum AVColorSpace colorspace;
2869 + * MPEG vs JPEG YUV range.
2870 + * - encoding: Set by user
2871 + * - decoding: Set by libavcodec
2873 + enum AVColorRange color_range;
2876 + * This defines the location of chroma samples.
2877 + * - encoding: Set by user
2878 + * - decoding: Set by libavcodec
2880 + enum AVChromaLocation chroma_sample_location;
2883 + * Number of slices.
2884 + * Indicates number of picture subdivisions. Used for parallelized
2886 + * - encoding: Set by user
2887 + * - decoding: unused
2892 + * - encoding: set by libavcodec
2893 + * - decoding: Set by user.
2895 + enum AVFieldOrder field_order;
2898 + int sample_rate; ///< samples per second
2899 + int channels; ///< number of audio channels
2902 + * audio sample format
2903 + * - encoding: Set by user.
2904 + * - decoding: Set by libavcodec.
2906 + enum AVSampleFormat sample_fmt; ///< sample format
2908 + /* The following data should not be initialized. */
2910 + * Number of samples per channel in an audio frame.
2912 + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2913 + * except the last must contain exactly frame_size samples per channel.
2914 + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2915 + * frame size is not restricted.
2916 + * - decoding: may be set by some decoders to indicate constant frame size
2921 + * Frame counter, set by libavcodec.
2923 + * - decoding: total number of frames returned from the decoder so far.
2924 + * - encoding: total number of frames passed to the encoder so far.
2926 + * @note the counter is not incremented if encoding/decoding resulted in
2932 + * number of bytes per packet if constant and known or 0
2933 + * Used by some WAV based audio codecs.
2938 + * Audio cutoff bandwidth (0 means "automatic")
2939 + * - encoding: Set by user.
2940 + * - decoding: unused
2945 + * Audio channel layout.
2946 + * - encoding: set by user.
2947 + * - decoding: set by user, may be overwritten by libavcodec.
2949 + uint64_t channel_layout;
2952 + * Request decoder to use this channel layout if it can (0 for default)
2953 + * - encoding: unused
2954 + * - decoding: Set by user.
2956 + uint64_t request_channel_layout;
2959 + * Type of service that the audio stream conveys.
2960 + * - encoding: Set by user.
2961 + * - decoding: Set by libavcodec.
2963 + enum AVAudioServiceType audio_service_type;
2966 + * desired sample format
2967 + * - encoding: Not used.
2968 + * - decoding: Set by user.
2969 + * Decoder will decode to this format if it can.
2971 + enum AVSampleFormat request_sample_fmt;
2974 + * This callback is called at the beginning of each frame to get data
2975 + * buffer(s) for it. There may be one contiguous buffer for all the data or
2976 + * there may be a buffer per each data plane or anything in between. What
2977 + * this means is, you may set however many entries in buf[] you feel necessary.
2978 + * Each buffer must be reference-counted using the AVBuffer API (see description
2979 + * of buf[] below).
2981 + * The following fields will be set in the frame before this callback is
2984 + * - width, height (video only)
2985 + * - sample_rate, channel_layout, nb_samples (audio only)
2986 + * Their values may differ from the corresponding values in
2987 + * AVCodecContext. This callback must use the frame values, not the codec
2988 + * context values, to calculate the required buffer size.
2990 + * This callback must fill the following fields in the frame:
2993 + * - extended_data:
2994 + * * if the data is planar audio with more than 8 channels, then this
2995 + * callback must allocate and fill extended_data to contain all pointers
2996 + * to all data planes. data[] must hold as many pointers as it can.
2997 + * extended_data must be allocated with av_malloc() and will be freed in
2998 + * av_frame_unref().
2999 + * * otherwise extended_data must point to data
3000 + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
3001 + * the frame's data and extended_data pointers must be contained in these. That
3002 + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one
3003 + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
3004 + * and av_buffer_ref().
3005 + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
3006 + * this callback and filled with the extra buffers if there are more
3007 + * buffers than buf[] can hold. extended_buf will be freed in
3008 + * av_frame_unref().
3010 + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
3011 + * avcodec_default_get_buffer2() instead of providing buffers allocated by
3012 + * some other means.
3014 + * Each data plane must be aligned to the maximum required by the target
3017 + * @see avcodec_default_get_buffer2()
3021 + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
3022 + * (read and/or written to if it is writable) later by libavcodec.
3024 + * avcodec_align_dimensions2() should be used to find the required width and
3025 + * height, as they normally need to be rounded up to the next multiple of 16.
3027 + * Some decoders do not support linesizes changing between frames.
3029 + * If frame multithreading is used and thread_safe_callbacks is set,
3030 + * this callback may be called from a different thread, but not from more
3031 + * than one at once. Does not need to be reentrant.
3033 + * @see avcodec_align_dimensions2()
3037 + * Decoders request a buffer of a particular size by setting
3038 + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
3039 + * however, utilize only part of the buffer by setting AVFrame.nb_samples
3040 + * to a smaller value in the output frame.
3042 + * As a convenience, av_samples_get_buffer_size() and
3043 + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
3044 + * functions to find the required data size and to fill data pointers and
3045 + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
3046 + * since all planes must be the same size.
3048 + * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
3050 + * - encoding: unused
3051 + * - decoding: Set by libavcodec, user can override.
3053 + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
3056 + * If non-zero, the decoded audio and video frames returned from
3057 + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
3058 + * and are valid indefinitely. The caller must free them with
3059 + * av_frame_unref() when they are not needed anymore.
3060 + * Otherwise, the decoded frames must not be freed by the caller and are
3061 + * only valid until the next decode call.
3063 + * This is always automatically enabled if avcodec_receive_frame() is used.
3065 + * - encoding: unused
3066 + * - decoding: set by the caller before avcodec_open2().
3068 + attribute_deprecated
3069 + int refcounted_frames;
3071 + /* - encoding parameters */
3072 + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
3073 + float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
3076 + * minimum quantizer
3077 + * - encoding: Set by user.
3078 + * - decoding: unused
3083 + * maximum quantizer
3084 + * - encoding: Set by user.
3085 + * - decoding: unused
3090 + * maximum quantizer difference between frames
3091 + * - encoding: Set by user.
3092 + * - decoding: unused
3097 + * decoder bitstream buffer size
3098 + * - encoding: Set by user.
3099 + * - decoding: unused
3101 + int rc_buffer_size;
3104 + * ratecontrol override, see RcOverride
3105 + * - encoding: Allocated/set/freed by user.
3106 + * - decoding: unused
3108 + int rc_override_count;
3109 + RcOverride *rc_override;
3113 + * - encoding: Set by user.
3114 + * - decoding: Set by user, may be overwritten by libavcodec.
3116 + int64_t rc_max_rate;
3120 + * - encoding: Set by user.
3121 + * - decoding: unused
3123 + int64_t rc_min_rate;
3126 + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
3127 + * - encoding: Set by user.
3128 + * - decoding: unused.
3130 + float rc_max_available_vbv_use;
3133 + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
3134 + * - encoding: Set by user.
3135 + * - decoding: unused.
3137 + float rc_min_vbv_overflow_use;
3140 + * Number of bits which should be loaded into the rc buffer before decoding starts.
3141 + * - encoding: Set by user.
3142 + * - decoding: unused
3144 + int rc_initial_buffer_occupancy;
3146 +#if FF_API_CODER_TYPE
3147 +#define FF_CODER_TYPE_VLC 0
3148 +#define FF_CODER_TYPE_AC 1
3149 +#define FF_CODER_TYPE_RAW 2
3150 +#define FF_CODER_TYPE_RLE 3
3152 + * @deprecated use encoder private options instead
3154 + attribute_deprecated
3156 +#endif /* FF_API_CODER_TYPE */
3158 +#if FF_API_PRIVATE_OPT
3159 + /** @deprecated use encoder private options instead */
3160 + attribute_deprecated
3161 + int context_model;
3164 +#if FF_API_PRIVATE_OPT
3165 + /** @deprecated use encoder private options instead */
3166 + attribute_deprecated
3167 + int frame_skip_threshold;
3169 + /** @deprecated use encoder private options instead */
3170 + attribute_deprecated
3171 + int frame_skip_factor;
3173 + /** @deprecated use encoder private options instead */
3174 + attribute_deprecated
3175 + int frame_skip_exp;
3177 + /** @deprecated use encoder private options instead */
3178 + attribute_deprecated
3179 + int frame_skip_cmp;
3180 +#endif /* FF_API_PRIVATE_OPT */
3183 + * trellis RD quantization
3184 + * - encoding: Set by user.
3185 + * - decoding: unused
3189 +#if FF_API_PRIVATE_OPT
3190 + /** @deprecated use encoder private options instead */
3191 + attribute_deprecated
3192 + int min_prediction_order;
3194 + /** @deprecated use encoder private options instead */
3195 + attribute_deprecated
3196 + int max_prediction_order;
3198 + /** @deprecated use encoder private options instead */
3199 + attribute_deprecated
3200 + int64_t timecode_frame_start;
3203 +#if FF_API_RTP_CALLBACK
3205 + * @deprecated unused
3207 + /* The RTP callback: This function is called */
3208 + /* every time the encoder has a packet to send. */
3209 + /* It depends on the encoder if the data starts */
3210 + /* with a Start Code (it should). H.263 does. */
3211 + /* mb_nb contains the number of macroblocks */
3212 + /* encoded in the RTP payload. */
3213 + attribute_deprecated
3214 + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3217 +#if FF_API_PRIVATE_OPT
3218 + /** @deprecated use encoder private options instead */
3219 + attribute_deprecated
3220 + int rtp_payload_size; /* The size of the RTP payload: the coder will */
3221 + /* do its best to deliver a chunk with size */
3222 + /* below rtp_payload_size, the chunk will start */
3223 + /* with a start code on some codecs like H.263. */
3224 + /* This doesn't take account of any particular */
3225 + /* headers inside the transmitted RTP payload. */
3228 +#if FF_API_STAT_BITS
3229 + /* statistics, used for 2-pass encoding */
3230 + attribute_deprecated
3232 + attribute_deprecated
3234 + attribute_deprecated
3236 + attribute_deprecated
3238 + attribute_deprecated
3240 + attribute_deprecated
3242 + attribute_deprecated
3244 + attribute_deprecated
3247 + /** @deprecated this field is unused */
3248 + attribute_deprecated
3253 + * pass1 encoding statistics output buffer
3254 + * - encoding: Set by libavcodec.
3255 + * - decoding: unused
3260 + * pass2 encoding statistics input buffer
3261 + * Concatenated stuff from stats_out of pass1 should be placed here.
3262 + * - encoding: Allocated/set/freed by user.
3263 + * - decoding: unused
3268 + * Work around bugs in encoders which sometimes cannot be detected automatically.
3269 + * - encoding: Set by user
3270 + * - decoding: Set by user
3272 + int workaround_bugs;
3273 +#define FF_BUG_AUTODETECT 1 ///< autodetection
3274 +#define FF_BUG_XVID_ILACE 4
3275 +#define FF_BUG_UMP4 8
3276 +#define FF_BUG_NO_PADDING 16
3277 +#define FF_BUG_AMV 32
3278 +#define FF_BUG_QPEL_CHROMA 64
3279 +#define FF_BUG_STD_QPEL 128
3280 +#define FF_BUG_QPEL_CHROMA2 256
3281 +#define FF_BUG_DIRECT_BLOCKSIZE 512
3282 +#define FF_BUG_EDGE 1024
3283 +#define FF_BUG_HPEL_CHROMA 2048
3284 +#define FF_BUG_DC_CLIP 4096
3285 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
3286 +#define FF_BUG_TRUNCATED 16384
3287 +#define FF_BUG_IEDGE 32768
3290 + * strictly follow the standard (MPEG-4, ...).
3291 + * - encoding: Set by user.
3292 + * - decoding: Set by user.
3293 + * Setting this to STRICT or higher means the encoder and decoder will
3294 + * generally do stupid things, whereas setting it to unofficial or lower
3295 + * will mean the encoder might produce output that is not supported by all
3296 + * spec-compliant decoders. Decoders don't differentiate between normal,
3297 + * unofficial and experimental (that is, they always try to decode things
3298 + * when they can) unless they are explicitly asked to behave stupidly
3299 + * (=strictly conform to the specs)
3301 + int strict_std_compliance;
3302 +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
3303 +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
3304 +#define FF_COMPLIANCE_NORMAL 0
3305 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
3306 +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
3309 + * error concealment flags
3310 + * - encoding: unused
3311 + * - decoding: Set by user.
3313 + int error_concealment;
3314 +#define FF_EC_GUESS_MVS 1
3315 +#define FF_EC_DEBLOCK 2
3316 +#define FF_EC_FAVOR_INTER 256
3320 + * - encoding: Set by user.
3321 + * - decoding: Set by user.
3324 +#define FF_DEBUG_PICT_INFO 1
3325 +#define FF_DEBUG_RC 2
3326 +#define FF_DEBUG_BITSTREAM 4
3327 +#define FF_DEBUG_MB_TYPE 8
3328 +#define FF_DEBUG_QP 16
3329 +#if FF_API_DEBUG_MV
3331 + * @deprecated this option does nothing
3333 +#define FF_DEBUG_MV 32
3335 +#define FF_DEBUG_DCT_COEFF 0x00000040
3336 +#define FF_DEBUG_SKIP 0x00000080
3337 +#define FF_DEBUG_STARTCODE 0x00000100
3338 +#define FF_DEBUG_ER 0x00000400
3339 +#define FF_DEBUG_MMCO 0x00000800
3340 +#define FF_DEBUG_BUGS 0x00001000
3341 +#if FF_API_DEBUG_MV
3342 +#define FF_DEBUG_VIS_QP 0x00002000
3343 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000
3345 +#define FF_DEBUG_BUFFERS 0x00008000
3346 +#define FF_DEBUG_THREADS 0x00010000
3347 +#define FF_DEBUG_GREEN_MD 0x00800000
3348 +#define FF_DEBUG_NOMC 0x01000000
3350 +#if FF_API_DEBUG_MV
3353 + * - encoding: Set by user.
3354 + * - decoding: Set by user.
3357 +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
3358 +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
3359 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
3363 + * Error recognition; may misdetect some more or less valid parts as errors.
3364 + * - encoding: unused
3365 + * - decoding: Set by user.
3367 + int err_recognition;
3370 + * Verify checksums embedded in the bitstream (could be of either encoded or
3371 + * decoded data, depending on the codec) and print an error message on mismatch.
3372 + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
3373 + * decoder returning an error.
3375 +#define AV_EF_CRCCHECK (1<<0)
3376 +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
3377 +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length
3378 +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection
3380 +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue
3381 +#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
3382 +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors
3383 +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error
3387 + * opaque 64-bit number (generally a PTS) that will be reordered and
3388 + * output in AVFrame.reordered_opaque
3389 + * - encoding: unused
3390 + * - decoding: Set by user.
3392 + int64_t reordered_opaque;
3395 + * Hardware accelerator in use
3396 + * - encoding: unused.
3397 + * - decoding: Set by libavcodec
3399 + const struct AVHWAccel *hwaccel;
3402 + * Hardware accelerator context.
3403 + * For some hardware accelerators, a global context needs to be
3404 + * provided by the user. In that case, this holds display-dependent
3405 + * data FFmpeg cannot instantiate itself. Please refer to the
3406 + * FFmpeg HW accelerator documentation to know how to fill this
3407 + * is. e.g. for VA API, this is a struct vaapi_context.
3408 + * - encoding: unused
3409 + * - decoding: Set by user
3411 + void *hwaccel_context;
3415 + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
3416 + * - decoding: unused
3418 + uint64_t error[AV_NUM_DATA_POINTERS];
3421 + * DCT algorithm, see FF_DCT_* below
3422 + * - encoding: Set by user.
3423 + * - decoding: unused
3426 +#define FF_DCT_AUTO 0
3427 +#define FF_DCT_FASTINT 1
3428 +#define FF_DCT_INT 2
3429 +#define FF_DCT_MMX 3
3430 +#define FF_DCT_ALTIVEC 5
3431 +#define FF_DCT_FAAN 6
3434 + * IDCT algorithm, see FF_IDCT_* below.
3435 + * - encoding: Set by user.
3436 + * - decoding: Set by user.
3439 +#define FF_IDCT_AUTO 0
3440 +#define FF_IDCT_INT 1
3441 +#define FF_IDCT_SIMPLE 2
3442 +#define FF_IDCT_SIMPLEMMX 3
3443 +#define FF_IDCT_ARM 7
3444 +#define FF_IDCT_ALTIVEC 8
3445 +#define FF_IDCT_SIMPLEARM 10
3446 +#define FF_IDCT_XVID 14
3447 +#define FF_IDCT_SIMPLEARMV5TE 16
3448 +#define FF_IDCT_SIMPLEARMV6 17
3449 +#define FF_IDCT_FAAN 20
3450 +#define FF_IDCT_SIMPLENEON 22
3451 +#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
3452 +#define FF_IDCT_SIMPLEAUTO 128
3455 + * bits per sample/pixel from the demuxer (needed for huffyuv).
3456 + * - encoding: Set by libavcodec.
3457 + * - decoding: Set by user.
3459 + int bits_per_coded_sample;
3462 + * Bits per sample/pixel of internal libavcodec pixel/sample format.
3463 + * - encoding: set by user.
3464 + * - decoding: set by libavcodec.
3466 + int bits_per_raw_sample;
3470 + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3471 + * - encoding: unused
3472 + * - decoding: Set by user.
3477 +#if FF_API_CODED_FRAME
3479 + * the picture in the bitstream
3480 + * - encoding: Set by libavcodec.
3481 + * - decoding: unused
3483 + * @deprecated use the quality factor packet side data instead
3485 + attribute_deprecated AVFrame *coded_frame;
3490 + * is used to decide how many independent tasks should be passed to execute()
3491 + * - encoding: Set by user.
3492 + * - decoding: Set by user.
3497 + * Which multithreading methods to use.
3498 + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
3499 + * so clients which cannot provide future frames should not use it.
3501 + * - encoding: Set by user, otherwise the default is used.
3502 + * - decoding: Set by user, otherwise the default is used.
3505 +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
3506 +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
3509 + * Which multithreading methods are in use by the codec.
3510 + * - encoding: Set by libavcodec.
3511 + * - decoding: Set by libavcodec.
3513 + int active_thread_type;
3516 + * Set by the client if its custom get_buffer() callback can be called
3517 + * synchronously from another thread, which allows faster multithreaded decoding.
3518 + * draw_horiz_band() will be called from other threads regardless of this setting.
3519 + * Ignored if the default get_buffer() is used.
3520 + * - encoding: Set by user.
3521 + * - decoding: Set by user.
3523 + int thread_safe_callbacks;
3526 + * The codec may call this to execute several independent things.
3527 + * It will return only after finishing all tasks.
3528 + * The user may replace this with some multithreaded implementation,
3529 + * the default implementation will execute the parts serially.
3530 + * @param count the number of things to execute
3531 + * - encoding: Set by libavcodec, user can override.
3532 + * - decoding: Set by libavcodec, user can override.
3534 + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3537 + * The codec may call this to execute several independent things.
3538 + * It will return only after finishing all tasks.
3539 + * The user may replace this with some multithreaded implementation,
3540 + * the default implementation will execute the parts serially.
3541 + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
3542 + * @param c context passed also to func
3543 + * @param count the number of things to execute
3544 + * @param arg2 argument passed unchanged to func
3545 + * @param ret return values of executed functions, must have space for "count" values. May be NULL.
3546 + * @param func function that will be called count times, with jobnr from 0 to count-1.
3547 + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
3548 + * two instances of func executing at the same time will have the same threadnr.
3549 + * @return always 0 currently, but code should handle a future improvement where when any call to func
3550 + * returns < 0 no further calls to func may be done and < 0 is returned.
3551 + * - encoding: Set by libavcodec, user can override.
3552 + * - decoding: Set by libavcodec, user can override.
3554 + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3557 + * noise vs. sse weight for the nsse comparison function
3558 + * - encoding: Set by user.
3559 + * - decoding: unused
3565 + * - encoding: Set by user.
3566 + * - decoding: Set by libavcodec.
3569 +#define FF_PROFILE_UNKNOWN -99
3570 +#define FF_PROFILE_RESERVED -100
3572 +#define FF_PROFILE_AAC_MAIN 0
3573 +#define FF_PROFILE_AAC_LOW 1
3574 +#define FF_PROFILE_AAC_SSR 2
3575 +#define FF_PROFILE_AAC_LTP 3
3576 +#define FF_PROFILE_AAC_HE 4
3577 +#define FF_PROFILE_AAC_HE_V2 28
3578 +#define FF_PROFILE_AAC_LD 22
3579 +#define FF_PROFILE_AAC_ELD 38
3580 +#define FF_PROFILE_MPEG2_AAC_LOW 128
3581 +#define FF_PROFILE_MPEG2_AAC_HE 131
3583 +#define FF_PROFILE_DNXHD 0
3584 +#define FF_PROFILE_DNXHR_LB 1
3585 +#define FF_PROFILE_DNXHR_SQ 2
3586 +#define FF_PROFILE_DNXHR_HQ 3
3587 +#define FF_PROFILE_DNXHR_HQX 4
3588 +#define FF_PROFILE_DNXHR_444 5
3590 +#define FF_PROFILE_DTS 20
3591 +#define FF_PROFILE_DTS_ES 30
3592 +#define FF_PROFILE_DTS_96_24 40
3593 +#define FF_PROFILE_DTS_HD_HRA 50
3594 +#define FF_PROFILE_DTS_HD_MA 60
3595 +#define FF_PROFILE_DTS_EXPRESS 70
3597 +#define FF_PROFILE_MPEG2_422 0
3598 +#define FF_PROFILE_MPEG2_HIGH 1
3599 +#define FF_PROFILE_MPEG2_SS 2
3600 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
3601 +#define FF_PROFILE_MPEG2_MAIN 4
3602 +#define FF_PROFILE_MPEG2_SIMPLE 5
3604 +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
3605 +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
3607 +#define FF_PROFILE_H264_BASELINE 66
3608 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3609 +#define FF_PROFILE_H264_MAIN 77
3610 +#define FF_PROFILE_H264_EXTENDED 88
3611 +#define FF_PROFILE_H264_HIGH 100
3612 +#define FF_PROFILE_H264_HIGH_10 110
3613 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
3614 +#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
3615 +#define FF_PROFILE_H264_HIGH_422 122
3616 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
3617 +#define FF_PROFILE_H264_STEREO_HIGH 128
3618 +#define FF_PROFILE_H264_HIGH_444 144
3619 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
3620 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
3621 +#define FF_PROFILE_H264_CAVLC_444 44
3623 +#define FF_PROFILE_VC1_SIMPLE 0
3624 +#define FF_PROFILE_VC1_MAIN 1
3625 +#define FF_PROFILE_VC1_COMPLEX 2
3626 +#define FF_PROFILE_VC1_ADVANCED 3
3628 +#define FF_PROFILE_MPEG4_SIMPLE 0
3629 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
3630 +#define FF_PROFILE_MPEG4_CORE 2
3631 +#define FF_PROFILE_MPEG4_MAIN 3
3632 +#define FF_PROFILE_MPEG4_N_BIT 4
3633 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
3634 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
3635 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
3636 +#define FF_PROFILE_MPEG4_HYBRID 8
3637 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
3638 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
3639 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
3640 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
3641 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3642 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
3643 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
3645 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
3646 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
3647 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
3648 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
3649 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
3651 +#define FF_PROFILE_VP9_0 0
3652 +#define FF_PROFILE_VP9_1 1
3653 +#define FF_PROFILE_VP9_2 2
3654 +#define FF_PROFILE_VP9_3 3
3656 +#define FF_PROFILE_HEVC_MAIN 1
3657 +#define FF_PROFILE_HEVC_MAIN_10 2
3658 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
3659 +#define FF_PROFILE_HEVC_REXT 4
3661 +#define FF_PROFILE_AV1_MAIN 0
3662 +#define FF_PROFILE_AV1_HIGH 1
3663 +#define FF_PROFILE_AV1_PROFESSIONAL 2
3665 +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
3666 +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
3667 +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
3668 +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
3669 +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
3671 +#define FF_PROFILE_SBC_MSBC 1
3675 + * - encoding: Set by user.
3676 + * - decoding: Set by libavcodec.
3679 +#define FF_LEVEL_UNKNOWN -99
3682 + * Skip loop filtering for selected frames.
3683 + * - encoding: unused
3684 + * - decoding: Set by user.
3686 + enum AVDiscard skip_loop_filter;
3689 + * Skip IDCT/dequantization for selected frames.
3690 + * - encoding: unused
3691 + * - decoding: Set by user.
3693 + enum AVDiscard skip_idct;
3696 + * Skip decoding for selected frames.
3697 + * - encoding: unused
3698 + * - decoding: Set by user.
3700 + enum AVDiscard skip_frame;
3703 + * Header containing style information for text subtitles.
3704 + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3705 + * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3706 + * the Format line following. It shouldn't include any Dialogue line.
3707 + * - encoding: Set/allocated/freed by user (before avcodec_open2())
3708 + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3710 + uint8_t *subtitle_header;
3711 + int subtitle_header_size;
3713 +#if FF_API_VBV_DELAY
3715 + * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3716 + * Used for compliant TS muxing.
3717 + * - encoding: Set by libavcodec.
3718 + * - decoding: unused.
3719 + * @deprecated this value is now exported as a part of
3720 + * AV_PKT_DATA_CPB_PROPERTIES packet side data
3722 + attribute_deprecated
3723 + uint64_t vbv_delay;
3726 +#if FF_API_SIDEDATA_ONLY_PKT
3728 + * Encoding only and set by default. Allow encoders to output packets
3729 + * that do not contain any encoded data, only side data.
3731 + * Some encoders need to output such packets, e.g. to update some stream
3732 + * parameters at the end of encoding.
3734 + * @deprecated this field disables the default behaviour and
3735 + * it is kept only for compatibility.
3737 + attribute_deprecated
3738 + int side_data_only_packets;
3742 + * Audio only. The number of "priming" samples (padding) inserted by the
3743 + * encoder at the beginning of the audio. I.e. this number of leading
3744 + * decoded samples must be discarded by the caller to get the original audio
3745 + * without leading padding.
3747 + * - decoding: unused
3748 + * - encoding: Set by libavcodec. The timestamps on the output packets are
3749 + * adjusted by the encoder so that they always refer to the
3750 + * first sample of the data actually contained in the packet,
3751 + * including any added padding. E.g. if the timebase is
3752 + * 1/samplerate and the timestamp of the first input sample is
3753 + * 0, the timestamp of the first output packet will be
3754 + * -initial_padding.
3756 + int initial_padding;
3759 + * - decoding: For codecs that store a framerate value in the compressed
3760 + * bitstream, the decoder may export it here. { 0, 1} when
3762 + * - encoding: May be used to signal the framerate of CFR content to an
3765 + AVRational framerate;
3768 + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3769 + * - encoding: unused.
3770 + * - decoding: Set by libavcodec before calling get_format()
3772 + enum AVPixelFormat sw_pix_fmt;
3775 + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3776 + * - encoding unused.
3777 + * - decoding set by user.
3779 + AVRational pkt_timebase;
3782 + * AVCodecDescriptor
3783 + * - encoding: unused.
3784 + * - decoding: set by libavcodec.
3786 + const AVCodecDescriptor *codec_descriptor;
3790 + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3791 + * - encoding: unused
3792 + * - decoding: Set by user.
3798 + * Current statistics for PTS correction.
3799 + * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3800 + * - encoding: unused
3802 + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3803 + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3804 + int64_t pts_correction_last_pts; /// PTS of the last frame
3805 + int64_t pts_correction_last_dts; /// DTS of the last frame
3808 + * Character encoding of the input subtitles file.
3809 + * - decoding: set by user
3810 + * - encoding: unused
3812 + char *sub_charenc;
3815 + * Subtitles character encoding mode. Formats or codecs might be adjusting
3816 + * this setting (if they are doing the conversion themselves for instance).
3817 + * - decoding: set by libavcodec
3818 + * - encoding: unused
3820 + int sub_charenc_mode;
3821 +#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)
3822 +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself
3823 +#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
3824 +#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8
3827 + * Skip processing alpha if supported by codec.
3828 + * Note that if the format uses pre-multiplied alpha (common with VP6,
3829 + * and recommended due to better video quality/compression)
3830 + * the image will look as if alpha-blended onto a black background.
3831 + * However for formats that do not use pre-multiplied alpha
3832 + * there might be serious artefacts (though e.g. libswscale currently
3833 + * assumes pre-multiplied alpha anyway).
3835 + * - decoding: set by user
3836 + * - encoding: unused
3841 + * Number of samples to skip after a discontinuity
3842 + * - decoding: unused
3843 + * - encoding: set by libavcodec
3847 +#if !FF_API_DEBUG_MV
3849 + * debug motion vectors
3850 + * - encoding: Set by user.
3851 + * - decoding: Set by user.
3854 +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
3855 +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
3856 +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3860 + * custom intra quantization matrix
3861 + * - encoding: Set by user, can be NULL.
3862 + * - decoding: unused.
3864 + uint16_t *chroma_intra_matrix;
3867 + * dump format separator.
3868 + * can be ", " or "\n " or anything else
3869 + * - encoding: Set by user.
3870 + * - decoding: Set by user.
3872 + uint8_t *dump_separator;
3875 + * ',' separated list of allowed decoders.
3876 + * If NULL then all are allowed
3877 + * - encoding: unused
3878 + * - decoding: set by user
3880 + char *codec_whitelist;
3883 + * Properties of the stream that gets decoded
3884 + * - encoding: unused
3885 + * - decoding: set by libavcodec
3887 + unsigned properties;
3888 +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
3889 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3892 + * Additional data associated with the entire coded stream.
3894 + * - decoding: unused
3895 + * - encoding: may be set by libavcodec after avcodec_open2().
3897 + AVPacketSideData *coded_side_data;
3898 + int nb_coded_side_data;
3901 + * A reference to the AVHWFramesContext describing the input (for encoding)
3902 + * or output (decoding) frames. The reference is set by the caller and
3903 + * afterwards owned (and freed) by libavcodec - it should never be read by
3904 + * the caller after being set.
3906 + * - decoding: This field should be set by the caller from the get_format()
3907 + * callback. The previous reference (if any) will always be
3908 + * unreffed by libavcodec before the get_format() call.
3910 + * If the default get_buffer2() is used with a hwaccel pixel
3911 + * format, then this AVHWFramesContext will be used for
3912 + * allocating the frame buffers.
3914 + * - encoding: For hardware encoders configured to use a hwaccel pixel
3915 + * format, this field should be set by the caller to a reference
3916 + * to the AVHWFramesContext describing input frames.
3917 + * AVHWFramesContext.format must be equal to
3918 + * AVCodecContext.pix_fmt.
3920 + * This field should be set before avcodec_open2() is called.
3922 + AVBufferRef *hw_frames_ctx;
3925 + * Control the form of AVSubtitle.rects[N]->ass
3926 + * - decoding: set by user
3927 + * - encoding: unused
3929 + int sub_text_format;
3930 +#define FF_SUB_TEXT_FMT_ASS 0
3931 +#if FF_API_ASS_TIMING
3932 +#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3936 + * Audio only. The amount of padding (in samples) appended by the encoder to
3937 + * the end of the audio. I.e. this number of decoded samples must be
3938 + * discarded by the caller from the end of the stream to get the original
3939 + * audio without any trailing padding.
3941 + * - decoding: unused
3942 + * - encoding: unused
3944 + int trailing_padding;
3947 + * The number of pixels per image to maximally accept.
3949 + * - decoding: set by user
3950 + * - encoding: set by user
3952 + int64_t max_pixels;
3955 + * A reference to the AVHWDeviceContext describing the device which will
3956 + * be used by a hardware encoder/decoder. The reference is set by the
3957 + * caller and afterwards owned (and freed) by libavcodec.
3959 + * This should be used if either the codec device does not require
3960 + * hardware frames or any that are used are to be allocated internally by
3961 + * libavcodec. If the user wishes to supply any of the frames used as
3962 + * encoder input or decoder output then hw_frames_ctx should be used
3963 + * instead. When hw_frames_ctx is set in get_format() for a decoder, this
3964 + * field will be ignored while decoding the associated stream segment, but
3965 + * may again be used on a following one after another get_format() call.
3967 + * For both encoders and decoders this field should be set before
3968 + * avcodec_open2() is called and must not be written to thereafter.
3970 + * Note that some decoders may require this field to be set initially in
3971 + * order to support hw_frames_ctx at all - in that case, all frames
3972 + * contexts used must be created on the same device.
3974 + AVBufferRef *hw_device_ctx;
3977 + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
3978 + * decoding (if active).
3979 + * - encoding: unused
3980 + * - decoding: Set by user (either before avcodec_open2(), or in the
3981 + * AVCodecContext.get_format callback)
3983 + int hwaccel_flags;
3986 + * Video decoding only. Certain video codecs support cropping, meaning that
3987 + * only a sub-rectangle of the decoded frame is intended for display. This
3988 + * option controls how cropping is handled by libavcodec.
3990 + * When set to 1 (the default), libavcodec will apply cropping internally.
3991 + * I.e. it will modify the output frame width/height fields and offset the
3992 + * data pointers (only by as much as possible while preserving alignment, or
3993 + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3994 + * the frames output by the decoder refer only to the cropped area. The
3995 + * crop_* fields of the output frames will be zero.
3997 + * When set to 0, the width/height fields of the output frames will be set
3998 + * to the coded dimensions and the crop_* fields will describe the cropping
3999 + * rectangle. Applying the cropping is left to the caller.
4001 + * @warning When hardware acceleration with opaque output frames is used,
4002 + * libavcodec is unable to apply cropping from the top/left border.
4004 + * @note when this option is set to zero, the width/height fields of the
4005 + * AVCodecContext and output AVFrames have different meanings. The codec
4006 + * context fields store display dimensions (with the coded dimensions in
4007 + * coded_width/height), while the frame fields store the coded dimensions
4008 + * (with the display dimensions being determined by the crop_* fields).
4010 + int apply_cropping;
4013 + * Video decoding only. Sets the number of extra hardware frames which
4014 + * the decoder will allocate for use by the caller. This must be set
4015 + * before avcodec_open2() is called.
4017 + * Some hardware decoders require all frames that they will use for
4018 + * output to be defined in advance before decoding starts. For such
4019 + * decoders, the hardware frame pool must therefore be of a fixed size.
4020 + * The extra frames set here are on top of any number that the decoder
4021 + * needs internally in order to operate normally (for example, frames
4022 + * used as reference pictures).
4024 + int extra_hw_frames;
4027 +#if FF_API_CODEC_GET_SET
4029 + * Accessors for some AVCodecContext fields. These used to be provided for ABI
4030 + * compatibility, and do not need to be used anymore.
4032 +attribute_deprecated
4033 +AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
4034 +attribute_deprecated
4035 +void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val);
4037 +attribute_deprecated
4038 +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
4039 +attribute_deprecated
4040 +void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
4042 +attribute_deprecated
4043 +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
4046 +attribute_deprecated
4047 +int av_codec_get_lowres(const AVCodecContext *avctx);
4048 +attribute_deprecated
4049 +void av_codec_set_lowres(AVCodecContext *avctx, int val);
4052 +attribute_deprecated
4053 +int av_codec_get_seek_preroll(const AVCodecContext *avctx);
4054 +attribute_deprecated
4055 +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
4057 +attribute_deprecated
4058 +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
4059 +attribute_deprecated
4060 +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
4066 +typedef struct AVProfile {
4068 + const char *name; ///< short name for the profile
4073 + * The codec supports this format via the hw_device_ctx interface.
4075 + * When selecting this format, AVCodecContext.hw_device_ctx should
4076 + * have been set to a device of the specified type before calling
4077 + * avcodec_open2().
4079 + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
4081 + * The codec supports this format via the hw_frames_ctx interface.
4083 + * When selecting this format for a decoder,
4084 + * AVCodecContext.hw_frames_ctx should be set to a suitable frames
4085 + * context inside the get_format() callback. The frames context
4086 + * must have been created on a device of the specified type.
4088 + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
4090 + * The codec supports this format by some internal method.
4092 + * This format can be selected without any additional configuration -
4093 + * no device or frames context is required.
4095 + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
4097 + * The codec supports this format by some ad-hoc method.
4099 + * Additional settings and/or function calls are required. See the
4100 + * codec-specific documentation for details. (Methods requiring
4101 + * this sort of configuration are deprecated and others should be
4102 + * used in preference.)
4104 + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
4107 +typedef struct AVCodecHWConfig {
4109 + * A hardware pixel format which the codec can use.
4111 + enum AVPixelFormat pix_fmt;
4113 + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
4114 + * setup methods which can be used with this configuration.
4118 + * The device type associated with the configuration.
4120 + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
4121 + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
4123 + enum AVHWDeviceType device_type;
4126 +typedef struct AVCodecDefault AVCodecDefault;
4133 +typedef struct AVCodec {
4135 + * Name of the codec implementation.
4136 + * The name is globally unique among encoders and among decoders (but an
4137 + * encoder and a decoder can share the same name).
4138 + * This is the primary way to find a codec from the user perspective.
4142 + * Descriptive name for the codec, meant to be more human readable than name.
4143 + * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
4145 + const char *long_name;
4146 + enum AVMediaType type;
4147 + enum AVCodecID id;
4149 + * Codec capabilities.
4150 + * see AV_CODEC_CAP_*
4153 + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
4154 + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
4155 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
4156 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
4157 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
4158 + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
4159 + const AVClass *priv_class; ///< AVClass for the private context
4160 + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
4163 + * Group name of the codec implementation.
4164 + * This is a short symbolic name of the wrapper backing this codec. A
4165 + * wrapper uses some kind of external implementation for the codec, such
4166 + * as an external library, or a codec implementation provided by the OS or
4168 + * If this field is NULL, this is a builtin, libavcodec native codec.
4169 + * If non-NULL, this will be the suffix in AVCodec.name in most cases
4170 + * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
4172 + const char *wrapper_name;
4174 + /*****************************************************************
4175 + * No fields below this line are part of the public API. They
4176 + * may not be used outside of libavcodec and can be changed and
4177 + * removed at will.
4178 + * New public fields should be added right above.
4179 + *****************************************************************
4181 + int priv_data_size;
4182 + struct AVCodec *next;
4184 + * @name Frame-level threading support functions
4188 + * If defined, called on thread contexts when they are created.
4189 + * If the codec allocates writable tables in init(), re-allocate them here.
4190 + * priv_data will be set to a copy of the original.
4192 + int (*init_thread_copy)(AVCodecContext *);
4194 + * Copy necessary context variables from a previous thread context to the current one.
4195 + * If not defined, the next thread will start automatically; otherwise, the codec
4196 + * must call ff_thread_finish_setup().
4198 + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
4200 + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
4204 + * Private codec-specific defaults.
4206 + const AVCodecDefault *defaults;
4209 + * Initialize codec static data, called from avcodec_register().
4211 + * This is not intended for time consuming operations as it is
4212 + * run for every codec regardless of that codec being used.
4214 + void (*init_static_data)(struct AVCodec *codec);
4216 + int (*init)(AVCodecContext *);
4217 + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
4218 + const struct AVSubtitle *sub);
4220 + * Encode data to an AVPacket.
4222 + * @param avctx codec context
4223 + * @param avpkt output AVPacket (may contain a user-provided buffer)
4224 + * @param[in] frame AVFrame containing the raw data to be encoded
4225 + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
4226 + * non-empty packet was returned in avpkt.
4227 + * @return 0 on success, negative error code on failure
4229 + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
4230 + int *got_packet_ptr);
4231 + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
4232 + int (*close)(AVCodecContext *);
4234 + * Encode API with decoupled packet/frame dataflow. The API is the
4235 + * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
4237 + * - never called if the codec is closed or the wrong type,
4238 + * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
4239 + * - only one drain frame is ever passed down,
4241 + int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
4242 + int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
4245 + * Decode API with decoupled packet/frame dataflow. This function is called
4246 + * to get one output frame. It should call ff_decode_get_packet() to obtain
4249 + int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
4252 + * Will be called when seeking
4254 + void (*flush)(AVCodecContext *);
4256 + * Internal codec capabilities.
4257 + * See FF_CODEC_CAP_* in internal.h
4259 + int caps_internal;
4262 + * Decoding only, a comma-separated list of bitstream filters to apply to
4263 + * packets before decoding.
4268 + * Array of pointers to hardware configurations supported by the codec,
4269 + * or NULL if no hardware supported. The array is terminated by a NULL
4272 + * The user can only access this field via avcodec_get_hw_config().
4274 + const struct AVCodecHWConfigInternal **hw_configs;
4277 +#if FF_API_CODEC_GET_SET
4278 +attribute_deprecated
4279 +int av_codec_get_max_lowres(const AVCodec *codec);
4282 +struct MpegEncContext;
4285 + * Retrieve supported hardware configurations for a codec.
4287 + * Values of index from zero to some maximum return the indexed configuration
4288 + * descriptor; all other values return NULL. If the codec does not support
4289 + * any hardware configurations then it will always return NULL.
4291 +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
4294 + * @defgroup lavc_hwaccel AVHWAccel
4296 + * @note Nothing in this structure should be accessed by the user. At some
4297 + * point in future it will not be externally visible at all.
4301 +typedef struct AVHWAccel {
4303 + * Name of the hardware accelerated codec.
4304 + * The name is globally unique among encoders and among decoders (but an
4305 + * encoder and a decoder can share the same name).
4310 + * Type of codec implemented by the hardware accelerator.
4312 + * See AVMEDIA_TYPE_xxx
4314 + enum AVMediaType type;
4317 + * Codec implemented by the hardware accelerator.
4319 + * See AV_CODEC_ID_xxx
4321 + enum AVCodecID id;
4324 + * Supported pixel format.
4326 + * Only hardware accelerated formats are supported here.
4328 + enum AVPixelFormat pix_fmt;
4331 + * Hardware accelerated codec capabilities.
4332 + * see AV_HWACCEL_CODEC_CAP_*
4336 + /*****************************************************************
4337 + * No fields below this line are part of the public API. They
4338 + * may not be used outside of libavcodec and can be changed and
4339 + * removed at will.
4340 + * New public fields should be added right above.
4341 + *****************************************************************
4345 + * Allocate a custom buffer
4347 + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
4350 + * Called at the beginning of each frame or field picture.
4352 + * Meaningful frame information (codec specific) is guaranteed to
4353 + * be parsed at this point. This function is mandatory.
4355 + * Note that buf can be NULL along with buf_size set to 0.
4356 + * Otherwise, this means the whole frame is available at this point.
4358 + * @param avctx the codec context
4359 + * @param buf the frame data buffer base
4360 + * @param buf_size the size of the frame in bytes
4361 + * @return zero if successful, a negative value otherwise
4363 + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4366 + * Callback for parameter data (SPS/PPS/VPS etc).
4368 + * Useful for hardware decoders which keep persistent state about the
4369 + * video parameters, and need to receive any changes to update that state.
4371 + * @param avctx the codec context
4372 + * @param type the nal unit type
4373 + * @param buf the nal unit data buffer
4374 + * @param buf_size the size of the nal unit in bytes
4375 + * @return zero if successful, a negative value otherwise
4377 + int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
4380 + * Callback for each slice.
4382 + * Meaningful slice information (codec specific) is guaranteed to
4383 + * be parsed at this point. This function is mandatory.
4384 + * The only exception is XvMC, that works on MB level.
4386 + * @param avctx the codec context
4387 + * @param buf the slice data buffer base
4388 + * @param buf_size the size of the slice in bytes
4389 + * @return zero if successful, a negative value otherwise
4391 + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4394 + * Called at the end of each frame or field picture.
4396 + * The whole picture is parsed at this point and can now be sent
4397 + * to the hardware accelerator. This function is mandatory.
4399 + * @param avctx the codec context
4400 + * @return zero if successful, a negative value otherwise
4402 + int (*end_frame)(AVCodecContext *avctx);
4405 + * Size of per-frame hardware accelerator private data.
4407 + * Private data is allocated with av_mallocz() before
4408 + * AVCodecContext.get_buffer() and deallocated after
4409 + * AVCodecContext.release_buffer().
4411 + int frame_priv_data_size;
4414 + * Called for every Macroblock in a slice.
4416 + * XvMC uses it to replace the ff_mpv_reconstruct_mb().
4417 + * Instead of decoding to raw picture, MB parameters are
4418 + * stored in an array provided by the video driver.
4420 + * @param s the mpeg context
4422 + void (*decode_mb)(struct MpegEncContext *s);
4425 + * Initialize the hwaccel private data.
4427 + * This will be called from ff_get_format(), after hwaccel and
4428 + * hwaccel_context are set and the hwaccel private data in AVCodecInternal
4431 + int (*init)(AVCodecContext *avctx);
4434 + * Uninitialize the hwaccel private data.
4436 + * This will be called from get_format() or avcodec_close(), after hwaccel
4437 + * and hwaccel_context are already uninitialized.
4439 + int (*uninit)(AVCodecContext *avctx);
4442 + * Size of the private data to allocate in
4443 + * AVCodecInternal.hwaccel_priv_data.
4445 + int priv_data_size;
4448 + * Internal hwaccel capabilities.
4450 + int caps_internal;
4453 + * Fill the given hw_frames context with current codec parameters. Called
4454 + * from get_format. Refer to avcodec_get_hw_frames_parameters() for
4457 + * This CAN be called before AVHWAccel.init is called, and you must assume
4458 + * that avctx->hwaccel_priv_data is invalid.
4460 + int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
4464 + * HWAccel is experimental and is thus avoided in favor of non experimental
4467 +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
4470 + * Hardware acceleration should be used for decoding even if the codec level
4471 + * used is unknown or higher than the maximum supported level reported by the
4472 + * hardware driver.
4474 + * It's generally a good idea to pass this flag unless you have a specific
4475 + * reason not to, as hardware tends to under-report supported levels.
4477 +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
4480 + * Hardware acceleration can output YUV pixel formats with a different chroma
4481 + * sampling than 4:2:0 and/or other than 8 bits per component.
4483 +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
4486 + * Hardware acceleration should still be attempted for decoding when the
4487 + * codec profile does not match the reported capabilities of the hardware.
4489 + * For example, this can be used to try to decode baseline profile H.264
4490 + * streams in hardware - it will often succeed, because many streams marked
4491 + * as baseline profile actually conform to constrained baseline profile.
4493 + * @warning If the stream is actually not supported then the behaviour is
4494 + * undefined, and may include returning entirely incorrect output
4495 + * while indicating success.
4497 +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
4503 +#if FF_API_AVPICTURE
4505 + * @defgroup lavc_picture AVPicture
4507 + * Functions for working with AVPicture
4512 + * Picture data structure.
4514 + * Up to four components can be stored into it, the last component is
4516 + * @deprecated use AVFrame or imgutils functions instead
4518 +typedef struct AVPicture {
4519 + attribute_deprecated
4520 + uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes
4521 + attribute_deprecated
4522 + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
4530 +enum AVSubtitleType {
4533 + SUBTITLE_BITMAP, ///< A bitmap, pict will be set
4536 + * Plain text, the text field must be set by the decoder and is
4537 + * authoritative. ass and pict fields may contain approximations.
4542 + * Formatted text, the ass field must be set by the decoder and is
4543 + * authoritative. pict and text fields may contain approximations.
4548 +#define AV_SUBTITLE_FLAG_FORCED 0x00000001
4550 +typedef struct AVSubtitleRect {
4551 + int x; ///< top left corner of pict, undefined when pict is not set
4552 + int y; ///< top left corner of pict, undefined when pict is not set
4553 + int w; ///< width of pict, undefined when pict is not set
4554 + int h; ///< height of pict, undefined when pict is not set
4555 + int nb_colors; ///< number of colors in pict, undefined when pict is not set
4557 +#if FF_API_AVPICTURE
4559 + * @deprecated unused
4561 + attribute_deprecated
4565 + * data+linesize for the bitmap of this subtitle.
4566 + * Can be set for text/ass as well once they are rendered.
4571 + enum AVSubtitleType type;
4573 + char *text; ///< 0 terminated plain UTF-8 text
4576 + * 0 terminated ASS/SSA compatible event line.
4577 + * The presentation of this is unaffected by the other values in this
4585 +typedef struct AVSubtitle {
4586 + uint16_t format; /* 0 = graphics */
4587 + uint32_t start_display_time; /* relative to packet pts, in ms */
4588 + uint32_t end_display_time; /* relative to packet pts, in ms */
4589 + unsigned num_rects;
4590 + AVSubtitleRect **rects;
4591 + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
4595 + * This struct describes the properties of an encoded stream.
4597 + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
4598 + * be allocated with avcodec_parameters_alloc() and freed with
4599 + * avcodec_parameters_free().
4601 +typedef struct AVCodecParameters {
4603 + * General type of the encoded data.
4605 + enum AVMediaType codec_type;
4607 + * Specific type of the encoded data (the codec used).
4609 + enum AVCodecID codec_id;
4611 + * Additional information about the codec (corresponds to the AVI FOURCC).
4613 + uint32_t codec_tag;
4616 + * Extra binary data needed for initializing the decoder, codec-dependent.
4618 + * Must be allocated with av_malloc() and will be freed by
4619 + * avcodec_parameters_free(). The allocated size of extradata must be at
4620 + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
4623 + uint8_t *extradata;
4625 + * Size of the extradata content in bytes.
4627 + int extradata_size;
4630 + * - video: the pixel format, the value corresponds to enum AVPixelFormat.
4631 + * - audio: the sample format, the value corresponds to enum AVSampleFormat.
4636 + * The average bitrate of the encoded data (in bits per second).
4641 + * The number of bits per sample in the codedwords.
4643 + * This is basically the bitrate per sample. It is mandatory for a bunch of
4644 + * formats to actually decode them. It's the number of bits for one sample in
4645 + * the actual coded bitstream.
4647 + * This could be for example 4 for ADPCM
4648 + * For PCM formats this matches bits_per_raw_sample
4651 + int bits_per_coded_sample;
4654 + * This is the number of valid bits in each output sample. If the
4655 + * sample format has more bits, the least significant bits are additional
4656 + * padding bits, which are always 0. Use right shifts to reduce the sample
4657 + * to its actual size. For example, audio formats with 24 bit samples will
4658 + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
4659 + * To get the original sample use "(int32_t)sample >> 8"."
4661 + * For ADPCM this might be 12 or 16 or similar
4664 + int bits_per_raw_sample;
4667 + * Codec-specific bitstream restrictions that the stream conforms to.
4673 + * Video only. The dimensions of the video frame in pixels.
4679 + * Video only. The aspect ratio (width / height) which a single pixel
4680 + * should have when displayed.
4682 + * When the aspect ratio is unknown / undefined, the numerator should be
4683 + * set to 0 (the denominator may have any value).
4685 + AVRational sample_aspect_ratio;
4688 + * Video only. The order of the fields in interlaced video.
4690 + enum AVFieldOrder field_order;
4693 + * Video only. Additional colorspace characteristics.
4695 + enum AVColorRange color_range;
4696 + enum AVColorPrimaries color_primaries;
4697 + enum AVColorTransferCharacteristic color_trc;
4698 + enum AVColorSpace color_space;
4699 + enum AVChromaLocation chroma_location;
4702 + * Video only. Number of delayed frames.
4707 + * Audio only. The channel layout bitmask. May be 0 if the channel layout is
4708 + * unknown or unspecified, otherwise the number of bits set must be equal to
4709 + * the channels field.
4711 + uint64_t channel_layout;
4713 + * Audio only. The number of audio channels.
4717 + * Audio only. The number of audio samples per second.
4721 + * Audio only. The number of bytes per coded audio frame, required by some
4724 + * Corresponds to nBlockAlign in WAVEFORMATEX.
4728 + * Audio only. Audio frame size, if known. Required by some formats to be static.
4733 + * Audio only. The amount of padding (in samples) inserted by the encoder at
4734 + * the beginning of the audio. I.e. this number of leading decoded samples
4735 + * must be discarded by the caller to get the original audio without leading
4738 + int initial_padding;
4740 + * Audio only. The amount of padding (in samples) appended by the encoder to
4741 + * the end of the audio. I.e. this number of decoded samples must be
4742 + * discarded by the caller from the end of the stream to get the original
4743 + * audio without any trailing padding.
4745 + int trailing_padding;
4747 + * Audio only. Number of samples to skip after a discontinuity.
4750 +} AVCodecParameters;
4753 + * Iterate over all registered codecs.
4755 + * @param opaque a pointer where libavcodec will store the iteration state. Must
4756 + * point to NULL to start the iteration.
4758 + * @return the next registered codec or NULL when the iteration is
4761 +const AVCodec *av_codec_iterate(void **opaque);
4765 + * If c is NULL, returns the first registered codec,
4766 + * if c is non-NULL, returns the next registered codec after c,
4767 + * or NULL if c is the last one.
4769 +attribute_deprecated
4770 +AVCodec *av_codec_next(const AVCodec *c);
4774 + * Return the LIBAVCODEC_VERSION_INT constant.
4776 +unsigned avcodec_version(void);
4779 + * Return the libavcodec build-time configuration.
4781 +const char *avcodec_configuration(void);
4784 + * Return the libavcodec license.
4786 +const char *avcodec_license(void);
4790 + * Register the codec codec and initialize libavcodec.
4792 + * @warning either this function or avcodec_register_all() must be called
4793 + * before any other libavcodec functions.
4795 + * @see avcodec_register_all()
4797 +attribute_deprecated
4798 +void avcodec_register(AVCodec *codec);
4801 + * Register all the codecs, parsers and bitstream filters which were enabled at
4802 + * configuration time. If you do not call this function you can select exactly
4803 + * which formats you want to support, by using the individual registration
4806 + * @see avcodec_register
4807 + * @see av_register_codec_parser
4808 + * @see av_register_bitstream_filter
4810 +attribute_deprecated
4811 +void avcodec_register_all(void);
4815 + * Allocate an AVCodecContext and set its fields to default values. The
4816 + * resulting struct should be freed with avcodec_free_context().
4818 + * @param codec if non-NULL, allocate private data and initialize defaults
4819 + * for the given codec. It is illegal to then call avcodec_open2()
4820 + * with a different codec.
4821 + * If NULL, then the codec-specific defaults won't be initialized,
4822 + * which may result in suboptimal default settings (this is
4823 + * important mainly for encoders, e.g. libx264).
4825 + * @return An AVCodecContext filled with default values or NULL on failure.
4827 +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
4830 + * Free the codec context and everything associated with it and write NULL to
4831 + * the provided pointer.
4833 +void avcodec_free_context(AVCodecContext **avctx);
4835 +#if FF_API_GET_CONTEXT_DEFAULTS
4837 + * @deprecated This function should not be used, as closing and opening a codec
4838 + * context multiple time is not supported. A new codec context should be
4839 + * allocated for each new use.
4841 +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
4845 + * Get the AVClass for AVCodecContext. It can be used in combination with
4846 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4848 + * @see av_opt_find().
4850 +const AVClass *avcodec_get_class(void);
4852 +#if FF_API_COPY_CONTEXT
4854 + * Get the AVClass for AVFrame. It can be used in combination with
4855 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4857 + * @see av_opt_find().
4859 +const AVClass *avcodec_get_frame_class(void);
4862 + * Get the AVClass for AVSubtitleRect. It can be used in combination with
4863 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4865 + * @see av_opt_find().
4867 +const AVClass *avcodec_get_subtitle_rect_class(void);
4870 + * Copy the settings of the source AVCodecContext into the destination
4871 + * AVCodecContext. The resulting destination codec context will be
4872 + * unopened, i.e. you are required to call avcodec_open2() before you
4873 + * can use this AVCodecContext to decode/encode video/audio data.
4875 + * @param dest target codec context, should be initialized with
4876 + * avcodec_alloc_context3(NULL), but otherwise uninitialized
4877 + * @param src source codec context
4878 + * @return AVERROR() on error (e.g. memory allocation error), 0 on success
4880 + * @deprecated The semantics of this function are ill-defined and it should not
4881 + * be used. If you need to transfer the stream parameters from one codec context
4882 + * to another, use an intermediate AVCodecParameters instance and the
4883 + * avcodec_parameters_from_context() / avcodec_parameters_to_context()
4886 +attribute_deprecated
4887 +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
4891 + * Allocate a new AVCodecParameters and set its fields to default values
4892 + * (unknown/invalid/0). The returned struct must be freed with
4893 + * avcodec_parameters_free().
4895 +AVCodecParameters *avcodec_parameters_alloc(void);
4898 + * Free an AVCodecParameters instance and everything associated with it and
4899 + * write NULL to the supplied pointer.
4901 +void avcodec_parameters_free(AVCodecParameters **par);
4904 + * Copy the contents of src to dst. Any allocated fields in dst are freed and
4905 + * replaced with newly allocated duplicates of the corresponding fields in src.
4907 + * @return >= 0 on success, a negative AVERROR code on failure.
4909 +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
4912 + * Fill the parameters struct based on the values from the supplied codec
4913 + * context. Any allocated fields in par are freed and replaced with duplicates
4914 + * of the corresponding fields in codec.
4916 + * @return >= 0 on success, a negative AVERROR code on failure
4918 +int avcodec_parameters_from_context(AVCodecParameters *par,
4919 + const AVCodecContext *codec);
4922 + * Fill the codec context based on the values from the supplied codec
4923 + * parameters. Any allocated fields in codec that have a corresponding field in
4924 + * par are freed and replaced with duplicates of the corresponding field in par.
4925 + * Fields in codec that do not have a counterpart in par are not touched.
4927 + * @return >= 0 on success, a negative AVERROR code on failure.
4929 +int avcodec_parameters_to_context(AVCodecContext *codec,
4930 + const AVCodecParameters *par);
4933 + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
4934 + * function the context has to be allocated with avcodec_alloc_context3().
4936 + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
4937 + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
4938 + * retrieving a codec.
4940 + * @warning This function is not thread safe!
4942 + * @note Always call this function before using decoding routines (such as
4943 + * @ref avcodec_receive_frame()).
4946 + * avcodec_register_all();
4947 + * av_dict_set(&opts, "b", "2.5M", 0);
4948 + * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
4952 + * context = avcodec_alloc_context3(codec);
4954 + * if (avcodec_open2(context, codec, opts) < 0)
4958 + * @param avctx The context to initialize.
4959 + * @param codec The codec to open this context for. If a non-NULL codec has been
4960 + * previously passed to avcodec_alloc_context3() or
4961 + * for this context, then this parameter MUST be either NULL or
4962 + * equal to the previously passed codec.
4963 + * @param options A dictionary filled with AVCodecContext and codec-private options.
4964 + * On return this object will be filled with options that were not found.
4966 + * @return zero on success, a negative value on error
4967 + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
4968 + * av_dict_set(), av_opt_find().
4970 +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
4973 + * Close a given AVCodecContext and free all the data associated with it
4974 + * (but not the AVCodecContext itself).
4976 + * Calling this function on an AVCodecContext that hasn't been opened will free
4977 + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
4978 + * codec. Subsequent calls will do nothing.
4980 + * @note Do not use this function. Use avcodec_free_context() to destroy a
4981 + * codec context (either open or closed). Opening and closing a codec context
4982 + * multiple times is not supported anymore -- use multiple codec contexts
4985 +int avcodec_close(AVCodecContext *avctx);
4988 + * Free all allocated data in the given subtitle struct.
4990 + * @param sub AVSubtitle to free.
4992 +void avsubtitle_free(AVSubtitle *sub);
4999 + * @addtogroup lavc_packet
5004 + * Allocate an AVPacket and set its fields to default values. The resulting
5005 + * struct must be freed using av_packet_free().
5007 + * @return An AVPacket filled with default values or NULL on failure.
5009 + * @note this only allocates the AVPacket itself, not the data buffers. Those
5010 + * must be allocated through other means such as av_new_packet.
5012 + * @see av_new_packet
5014 +AVPacket *av_packet_alloc(void);
5017 + * Create a new packet that references the same data as src.
5019 + * This is a shortcut for av_packet_alloc()+av_packet_ref().
5021 + * @return newly created AVPacket on success, NULL on error.
5023 + * @see av_packet_alloc
5024 + * @see av_packet_ref
5026 +AVPacket *av_packet_clone(const AVPacket *src);
5029 + * Free the packet, if the packet is reference counted, it will be
5030 + * unreferenced first.
5032 + * @param pkt packet to be freed. The pointer will be set to NULL.
5033 + * @note passing NULL is a no-op.
5035 +void av_packet_free(AVPacket **pkt);
5038 + * Initialize optional fields of a packet with default values.
5040 + * Note, this does not touch the data and size members, which have to be
5041 + * initialized separately.
5043 + * @param pkt packet
5045 +void av_init_packet(AVPacket *pkt);
5048 + * Allocate the payload of a packet and initialize its fields with
5051 + * @param pkt packet
5052 + * @param size wanted payload size
5053 + * @return 0 if OK, AVERROR_xxx otherwise
5055 +int av_new_packet(AVPacket *pkt, int size);
5058 + * Reduce packet size, correctly zeroing padding
5060 + * @param pkt packet
5061 + * @param size new size
5063 +void av_shrink_packet(AVPacket *pkt, int size);
5066 + * Increase packet size, correctly zeroing padding
5068 + * @param pkt packet
5069 + * @param grow_by number of bytes by which to increase the size of the packet
5071 +int av_grow_packet(AVPacket *pkt, int grow_by);
5074 + * Initialize a reference-counted packet from av_malloc()ed data.
5076 + * @param pkt packet to be initialized. This function will set the data, size,
5077 + * buf and destruct fields, all others are left untouched.
5078 + * @param data Data allocated by av_malloc() to be used as packet data. If this
5079 + * function returns successfully, the data is owned by the underlying AVBuffer.
5080 + * The caller may not access the data through other means.
5081 + * @param size size of data in bytes, without the padding. I.e. the full buffer
5082 + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
5084 + * @return 0 on success, a negative AVERROR on error
5086 +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
5088 +#if FF_API_AVPACKET_OLD_API
5090 + * @warning This is a hack - the packet memory allocation stuff is broken. The
5091 + * packet is allocated if it was not really allocated.
5093 + * @deprecated Use av_packet_ref or av_packet_make_refcounted
5095 +attribute_deprecated
5096 +int av_dup_packet(AVPacket *pkt);
5098 + * Copy packet, including contents
5100 + * @return 0 on success, negative AVERROR on fail
5102 + * @deprecated Use av_packet_ref
5104 +attribute_deprecated
5105 +int av_copy_packet(AVPacket *dst, const AVPacket *src);
5108 + * Copy packet side data
5110 + * @return 0 on success, negative AVERROR on fail
5112 + * @deprecated Use av_packet_copy_props
5114 +attribute_deprecated
5115 +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
5120 + * @deprecated Use av_packet_unref
5122 + * @param pkt packet to free
5124 +attribute_deprecated
5125 +void av_free_packet(AVPacket *pkt);
5128 + * Allocate new information of a packet.
5130 + * @param pkt packet
5131 + * @param type side information type
5132 + * @param size side information size
5133 + * @return pointer to fresh allocated data or NULL otherwise
5135 +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5139 + * Wrap an existing array as a packet side data.
5141 + * @param pkt packet
5142 + * @param type side information type
5143 + * @param data the side data array. It must be allocated with the av_malloc()
5144 + * family of functions. The ownership of the data is transferred to
5146 + * @param size side information size
5147 + * @return a non-negative number on success, a negative AVERROR code on
5148 + * failure. On failure, the packet is unchanged and the data remains
5149 + * owned by the caller.
5151 +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5152 + uint8_t *data, size_t size);
5155 + * Shrink the already allocated side data buffer
5157 + * @param pkt packet
5158 + * @param type side information type
5159 + * @param size new side information size
5160 + * @return 0 on success, < 0 on failure
5162 +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5166 + * Get side information from packet.
5168 + * @param pkt packet
5169 + * @param type desired side information type
5170 + * @param size pointer for side information size to store (optional)
5171 + * @return pointer to data if present or NULL otherwise
5173 +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
5176 +#if FF_API_MERGE_SD_API
5177 +attribute_deprecated
5178 +int av_packet_merge_side_data(AVPacket *pkt);
5180 +attribute_deprecated
5181 +int av_packet_split_side_data(AVPacket *pkt);
5184 +const char *av_packet_side_data_name(enum AVPacketSideDataType type);
5187 + * Pack a dictionary for use in side_data.
5189 + * @param dict The dictionary to pack.
5190 + * @param size pointer to store the size of the returned data
5191 + * @return pointer to data if successful, NULL otherwise
5193 +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
5195 + * Unpack a dictionary from side_data.
5197 + * @param data data from side_data
5198 + * @param size size of the data
5199 + * @param dict the metadata storage dictionary
5200 + * @return 0 on success, < 0 on failure
5202 +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
5206 + * Convenience function to free all the side data stored.
5207 + * All the other fields stay untouched.
5209 + * @param pkt packet
5211 +void av_packet_free_side_data(AVPacket *pkt);
5214 + * Setup a new reference to the data described by a given packet
5216 + * If src is reference-counted, setup dst as a new reference to the
5217 + * buffer in src. Otherwise allocate a new buffer in dst and copy the
5218 + * data from src into it.
5220 + * All the other fields are copied from src.
5222 + * @see av_packet_unref
5224 + * @param dst Destination packet
5225 + * @param src Source packet
5227 + * @return 0 on success, a negative AVERROR on error.
5229 +int av_packet_ref(AVPacket *dst, const AVPacket *src);
5232 + * Wipe the packet.
5234 + * Unreference the buffer referenced by the packet and reset the
5235 + * remaining packet fields to their default values.
5237 + * @param pkt The packet to be unreferenced.
5239 +void av_packet_unref(AVPacket *pkt);
5242 + * Move every field in src to dst and reset src.
5244 + * @see av_packet_unref
5246 + * @param src Source packet, will be reset
5247 + * @param dst Destination packet
5249 +void av_packet_move_ref(AVPacket *dst, AVPacket *src);
5252 + * Copy only "properties" fields from src to dst.
5254 + * Properties for the purpose of this function are all the fields
5255 + * beside those related to the packet data (buf, data, size)
5257 + * @param dst Destination packet
5258 + * @param src Source packet
5260 + * @return 0 on success AVERROR on failure.
5262 +int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
5265 + * Ensure the data described by a given packet is reference counted.
5267 + * @note This function does not ensure that the reference will be writable.
5268 + * Use av_packet_make_writable instead for that purpose.
5270 + * @see av_packet_ref
5271 + * @see av_packet_make_writable
5273 + * @param pkt packet whose data should be made reference counted.
5275 + * @return 0 on success, a negative AVERROR on error. On failure, the
5276 + * packet is unchanged.
5278 +int av_packet_make_refcounted(AVPacket *pkt);
5281 + * Create a writable reference for the data described by a given packet,
5282 + * avoiding data copy if possible.
5284 + * @param pkt Packet whose data should be made writable.
5286 + * @return 0 on success, a negative AVERROR on failure. On failure, the
5287 + * packet is unchanged.
5289 +int av_packet_make_writable(AVPacket *pkt);
5292 + * Convert valid timing fields (timestamps / durations) in a packet from one
5293 + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
5296 + * @param pkt packet on which the conversion will be performed
5297 + * @param tb_src source timebase, in which the timing fields in pkt are
5299 + * @param tb_dst destination timebase, to which the timing fields will be
5302 +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
5309 + * @addtogroup lavc_decoding
5314 + * Find a registered decoder with a matching codec ID.
5316 + * @param id AVCodecID of the requested decoder
5317 + * @return A decoder if one was found, NULL otherwise.
5319 +AVCodec *avcodec_find_decoder(enum AVCodecID id);
5322 + * Find a registered decoder with the specified name.
5324 + * @param name name of the requested decoder
5325 + * @return A decoder if one was found, NULL otherwise.
5327 +AVCodec *avcodec_find_decoder_by_name(const char *name);
5330 + * The default callback for AVCodecContext.get_buffer2(). It is made public so
5331 + * it can be called by custom get_buffer2() implementations for decoders without
5332 + * AV_CODEC_CAP_DR1 set.
5334 +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
5337 + * Modify width and height values so that they will result in a memory
5338 + * buffer that is acceptable for the codec if you do not use any horizontal
5341 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5343 +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
5346 + * Modify width and height values so that they will result in a memory
5347 + * buffer that is acceptable for the codec if you also ensure that all
5348 + * line sizes are a multiple of the respective linesize_align[i].
5350 + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5352 +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
5353 + int linesize_align[AV_NUM_DATA_POINTERS]);
5356 + * Converts AVChromaLocation to swscale x/y chroma position.
5358 + * The positions represent the chroma (0,0) position in a coordinates system
5359 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5361 + * @param xpos horizontal chroma sample position
5362 + * @param ypos vertical chroma sample position
5364 +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
5367 + * Converts swscale x/y chroma position to AVChromaLocation.
5369 + * The positions represent the chroma (0,0) position in a coordinates system
5370 + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5372 + * @param xpos horizontal chroma sample position
5373 + * @param ypos vertical chroma sample position
5375 +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
5378 + * Decode the audio frame of size avpkt->size from avpkt->data into frame.
5380 + * Some decoders may support multiple frames in a single AVPacket. Such
5381 + * decoders would then just decode the first frame and the return value would be
5382 + * less than the packet size. In this case, avcodec_decode_audio4 has to be
5383 + * called again with an AVPacket containing the remaining data in order to
5384 + * decode the second frame, etc... Even if no frames are returned, the packet
5385 + * needs to be fed to the decoder with remaining data until it is completely
5386 + * consumed or an error occurs.
5388 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5389 + * and output. This means that for some packets they will not immediately
5390 + * produce decoded output and need to be flushed at the end of decoding to get
5391 + * all the decoded data. Flushing is done by calling this function with packets
5392 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5393 + * returning samples. It is safe to flush even those decoders that are not
5394 + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
5396 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5397 + * larger than the actual read bytes because some optimized bitstream
5398 + * readers read 32 or 64 bits at once and could read over the end.
5400 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5401 + * before packets may be fed to the decoder.
5403 + * @param avctx the codec context
5404 + * @param[out] frame The AVFrame in which to store decoded audio samples.
5405 + * The decoder will allocate a buffer for the decoded frame by
5406 + * calling the AVCodecContext.get_buffer2() callback.
5407 + * When AVCodecContext.refcounted_frames is set to 1, the frame is
5408 + * reference counted and the returned reference belongs to the
5409 + * caller. The caller must release the frame using av_frame_unref()
5410 + * when the frame is no longer needed. The caller may safely write
5411 + * to the frame if av_frame_is_writable() returns 1.
5412 + * When AVCodecContext.refcounted_frames is set to 0, the returned
5413 + * reference belongs to the decoder and is valid only until the
5414 + * next call to this function or until closing or flushing the
5415 + * decoder. The caller may not write to it.
5416 + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
5417 + * non-zero. Note that this field being set to zero
5418 + * does not mean that an error has occurred. For
5419 + * decoders with AV_CODEC_CAP_DELAY set, no given decode
5420 + * call is guaranteed to produce a frame.
5421 + * @param[in] avpkt The input AVPacket containing the input buffer.
5422 + * At least avpkt->data and avpkt->size should be set. Some
5423 + * decoders might also require additional fields to be set.
5424 + * @return A negative error code is returned if an error occurred during
5425 + * decoding, otherwise the number of bytes consumed from the input
5426 + * AVPacket is returned.
5428 +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5430 +attribute_deprecated
5431 +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
5432 + int *got_frame_ptr, const AVPacket *avpkt);
5435 + * Decode the video frame of size avpkt->size from avpkt->data into picture.
5436 + * Some decoders may support multiple frames in a single AVPacket, such
5437 + * decoders would then just decode the first frame.
5439 + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
5440 + * the actual read bytes because some optimized bitstream readers read 32 or 64
5441 + * bits at once and could read over the end.
5443 + * @warning The end of the input buffer buf should be set to 0 to ensure that
5444 + * no overreading happens for damaged MPEG streams.
5446 + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
5447 + * between input and output, these need to be fed with avpkt->data=NULL,
5448 + * avpkt->size=0 at the end to return the remaining frames.
5450 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5451 + * before packets may be fed to the decoder.
5453 + * @param avctx the codec context
5454 + * @param[out] picture The AVFrame in which the decoded video frame will be stored.
5455 + * Use av_frame_alloc() to get an AVFrame. The codec will
5456 + * allocate memory for the actual bitmap by calling the
5457 + * AVCodecContext.get_buffer2() callback.
5458 + * When AVCodecContext.refcounted_frames is set to 1, the frame is
5459 + * reference counted and the returned reference belongs to the
5460 + * caller. The caller must release the frame using av_frame_unref()
5461 + * when the frame is no longer needed. The caller may safely write
5462 + * to the frame if av_frame_is_writable() returns 1.
5463 + * When AVCodecContext.refcounted_frames is set to 0, the returned
5464 + * reference belongs to the decoder and is valid only until the
5465 + * next call to this function or until closing or flushing the
5466 + * decoder. The caller may not write to it.
5468 + * @param[in] avpkt The input AVPacket containing the input buffer.
5469 + * You can create such packet with av_init_packet() and by then setting
5470 + * data and size, some decoders might in addition need other fields like
5471 + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
5472 + * fields possible.
5473 + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
5474 + * @return On error a negative value is returned, otherwise the number of bytes
5475 + * used or zero if no frame could be decompressed.
5477 + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5479 +attribute_deprecated
5480 +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
5481 + int *got_picture_ptr,
5482 + const AVPacket *avpkt);
5485 + * Decode a subtitle message.
5486 + * Return a negative value on error, otherwise return the number of bytes used.
5487 + * If no subtitle could be decompressed, got_sub_ptr is zero.
5488 + * Otherwise, the subtitle is stored in *sub.
5489 + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
5490 + * simplicity, because the performance difference is expect to be negligible
5491 + * and reusing a get_buffer written for video codecs would probably perform badly
5492 + * due to a potentially very different allocation pattern.
5494 + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5495 + * and output. This means that for some packets they will not immediately
5496 + * produce decoded output and need to be flushed at the end of decoding to get
5497 + * all the decoded data. Flushing is done by calling this function with packets
5498 + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5499 + * returning subtitles. It is safe to flush even those decoders that are not
5500 + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
5502 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5503 + * before packets may be fed to the decoder.
5505 + * @param avctx the codec context
5506 + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
5507 + * must be freed with avsubtitle_free if *got_sub_ptr is set.
5508 + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
5509 + * @param[in] avpkt The input AVPacket containing the input buffer.
5511 +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
5516 + * Supply raw packet data as input to a decoder.
5518 + * Internally, this call will copy relevant AVCodecContext fields, which can
5519 + * influence decoding per-packet, and apply them when the packet is actually
5520 + * decoded. (For example AVCodecContext.skip_frame, which might direct the
5521 + * decoder to drop the frame contained by the packet sent with this function.)
5523 + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5524 + * larger than the actual read bytes because some optimized bitstream
5525 + * readers read 32 or 64 bits at once and could read over the end.
5527 + * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
5528 + * on the same AVCodecContext. It will return unexpected results now
5529 + * or in future libavcodec versions.
5531 + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5532 + * before packets may be fed to the decoder.
5534 + * @param avctx codec context
5535 + * @param[in] avpkt The input AVPacket. Usually, this will be a single video
5536 + * frame, or several complete audio frames.
5537 + * Ownership of the packet remains with the caller, and the
5538 + * decoder will not write to the packet. The decoder may create
5539 + * a reference to the packet data (or copy it if the packet is
5540 + * not reference-counted).
5541 + * Unlike with older APIs, the packet is always fully consumed,
5542 + * and if it contains multiple frames (e.g. some audio codecs),
5543 + * will require you to call avcodec_receive_frame() multiple
5544 + * times afterwards before you can send a new packet.
5545 + * It can be NULL (or an AVPacket with data set to NULL and
5546 + * size set to 0); in this case, it is considered a flush
5547 + * packet, which signals the end of the stream. Sending the
5548 + * first flush packet will return success. Subsequent ones are
5549 + * unnecessary and will return AVERROR_EOF. If the decoder
5550 + * still has frames buffered, it will return them after sending
5553 + * @return 0 on success, otherwise negative error code:
5554 + * AVERROR(EAGAIN): input is not accepted in the current state - user
5555 + * must read output with avcodec_receive_frame() (once
5556 + * all output is read, the packet should be resent, and
5557 + * the call will not fail with EAGAIN).
5558 + * AVERROR_EOF: the decoder has been flushed, and no new packets can
5559 + * be sent to it (also returned if more than 1 flush
5561 + * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush
5562 + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
5563 + * other errors: legitimate decoding errors
5565 +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
5568 + * Return decoded output data from a decoder.
5570 + * @param avctx codec context
5571 + * @param frame This will be set to a reference-counted video or audio
5572 + * frame (depending on the decoder type) allocated by the
5573 + * decoder. Note that the function will always call
5574 + * av_frame_unref(frame) before doing anything else.
5577 + * 0: success, a frame was returned
5578 + * AVERROR(EAGAIN): output is not available in this state - user must try
5579 + * to send new input
5580 + * AVERROR_EOF: the decoder has been fully flushed, and there will be
5581 + * no more output frames
5582 + * AVERROR(EINVAL): codec not opened, or it is an encoder
5583 + * other negative values: legitimate decoding errors
5585 +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
5588 + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
5589 + * to retrieve buffered output packets.
5591 + * @param avctx codec context
5592 + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
5593 + * Ownership of the frame remains with the caller, and the
5594 + * encoder will not write to the frame. The encoder may create
5595 + * a reference to the frame data (or copy it if the frame is
5596 + * not reference-counted).
5597 + * It can be NULL, in which case it is considered a flush
5598 + * packet. This signals the end of the stream. If the encoder
5599 + * still has packets buffered, it will return them after this
5600 + * call. Once flushing mode has been entered, additional flush
5601 + * packets are ignored, and sending frames will return
5605 + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
5606 + * can have any number of samples.
5607 + * If it is not set, frame->nb_samples must be equal to
5608 + * avctx->frame_size for all frames except the last.
5609 + * The final frame may be smaller than avctx->frame_size.
5610 + * @return 0 on success, otherwise negative error code:
5611 + * AVERROR(EAGAIN): input is not accepted in the current state - user
5612 + * must read output with avcodec_receive_packet() (once
5613 + * all output is read, the packet should be resent, and
5614 + * the call will not fail with EAGAIN).
5615 + * AVERROR_EOF: the encoder has been flushed, and no new frames can
5617 + * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a
5618 + * decoder, or requires flush
5619 + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
5620 + * other errors: legitimate decoding errors
5622 +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
5625 + * Read encoded data from the encoder.
5627 + * @param avctx codec context
5628 + * @param avpkt This will be set to a reference-counted packet allocated by the
5629 + * encoder. Note that the function will always call
5630 + * av_frame_unref(frame) before doing anything else.
5631 + * @return 0 on success, otherwise negative error code:
5632 + * AVERROR(EAGAIN): output is not available in the current state - user
5633 + * must try to send input
5634 + * AVERROR_EOF: the encoder has been fully flushed, and there will be
5635 + * no more output packets
5636 + * AVERROR(EINVAL): codec not opened, or it is an encoder
5637 + * other errors: legitimate decoding errors
5639 +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
5642 + * Create and return a AVHWFramesContext with values adequate for hardware
5643 + * decoding. This is meant to get called from the get_format callback, and is
5644 + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
5645 + * This API is for decoding with certain hardware acceleration modes/APIs only.
5647 + * The returned AVHWFramesContext is not initialized. The caller must do this
5648 + * with av_hwframe_ctx_init().
5650 + * Calling this function is not a requirement, but makes it simpler to avoid
5651 + * codec or hardware API specific details when manually allocating frames.
5653 + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
5654 + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
5655 + * it unnecessary to call this function or having to care about
5656 + * AVHWFramesContext initialization at all.
5658 + * There are a number of requirements for calling this function:
5660 + * - It must be called from get_format with the same avctx parameter that was
5661 + * passed to get_format. Calling it outside of get_format is not allowed, and
5662 + * can trigger undefined behavior.
5663 + * - The function is not always supported (see description of return values).
5664 + * Even if this function returns successfully, hwaccel initialization could
5665 + * fail later. (The degree to which implementations check whether the stream
5666 + * is actually supported varies. Some do this check only after the user's
5667 + * get_format callback returns.)
5668 + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
5669 + * user decides to use a AVHWFramesContext prepared with this API function,
5670 + * the user must return the same hw_pix_fmt from get_format.
5671 + * - The device_ref passed to this function must support the given hw_pix_fmt.
5672 + * - After calling this API function, it is the user's responsibility to
5673 + * initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
5674 + * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
5675 + * before returning from get_format (this is implied by the normal
5676 + * AVCodecContext.hw_frames_ctx API rules).
5677 + * - The AVHWFramesContext parameters may change every time time get_format is
5678 + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
5679 + * you are inherently required to go through this process again on every
5680 + * get_format call.
5681 + * - It is perfectly possible to call this function without actually using
5682 + * the resulting AVHWFramesContext. One use-case might be trying to reuse a
5683 + * previously initialized AVHWFramesContext, and calling this API function
5684 + * only to test whether the required frame parameters have changed.
5685 + * - Fields that use dynamically allocated values of any kind must not be set
5686 + * by the user unless setting them is explicitly allowed by the documentation.
5687 + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
5688 + * the new free callback must call the potentially set previous free callback.
5689 + * This API call may set any dynamically allocated fields, including the free
5692 + * The function will set at least the following fields on AVHWFramesContext
5693 + * (potentially more, depending on hwaccel API):
5695 + * - All fields set by av_hwframe_ctx_alloc().
5696 + * - Set the format field to hw_pix_fmt.
5697 + * - Set the sw_format field to the most suited and most versatile format. (An
5698 + * implication is that this will prefer generic formats over opaque formats
5699 + * with arbitrary restrictions, if possible.)
5700 + * - Set the width/height fields to the coded frame size, rounded up to the
5701 + * API-specific minimum alignment.
5702 + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
5703 + * field to the number of maximum reference surfaces possible with the codec,
5704 + * plus 1 surface for the user to work (meaning the user can safely reference
5705 + * at most 1 decoded surface at a time), plus additional buffering introduced
5706 + * by frame threading. If the hwaccel does not require pre-allocation, the
5707 + * field is left to 0, and the decoder will allocate new surfaces on demand
5708 + * during decoding.
5709 + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
5712 + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
5713 + * with basic frame parameters set.
5715 + * The function is stateless, and does not change the AVCodecContext or the
5716 + * device_ref AVHWDeviceContext.
5718 + * @param avctx The context which is currently calling get_format, and which
5719 + * implicitly contains all state needed for filling the returned
5720 + * AVHWFramesContext properly.
5721 + * @param device_ref A reference to the AVHWDeviceContext describing the device
5722 + * which will be used by the hardware decoder.
5723 + * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
5724 + * @param out_frames_ref On success, set to a reference to an _uninitialized_
5725 + * AVHWFramesContext, created from the given device_ref.
5726 + * Fields will be set to values required for decoding.
5727 + * Not changed if an error is returned.
5728 + * @return zero on success, a negative value on error. The following error codes
5729 + * have special semantics:
5730 + * AVERROR(ENOENT): the decoder does not support this functionality. Setup
5731 + * is always manual, or it is a decoder which does not
5732 + * support setting AVCodecContext.hw_frames_ctx at all,
5733 + * or it is a software format.
5734 + * AVERROR(EINVAL): it is known that hardware decoding is not supported for
5735 + * this configuration, or the device_ref is not supported
5736 + * for the hwaccel referenced by hw_pix_fmt.
5738 +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
5739 + AVBufferRef *device_ref,
5740 + enum AVPixelFormat hw_pix_fmt,
5741 + AVBufferRef **out_frames_ref);
5746 + * @defgroup lavc_parsing Frame parsing
5750 +enum AVPictureStructure {
5751 + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown
5752 + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field
5753 + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
5754 + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame
5757 +typedef struct AVCodecParserContext {
5759 + struct AVCodecParser *parser;
5760 + int64_t frame_offset; /* offset of the current frame */
5761 + int64_t cur_offset; /* current offset
5762 + (incremented by each av_parser_parse()) */
5763 + int64_t next_frame_offset; /* offset of the next frame */
5765 + int pict_type; /* XXX: Put it back in AVCodecContext. */
5767 + * This field is used for proper frame duration computation in lavf.
5768 + * It signals, how much longer the frame duration of the current frame
5769 + * is compared to normal frame duration.
5771 + * frame_duration = (1 + repeat_pict) * time_base
5773 + * It is used by codecs like H.264 to display telecined material.
5775 + int repeat_pict; /* XXX: Put it back in AVCodecContext. */
5776 + int64_t pts; /* pts of the current frame */
5777 + int64_t dts; /* dts of the current frame */
5779 + /* private data */
5782 + int fetch_timestamp;
5784 +#define AV_PARSER_PTS_NB 4
5785 + int cur_frame_start_index;
5786 + int64_t cur_frame_offset[AV_PARSER_PTS_NB];
5787 + int64_t cur_frame_pts[AV_PARSER_PTS_NB];
5788 + int64_t cur_frame_dts[AV_PARSER_PTS_NB];
5791 +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
5792 +#define PARSER_FLAG_ONCE 0x0002
5793 +/// Set if the parser has a valid file offset
5794 +#define PARSER_FLAG_FETCHED_OFFSET 0x0004
5795 +#define PARSER_FLAG_USE_CODEC_TS 0x1000
5797 + int64_t offset; ///< byte offset from starting packet start
5798 + int64_t cur_frame_end[AV_PARSER_PTS_NB];
5801 + * Set by parser to 1 for key frames and 0 for non-key frames.
5802 + * It is initialized to -1, so if the parser doesn't set this flag,
5803 + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
5808 +#if FF_API_CONVERGENCE_DURATION
5810 + * @deprecated unused
5812 + attribute_deprecated
5813 + int64_t convergence_duration;
5816 + // Timestamp generation support:
5818 + * Synchronization point for start of timestamp generation.
5820 + * Set to >0 for sync point, 0 for no sync point and <0 for undefined
5823 + * For example, this corresponds to presence of H.264 buffering period
5826 + int dts_sync_point;
5829 + * Offset of the current timestamp against last timestamp sync point in
5830 + * units of AVCodecContext.time_base.
5832 + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5833 + * contain a valid timestamp offset.
5835 + * Note that the timestamp of sync point has usually a nonzero
5836 + * dts_ref_dts_delta, which refers to the previous sync point. Offset of
5837 + * the next frame after timestamp sync point will be usually 1.
5839 + * For example, this corresponds to H.264 cpb_removal_delay.
5841 + int dts_ref_dts_delta;
5844 + * Presentation delay of current frame in units of AVCodecContext.time_base.
5846 + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5847 + * contain valid non-negative timestamp delta (presentation time of a frame
5848 + * must not lie in the past).
5850 + * This delay represents the difference between decoding and presentation
5851 + * time of the frame.
5853 + * For example, this corresponds to H.264 dpb_output_delay.
5855 + int pts_dts_delta;
5858 + * Position of the packet in file.
5860 + * Analogous to cur_frame_pts/dts
5862 + int64_t cur_frame_pos[AV_PARSER_PTS_NB];
5865 + * Byte position of currently parsed frame in stream.
5870 + * Previous frame byte position.
5875 + * Duration of the current frame.
5876 + * For audio, this is in units of 1 / AVCodecContext.sample_rate.
5877 + * For all other types, this is in units of AVCodecContext.time_base.
5881 + enum AVFieldOrder field_order;
5884 + * Indicate whether a picture is coded as a frame, top field or bottom field.
5886 + * For example, H.264 field_pic_flag equal to 0 corresponds to
5887 + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
5888 + * equal to 1 and bottom_field_flag equal to 0 corresponds to
5889 + * AV_PICTURE_STRUCTURE_TOP_FIELD.
5891 + enum AVPictureStructure picture_structure;
5894 + * Picture number incremented in presentation or output order.
5895 + * This field may be reinitialized at the first picture of a new sequence.
5897 + * For example, this corresponds to H.264 PicOrderCnt.
5899 + int output_picture_number;
5902 + * Dimensions of the decoded video intended for presentation.
5908 + * Dimensions of the coded video.
5914 + * The format of the coded data, corresponds to enum AVPixelFormat for video
5915 + * and for enum AVSampleFormat for audio.
5917 + * Note that a decoder can have considerable freedom in how exactly it
5918 + * decodes the data, so the format reported here might be different from the
5919 + * one returned by a decoder.
5922 +} AVCodecParserContext;
5924 +typedef struct AVCodecParser {
5925 + int codec_ids[5]; /* several codec IDs are permitted */
5926 + int priv_data_size;
5927 + int (*parser_init)(AVCodecParserContext *s);
5928 + /* This callback never returns an error, a negative value means that
5929 + * the frame start was in a previous packet. */
5930 + int (*parser_parse)(AVCodecParserContext *s,
5931 + AVCodecContext *avctx,
5932 + const uint8_t **poutbuf, int *poutbuf_size,
5933 + const uint8_t *buf, int buf_size);
5934 + void (*parser_close)(AVCodecParserContext *s);
5935 + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
5936 + struct AVCodecParser *next;
5940 + * Iterate over all registered codec parsers.
5942 + * @param opaque a pointer where libavcodec will store the iteration state. Must
5943 + * point to NULL to start the iteration.
5945 + * @return the next registered codec parser or NULL when the iteration is
5948 +const AVCodecParser *av_parser_iterate(void **opaque);
5950 +attribute_deprecated
5951 +AVCodecParser *av_parser_next(const AVCodecParser *c);
5953 +attribute_deprecated
5954 +void av_register_codec_parser(AVCodecParser *parser);
5955 +AVCodecParserContext *av_parser_init(int codec_id);
5960 + * @param s parser context.
5961 + * @param avctx codec context.
5962 + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
5963 + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
5964 + * @param buf input buffer.
5965 + * @param buf_size buffer size in bytes without the padding. I.e. the full buffer
5966 + size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
5967 + To signal EOF, this should be 0 (so that the last frame
5969 + * @param pts input presentation timestamp.
5970 + * @param dts input decoding timestamp.
5971 + * @param pos input byte position in stream.
5972 + * @return the number of bytes of the input bitstream used.
5977 + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
5978 + * in_data, in_len,
5984 + * decode_frame(data, size);
5988 +int av_parser_parse2(AVCodecParserContext *s,
5989 + AVCodecContext *avctx,
5990 + uint8_t **poutbuf, int *poutbuf_size,
5991 + const uint8_t *buf, int buf_size,
5992 + int64_t pts, int64_t dts,
5996 + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
5997 + * @deprecated use AVBitStreamFilter
5999 +int av_parser_change(AVCodecParserContext *s,
6000 + AVCodecContext *avctx,
6001 + uint8_t **poutbuf, int *poutbuf_size,
6002 + const uint8_t *buf, int buf_size, int keyframe);
6003 +void av_parser_close(AVCodecParserContext *s);
6011 + * @addtogroup lavc_encoding
6016 + * Find a registered encoder with a matching codec ID.
6018 + * @param id AVCodecID of the requested encoder
6019 + * @return An encoder if one was found, NULL otherwise.
6021 +AVCodec *avcodec_find_encoder(enum AVCodecID id);
6024 + * Find a registered encoder with the specified name.
6026 + * @param name name of the requested encoder
6027 + * @return An encoder if one was found, NULL otherwise.
6029 +AVCodec *avcodec_find_encoder_by_name(const char *name);
6032 + * Encode a frame of audio.
6034 + * Takes input samples from frame and writes the next output packet, if
6035 + * available, to avpkt. The output packet does not necessarily contain data for
6036 + * the most recent frame, as encoders can delay, split, and combine input frames
6037 + * internally as needed.
6039 + * @param avctx codec context
6040 + * @param avpkt output AVPacket.
6041 + * The user can supply an output buffer by setting
6042 + * avpkt->data and avpkt->size prior to calling the
6043 + * function, but if the size of the user-provided data is not
6044 + * large enough, encoding will fail. If avpkt->data and
6045 + * avpkt->size are set, avpkt->destruct must also be set. All
6046 + * other AVPacket fields will be reset by the encoder using
6047 + * av_init_packet(). If avpkt->data is NULL, the encoder will
6048 + * allocate it. The encoder will set avpkt->size to the size
6049 + * of the output packet.
6051 + * If this function fails or produces no output, avpkt will be
6052 + * freed using av_packet_unref().
6053 + * @param[in] frame AVFrame containing the raw audio data to be encoded.
6054 + * May be NULL when flushing an encoder that has the
6055 + * AV_CODEC_CAP_DELAY capability set.
6056 + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
6057 + * can have any number of samples.
6058 + * If it is not set, frame->nb_samples must be equal to
6059 + * avctx->frame_size for all frames except the last.
6060 + * The final frame may be smaller than avctx->frame_size.
6061 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6062 + * output packet is non-empty, and to 0 if it is
6063 + * empty. If the function returns an error, the
6064 + * packet can be assumed to be invalid, and the
6065 + * value of got_packet_ptr is undefined and should
6067 + * @return 0 on success, negative error code on failure
6069 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6071 +attribute_deprecated
6072 +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
6073 + const AVFrame *frame, int *got_packet_ptr);
6076 + * Encode a frame of video.
6078 + * Takes input raw video data from frame and writes the next output packet, if
6079 + * available, to avpkt. The output packet does not necessarily contain data for
6080 + * the most recent frame, as encoders can delay and reorder input frames
6081 + * internally as needed.
6083 + * @param avctx codec context
6084 + * @param avpkt output AVPacket.
6085 + * The user can supply an output buffer by setting
6086 + * avpkt->data and avpkt->size prior to calling the
6087 + * function, but if the size of the user-provided data is not
6088 + * large enough, encoding will fail. All other AVPacket fields
6089 + * will be reset by the encoder using av_init_packet(). If
6090 + * avpkt->data is NULL, the encoder will allocate it.
6091 + * The encoder will set avpkt->size to the size of the
6092 + * output packet. The returned data (if any) belongs to the
6093 + * caller, he is responsible for freeing it.
6095 + * If this function fails or produces no output, avpkt will be
6096 + * freed using av_packet_unref().
6097 + * @param[in] frame AVFrame containing the raw video data to be encoded.
6098 + * May be NULL when flushing an encoder that has the
6099 + * AV_CODEC_CAP_DELAY capability set.
6100 + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6101 + * output packet is non-empty, and to 0 if it is
6102 + * empty. If the function returns an error, the
6103 + * packet can be assumed to be invalid, and the
6104 + * value of got_packet_ptr is undefined and should
6106 + * @return 0 on success, negative error code on failure
6108 + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6110 +attribute_deprecated
6111 +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
6112 + const AVFrame *frame, int *got_packet_ptr);
6114 +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
6115 + const AVSubtitle *sub);
6122 +#if FF_API_AVPICTURE
6124 + * @addtogroup lavc_picture
6129 + * @deprecated unused
6131 +attribute_deprecated
6132 +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
6135 + * @deprecated unused
6137 +attribute_deprecated
6138 +void avpicture_free(AVPicture *picture);
6141 + * @deprecated use av_image_fill_arrays() instead.
6143 +attribute_deprecated
6144 +int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
6145 + enum AVPixelFormat pix_fmt, int width, int height);
6148 + * @deprecated use av_image_copy_to_buffer() instead.
6150 +attribute_deprecated
6151 +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
6152 + int width, int height,
6153 + unsigned char *dest, int dest_size);
6156 + * @deprecated use av_image_get_buffer_size() instead.
6158 +attribute_deprecated
6159 +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
6162 + * @deprecated av_image_copy() instead.
6164 +attribute_deprecated
6165 +void av_picture_copy(AVPicture *dst, const AVPicture *src,
6166 + enum AVPixelFormat pix_fmt, int width, int height);
6169 + * @deprecated unused
6171 +attribute_deprecated
6172 +int av_picture_crop(AVPicture *dst, const AVPicture *src,
6173 + enum AVPixelFormat pix_fmt, int top_band, int left_band);
6176 + * @deprecated unused
6178 +attribute_deprecated
6179 +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
6180 + int padtop, int padbottom, int padleft, int padright, int *color);
6188 + * @defgroup lavc_misc Utility functions
6191 + * Miscellaneous utility functions related to both encoding and decoding
6197 + * @defgroup lavc_misc_pixfmt Pixel formats
6199 + * Functions for working with pixel formats.
6203 +#if FF_API_GETCHROMA
6205 + * @deprecated Use av_pix_fmt_get_chroma_sub_sample
6208 +attribute_deprecated
6209 +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
6213 + * Return a value representing the fourCC code associated to the
6214 + * pixel format pix_fmt, or 0 if no associated fourCC code can be
6217 +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
6220 + * @deprecated see av_get_pix_fmt_loss()
6222 +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
6226 + * Find the best pixel format to convert to given a certain source pixel
6227 + * format. When converting from one pixel format to another, information loss
6228 + * may occur. For example, when converting from RGB24 to GRAY, the color
6229 + * information will be lost. Similarly, other losses occur when converting from
6230 + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
6231 + * the given pixel formats should be used to suffer the least amount of loss.
6232 + * The pixel formats from which it chooses one, are determined by the
6233 + * pix_fmt_list parameter.
6236 + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
6237 + * @param[in] src_pix_fmt source pixel format
6238 + * @param[in] has_alpha Whether the source pixel format alpha channel is used.
6239 + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
6240 + * @return The best pixel format to convert to or -1 if none was found.
6242 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
6243 + enum AVPixelFormat src_pix_fmt,
6244 + int has_alpha, int *loss_ptr);
6247 + * @deprecated see av_find_best_pix_fmt_of_2()
6249 +enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6250 + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6252 +attribute_deprecated
6253 +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6254 + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6256 +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
6262 +#if FF_API_TAG_STRING
6264 + * Put a string representing the codec tag codec_tag in buf.
6266 + * @param buf buffer to place codec tag in
6267 + * @param buf_size size in bytes of buf
6268 + * @param codec_tag codec tag to assign
6269 + * @return the length of the string that would have been generated if
6270 + * enough space had been available, excluding the trailing null
6272 + * @deprecated see av_fourcc_make_string() and av_fourcc2str().
6274 +attribute_deprecated
6275 +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
6278 +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
6281 + * Return a name for the specified profile, if available.
6283 + * @param codec the codec that is searched for the given profile
6284 + * @param profile the profile value for which a name is requested
6285 + * @return A name for the profile if found, NULL otherwise.
6287 +const char *av_get_profile_name(const AVCodec *codec, int profile);
6290 + * Return a name for the specified profile, if available.
6292 + * @param codec_id the ID of the codec to which the requested profile belongs
6293 + * @param profile the profile value for which a name is requested
6294 + * @return A name for the profile if found, NULL otherwise.
6296 + * @note unlike av_get_profile_name(), which searches a list of profiles
6297 + * supported by a specific decoder or encoder implementation, this
6298 + * function searches the list of profiles from the AVCodecDescriptor
6300 +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
6302 +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
6303 +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
6304 +//FIXME func typedef
6307 + * Fill AVFrame audio data and linesize pointers.
6309 + * The buffer buf must be a preallocated buffer with a size big enough
6310 + * to contain the specified samples amount. The filled AVFrame data
6311 + * pointers will point to this buffer.
6313 + * AVFrame extended_data channel pointers are allocated if necessary for
6316 + * @param frame the AVFrame
6317 + * frame->nb_samples must be set prior to calling the
6318 + * function. This function fills in frame->data,
6319 + * frame->extended_data, frame->linesize[0].
6320 + * @param nb_channels channel count
6321 + * @param sample_fmt sample format
6322 + * @param buf buffer to use for frame data
6323 + * @param buf_size size of buffer
6324 + * @param align plane size sample alignment (0 = default)
6325 + * @return >=0 on success, negative error code on failure
6326 + * @todo return the size in bytes required to store the samples in
6327 + * case of success, at the next libavutil bump
6329 +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
6330 + enum AVSampleFormat sample_fmt, const uint8_t *buf,
6331 + int buf_size, int align);
6334 + * Reset the internal decoder state / flush internal buffers. Should be called
6335 + * e.g. when seeking or when switching to a different stream.
6337 + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
6338 + * this invalidates the frames previously returned from the decoder. When
6339 + * refcounted frames are used, the decoder just releases any references it might
6340 + * keep internally, but the caller's reference remains valid.
6342 +void avcodec_flush_buffers(AVCodecContext *avctx);
6345 + * Return codec bits per sample.
6347 + * @param[in] codec_id the codec
6348 + * @return Number of bits per sample or zero if unknown for the given codec.
6350 +int av_get_bits_per_sample(enum AVCodecID codec_id);
6353 + * Return the PCM codec associated with a sample format.
6354 + * @param be endianness, 0 for little, 1 for big,
6355 + * -1 (or anything else) for native
6356 + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
6358 +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
6361 + * Return codec bits per sample.
6362 + * Only return non-zero if the bits per sample is exactly correct, not an
6365 + * @param[in] codec_id the codec
6366 + * @return Number of bits per sample or zero if unknown for the given codec.
6368 +int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
6371 + * Return audio frame duration.
6373 + * @param avctx codec context
6374 + * @param frame_bytes size of the frame, or 0 if unknown
6375 + * @return frame duration, in samples, if known. 0 if not able to
6378 +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
6381 + * This function is the same as av_get_audio_frame_duration(), except it works
6382 + * with AVCodecParameters instead of an AVCodecContext.
6384 +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
6387 +typedef struct AVBitStreamFilterContext {
6389 + const struct AVBitStreamFilter *filter;
6390 + AVCodecParserContext *parser;
6391 + struct AVBitStreamFilterContext *next;
6393 + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
6394 + * Not for access by library users.
6397 +} AVBitStreamFilterContext;
6400 +typedef struct AVBSFInternal AVBSFInternal;
6403 + * The bitstream filter state.
6405 + * This struct must be allocated with av_bsf_alloc() and freed with
6408 + * The fields in the struct will only be changed (by the caller or by the
6409 + * filter) as described in their documentation, and are to be considered
6410 + * immutable otherwise.
6412 +typedef struct AVBSFContext {
6414 + * A class for logging and AVOptions
6416 + const AVClass *av_class;
6419 + * The bitstream filter this context is an instance of.
6421 + const struct AVBitStreamFilter *filter;
6424 + * Opaque libavcodec internal data. Must not be touched by the caller in any
6427 + AVBSFInternal *internal;
6430 + * Opaque filter-specific private data. If filter->priv_class is non-NULL,
6431 + * this is an AVOptions-enabled struct.
6436 + * Parameters of the input stream. This field is allocated in
6437 + * av_bsf_alloc(), it needs to be filled by the caller before
6440 + AVCodecParameters *par_in;
6443 + * Parameters of the output stream. This field is allocated in
6444 + * av_bsf_alloc(), it is set by the filter in av_bsf_init().
6446 + AVCodecParameters *par_out;
6449 + * The timebase used for the timestamps of the input packets. Set by the
6450 + * caller before av_bsf_init().
6452 + AVRational time_base_in;
6455 + * The timebase used for the timestamps of the output packets. Set by the
6456 + * filter in av_bsf_init().
6458 + AVRational time_base_out;
6461 +typedef struct AVBitStreamFilter {
6465 + * A list of codec ids supported by the filter, terminated by
6466 + * AV_CODEC_ID_NONE.
6467 + * May be NULL, in that case the bitstream filter works with any codec id.
6469 + const enum AVCodecID *codec_ids;
6472 + * A class for the private data, used to declare bitstream filter private
6473 + * AVOptions. This field is NULL for bitstream filters that do not declare
6476 + * If this field is non-NULL, the first member of the filter private data
6477 + * must be a pointer to AVClass, which will be set by libavcodec generic
6478 + * code to this class.
6480 + const AVClass *priv_class;
6482 + /*****************************************************************
6483 + * No fields below this line are part of the public API. They
6484 + * may not be used outside of libavcodec and can be changed and
6485 + * removed at will.
6486 + * New public fields should be added right above.
6487 + *****************************************************************
6490 + int priv_data_size;
6491 + int (*init)(AVBSFContext *ctx);
6492 + int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
6493 + void (*close)(AVBSFContext *ctx);
6494 +} AVBitStreamFilter;
6498 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6499 + * is deprecated. Use the new bitstream filtering API (using AVBSFContext).
6501 +attribute_deprecated
6502 +void av_register_bitstream_filter(AVBitStreamFilter *bsf);
6504 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6505 + * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init()
6506 + * from the new bitstream filtering API (using AVBSFContext).
6508 +attribute_deprecated
6509 +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
6511 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6512 + * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the
6513 + * new bitstream filtering API (using AVBSFContext).
6515 +attribute_deprecated
6516 +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
6517 + AVCodecContext *avctx, const char *args,
6518 + uint8_t **poutbuf, int *poutbuf_size,
6519 + const uint8_t *buf, int buf_size, int keyframe);
6521 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6522 + * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using
6525 +attribute_deprecated
6526 +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
6528 + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
6529 + * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using
6532 +attribute_deprecated
6533 +const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
6537 + * @return a bitstream filter with the specified name or NULL if no such
6538 + * bitstream filter exists.
6540 +const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
6543 + * Iterate over all registered bitstream filters.
6545 + * @param opaque a pointer where libavcodec will store the iteration state. Must
6546 + * point to NULL to start the iteration.
6548 + * @return the next registered bitstream filter or NULL when the iteration is
6551 +const AVBitStreamFilter *av_bsf_iterate(void **opaque);
6553 +attribute_deprecated
6554 +const AVBitStreamFilter *av_bsf_next(void **opaque);
6558 + * Allocate a context for a given bitstream filter. The caller must fill in the
6559 + * context parameters as described in the documentation and then call
6560 + * av_bsf_init() before sending any data to the filter.
6562 + * @param filter the filter for which to allocate an instance.
6563 + * @param ctx a pointer into which the pointer to the newly-allocated context
6564 + * will be written. It must be freed with av_bsf_free() after the
6565 + * filtering is done.
6567 + * @return 0 on success, a negative AVERROR code on failure
6569 +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
6572 + * Prepare the filter for use, after all the parameters and options have been
6575 +int av_bsf_init(AVBSFContext *ctx);
6578 + * Submit a packet for filtering.
6580 + * After sending each packet, the filter must be completely drained by calling
6581 + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
6584 + * @param pkt the packet to filter. The bitstream filter will take ownership of
6585 + * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
6586 + * This parameter may be NULL, which signals the end of the stream (i.e. no more
6587 + * packets will be sent). That will cause the filter to output any packets it
6588 + * may have buffered internally.
6590 + * @return 0 on success, a negative AVERROR on error.
6592 +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
6595 + * Retrieve a filtered packet.
6597 + * @param[out] pkt this struct will be filled with the contents of the filtered
6598 + * packet. It is owned by the caller and must be freed using
6599 + * av_packet_unref() when it is no longer needed.
6600 + * This parameter should be "clean" (i.e. freshly allocated
6601 + * with av_packet_alloc() or unreffed with av_packet_unref())
6602 + * when this function is called. If this function returns
6603 + * successfully, the contents of pkt will be completely
6604 + * overwritten by the returned data. On failure, pkt is not
6607 + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the
6608 + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there
6609 + * will be no further output from the filter. Another negative AVERROR value if
6610 + * an error occurs.
6612 + * @note one input packet may result in several output packets, so after sending
6613 + * a packet with av_bsf_send_packet(), this function needs to be called
6614 + * repeatedly until it stops returning 0. It is also possible for a filter to
6615 + * output fewer packets than were sent to it, so this function may return
6616 + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
6618 +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
6621 + * Free a bitstream filter context and everything associated with it; write NULL
6622 + * into the supplied pointer.
6624 +void av_bsf_free(AVBSFContext **ctx);
6627 + * Get the AVClass for AVBSFContext. It can be used in combination with
6628 + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
6630 + * @see av_opt_find().
6632 +const AVClass *av_bsf_get_class(void);
6635 + * Structure for chain/list of bitstream filters.
6636 + * Empty list can be allocated by av_bsf_list_alloc().
6638 +typedef struct AVBSFList AVBSFList;
6641 + * Allocate empty list of bitstream filters.
6642 + * The list must be later freed by av_bsf_list_free()
6643 + * or finalized by av_bsf_list_finalize().
6645 + * @return Pointer to @ref AVBSFList on success, NULL in case of failure
6647 +AVBSFList *av_bsf_list_alloc(void);
6650 + * Free list of bitstream filters.
6652 + * @param lst Pointer to pointer returned by av_bsf_list_alloc()
6654 +void av_bsf_list_free(AVBSFList **lst);
6657 + * Append bitstream filter to the list of bitstream filters.
6659 + * @param lst List to append to
6660 + * @param bsf Filter context to be appended
6662 + * @return >=0 on success, negative AVERROR in case of failure
6664 +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
6667 + * Construct new bitstream filter context given it's name and options
6668 + * and append it to the list of bitstream filters.
6670 + * @param lst List to append to
6671 + * @param bsf_name Name of the bitstream filter
6672 + * @param options Options for the bitstream filter, can be set to NULL
6674 + * @return >=0 on success, negative AVERROR in case of failure
6676 +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
6678 + * Finalize list of bitstream filters.
6680 + * This function will transform @ref AVBSFList to single @ref AVBSFContext,
6681 + * so the whole chain of bitstream filters can be treated as single filter
6682 + * freshly allocated by av_bsf_alloc().
6683 + * If the call is successful, @ref AVBSFList structure is freed and lst
6684 + * will be set to NULL. In case of failure, caller is responsible for
6685 + * freeing the structure by av_bsf_list_free()
6687 + * @param lst Filter list structure to be transformed
6688 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6689 + * representing the chain of bitstream filters
6691 + * @return >=0 on success, negative AVERROR in case of failure
6693 +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
6696 + * Parse string describing list of bitstream filters and create single
6697 + * @ref AVBSFContext describing the whole chain of bitstream filters.
6698 + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
6699 + * allocated by av_bsf_alloc().
6701 + * @param str String describing chain of bitstream filters in format
6702 + * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
6703 + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
6704 + * representing the chain of bitstream filters
6706 + * @return >=0 on success, negative AVERROR in case of failure
6708 +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
6711 + * Get null/pass-through bitstream filter.
6713 + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
6717 +int av_bsf_get_null_filter(AVBSFContext **bsf);
6722 + * Same behaviour av_fast_malloc but the buffer has additional
6723 + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
6725 + * In addition the whole buffer will initially and after resizes
6726 + * be 0-initialized so that no uninitialized data will ever appear.
6728 +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
6731 + * Same behaviour av_fast_padded_malloc except that buffer will always
6732 + * be 0-initialized after call.
6734 +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
6737 + * Encode extradata length to a buffer. Used by xiph codecs.
6739 + * @param s buffer to write to; must be at least (v/255+1) bytes long
6740 + * @param v size of extradata in bytes
6741 + * @return number of bytes written to the buffer.
6743 +unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
6745 +#if FF_API_USER_VISIBLE_AVHWACCEL
6747 + * Register the hardware accelerator hwaccel.
6749 + * @deprecated This function doesn't do anything.
6751 +attribute_deprecated
6752 +void av_register_hwaccel(AVHWAccel *hwaccel);
6755 + * If hwaccel is NULL, returns the first registered hardware accelerator,
6756 + * if hwaccel is non-NULL, returns the next registered hardware accelerator
6757 + * after hwaccel, or NULL if hwaccel is the last one.
6759 + * @deprecated AVHWaccel structures contain no user-serviceable parts, so
6760 + * this function should not be used.
6762 +attribute_deprecated
6763 +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
6768 + * Lock operation used by lockmgr
6770 + * @deprecated Deprecated together with av_lockmgr_register().
6773 + AV_LOCK_CREATE, ///< Create a mutex
6774 + AV_LOCK_OBTAIN, ///< Lock the mutex
6775 + AV_LOCK_RELEASE, ///< Unlock the mutex
6776 + AV_LOCK_DESTROY, ///< Free mutex resources
6780 + * Register a user provided lock manager supporting the operations
6781 + * specified by AVLockOp. The "mutex" argument to the function points
6782 + * to a (void *) where the lockmgr should store/get a pointer to a user
6783 + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
6784 + * value left by the last call for all other ops. If the lock manager is
6785 + * unable to perform the op then it should leave the mutex in the same
6786 + * state as when it was called and return a non-zero value. However,
6787 + * when called with AV_LOCK_DESTROY the mutex will always be assumed to
6788 + * have been successfully destroyed. If av_lockmgr_register succeeds
6789 + * it will return a non-negative value, if it fails it will return a
6790 + * negative value and destroy all mutex and unregister all callbacks.
6791 + * av_lockmgr_register is not thread-safe, it must be called from a
6792 + * single thread before any calls which make use of locking are used.
6794 + * @param cb User defined callback. av_lockmgr_register invokes calls
6795 + * to this callback and the previously registered callback.
6796 + * The callback will be used to create more than one mutex
6797 + * each of which must be backed by its own underlying locking
6798 + * mechanism (i.e. do not use a single static object to
6799 + * implement your lock manager). If cb is set to NULL the
6800 + * lockmgr will be unregistered.
6802 + * @deprecated This function does nothing, and always returns 0. Be sure to
6803 + * build with thread support to get basic thread safety.
6805 +attribute_deprecated
6806 +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
6810 + * Get the type of the given codec.
6812 +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
6815 + * Get the name of a codec.
6816 + * @return a static string identifying the codec; never NULL
6818 +const char *avcodec_get_name(enum AVCodecID id);
6821 + * @return a positive value if s is open (i.e. avcodec_open2() was called on it
6822 + * with no corresponding avcodec_close()), 0 otherwise.
6824 +int avcodec_is_open(AVCodecContext *s);
6827 + * @return a non-zero number if codec is an encoder, zero otherwise
6829 +int av_codec_is_encoder(const AVCodec *codec);
6832 + * @return a non-zero number if codec is a decoder, zero otherwise
6834 +int av_codec_is_decoder(const AVCodec *codec);
6837 + * @return descriptor for given codec ID or NULL if no descriptor exists.
6839 +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
6842 + * Iterate over all codec descriptors known to libavcodec.
6844 + * @param prev previous descriptor. NULL to get the first descriptor.
6846 + * @return next descriptor or NULL after the last descriptor
6848 +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
6851 + * @return codec descriptor with the given name or NULL if no such descriptor
6854 +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
6857 + * Allocate a CPB properties structure and initialize its fields to default
6860 + * @param size if non-NULL, the size of the allocated struct will be written
6861 + * here. This is useful for embedding it in side data.
6863 + * @return the newly allocated struct or NULL on failure
6865 +AVCPBProperties *av_cpb_properties_alloc(size_t *size);
6871 +#endif /* AVCODEC_AVCODEC_H */
6872 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6873 new file mode 100644
6875 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
6878 + * This file is part of FFmpeg.
6880 + * FFmpeg is free software; you can redistribute it and/or
6881 + * modify it under the terms of the GNU Lesser General Public
6882 + * License as published by the Free Software Foundation; either
6883 + * version 2.1 of the License, or (at your option) any later version.
6885 + * FFmpeg is distributed in the hope that it will be useful,
6886 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6887 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6888 + * Lesser General Public License for more details.
6890 + * You should have received a copy of the GNU Lesser General Public
6891 + * License along with FFmpeg; if not, write to the Free Software
6892 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6895 +#ifndef AVCODEC_AVFFT_H
6896 +#define AVCODEC_AVFFT_H
6900 + * @ingroup lavc_fft
6905 + * @defgroup lavc_fft FFT functions
6906 + * @ingroup lavc_misc
6911 +typedef float FFTSample;
6913 +typedef struct FFTComplex {
6917 +typedef struct FFTContext FFTContext;
6920 + * Set up a complex FFT.
6921 + * @param nbits log2 of the length of the input array
6922 + * @param inverse if 0 perform the forward transform, if 1 perform the inverse
6924 +FFTContext *av_fft_init(int nbits, int inverse);
6927 + * Do the permutation needed BEFORE calling ff_fft_calc().
6929 +void av_fft_permute(FFTContext *s, FFTComplex *z);
6932 + * Do a complex FFT with the parameters defined in av_fft_init(). The
6933 + * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
6935 +void av_fft_calc(FFTContext *s, FFTComplex *z);
6937 +void av_fft_end(FFTContext *s);
6939 +FFTContext *av_mdct_init(int nbits, int inverse, double scale);
6940 +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6941 +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
6942 +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
6943 +void av_mdct_end(FFTContext *s);
6945 +/* Real Discrete Fourier Transform */
6947 +enum RDFTransformType {
6954 +typedef struct RDFTContext RDFTContext;
6957 + * Set up a real FFT.
6958 + * @param nbits log2 of the length of the input array
6959 + * @param trans the type of transform
6961 +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
6962 +void av_rdft_calc(RDFTContext *s, FFTSample *data);
6963 +void av_rdft_end(RDFTContext *s);
6965 +/* Discrete Cosine Transform */
6967 +typedef struct DCTContext DCTContext;
6969 +enum DCTTransformType {
6979 + * @param nbits size of the input array:
6980 + * (1 << nbits) for DCT-II, DCT-III and DST-I
6981 + * (1 << nbits) + 1 for DCT-I
6982 + * @param type the type of transform
6984 + * @note the first element of the input of DST-I is ignored
6986 +DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
6987 +void av_dct_calc(DCTContext *s, FFTSample *data);
6988 +void av_dct_end (DCTContext *s);
6994 +#endif /* AVCODEC_AVFFT_H */
6995 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
6996 new file mode 100644
6998 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
7001 + * Video Acceleration API (shared data between FFmpeg and the video player)
7002 + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
7004 + * Copyright (C) 2008-2009 Splitted-Desktop Systems
7006 + * This file is part of FFmpeg.
7008 + * FFmpeg is free software; you can redistribute it and/or
7009 + * modify it under the terms of the GNU Lesser General Public
7010 + * License as published by the Free Software Foundation; either
7011 + * version 2.1 of the License, or (at your option) any later version.
7013 + * FFmpeg is distributed in the hope that it will be useful,
7014 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7015 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7016 + * Lesser General Public License for more details.
7018 + * You should have received a copy of the GNU Lesser General Public
7019 + * License along with FFmpeg; if not, write to the Free Software
7020 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7023 +#ifndef AVCODEC_VAAPI_H
7024 +#define AVCODEC_VAAPI_H
7028 + * @ingroup lavc_codec_hwaccel_vaapi
7029 + * Public libavcodec VA API header.
7032 +#include <stdint.h>
7033 +#include "libavutil/attributes.h"
7034 +#include "version.h"
7036 +#if FF_API_STRUCT_VAAPI_CONTEXT
7039 + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
7040 + * @ingroup lavc_codec_hwaccel
7045 + * This structure is used to share data between the FFmpeg library and
7046 + * the client video application.
7047 + * This shall be zero-allocated and available as
7048 + * AVCodecContext.hwaccel_context. All user members can be set once
7049 + * during initialization or through each AVCodecContext.get_buffer()
7050 + * function call. In any case, they must be valid prior to calling
7051 + * decoding functions.
7053 + * Deprecated: use AVCodecContext.hw_frames_ctx instead.
7055 +struct attribute_deprecated vaapi_context {
7057 + * Window system dependent data
7059 + * - encoding: unused
7060 + * - decoding: Set by user
7065 + * Configuration ID
7067 + * - encoding: unused
7068 + * - decoding: Set by user
7070 + uint32_t config_id;
7073 + * Context ID (video decode pipeline)
7075 + * - encoding: unused
7076 + * - decoding: Set by user
7078 + uint32_t context_id;
7083 +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
7085 +#endif /* AVCODEC_VAAPI_H */
7086 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7087 new file mode 100644
7089 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
7092 + * The Video Decode and Presentation API for UNIX (VDPAU) is used for
7093 + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
7095 + * Copyright (C) 2008 NVIDIA
7097 + * This file is part of FFmpeg.
7099 + * FFmpeg is free software; you can redistribute it and/or
7100 + * modify it under the terms of the GNU Lesser General Public
7101 + * License as published by the Free Software Foundation; either
7102 + * version 2.1 of the License, or (at your option) any later version.
7104 + * FFmpeg is distributed in the hope that it will be useful,
7105 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7106 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7107 + * Lesser General Public License for more details.
7109 + * You should have received a copy of the GNU Lesser General Public
7110 + * License along with FFmpeg; if not, write to the Free Software
7111 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7114 +#ifndef AVCODEC_VDPAU_H
7115 +#define AVCODEC_VDPAU_H
7119 + * @ingroup lavc_codec_hwaccel_vdpau
7120 + * Public libavcodec VDPAU header.
7125 + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
7126 + * @ingroup lavc_codec_hwaccel
7128 + * VDPAU hardware acceleration has two modules
7129 + * - VDPAU decoding
7130 + * - VDPAU presentation
7132 + * The VDPAU decoding module parses all headers using FFmpeg
7133 + * parsing mechanisms and uses VDPAU for the actual decoding.
7135 + * As per the current implementation, the actual decoding
7136 + * and rendering (API calls) are done as part of the VDPAU
7137 + * presentation (vo_vdpau.c) module.
7142 +#include <vdpau/vdpau.h>
7144 +#include "libavutil/avconfig.h"
7145 +#include "libavutil/attributes.h"
7147 +#include "avcodec.h"
7148 +#include "version.h"
7150 +struct AVCodecContext;
7153 +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
7154 + const VdpPictureInfo *, uint32_t,
7155 + const VdpBitstreamBuffer *);
7158 + * This structure is used to share data between the libavcodec library and
7159 + * the client video application.
7160 + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
7161 + * function and make it available as
7162 + * AVCodecContext.hwaccel_context. Members can be set by the user once
7163 + * during initialization or through each AVCodecContext.get_buffer()
7164 + * function call. In any case, they must be valid prior to calling
7165 + * decoding functions.
7167 + * The size of this structure is not a part of the public ABI and must not
7168 + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
7171 +typedef struct AVVDPAUContext {
7173 + * VDPAU decoder handle
7177 + VdpDecoder decoder;
7180 + * VDPAU decoder render callback
7182 + * Set by the user.
7184 + VdpDecoderRender *render;
7186 + AVVDPAU_Render2 render2;
7190 + * @brief allocation function for AVVDPAUContext
7192 + * Allows extending the struct without breaking API/ABI
7194 +AVVDPAUContext *av_alloc_vdpaucontext(void);
7196 +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
7197 +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
7200 + * Associate a VDPAU device with a codec context for hardware acceleration.
7201 + * This function is meant to be called from the get_format() codec callback,
7202 + * or earlier. It can also be called after avcodec_flush_buffers() to change
7203 + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
7204 + * display preemption).
7206 + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
7209 + * @param avctx decoding context whose get_format() callback is invoked
7210 + * @param device VDPAU device handle to use for hardware acceleration
7211 + * @param get_proc_address VDPAU device driver
7212 + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
7214 + * @return 0 on success, an AVERROR code on failure.
7216 +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
7217 + VdpGetProcAddress *get_proc_address, unsigned flags);
7220 + * Gets the parameters to create an adequate VDPAU video surface for the codec
7221 + * context using VDPAU hardware decoding acceleration.
7223 + * @note Behavior is undefined if the context was not successfully bound to a
7224 + * VDPAU device using av_vdpau_bind_context().
7226 + * @param avctx the codec context being used for decoding the stream
7227 + * @param type storage space for the VDPAU video surface chroma type
7228 + * (or NULL to ignore)
7229 + * @param width storage space for the VDPAU video surface pixel width
7230 + * (or NULL to ignore)
7231 + * @param height storage space for the VDPAU video surface pixel height
7232 + * (or NULL to ignore)
7234 + * @return 0 on success, a negative AVERROR code on failure.
7236 +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
7237 + uint32_t *width, uint32_t *height);
7240 + * Allocate an AVVDPAUContext.
7242 + * @return Newly-allocated AVVDPAUContext or NULL on failure.
7244 +AVVDPAUContext *av_vdpau_alloc_context(void);
7246 +#if FF_API_VDPAU_PROFILE
7248 + * Get a decoder profile that should be used for initializing a VDPAU decoder.
7249 + * Should be called from the AVCodecContext.get_format() callback.
7251 + * @deprecated Use av_vdpau_bind_context() instead.
7253 + * @param avctx the codec context being used for decoding the stream
7254 + * @param profile a pointer into which the result will be written on success.
7255 + * The contents of profile are undefined if this function returns
7258 + * @return 0 on success (non-negative), a negative AVERROR on failure.
7260 +attribute_deprecated
7261 +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
7266 +#endif /* AVCODEC_VDPAU_H */
7267 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7268 new file mode 100644
7270 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
7273 + * This file is part of FFmpeg.
7275 + * FFmpeg is free software; you can redistribute it and/or
7276 + * modify it under the terms of the GNU Lesser General Public
7277 + * License as published by the Free Software Foundation; either
7278 + * version 2.1 of the License, or (at your option) any later version.
7280 + * FFmpeg is distributed in the hope that it will be useful,
7281 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7282 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7283 + * Lesser General Public License for more details.
7285 + * You should have received a copy of the GNU Lesser General Public
7286 + * License along with FFmpeg; if not, write to the Free Software
7287 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7290 +#ifndef AVCODEC_VERSION_H
7291 +#define AVCODEC_VERSION_H
7296 + * Libavcodec version macros.
7299 +#include "libavutil/version.h"
7301 +#define LIBAVCODEC_VERSION_MAJOR 58
7302 +#define LIBAVCODEC_VERSION_MINOR 18
7303 +#define LIBAVCODEC_VERSION_MICRO 100
7305 +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
7306 + LIBAVCODEC_VERSION_MINOR, \
7307 + LIBAVCODEC_VERSION_MICRO)
7308 +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
7309 + LIBAVCODEC_VERSION_MINOR, \
7310 + LIBAVCODEC_VERSION_MICRO)
7311 +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
7313 +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
7316 + * FF_API_* defines may be placed below to indicate public API that will be
7317 + * dropped at a future version bump. The defines themselves are not part of
7318 + * the public API and may change, break or disappear at any time.
7320 + * @note, when bumping the major version it is recommended to manually
7321 + * disable each FF_API_* in its own commit instead of disabling them all
7322 + * at once through the bump. This improves the git bisect-ability of the change.
7325 +#ifndef FF_API_LOWRES
7326 +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
7328 +#ifndef FF_API_DEBUG_MV
7329 +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
7331 +#ifndef FF_API_AVCTX_TIMEBASE
7332 +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
7334 +#ifndef FF_API_CODED_FRAME
7335 +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59)
7337 +#ifndef FF_API_SIDEDATA_ONLY_PKT
7338 +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
7340 +#ifndef FF_API_VDPAU_PROFILE
7341 +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59)
7343 +#ifndef FF_API_CONVERGENCE_DURATION
7344 +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
7346 +#ifndef FF_API_AVPICTURE
7347 +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59)
7349 +#ifndef FF_API_AVPACKET_OLD_API
7350 +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7352 +#ifndef FF_API_RTP_CALLBACK
7353 +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59)
7355 +#ifndef FF_API_VBV_DELAY
7356 +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59)
7358 +#ifndef FF_API_CODER_TYPE
7359 +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59)
7361 +#ifndef FF_API_STAT_BITS
7362 +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
7364 +#ifndef FF_API_PRIVATE_OPT
7365 +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
7367 +#ifndef FF_API_ASS_TIMING
7368 +#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
7370 +#ifndef FF_API_OLD_BSF
7371 +#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
7373 +#ifndef FF_API_COPY_CONTEXT
7374 +#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7376 +#ifndef FF_API_GET_CONTEXT_DEFAULTS
7377 +#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
7379 +#ifndef FF_API_NVENC_OLD_NAME
7380 +#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
7382 +#ifndef FF_API_STRUCT_VAAPI_CONTEXT
7383 +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7385 +#ifndef FF_API_MERGE_SD_API
7386 +#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59)
7388 +#ifndef FF_API_TAG_STRING
7389 +#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59)
7391 +#ifndef FF_API_GETCHROMA
7392 +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59)
7394 +#ifndef FF_API_CODEC_GET_SET
7395 +#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59)
7397 +#ifndef FF_API_USER_VISIBLE_AVHWACCEL
7398 +#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
7400 +#ifndef FF_API_LOCKMGR
7401 +#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
7403 +#ifndef FF_API_NEXT
7404 +#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
7408 +#endif /* AVCODEC_VERSION_H */
7409 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7410 new file mode 100644
7412 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
7415 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7417 + * This file is part of FFmpeg.
7419 + * FFmpeg is free software; you can redistribute it and/or
7420 + * modify it under the terms of the GNU Lesser General Public
7421 + * License as published by the Free Software Foundation; either
7422 + * version 2.1 of the License, or (at your option) any later version.
7424 + * FFmpeg is distributed in the hope that it will be useful,
7425 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7426 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7427 + * Lesser General Public License for more details.
7429 + * You should have received a copy of the GNU Lesser General Public
7430 + * License along with FFmpeg; if not, write to the Free Software
7431 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7436 + * Macro definitions for various function/variable attributes
7439 +#ifndef AVUTIL_ATTRIBUTES_H
7440 +#define AVUTIL_ATTRIBUTES_H
7443 +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
7444 +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
7446 +# define AV_GCC_VERSION_AT_LEAST(x,y) 0
7447 +# define AV_GCC_VERSION_AT_MOST(x,y) 0
7450 +#ifndef av_always_inline
7451 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7452 +# define av_always_inline __attribute__((always_inline)) inline
7453 +#elif defined(_MSC_VER)
7454 +# define av_always_inline __forceinline
7456 +# define av_always_inline inline
7460 +#ifndef av_extern_inline
7461 +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
7462 +# define av_extern_inline extern inline
7464 +# define av_extern_inline inline
7468 +#if AV_GCC_VERSION_AT_LEAST(3,4)
7469 +# define av_warn_unused_result __attribute__((warn_unused_result))
7471 +# define av_warn_unused_result
7474 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7475 +# define av_noinline __attribute__((noinline))
7476 +#elif defined(_MSC_VER)
7477 +# define av_noinline __declspec(noinline)
7479 +# define av_noinline
7482 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7483 +# define av_pure __attribute__((pure))
7488 +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
7489 +# define av_const __attribute__((const))
7494 +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
7495 +# define av_cold __attribute__((cold))
7500 +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
7501 +# define av_flatten __attribute__((flatten))
7503 +# define av_flatten
7506 +#if AV_GCC_VERSION_AT_LEAST(3,1)
7507 +# define attribute_deprecated __attribute__((deprecated))
7508 +#elif defined(_MSC_VER)
7509 +# define attribute_deprecated __declspec(deprecated)
7511 +# define attribute_deprecated
7515 + * Disable warnings about deprecated features
7516 + * This is useful for sections of code kept for backward compatibility and
7517 + * scheduled for removal.
7519 +#ifndef AV_NOWARN_DEPRECATED
7520 +#if AV_GCC_VERSION_AT_LEAST(4,6)
7521 +# define AV_NOWARN_DEPRECATED(code) \
7522 + _Pragma("GCC diagnostic push") \
7523 + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
7525 + _Pragma("GCC diagnostic pop")
7526 +#elif defined(_MSC_VER)
7527 +# define AV_NOWARN_DEPRECATED(code) \
7528 + __pragma(warning(push)) \
7529 + __pragma(warning(disable : 4996)) \
7531 + __pragma(warning(pop))
7533 +# define AV_NOWARN_DEPRECATED(code) code
7537 +#if defined(__GNUC__) || defined(__clang__)
7538 +# define av_unused __attribute__((unused))
7544 + * Mark a variable as used and prevent the compiler from optimizing it
7545 + * away. This is useful for variables accessed only from inline
7546 + * assembler without the compiler being aware.
7548 +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
7549 +# define av_used __attribute__((used))
7554 +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
7555 +# define av_alias __attribute__((may_alias))
7560 +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
7561 +# define av_uninit(x) x=x
7563 +# define av_uninit(x) x
7566 +#if defined(__GNUC__) || defined(__clang__)
7567 +# define av_builtin_constant_p __builtin_constant_p
7568 +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
7570 +# define av_builtin_constant_p(x) 0
7571 +# define av_printf_format(fmtpos, attrpos)
7574 +#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
7575 +# define av_noreturn __attribute__((noreturn))
7577 +# define av_noreturn
7580 +#endif /* AVUTIL_ATTRIBUTES_H */
7581 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7582 new file mode 100644
7584 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
7586 +/* Generated by ffmpeg configure */
7587 +#ifndef AVUTIL_AVCONFIG_H
7588 +#define AVUTIL_AVCONFIG_H
7589 +#define AV_HAVE_BIGENDIAN 0
7590 +#define AV_HAVE_FAST_UNALIGNED 1
7591 +#endif /* AVUTIL_AVCONFIG_H */
7592 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7593 new file mode 100644
7595 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
7598 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
7600 + * This file is part of FFmpeg.
7602 + * FFmpeg is free software; you can redistribute it and/or
7603 + * modify it under the terms of the GNU Lesser General Public
7604 + * License as published by the Free Software Foundation; either
7605 + * version 2.1 of the License, or (at your option) any later version.
7607 + * FFmpeg is distributed in the hope that it will be useful,
7608 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7609 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7610 + * Lesser General Public License for more details.
7612 + * You should have received a copy of the GNU Lesser General Public
7613 + * License along with FFmpeg; if not, write to the Free Software
7614 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7617 +#ifndef AVUTIL_AVUTIL_H
7618 +#define AVUTIL_AVUTIL_H
7623 + * Convenience header that includes @ref lavu "libavutil"'s core.
7629 + * @section ffmpeg_intro Introduction
7631 + * This document describes the usage of the different libraries
7632 + * provided by FFmpeg.
7634 + * @li @ref libavc "libavcodec" encoding/decoding library
7635 + * @li @ref lavfi "libavfilter" graph-based frame editing library
7636 + * @li @ref libavf "libavformat" I/O and muxing/demuxing library
7637 + * @li @ref lavd "libavdevice" special devices muxing/demuxing library
7638 + * @li @ref lavu "libavutil" common utility library
7639 + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
7640 + * @li @ref lpp "libpostproc" post processing library
7641 + * @li @ref libsws "libswscale" color conversion and scaling library
7643 + * @section ffmpeg_versioning Versioning and compatibility
7645 + * Each of the FFmpeg libraries contains a version.h header, which defines a
7646 + * major, minor and micro version number with the
7647 + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
7648 + * number is incremented with backward incompatible changes - e.g. removing
7649 + * parts of the public API, reordering public struct members, etc. The minor
7650 + * version number is incremented for backward compatible API changes or major
7651 + * new features - e.g. adding a new public function or a new decoder. The micro
7652 + * version number is incremented for smaller changes that a calling program
7653 + * might still want to check for - e.g. changing behavior in a previously
7654 + * unspecified situation.
7656 + * FFmpeg guarantees backward API and ABI compatibility for each library as long
7657 + * as its major version number is unchanged. This means that no public symbols
7658 + * will be removed or renamed. Types and names of the public struct members and
7659 + * values of public macros and enums will remain the same (unless they were
7660 + * explicitly declared as not part of the public API). Documented behavior will
7663 + * In other words, any correct program that works with a given FFmpeg snapshot
7664 + * should work just as well without any changes with any later snapshot with the
7665 + * same major versions. This applies to both rebuilding the program against new
7666 + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
7669 + * However, new public symbols may be added and new members may be appended to
7670 + * public structs whose size is not part of public ABI (most public structs in
7671 + * FFmpeg). New macros and enum values may be added. Behavior in undocumented
7672 + * situations may change slightly (and be documented). All those are accompanied
7673 + * by an entry in doc/APIchanges and incrementing either the minor or micro
7678 + * @defgroup lavu libavutil
7679 + * Common code shared across all FFmpeg libraries.
7682 + * libavutil is designed to be modular. In most cases, in order to use the
7683 + * functions provided by one component of libavutil you must explicitly include
7684 + * the specific header containing that feature. If you are only using
7685 + * media-related components, you could simply include libavutil/avutil.h, which
7686 + * brings in most of the "core" components.
7690 + * @defgroup lavu_crypto Crypto and Hashing
7695 + * @defgroup lavu_math Mathematics
7700 + * @defgroup lavu_string String Manipulation
7706 + * @defgroup lavu_mem Memory Management
7712 + * @defgroup lavu_data Data Structures
7717 + * @defgroup lavu_video Video related
7723 + * @defgroup lavu_audio Audio related
7729 + * @defgroup lavu_error Error Codes
7735 + * @defgroup lavu_log Logging Facility
7741 + * @defgroup lavu_misc Other
7745 + * @defgroup preproc_misc Preprocessor String Macros
7751 + * @defgroup version_utils Library Version Macros
7760 + * @addtogroup lavu_ver
7765 + * Return the LIBAVUTIL_VERSION_INT constant.
7767 +unsigned avutil_version(void);
7770 + * Return an informative version string. This usually is the actual release
7771 + * version number or a git commit description. This string has no fixed format
7772 + * and can change any time. It should never be parsed by code.
7774 +const char *av_version_info(void);
7777 + * Return the libavutil build-time configuration.
7779 +const char *avutil_configuration(void);
7782 + * Return the libavutil license.
7784 +const char *avutil_license(void);
7791 + * @addtogroup lavu_media Media Type
7792 + * @brief Media Type
7796 + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
7797 + AVMEDIA_TYPE_VIDEO,
7798 + AVMEDIA_TYPE_AUDIO,
7799 + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
7800 + AVMEDIA_TYPE_SUBTITLE,
7801 + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
7806 + * Return a string describing the media_type enum, NULL if media_type
7809 +const char *av_get_media_type_string(enum AVMediaType media_type);
7812 + * @defgroup lavu_const Constants
7815 + * @defgroup lavu_enc Encoding specific
7817 + * @note those definition should move to avcodec
7821 +#define FF_LAMBDA_SHIFT 7
7822 +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
7823 +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
7824 +#define FF_LAMBDA_MAX (256*128-1)
7826 +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
7830 + * @defgroup lavu_time Timestamp specific
7832 + * FFmpeg internal timebase and timestamp definitions
7838 + * @brief Undefined timestamp value
7840 + * Usually reported by demuxer that work on containers that do not provide
7841 + * either pts or dts.
7844 +#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
7847 + * Internal time base represented as integer
7850 +#define AV_TIME_BASE 1000000
7853 + * Internal time base represented as fractional value
7856 +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
7861 + * @defgroup lavu_picture Image related
7863 + * AVPicture types, pixel formats and basic image planes manipulation.
7868 +enum AVPictureType {
7869 + AV_PICTURE_TYPE_NONE = 0, ///< Undefined
7870 + AV_PICTURE_TYPE_I, ///< Intra
7871 + AV_PICTURE_TYPE_P, ///< Predicted
7872 + AV_PICTURE_TYPE_B, ///< Bi-dir predicted
7873 + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
7874 + AV_PICTURE_TYPE_SI, ///< Switching Intra
7875 + AV_PICTURE_TYPE_SP, ///< Switching Predicted
7876 + AV_PICTURE_TYPE_BI, ///< BI type
7880 + * Return a single letter to describe the given picture type
7883 + * @param[in] pict_type the picture type @return a single character
7884 + * representing the picture type, '?' if pict_type is unknown
7886 +char av_get_picture_type_char(enum AVPictureType pict_type);
7892 +#include "common.h"
7894 +#include "rational.h"
7895 +#include "version.h"
7896 +#include "macros.h"
7897 +#include "mathematics.h"
7899 +#include "pixfmt.h"
7902 + * Return x default pointer in case p is NULL.
7904 +static inline void *av_x_if_null(const void *p, const void *x)
7906 + return (void *)(intptr_t)(p ? p : x);
7910 + * Compute the length of an integer list.
7912 + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
7913 + * @param term list terminator (usually 0 or -1)
7914 + * @param list pointer to the list
7915 + * @return length of the list, in elements, not counting the terminator
7917 +unsigned av_int_list_length_for_size(unsigned elsize,
7918 + const void *list, uint64_t term) av_pure;
7921 + * Compute the length of an integer list.
7923 + * @param term list terminator (usually 0 or -1)
7924 + * @param list pointer to the list
7925 + * @return length of the list, in elements, not counting the terminator
7927 +#define av_int_list_length(list, term) \
7928 + av_int_list_length_for_size(sizeof(*(list)), list, term)
7931 + * Open a file using a UTF-8 filename.
7932 + * The API of this function matches POSIX fopen(), errors are returned through
7935 +FILE *av_fopen_utf8(const char *path, const char *mode);
7938 + * Return the fractional representation of the internal time base.
7940 +AVRational av_get_time_base_q(void);
7942 +#define AV_FOURCC_MAX_STRING_SIZE 32
7944 +#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
7947 + * Fill the provided buffer with a string containing a FourCC (four-character
7948 + * code) representation.
7950 + * @param buf a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
7951 + * @param fourcc the fourcc to represent
7952 + * @return the buffer in input
7954 +char *av_fourcc_make_string(char *buf, uint32_t fourcc);
7961 +#endif /* AVUTIL_AVUTIL_H */
7962 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7963 new file mode 100644
7965 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
7968 + * This file is part of FFmpeg.
7970 + * FFmpeg is free software; you can redistribute it and/or
7971 + * modify it under the terms of the GNU Lesser General Public
7972 + * License as published by the Free Software Foundation; either
7973 + * version 2.1 of the License, or (at your option) any later version.
7975 + * FFmpeg is distributed in the hope that it will be useful,
7976 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7977 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7978 + * Lesser General Public License for more details.
7980 + * You should have received a copy of the GNU Lesser General Public
7981 + * License along with FFmpeg; if not, write to the Free Software
7982 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7987 + * @ingroup lavu_buffer
7988 + * refcounted data buffer API
7991 +#ifndef AVUTIL_BUFFER_H
7992 +#define AVUTIL_BUFFER_H
7994 +#include <stdint.h>
7997 + * @defgroup lavu_buffer AVBuffer
7998 + * @ingroup lavu_data
8001 + * AVBuffer is an API for reference-counted data buffers.
8003 + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
8004 + * represents the data buffer itself; it is opaque and not meant to be accessed
8005 + * by the caller directly, but only through AVBufferRef. However, the caller may
8006 + * e.g. compare two AVBuffer pointers to check whether two different references
8007 + * are describing the same data buffer. AVBufferRef represents a single
8008 + * reference to an AVBuffer and it is the object that may be manipulated by the
8009 + * caller directly.
8011 + * There are two functions provided for creating a new AVBuffer with a single
8012 + * reference -- av_buffer_alloc() to just allocate a new buffer, and
8013 + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
8014 + * reference, additional references may be created with av_buffer_ref().
8015 + * Use av_buffer_unref() to free a reference (this will automatically free the
8016 + * data once all the references are freed).
8018 + * The convention throughout this API and the rest of FFmpeg is such that the
8019 + * buffer is considered writable if there exists only one reference to it (and
8020 + * it has not been marked as read-only). The av_buffer_is_writable() function is
8021 + * provided to check whether this is true and av_buffer_make_writable() will
8022 + * automatically create a new writable buffer when necessary.
8023 + * Of course nothing prevents the calling code from violating this convention,
8024 + * however that is safe only when all the existing references are under its
8027 + * @note Referencing and unreferencing the buffers is thread-safe and thus
8028 + * may be done from multiple threads simultaneously without any need for
8029 + * additional locking.
8031 + * @note Two different references to the same buffer can point to different
8032 + * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
8036 + * A reference counted buffer type. It is opaque and is meant to be used through
8037 + * references (AVBufferRef).
8039 +typedef struct AVBuffer AVBuffer;
8042 + * A reference to a data buffer.
8044 + * The size of this struct is not a part of the public ABI and it is not meant
8045 + * to be allocated directly.
8047 +typedef struct AVBufferRef {
8051 + * The data buffer. It is considered writable if and only if
8052 + * this is the only reference to the buffer, in which case
8053 + * av_buffer_is_writable() returns 1.
8057 + * Size of data in bytes.
8063 + * Allocate an AVBuffer of the given size using av_malloc().
8065 + * @return an AVBufferRef of given size or NULL when out of memory
8067 +AVBufferRef *av_buffer_alloc(int size);
8070 + * Same as av_buffer_alloc(), except the returned buffer will be initialized
8073 +AVBufferRef *av_buffer_allocz(int size);
8076 + * Always treat the buffer as read-only, even when it has only one
8079 +#define AV_BUFFER_FLAG_READONLY (1 << 0)
8082 + * Create an AVBuffer from an existing array.
8084 + * If this function is successful, data is owned by the AVBuffer. The caller may
8085 + * only access data through the returned AVBufferRef and references derived from
8087 + * If this function fails, data is left untouched.
8088 + * @param data data array
8089 + * @param size size of data in bytes
8090 + * @param free a callback for freeing this buffer's data
8091 + * @param opaque parameter to be got for processing or passed to free
8092 + * @param flags a combination of AV_BUFFER_FLAG_*
8094 + * @return an AVBufferRef referring to data on success, NULL on failure.
8096 +AVBufferRef *av_buffer_create(uint8_t *data, int size,
8097 + void (*free)(void *opaque, uint8_t *data),
8098 + void *opaque, int flags);
8101 + * Default free callback, which calls av_free() on the buffer data.
8102 + * This function is meant to be passed to av_buffer_create(), not called
8105 +void av_buffer_default_free(void *opaque, uint8_t *data);
8108 + * Create a new reference to an AVBuffer.
8110 + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
8113 +AVBufferRef *av_buffer_ref(AVBufferRef *buf);
8116 + * Free a given reference and automatically free the buffer if there are no more
8117 + * references to it.
8119 + * @param buf the reference to be freed. The pointer is set to NULL on return.
8121 +void av_buffer_unref(AVBufferRef **buf);
8124 + * @return 1 if the caller may write to the data referred to by buf (which is
8125 + * true if and only if buf is the only reference to the underlying AVBuffer).
8126 + * Return 0 otherwise.
8127 + * A positive answer is valid until av_buffer_ref() is called on buf.
8129 +int av_buffer_is_writable(const AVBufferRef *buf);
8132 + * @return the opaque parameter set by av_buffer_create.
8134 +void *av_buffer_get_opaque(const AVBufferRef *buf);
8136 +int av_buffer_get_ref_count(const AVBufferRef *buf);
8139 + * Create a writable reference from a given buffer reference, avoiding data copy
8142 + * @param buf buffer reference to make writable. On success, buf is either left
8143 + * untouched, or it is unreferenced and a new writable AVBufferRef is
8144 + * written in its place. On failure, buf is left untouched.
8145 + * @return 0 on success, a negative AVERROR on failure.
8147 +int av_buffer_make_writable(AVBufferRef **buf);
8150 + * Reallocate a given buffer.
8152 + * @param buf a buffer reference to reallocate. On success, buf will be
8153 + * unreferenced and a new reference with the required size will be
8154 + * written in its place. On failure buf will be left untouched. *buf
8155 + * may be NULL, then a new buffer is allocated.
8156 + * @param size required new buffer size.
8157 + * @return 0 on success, a negative AVERROR on failure.
8159 + * @note the buffer is actually reallocated with av_realloc() only if it was
8160 + * initially allocated through av_buffer_realloc(NULL) and there is only one
8161 + * reference to it (i.e. the one passed to this function). In all other cases
8162 + * a new buffer is allocated and the data is copied.
8164 +int av_buffer_realloc(AVBufferRef **buf, int size);
8171 + * @defgroup lavu_bufferpool AVBufferPool
8172 + * @ingroup lavu_data
8175 + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
8177 + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
8178 + * meant to solve this in cases when the caller needs a set of buffers of the
8179 + * same size (the most obvious use case being buffers for raw video or audio
8182 + * At the beginning, the user must call av_buffer_pool_init() to create the
8183 + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
8184 + * get a reference to a new buffer, similar to av_buffer_alloc(). This new
8185 + * reference works in all aspects the same way as the one created by
8186 + * av_buffer_alloc(). However, when the last reference to this buffer is
8187 + * unreferenced, it is returned to the pool instead of being freed and will be
8188 + * reused for subsequent av_buffer_pool_get() calls.
8190 + * When the caller is done with the pool and no longer needs to allocate any new
8191 + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
8192 + * Once all the buffers are released, it will automatically be freed.
8194 + * Allocating and releasing buffers with this API is thread-safe as long as
8195 + * either the default alloc callback is used, or the user-supplied one is
8200 + * The buffer pool. This structure is opaque and not meant to be accessed
8201 + * directly. It is allocated with av_buffer_pool_init() and freed with
8202 + * av_buffer_pool_uninit().
8204 +typedef struct AVBufferPool AVBufferPool;
8207 + * Allocate and initialize a buffer pool.
8209 + * @param size size of each buffer in this pool
8210 + * @param alloc a function that will be used to allocate new buffers when the
8211 + * pool is empty. May be NULL, then the default allocator will be used
8212 + * (av_buffer_alloc()).
8213 + * @return newly created buffer pool on success, NULL on error.
8215 +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
8218 + * Allocate and initialize a buffer pool with a more complex allocator.
8220 + * @param size size of each buffer in this pool
8221 + * @param opaque arbitrary user data used by the allocator
8222 + * @param alloc a function that will be used to allocate new buffers when the
8224 + * @param pool_free a function that will be called immediately before the pool
8225 + * is freed. I.e. after av_buffer_pool_uninit() is called
8226 + * by the caller and all the frames are returned to the pool
8227 + * and freed. It is intended to uninitialize the user opaque
8229 + * @return newly created buffer pool on success, NULL on error.
8231 +AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
8232 + AVBufferRef* (*alloc)(void *opaque, int size),
8233 + void (*pool_free)(void *opaque));
8236 + * Mark the pool as being available for freeing. It will actually be freed only
8237 + * once all the allocated buffers associated with the pool are released. Thus it
8238 + * is safe to call this function while some of the allocated buffers are still
8241 + * @param pool pointer to the pool to be freed. It will be set to NULL.
8243 +void av_buffer_pool_uninit(AVBufferPool **pool);
8246 + * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
8247 + * This function may be called simultaneously from multiple threads.
8249 + * @return a reference to the new buffer on success, NULL on error.
8251 +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
8257 +#endif /* AVUTIL_BUFFER_H */
8258 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8259 new file mode 100644
8261 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
8264 + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8265 + * Copyright (c) 2008 Peter Ross
8267 + * This file is part of FFmpeg.
8269 + * FFmpeg is free software; you can redistribute it and/or
8270 + * modify it under the terms of the GNU Lesser General Public
8271 + * License as published by the Free Software Foundation; either
8272 + * version 2.1 of the License, or (at your option) any later version.
8274 + * FFmpeg is distributed in the hope that it will be useful,
8275 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8276 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8277 + * Lesser General Public License for more details.
8279 + * You should have received a copy of the GNU Lesser General Public
8280 + * License along with FFmpeg; if not, write to the Free Software
8281 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8284 +#ifndef AVUTIL_CHANNEL_LAYOUT_H
8285 +#define AVUTIL_CHANNEL_LAYOUT_H
8287 +#include <stdint.h>
8291 + * audio channel layout utility functions
8295 + * @addtogroup lavu_audio
8300 + * @defgroup channel_masks Audio channel masks
8302 + * A channel layout is a 64-bits integer with a bit set for every channel.
8303 + * The number of bits set must be equal to the number of channels.
8304 + * The value 0 means that the channel layout is not known.
8305 + * @note this data structure is not powerful enough to handle channels
8306 + * combinations that have the same channel multiple times, such as
8311 +#define AV_CH_FRONT_LEFT 0x00000001
8312 +#define AV_CH_FRONT_RIGHT 0x00000002
8313 +#define AV_CH_FRONT_CENTER 0x00000004
8314 +#define AV_CH_LOW_FREQUENCY 0x00000008
8315 +#define AV_CH_BACK_LEFT 0x00000010
8316 +#define AV_CH_BACK_RIGHT 0x00000020
8317 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
8318 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
8319 +#define AV_CH_BACK_CENTER 0x00000100
8320 +#define AV_CH_SIDE_LEFT 0x00000200
8321 +#define AV_CH_SIDE_RIGHT 0x00000400
8322 +#define AV_CH_TOP_CENTER 0x00000800
8323 +#define AV_CH_TOP_FRONT_LEFT 0x00001000
8324 +#define AV_CH_TOP_FRONT_CENTER 0x00002000
8325 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000
8326 +#define AV_CH_TOP_BACK_LEFT 0x00008000
8327 +#define AV_CH_TOP_BACK_CENTER 0x00010000
8328 +#define AV_CH_TOP_BACK_RIGHT 0x00020000
8329 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
8330 +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
8331 +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
8332 +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
8333 +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
8334 +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
8335 +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
8337 +/** Channel mask value used for AVCodecContext.request_channel_layout
8338 + to indicate that the user requests the channel order of the decoder output
8339 + to be the native codec channel order. */
8340 +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
8344 + * @defgroup channel_mask_c Audio channel layouts
8347 +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
8348 +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
8349 +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
8350 +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
8351 +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
8352 +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
8353 +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
8354 +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
8355 +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8356 +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8357 +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
8358 +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
8359 +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8360 +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
8361 +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
8362 +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8363 +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
8364 +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
8365 +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
8366 +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
8367 +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8368 +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8369 +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
8370 +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8371 +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
8372 +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
8373 +#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)
8374 +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
8376 +enum AVMatrixEncoding {
8377 + AV_MATRIX_ENCODING_NONE,
8378 + AV_MATRIX_ENCODING_DOLBY,
8379 + AV_MATRIX_ENCODING_DPLII,
8380 + AV_MATRIX_ENCODING_DPLIIX,
8381 + AV_MATRIX_ENCODING_DPLIIZ,
8382 + AV_MATRIX_ENCODING_DOLBYEX,
8383 + AV_MATRIX_ENCODING_DOLBYHEADPHONE,
8384 + AV_MATRIX_ENCODING_NB
8388 + * Return a channel layout id that matches name, or 0 if no match is found.
8390 + * name can be one or several of the following notations,
8391 + * separated by '+' or '|':
8392 + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
8393 + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
8394 + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
8395 + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
8396 + * - a number of channels, in decimal, followed by 'c', yielding
8397 + * the default channel layout for that number of channels (@see
8398 + * av_get_default_channel_layout);
8399 + * - a channel layout mask, in hexadecimal starting with "0x" (see the
8400 + * AV_CH_* macros).
8402 + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
8404 +uint64_t av_get_channel_layout(const char *name);
8407 + * Return a channel layout and the number of channels based on the specified name.
8409 + * This function is similar to (@see av_get_channel_layout), but can also parse
8410 + * unknown channel layout specifications.
8412 + * @param[in] name channel layout specification string
8413 + * @param[out] channel_layout parsed channel layout (0 if unknown)
8414 + * @param[out] nb_channels number of channels
8416 + * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
8418 +int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
8421 + * Return a description of a channel layout.
8422 + * If nb_channels is <= 0, it is guessed from the channel_layout.
8424 + * @param buf put here the string containing the channel layout
8425 + * @param buf_size size in bytes of the buffer
8427 +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
8431 + * Append a description of a channel layout to a bprint buffer.
8433 +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
8436 + * Return the number of channels in the channel layout.
8438 +int av_get_channel_layout_nb_channels(uint64_t channel_layout);
8441 + * Return default channel layout for a given number of channels.
8443 +int64_t av_get_default_channel_layout(int nb_channels);
8446 + * Get the index of a channel in channel_layout.
8448 + * @param channel a channel layout describing exactly one channel which must be
8449 + * present in channel_layout.
8451 + * @return index of channel in channel_layout on success, a negative AVERROR
8454 +int av_get_channel_layout_channel_index(uint64_t channel_layout,
8455 + uint64_t channel);
8458 + * Get the channel with the given index in channel_layout.
8460 +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
8463 + * Get the name of a given channel.
8465 + * @return channel name on success, NULL on error.
8467 +const char *av_get_channel_name(uint64_t channel);
8470 + * Get the description of a given channel.
8472 + * @param channel a channel layout with a single channel
8473 + * @return channel description on success, NULL on error
8475 +const char *av_get_channel_description(uint64_t channel);
8478 + * Get the value and name of a standard channel layout.
8480 + * @param[in] index index in an internal list, starting at 0
8481 + * @param[out] layout channel layout mask
8482 + * @param[out] name name of the layout
8483 + * @return 0 if the layout exists,
8484 + * <0 if index is beyond the limits
8486 +int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
8487 + const char **name);
8494 +#endif /* AVUTIL_CHANNEL_LAYOUT_H */
8495 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8496 new file mode 100644
8498 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
8501 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8503 + * This file is part of FFmpeg.
8505 + * FFmpeg is free software; you can redistribute it and/or
8506 + * modify it under the terms of the GNU Lesser General Public
8507 + * License as published by the Free Software Foundation; either
8508 + * version 2.1 of the License, or (at your option) any later version.
8510 + * FFmpeg is distributed in the hope that it will be useful,
8511 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8512 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8513 + * Lesser General Public License for more details.
8515 + * You should have received a copy of the GNU Lesser General Public
8516 + * License along with FFmpeg; if not, write to the Free Software
8517 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8522 + * common internal and external API header
8525 +#ifndef AVUTIL_COMMON_H
8526 +#define AVUTIL_COMMON_H
8528 +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
8529 +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
8533 +#include <inttypes.h>
8534 +#include <limits.h>
8536 +#include <stdint.h>
8538 +#include <stdlib.h>
8539 +#include <string.h>
8541 +#include "attributes.h"
8542 +#include "macros.h"
8543 +#include "version.h"
8544 +#include "libavutil/avconfig.h"
8546 +#if AV_HAVE_BIGENDIAN
8547 +# define AV_NE(be, le) (be)
8549 +# define AV_NE(be, le) (le)
8552 +//rounded division & shift
8553 +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
8555 +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
8556 +/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
8557 +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
8558 + : ((a) + (1<<(b)) - 1) >> (b))
8559 +/* Backwards compat. */
8560 +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
8562 +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
8563 +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
8566 + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
8567 + * are not representable as absolute values of their type. This is the same
8571 +#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
8572 +#define FFSIGN(a) ((a) > 0 ? 1 : -1)
8575 + * Negative Absolute value.
8576 + * this works for all integers of all types.
8577 + * As with many macros, this evaluates its argument twice, it thus must not have
8578 + * a sideeffect, that is FFNABS(x++) has undefined behavior.
8580 +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
8584 + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
8585 + * if x == y. This is useful for instance in a qsort comparator callback.
8586 + * Furthermore, compilers are able to optimize this to branchless code, and
8587 + * there is no risk of overflow with signed types.
8588 + * As with many macros, this evaluates its argument multiple times, it thus
8589 + * must not have a side-effect.
8591 +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
8593 +#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
8594 +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
8595 +#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
8596 +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
8598 +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
8599 +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
8601 +/* misc math functions */
8603 +#ifdef HAVE_AV_CONFIG_H
8604 +# include "config.h"
8605 +# include "intmath.h"
8608 +/* Pull in unguarded fallback defines at the end of this file. */
8609 +#include "common.h"
8612 +av_const int av_log2(unsigned v);
8615 +#ifndef av_log2_16bit
8616 +av_const int av_log2_16bit(unsigned v);
8620 + * Clip a signed integer value into the amin-amax range.
8621 + * @param a value to clip
8622 + * @param amin minimum value of the clip range
8623 + * @param amax maximum value of the clip range
8624 + * @return clipped value
8626 +static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
8628 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8629 + if (amin > amax) abort();
8631 + if (a < amin) return amin;
8632 + else if (a > amax) return amax;
8637 + * Clip a signed 64bit integer value into the amin-amax range.
8638 + * @param a value to clip
8639 + * @param amin minimum value of the clip range
8640 + * @param amax maximum value of the clip range
8641 + * @return clipped value
8643 +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
8645 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8646 + if (amin > amax) abort();
8648 + if (a < amin) return amin;
8649 + else if (a > amax) return amax;
8654 + * Clip a signed integer value into the 0-255 range.
8655 + * @param a value to clip
8656 + * @return clipped value
8658 +static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
8660 + if (a&(~0xFF)) return (~a)>>31;
8665 + * Clip a signed integer value into the -128,127 range.
8666 + * @param a value to clip
8667 + * @return clipped value
8669 +static av_always_inline av_const int8_t av_clip_int8_c(int a)
8671 + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
8676 + * Clip a signed integer value into the 0-65535 range.
8677 + * @param a value to clip
8678 + * @return clipped value
8680 +static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
8682 + if (a&(~0xFFFF)) return (~a)>>31;
8687 + * Clip a signed integer value into the -32768,32767 range.
8688 + * @param a value to clip
8689 + * @return clipped value
8691 +static av_always_inline av_const int16_t av_clip_int16_c(int a)
8693 + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
8698 + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
8699 + * @param a value to clip
8700 + * @return clipped value
8702 +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
8704 + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
8705 + else return (int32_t)a;
8709 + * Clip a signed integer into the -(2^p),(2^p-1) range.
8710 + * @param a value to clip
8711 + * @param p bit position to clip at
8712 + * @return clipped value
8714 +static av_always_inline av_const int av_clip_intp2_c(int a, int p)
8716 + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
8717 + return (a >> 31) ^ ((1 << p) - 1);
8723 + * Clip a signed integer to an unsigned power of two range.
8724 + * @param a value to clip
8725 + * @param p bit position to clip at
8726 + * @return clipped value
8728 +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
8730 + if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
8735 + * Clear high bits from an unsigned integer starting with specific bit position
8736 + * @param a value to clip
8737 + * @param p bit position to clip at
8738 + * @return clipped value
8740 +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
8742 + return a & ((1 << p) - 1);
8746 + * Add two signed 32-bit values with saturation.
8748 + * @param a one value
8749 + * @param b another value
8750 + * @return sum with signed saturation
8752 +static av_always_inline int av_sat_add32_c(int a, int b)
8754 + return av_clipl_int32((int64_t)a + b);
8758 + * Add a doubled value to another value with saturation at both stages.
8760 + * @param a first value
8761 + * @param b value doubled and added to a
8762 + * @return sum sat(a + sat(2*b)) with signed saturation
8764 +static av_always_inline int av_sat_dadd32_c(int a, int b)
8766 + return av_sat_add32(a, av_sat_add32(b, b));
8770 + * Subtract two signed 32-bit values with saturation.
8772 + * @param a one value
8773 + * @param b another value
8774 + * @return difference with signed saturation
8776 +static av_always_inline int av_sat_sub32_c(int a, int b)
8778 + return av_clipl_int32((int64_t)a - b);
8782 + * Subtract a doubled value from another value with saturation at both stages.
8784 + * @param a first value
8785 + * @param b value doubled and subtracted from a
8786 + * @return difference sat(a - sat(2*b)) with signed saturation
8788 +static av_always_inline int av_sat_dsub32_c(int a, int b)
8790 + return av_sat_sub32(a, av_sat_add32(b, b));
8794 + * Clip a float value into the amin-amax range.
8795 + * @param a value to clip
8796 + * @param amin minimum value of the clip range
8797 + * @param amax maximum value of the clip range
8798 + * @return clipped value
8800 +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
8802 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8803 + if (amin > amax) abort();
8805 + if (a < amin) return amin;
8806 + else if (a > amax) return amax;
8811 + * Clip a double value into the amin-amax range.
8812 + * @param a value to clip
8813 + * @param amin minimum value of the clip range
8814 + * @param amax maximum value of the clip range
8815 + * @return clipped value
8817 +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
8819 +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
8820 + if (amin > amax) abort();
8822 + if (a < amin) return amin;
8823 + else if (a > amax) return amax;
8827 +/** Compute ceil(log2(x)).
8828 + * @param x value used to compute ceil(log2(x))
8829 + * @return computed ceiling of log2(x)
8831 +static av_always_inline av_const int av_ceil_log2_c(int x)
8833 + return av_log2((x - 1) << 1);
8837 + * Count number of bits set to one in x
8838 + * @param x value to count bits of
8839 + * @return the number of bits set to one in x
8841 +static av_always_inline av_const int av_popcount_c(uint32_t x)
8843 + x -= (x >> 1) & 0x55555555;
8844 + x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
8845 + x = (x + (x >> 4)) & 0x0F0F0F0F;
8847 + return (x + (x >> 16)) & 0x3F;
8851 + * Count number of bits set to one in x
8852 + * @param x value to count bits of
8853 + * @return the number of bits set to one in x
8855 +static av_always_inline av_const int av_popcount64_c(uint64_t x)
8857 + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
8860 +static av_always_inline av_const int av_parity_c(uint32_t v)
8862 + return av_popcount(v) & 1;
8865 +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
8866 +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
8869 + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
8871 + * @param val Output value, must be an lvalue of type uint32_t.
8872 + * @param GET_BYTE Expression reading one byte from the input.
8873 + * Evaluated up to 7 times (4 for the currently
8874 + * assigned Unicode range). With a memory buffer
8875 + * input, this could be *ptr++.
8876 + * @param ERROR Expression to be evaluated on invalid input,
8877 + * typically a goto statement.
8879 + * @warning ERROR should not contain a loop control statement which
8880 + * could interact with the internal while loop, and should force an
8881 + * exit from the macro code (e.g. through a goto or a return) in order
8882 + * to prevent undefined results.
8884 +#define GET_UTF8(val, GET_BYTE, ERROR)\
8887 + uint32_t top = (val & 128) >> 1;\
8888 + if ((val & 0xc0) == 0x80 || val >= 0xFE)\
8890 + while (val & top) {\
8891 + int tmp= (GET_BYTE) - 128;\
8894 + val= (val<<6) + tmp;\
8897 + val &= (top << 1) - 1;\
8901 + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
8903 + * @param val Output value, must be an lvalue of type uint32_t.
8904 + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
8905 + * to native byte order. Evaluated one or two times.
8906 + * @param ERROR Expression to be evaluated on invalid input,
8907 + * typically a goto statement.
8909 +#define GET_UTF16(val, GET_16BIT, ERROR)\
8912 + unsigned int hi = val - 0xD800;\
8913 + if (hi < 0x800) {\
8914 + val = GET_16BIT - 0xDC00;\
8915 + if (val > 0x3FFU || hi > 0x3FFU)\
8917 + val += (hi<<10) + 0x10000;\
8922 + * @def PUT_UTF8(val, tmp, PUT_BYTE)
8923 + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
8924 + * @param val is an input-only argument and should be of type uint32_t. It holds
8925 + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
8926 + * val is given as a function it is executed only once.
8927 + * @param tmp is a temporary variable and should be of type uint8_t. It
8928 + * represents an intermediate value during conversion that is to be
8929 + * output by PUT_BYTE.
8930 + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
8931 + * It could be a function or a statement, and uses tmp as the input byte.
8932 + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
8933 + * executed up to 4 times for values in the valid UTF-8 range and up to
8934 + * 7 times in the general case, depending on the length of the converted
8935 + * Unicode character.
8937 +#define PUT_UTF8(val, tmp, PUT_BYTE)\
8939 + int bytes, shift;\
8940 + uint32_t in = val;\
8945 + bytes = (av_log2(in) + 4) / 5;\
8946 + shift = (bytes - 1) * 6;\
8947 + tmp = (256 - (256 >> bytes)) | (in >> shift);\
8949 + while (shift >= 6) {\
8951 + tmp = 0x80 | ((in >> shift) & 0x3f);\
8958 + * @def PUT_UTF16(val, tmp, PUT_16BIT)
8959 + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
8960 + * @param val is an input-only argument and should be of type uint32_t. It holds
8961 + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
8962 + * val is given as a function it is executed only once.
8963 + * @param tmp is a temporary variable and should be of type uint16_t. It
8964 + * represents an intermediate value during conversion that is to be
8965 + * output by PUT_16BIT.
8966 + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
8967 + * in desired endianness. It could be a function or a statement, and uses tmp
8968 + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
8969 + * PUT_BYTE will be executed 1 or 2 times depending on input character.
8971 +#define PUT_UTF16(val, tmp, PUT_16BIT)\
8973 + uint32_t in = val;\
8974 + if (in < 0x10000) {\
8978 + tmp = 0xD800 | ((in - 0x10000) >> 10);\
8980 + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
8989 +#ifdef HAVE_AV_CONFIG_H
8990 +# include "internal.h"
8991 +#endif /* HAVE_AV_CONFIG_H */
8993 +#endif /* AVUTIL_COMMON_H */
8996 + * The following definitions are outside the multiple inclusion guard
8997 + * to ensure they are immediately available in intmath.h.
9000 +#ifndef av_ceil_log2
9001 +# define av_ceil_log2 av_ceil_log2_c
9004 +# define av_clip av_clip_c
9007 +# define av_clip64 av_clip64_c
9009 +#ifndef av_clip_uint8
9010 +# define av_clip_uint8 av_clip_uint8_c
9012 +#ifndef av_clip_int8
9013 +# define av_clip_int8 av_clip_int8_c
9015 +#ifndef av_clip_uint16
9016 +# define av_clip_uint16 av_clip_uint16_c
9018 +#ifndef av_clip_int16
9019 +# define av_clip_int16 av_clip_int16_c
9021 +#ifndef av_clipl_int32
9022 +# define av_clipl_int32 av_clipl_int32_c
9024 +#ifndef av_clip_intp2
9025 +# define av_clip_intp2 av_clip_intp2_c
9027 +#ifndef av_clip_uintp2
9028 +# define av_clip_uintp2 av_clip_uintp2_c
9030 +#ifndef av_mod_uintp2
9031 +# define av_mod_uintp2 av_mod_uintp2_c
9033 +#ifndef av_sat_add32
9034 +# define av_sat_add32 av_sat_add32_c
9036 +#ifndef av_sat_dadd32
9037 +# define av_sat_dadd32 av_sat_dadd32_c
9039 +#ifndef av_sat_sub32
9040 +# define av_sat_sub32 av_sat_sub32_c
9042 +#ifndef av_sat_dsub32
9043 +# define av_sat_dsub32 av_sat_dsub32_c
9046 +# define av_clipf av_clipf_c
9049 +# define av_clipd av_clipd_c
9051 +#ifndef av_popcount
9052 +# define av_popcount av_popcount_c
9054 +#ifndef av_popcount64
9055 +# define av_popcount64 av_popcount64_c
9058 +# define av_parity av_parity_c
9060 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9061 new file mode 100644
9063 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
9066 + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
9068 + * This file is part of FFmpeg.
9070 + * FFmpeg is free software; you can redistribute it and/or
9071 + * modify it under the terms of the GNU Lesser General Public
9072 + * License as published by the Free Software Foundation; either
9073 + * version 2.1 of the License, or (at your option) any later version.
9075 + * FFmpeg is distributed in the hope that it will be useful,
9076 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9077 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9078 + * Lesser General Public License for more details.
9080 + * You should have received a copy of the GNU Lesser General Public
9081 + * License along with FFmpeg; if not, write to the Free Software
9082 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9085 +#ifndef AVUTIL_CPU_H
9086 +#define AVUTIL_CPU_H
9088 +#include <stddef.h>
9090 +#include "attributes.h"
9092 +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
9094 + /* lower 16 bits - CPU features */
9095 +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
9096 +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
9097 +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
9098 +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
9099 +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
9100 +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
9101 +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
9102 + ///< than regular MMX/SSE (e.g. Core1)
9103 +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
9104 +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
9105 +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
9106 + ///< than regular MMX/SSE (e.g. Core1)
9107 +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
9108 +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
9109 +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
9110 +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
9111 +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
9112 +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
9113 +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
9114 +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
9115 +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
9116 +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
9117 +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
9118 +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
9119 +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
9120 +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
9121 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
9122 +#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
9124 +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
9125 +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
9126 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
9128 +#define AV_CPU_FLAG_ARMV5TE (1 << 0)
9129 +#define AV_CPU_FLAG_ARMV6 (1 << 1)
9130 +#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
9131 +#define AV_CPU_FLAG_VFP (1 << 3)
9132 +#define AV_CPU_FLAG_VFPV3 (1 << 4)
9133 +#define AV_CPU_FLAG_NEON (1 << 5)
9134 +#define AV_CPU_FLAG_ARMV8 (1 << 6)
9135 +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
9136 +#define AV_CPU_FLAG_SETEND (1 <<16)
9139 + * Return the flags which specify extensions supported by the CPU.
9140 + * The returned value is affected by av_force_cpu_flags() if that was used
9141 + * before. So av_get_cpu_flags() can easily be used in an application to
9142 + * detect the enabled cpu flags.
9144 +int av_get_cpu_flags(void);
9147 + * Disables cpu detection and forces the specified flags.
9148 + * -1 is a special case that disables forcing of specific flags.
9150 +void av_force_cpu_flags(int flags);
9153 + * Set a mask on flags returned by av_get_cpu_flags().
9154 + * This function is mainly useful for testing.
9155 + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
9157 +attribute_deprecated void av_set_cpu_flags_mask(int mask);
9160 + * Parse CPU flags from a string.
9162 + * The returned flags contain the specified flags as well as related unspecified flags.
9164 + * This function exists only for compatibility with libav.
9165 + * Please use av_parse_cpu_caps() when possible.
9166 + * @return a combination of AV_CPU_* flags, negative on error.
9168 +attribute_deprecated
9169 +int av_parse_cpu_flags(const char *s);
9172 + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
9174 + * @return negative on error.
9176 +int av_parse_cpu_caps(unsigned *flags, const char *s);
9179 + * @return the number of logical CPU cores present.
9181 +int av_cpu_count(void);
9184 + * Get the maximum data alignment that may be required by FFmpeg.
9186 + * Note that this is affected by the build configuration and the CPU flags mask,
9187 + * so e.g. if the CPU supports AVX, but libavutil has been built with
9188 + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
9189 + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
9192 +size_t av_cpu_max_align(void);
9194 +#endif /* AVUTIL_CPU_H */
9195 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9196 new file mode 100644
9198 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
9201 + * This file is part of FFmpeg.
9203 + * FFmpeg is free software; you can redistribute it and/or
9204 + * modify it under the terms of the GNU Lesser General Public
9205 + * License as published by the Free Software Foundation; either
9206 + * version 2.1 of the License, or (at your option) any later version.
9208 + * FFmpeg is distributed in the hope that it will be useful,
9209 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9210 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9211 + * Lesser General Public License for more details.
9213 + * You should have received a copy of the GNU Lesser General Public
9214 + * License along with FFmpeg; if not, write to the Free Software
9215 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9220 + * Public dictionary API.
9222 + * AVDictionary is provided for compatibility with libav. It is both in
9223 + * implementation as well as API inefficient. It does not scale and is
9224 + * extremely slow with large dictionaries.
9225 + * It is recommended that new code uses our tree container from tree.c/h
9226 + * where applicable, which uses AVL trees to achieve O(log n) performance.
9229 +#ifndef AVUTIL_DICT_H
9230 +#define AVUTIL_DICT_H
9232 +#include <stdint.h>
9234 +#include "version.h"
9237 + * @addtogroup lavu_dict AVDictionary
9238 + * @ingroup lavu_data
9240 + * @brief Simple key:value store
9243 + * Dictionaries are used for storing key:value pairs. To create
9244 + * an AVDictionary, simply pass an address of a NULL pointer to
9245 + * av_dict_set(). NULL can be used as an empty dictionary wherever
9246 + * a pointer to an AVDictionary is required.
9247 + * Use av_dict_get() to retrieve an entry or iterate over all
9248 + * entries and finally av_dict_free() to free the dictionary
9249 + * and all its contents.
9252 + AVDictionary *d = NULL; // "create" an empty dictionary
9253 + AVDictionaryEntry *t = NULL;
9255 + av_dict_set(&d, "foo", "bar", 0); // add an entry
9257 + char *k = av_strdup("key"); // if your strings are already allocated,
9258 + char *v = av_strdup("value"); // you can avoid copying them like this
9259 + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
9261 + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
9262 + <....> // iterate over all entries in d
9268 +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
9269 +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
9270 + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
9271 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
9272 + allocated with av_malloc() or another memory allocation function. */
9273 +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
9274 + allocated with av_malloc() or another memory allocation function. */
9275 +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
9276 +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
9277 + delimiter is added, the strings are simply concatenated. */
9278 +#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
9280 +typedef struct AVDictionaryEntry {
9283 +} AVDictionaryEntry;
9285 +typedef struct AVDictionary AVDictionary;
9288 + * Get a dictionary entry with matching key.
9290 + * The returned entry key or value must not be changed, or it will
9291 + * cause undefined behavior.
9293 + * To iterate through all the dictionary entries, you can set the matching key
9294 + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
9296 + * @param prev Set to the previous matching element to find the next.
9297 + * If set to NULL the first matching element is returned.
9298 + * @param key matching key
9299 + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
9300 + * @return found entry or NULL in case no matching entry was found in the dictionary
9302 +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
9303 + const AVDictionaryEntry *prev, int flags);
9306 + * Get number of entries in dictionary.
9308 + * @param m dictionary
9309 + * @return number of entries in dictionary
9311 +int av_dict_count(const AVDictionary *m);
9314 + * Set the given entry in *pm, overwriting an existing entry.
9316 + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
9317 + * these arguments will be freed on error.
9319 + * Warning: Adding a new entry to a dictionary invalidates all existing entries
9320 + * previously returned with av_dict_get.
9322 + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
9323 + * a dictionary struct is allocated and put in *pm.
9324 + * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
9325 + * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
9326 + * Passing a NULL value will cause an existing entry to be deleted.
9327 + * @return >= 0 on success otherwise an error code <0
9329 +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
9332 + * Convenience wrapper for av_dict_set that converts the value to a string
9335 + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
9337 +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
9340 + * Parse the key/value pairs list and add the parsed entries to a dictionary.
9342 + * In case of failure, all the successfully set entries are stored in
9343 + * *pm. You may need to manually free the created dictionary.
9345 + * @param key_val_sep a 0-terminated list of characters used to separate
9347 + * @param pairs_sep a 0-terminated list of characters used to separate
9348 + * two pairs from each other
9349 + * @param flags flags to use when adding to dictionary.
9350 + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
9351 + * are ignored since the key/value tokens will always
9353 + * @return 0 on success, negative AVERROR code on failure
9355 +int av_dict_parse_string(AVDictionary **pm, const char *str,
9356 + const char *key_val_sep, const char *pairs_sep,
9360 + * Copy entries from one AVDictionary struct into another.
9361 + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
9362 + * this function will allocate a struct for you and put it in *dst
9363 + * @param src pointer to source AVDictionary struct
9364 + * @param flags flags to use when setting entries in *dst
9365 + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
9366 + * @return 0 on success, negative AVERROR code on failure. If dst was allocated
9367 + * by this function, callers should free the associated memory.
9369 +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
9372 + * Free all the memory allocated for an AVDictionary struct
9373 + * and all keys and values.
9375 +void av_dict_free(AVDictionary **m);
9378 + * Get dictionary entries as a string.
9380 + * Create a string containing dictionary's entries.
9381 + * Such string may be passed back to av_dict_parse_string().
9382 + * @note String is escaped with backslashes ('\').
9384 + * @param[in] m dictionary
9385 + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
9386 + * Buffer must be freed by the caller when is no longer needed.
9387 + * @param[in] key_val_sep character used to separate key from value
9388 + * @param[in] pairs_sep character used to separate two pairs from each other
9389 + * @return >= 0 on success, negative on error
9390 + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
9392 +int av_dict_get_string(const AVDictionary *m, char **buffer,
9393 + const char key_val_sep, const char pairs_sep);
9399 +#endif /* AVUTIL_DICT_H */
9400 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9401 new file mode 100644
9403 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
9406 + * This file is part of FFmpeg.
9408 + * FFmpeg is free software; you can redistribute it and/or
9409 + * modify it under the terms of the GNU Lesser General Public
9410 + * License as published by the Free Software Foundation; either
9411 + * version 2.1 of the License, or (at your option) any later version.
9413 + * FFmpeg is distributed in the hope that it will be useful,
9414 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9415 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9416 + * Lesser General Public License for more details.
9418 + * You should have received a copy of the GNU Lesser General Public
9419 + * License along with FFmpeg; if not, write to the Free Software
9420 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9425 + * error code definitions
9428 +#ifndef AVUTIL_ERROR_H
9429 +#define AVUTIL_ERROR_H
9432 +#include <stddef.h>
9435 + * @addtogroup lavu_error
9441 +/* error handling */
9443 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
9444 +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
9446 +/* Some platforms have E* and errno already negated. */
9447 +#define AVERROR(e) (e)
9448 +#define AVUNERROR(e) (e)
9451 +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
9453 +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
9454 +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
9455 +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
9456 +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
9457 +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
9458 +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
9459 +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
9460 +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
9461 +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
9462 +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
9463 +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
9464 +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
9465 +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
9466 +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
9467 +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
9469 +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
9471 + * This is semantically identical to AVERROR_BUG
9472 + * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
9474 +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
9475 +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
9476 +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
9477 +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
9478 +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
9479 +/* HTTP & RTSP errors */
9480 +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0')
9481 +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
9482 +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
9483 +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
9484 +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
9485 +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')
9487 +#define AV_ERROR_MAX_STRING_SIZE 64
9490 + * Put a description of the AVERROR code errnum in errbuf.
9491 + * In case of failure the global variable errno is set to indicate the
9492 + * error. Even in case of failure av_strerror() will print a generic
9493 + * error message indicating the errnum provided to errbuf.
9495 + * @param errnum error code to describe
9496 + * @param errbuf buffer to which description is written
9497 + * @param errbuf_size the size in bytes of errbuf
9498 + * @return 0 on success, a negative value if a description for errnum
9501 +int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
9504 + * Fill the provided buffer with a string containing an error string
9505 + * corresponding to the AVERROR code errnum.
9507 + * @param errbuf a buffer
9508 + * @param errbuf_size size in bytes of errbuf
9509 + * @param errnum error code to describe
9510 + * @return the buffer in input, filled with the error description
9511 + * @see av_strerror()
9513 +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
9515 + av_strerror(errnum, errbuf, errbuf_size);
9520 + * Convenience macro, the return value should be used only directly in
9521 + * function arguments but never stand-alone.
9523 +#define av_err2str(errnum) \
9524 + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
9530 +#endif /* AVUTIL_ERROR_H */
9531 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9532 new file mode 100644
9534 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
9537 + * This file is part of FFmpeg.
9539 + * FFmpeg is free software; you can redistribute it and/or
9540 + * modify it under the terms of the GNU Lesser General Public
9541 + * License as published by the Free Software Foundation; either
9542 + * version 2.1 of the License, or (at your option) any later version.
9544 + * FFmpeg is distributed in the hope that it will be useful,
9545 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9546 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9547 + * Lesser General Public License for more details.
9549 + * You should have received a copy of the GNU Lesser General Public
9550 + * License along with FFmpeg; if not, write to the Free Software
9551 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9556 + * @ingroup lavu_frame
9557 + * reference-counted frame API
9560 +#ifndef AVUTIL_FRAME_H
9561 +#define AVUTIL_FRAME_H
9563 +#include <stddef.h>
9564 +#include <stdint.h>
9566 +#include "avutil.h"
9567 +#include "buffer.h"
9569 +#include "rational.h"
9570 +#include "samplefmt.h"
9571 +#include "pixfmt.h"
9572 +#include "version.h"
9576 + * @defgroup lavu_frame AVFrame
9577 + * @ingroup lavu_data
9580 + * AVFrame is an abstraction for reference-counted raw multimedia data.
9583 +enum AVFrameSideDataType {
9585 + * The data is the AVPanScan struct defined in libavcodec.
9587 + AV_FRAME_DATA_PANSCAN,
9589 + * ATSC A53 Part 4 Closed Captions.
9590 + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
9591 + * The number of bytes of CC data is AVFrameSideData.size.
9593 + AV_FRAME_DATA_A53_CC,
9595 + * Stereoscopic 3d metadata.
9596 + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
9598 + AV_FRAME_DATA_STEREO3D,
9600 + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
9602 + AV_FRAME_DATA_MATRIXENCODING,
9604 + * Metadata relevant to a downmix procedure.
9605 + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
9607 + AV_FRAME_DATA_DOWNMIX_INFO,
9609 + * ReplayGain information in the form of the AVReplayGain struct.
9611 + AV_FRAME_DATA_REPLAYGAIN,
9613 + * This side data contains a 3x3 transformation matrix describing an affine
9614 + * transformation that needs to be applied to the frame for correct
9617 + * See libavutil/display.h for a detailed description of the data.
9619 + AV_FRAME_DATA_DISPLAYMATRIX,
9621 + * Active Format Description data consisting of a single byte as specified
9622 + * in ETSI TS 101 154 using AVActiveFormatDescription enum.
9624 + AV_FRAME_DATA_AFD,
9626 + * Motion vectors exported by some codecs (on demand through the export_mvs
9627 + * flag set in the libavcodec AVCodecContext flags2 option).
9628 + * The data is the AVMotionVector struct defined in
9629 + * libavutil/motion_vector.h.
9631 + AV_FRAME_DATA_MOTION_VECTORS,
9633 + * Recommmends skipping the specified number of samples. This is exported
9634 + * only if the "skip_manual" AVOption is set in libavcodec.
9635 + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
9637 + * u32le number of samples to skip from start of this packet
9638 + * u32le number of samples to skip from end of this packet
9639 + * u8 reason for start skip
9640 + * u8 reason for end skip (0=padding silence, 1=convergence)
9643 + AV_FRAME_DATA_SKIP_SAMPLES,
9645 + * This side data must be associated with an audio frame and corresponds to
9646 + * enum AVAudioServiceType defined in avcodec.h.
9648 + AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
9650 + * Mastering display metadata associated with a video frame. The payload is
9651 + * an AVMasteringDisplayMetadata type and contains information about the
9652 + * mastering display color volume.
9654 + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
9656 + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
9657 + * This is set on the first frame of a GOP that has a temporal reference of 0.
9659 + AV_FRAME_DATA_GOP_TIMECODE,
9662 + * The data represents the AVSphericalMapping structure defined in
9663 + * libavutil/spherical.h.
9665 + AV_FRAME_DATA_SPHERICAL,
9668 + * Content light level (based on CTA-861.3). This payload contains data in
9669 + * the form of the AVContentLightMetadata struct.
9671 + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
9674 + * The data contains an ICC profile as an opaque octet buffer following the
9675 + * format described by ISO 15076-1 with an optional name defined in the
9676 + * metadata key entry "name".
9678 + AV_FRAME_DATA_ICC_PROFILE,
9680 +#if FF_API_FRAME_QP
9682 + * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
9683 + * The contents of this side data are undocumented and internal; use
9684 + * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
9685 + * meaningful way instead.
9687 + AV_FRAME_DATA_QP_TABLE_PROPERTIES,
9690 + * Raw QP table data. Its format is described by
9691 + * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
9692 + * av_frame_get_qp_table() to access this instead.
9694 + AV_FRAME_DATA_QP_TABLE_DATA,
9698 +enum AVActiveFormatDescription {
9703 + AV_AFD_4_3_SP_14_9 = 13,
9704 + AV_AFD_16_9_SP_14_9 = 14,
9705 + AV_AFD_SP_4_3 = 15,
9710 + * Structure to hold side data for an AVFrame.
9712 + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
9713 + * to the end with a minor bump.
9715 +typedef struct AVFrameSideData {
9716 + enum AVFrameSideDataType type;
9719 + AVDictionary *metadata;
9724 + * This structure describes decoded (raw) audio or video data.
9726 + * AVFrame must be allocated using av_frame_alloc(). Note that this only
9727 + * allocates the AVFrame itself, the buffers for the data must be managed
9728 + * through other means (see below).
9729 + * AVFrame must be freed with av_frame_free().
9731 + * AVFrame is typically allocated once and then reused multiple times to hold
9732 + * different data (e.g. a single AVFrame to hold frames received from a
9733 + * decoder). In such a case, av_frame_unref() will free any references held by
9734 + * the frame and reset it to its original clean state before it
9735 + * is reused again.
9737 + * The data described by an AVFrame is usually reference counted through the
9738 + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
9739 + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
9740 + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
9741 + * every single data plane must be contained in one of the buffers in
9742 + * AVFrame.buf or AVFrame.extended_buf.
9743 + * There may be a single buffer for all the data, or one separate buffer for
9744 + * each plane, or anything in between.
9746 + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
9747 + * to the end with a minor bump.
9749 + * Fields can be accessed through AVOptions, the name string used, matches the
9750 + * C structure field name for fields accessible through AVOptions. The AVClass
9751 + * for AVFrame can be obtained from avcodec_get_frame_class()
9753 +typedef struct AVFrame {
9754 +#define AV_NUM_DATA_POINTERS 8
9756 + * pointer to the picture/channel planes.
9757 + * This might be different from the first allocated byte
9759 + * Some decoders access areas outside 0,0 - width,height, please
9760 + * see avcodec_align_dimensions2(). Some filters and swscale can read
9761 + * up to 16 bytes beyond the planes, if these filters are to be used,
9762 + * then 16 extra bytes must be allocated.
9764 + * NOTE: Except for hwaccel formats, pointers not needed by the format
9765 + * MUST be set to NULL.
9767 + uint8_t *data[AV_NUM_DATA_POINTERS];
9770 + * For video, size in bytes of each picture line.
9771 + * For audio, size in bytes of each plane.
9773 + * For audio, only linesize[0] may be set. For planar audio, each channel
9774 + * plane must be the same size.
9776 + * For video the linesizes should be multiples of the CPUs alignment
9777 + * preference, this is 16 or 32 for modern desktop CPUs.
9778 + * Some code requires such alignment other code can be slower without
9779 + * correct alignment, for yet other it makes no difference.
9781 + * @note The linesize may be larger than the size of usable data -- there
9782 + * may be extra padding present for performance reasons.
9784 + int linesize[AV_NUM_DATA_POINTERS];
9787 + * pointers to the data planes/channels.
9789 + * For video, this should simply point to data[].
9791 + * For planar audio, each channel has a separate data pointer, and
9792 + * linesize[0] contains the size of each channel buffer.
9793 + * For packed audio, there is just one data pointer, and linesize[0]
9794 + * contains the total size of the buffer for all channels.
9796 + * Note: Both data and extended_data should always be set in a valid frame,
9797 + * but for planar audio with more channels that can fit in data,
9798 + * extended_data must be used in order to access all channels.
9800 + uint8_t **extended_data;
9803 + * @name Video dimensions
9804 + * Video frames only. The coded dimensions (in pixels) of the video frame,
9805 + * i.e. the size of the rectangle that contains some well-defined values.
9807 + * @note The part of the frame intended for display/presentation is further
9808 + * restricted by the @ref cropping "Cropping rectangle".
9811 + int width, height;
9817 + * number of audio samples (per channel) described by this frame
9822 + * format of the frame, -1 if unknown or unset
9823 + * Values correspond to enum AVPixelFormat for video frames,
9824 + * enum AVSampleFormat for audio)
9829 + * 1 -> keyframe, 0-> not
9834 + * Picture type of the frame.
9836 + enum AVPictureType pict_type;
9839 + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
9841 + AVRational sample_aspect_ratio;
9844 + * Presentation timestamp in time_base units (time when frame should be shown to user).
9850 + * PTS copied from the AVPacket that was decoded to produce this frame.
9851 + * @deprecated use the pts field instead
9853 + attribute_deprecated
9858 + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
9859 + * This is also the Presentation time of this AVFrame calculated from
9860 + * only AVPacket.dts values without pts values.
9865 + * picture number in bitstream order
9867 + int coded_picture_number;
9869 + * picture number in display order
9871 + int display_picture_number;
9874 + * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
9879 + * for some private data of the user
9883 +#if FF_API_ERROR_FRAME
9885 + * @deprecated unused
9887 + attribute_deprecated
9888 + uint64_t error[AV_NUM_DATA_POINTERS];
9892 + * When decoding, this signals how much the picture must be delayed.
9893 + * extra_delay = repeat_pict / (2*fps)
9898 + * The content of the picture is interlaced.
9900 + int interlaced_frame;
9903 + * If the content is interlaced, is top field displayed first.
9905 + int top_field_first;
9908 + * Tell user application that palette has changed from previous frame.
9910 + int palette_has_changed;
9913 + * reordered opaque 64 bits (generally an integer or a double precision float
9914 + * PTS but can be anything).
9915 + * The user sets AVCodecContext.reordered_opaque to represent the input at
9917 + * the decoder reorders values as needed and sets AVFrame.reordered_opaque
9918 + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
9919 + * @deprecated in favor of pkt_pts
9921 + int64_t reordered_opaque;
9924 + * Sample rate of the audio data.
9929 + * Channel layout of the audio data.
9931 + uint64_t channel_layout;
9934 + * AVBuffer references backing the data for this frame. If all elements of
9935 + * this array are NULL, then this frame is not reference counted. This array
9936 + * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
9937 + * also be non-NULL for all j < i.
9939 + * There may be at most one AVBuffer per data plane, so for video this array
9940 + * always contains all the references. For planar audio with more than
9941 + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
9942 + * this array. Then the extra AVBufferRef pointers are stored in the
9943 + * extended_buf array.
9945 + AVBufferRef *buf[AV_NUM_DATA_POINTERS];
9948 + * For planar audio which requires more than AV_NUM_DATA_POINTERS
9949 + * AVBufferRef pointers, this array will hold all the references which
9950 + * cannot fit into AVFrame.buf.
9952 + * Note that this is different from AVFrame.extended_data, which always
9953 + * contains all the pointers. This array only contains the extra pointers,
9954 + * which cannot fit into AVFrame.buf.
9956 + * This array is always allocated using av_malloc() by whoever constructs
9957 + * the frame. It is freed in av_frame_unref().
9959 + AVBufferRef **extended_buf;
9961 + * Number of elements in extended_buf.
9963 + int nb_extended_buf;
9965 + AVFrameSideData **side_data;
9969 + * @defgroup lavu_frame_flags AV_FRAME_FLAGS
9970 + * @ingroup lavu_frame
9971 + * Flags describing additional frame properties.
9977 + * The frame data may be corrupted, e.g. due to decoding errors.
9979 +#define AV_FRAME_FLAG_CORRUPT (1 << 0)
9981 + * A flag to mark the frames which need to be decoded, but shouldn't be output.
9983 +#define AV_FRAME_FLAG_DISCARD (1 << 2)
9989 + * Frame flags, a combination of @ref lavu_frame_flags
9994 + * MPEG vs JPEG YUV range.
9995 + * - encoding: Set by user
9996 + * - decoding: Set by libavcodec
9998 + enum AVColorRange color_range;
10000 + enum AVColorPrimaries color_primaries;
10002 + enum AVColorTransferCharacteristic color_trc;
10005 + * YUV colorspace type.
10006 + * - encoding: Set by user
10007 + * - decoding: Set by libavcodec
10009 + enum AVColorSpace colorspace;
10011 + enum AVChromaLocation chroma_location;
10014 + * frame timestamp estimated using various heuristics, in stream time base
10015 + * - encoding: unused
10016 + * - decoding: set by libavcodec, read by user.
10018 + int64_t best_effort_timestamp;
10021 + * reordered pos from the last AVPacket that has been input into the decoder
10022 + * - encoding: unused
10023 + * - decoding: Read by user.
10028 + * duration of the corresponding packet, expressed in
10029 + * AVStream->time_base units, 0 if unknown.
10030 + * - encoding: unused
10031 + * - decoding: Read by user.
10033 + int64_t pkt_duration;
10037 + * - encoding: Set by user.
10038 + * - decoding: Set by libavcodec.
10040 + AVDictionary *metadata;
10043 + * decode error flags of the frame, set to a combination of
10044 + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
10045 + * were errors during the decoding.
10046 + * - encoding: unused
10047 + * - decoding: set by libavcodec, read by user.
10049 + int decode_error_flags;
10050 +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
10051 +#define FF_DECODE_ERROR_MISSING_REFERENCE 2
10054 + * number of audio channels, only used for audio.
10055 + * - encoding: unused
10056 + * - decoding: Read by user.
10061 + * size of the corresponding packet containing the compressed
10063 + * It is set to a negative value if unknown.
10064 + * - encoding: unused
10065 + * - decoding: set by libavcodec, read by user.
10069 +#if FF_API_FRAME_QP
10073 + attribute_deprecated
10074 + int8_t *qscale_table;
10076 + * QP store stride
10078 + attribute_deprecated
10081 + attribute_deprecated
10084 + attribute_deprecated
10085 + AVBufferRef *qp_table_buf;
10088 + * For hwaccel-format frames, this should be a reference to the
10089 + * AVHWFramesContext describing the frame.
10091 + AVBufferRef *hw_frames_ctx;
10094 + * AVBufferRef for free use by the API user. FFmpeg will never check the
10095 + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
10096 + * the frame is unreferenced. av_frame_copy_props() calls create a new
10097 + * reference with av_buffer_ref() for the target frame's opaque_ref field.
10099 + * This is unrelated to the opaque field, although it serves a similar
10102 + AVBufferRef *opaque_ref;
10105 + * @anchor cropping
10107 + * Video frames only. The number of pixels to discard from the the
10108 + * top/bottom/left/right border of the frame to obtain the sub-rectangle of
10109 + * the frame intended for presentation.
10113 + size_t crop_bottom;
10114 + size_t crop_left;
10115 + size_t crop_right;
10121 + * AVBufferRef for internal use by a single libav* library.
10122 + * Must not be used to transfer data between libraries.
10123 + * Has to be NULL when ownership of the frame leaves the respective library.
10125 + * Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
10127 + * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
10128 + * av_frame_copy_props() calls create a new reference with av_buffer_ref()
10129 + * for the target frame's private_ref field.
10131 + AVBufferRef *private_ref;
10134 +#if FF_API_FRAME_GET_SET
10136 + * Accessors for some AVFrame fields. These used to be provided for ABI
10137 + * compatibility, and do not need to be used anymore.
10139 +attribute_deprecated
10140 +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
10141 +attribute_deprecated
10142 +void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
10143 +attribute_deprecated
10144 +int64_t av_frame_get_pkt_duration (const AVFrame *frame);
10145 +attribute_deprecated
10146 +void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
10147 +attribute_deprecated
10148 +int64_t av_frame_get_pkt_pos (const AVFrame *frame);
10149 +attribute_deprecated
10150 +void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
10151 +attribute_deprecated
10152 +int64_t av_frame_get_channel_layout (const AVFrame *frame);
10153 +attribute_deprecated
10154 +void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
10155 +attribute_deprecated
10156 +int av_frame_get_channels (const AVFrame *frame);
10157 +attribute_deprecated
10158 +void av_frame_set_channels (AVFrame *frame, int val);
10159 +attribute_deprecated
10160 +int av_frame_get_sample_rate (const AVFrame *frame);
10161 +attribute_deprecated
10162 +void av_frame_set_sample_rate (AVFrame *frame, int val);
10163 +attribute_deprecated
10164 +AVDictionary *av_frame_get_metadata (const AVFrame *frame);
10165 +attribute_deprecated
10166 +void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
10167 +attribute_deprecated
10168 +int av_frame_get_decode_error_flags (const AVFrame *frame);
10169 +attribute_deprecated
10170 +void av_frame_set_decode_error_flags (AVFrame *frame, int val);
10171 +attribute_deprecated
10172 +int av_frame_get_pkt_size(const AVFrame *frame);
10173 +attribute_deprecated
10174 +void av_frame_set_pkt_size(AVFrame *frame, int val);
10175 +#if FF_API_FRAME_QP
10176 +attribute_deprecated
10177 +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
10178 +attribute_deprecated
10179 +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
10181 +attribute_deprecated
10182 +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
10183 +attribute_deprecated
10184 +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
10185 +attribute_deprecated
10186 +enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
10187 +attribute_deprecated
10188 +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
10192 + * Get the name of a colorspace.
10193 + * @return a static string identifying the colorspace; can be NULL.
10195 +const char *av_get_colorspace_name(enum AVColorSpace val);
10198 + * Allocate an AVFrame and set its fields to default values. The resulting
10199 + * struct must be freed using av_frame_free().
10201 + * @return An AVFrame filled with default values or NULL on failure.
10203 + * @note this only allocates the AVFrame itself, not the data buffers. Those
10204 + * must be allocated through other means, e.g. with av_frame_get_buffer() or
10207 +AVFrame *av_frame_alloc(void);
10210 + * Free the frame and any dynamically allocated objects in it,
10211 + * e.g. extended_data. If the frame is reference counted, it will be
10212 + * unreferenced first.
10214 + * @param frame frame to be freed. The pointer will be set to NULL.
10216 +void av_frame_free(AVFrame **frame);
10219 + * Set up a new reference to the data described by the source frame.
10221 + * Copy frame properties from src to dst and create a new reference for each
10222 + * AVBufferRef from src.
10224 + * If src is not reference counted, new buffers are allocated and the data is
10227 + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
10228 + * or newly allocated with av_frame_alloc() before calling this
10229 + * function, or undefined behavior will occur.
10231 + * @return 0 on success, a negative AVERROR on error
10233 +int av_frame_ref(AVFrame *dst, const AVFrame *src);
10236 + * Create a new frame that references the same data as src.
10238 + * This is a shortcut for av_frame_alloc()+av_frame_ref().
10240 + * @return newly created AVFrame on success, NULL on error.
10242 +AVFrame *av_frame_clone(const AVFrame *src);
10245 + * Unreference all the buffers referenced by frame and reset the frame fields.
10247 +void av_frame_unref(AVFrame *frame);
10250 + * Move everything contained in src to dst and reset src.
10252 + * @warning: dst is not unreferenced, but directly overwritten without reading
10253 + * or deallocating its contents. Call av_frame_unref(dst) manually
10254 + * before calling this function to ensure that no memory is leaked.
10256 +void av_frame_move_ref(AVFrame *dst, AVFrame *src);
10259 + * Allocate new buffer(s) for audio or video data.
10261 + * The following fields must be set on frame before calling this function:
10262 + * - format (pixel format for video, sample format for audio)
10263 + * - width and height for video
10264 + * - nb_samples and channel_layout for audio
10266 + * This function will fill AVFrame.data and AVFrame.buf arrays and, if
10267 + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
10268 + * For planar formats, one buffer will be allocated for each plane.
10270 + * @warning: if frame already has been allocated, calling this function will
10271 + * leak memory. In addition, undefined behavior can occur in certain
10274 + * @param frame frame in which to store the new buffers.
10275 + * @param align Required buffer size alignment. If equal to 0, alignment will be
10276 + * chosen automatically for the current CPU. It is highly
10277 + * recommended to pass 0 here unless you know what you are doing.
10279 + * @return 0 on success, a negative AVERROR on error.
10281 +int av_frame_get_buffer(AVFrame *frame, int align);
10284 + * Check if the frame data is writable.
10286 + * @return A positive value if the frame data is writable (which is true if and
10287 + * only if each of the underlying buffers has only one reference, namely the one
10288 + * stored in this frame). Return 0 otherwise.
10290 + * If 1 is returned the answer is valid until av_buffer_ref() is called on any
10291 + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
10293 + * @see av_frame_make_writable(), av_buffer_is_writable()
10295 +int av_frame_is_writable(AVFrame *frame);
10298 + * Ensure that the frame data is writable, avoiding data copy if possible.
10300 + * Do nothing if the frame is writable, allocate new buffers and copy the data
10303 + * @return 0 on success, a negative AVERROR on error.
10305 + * @see av_frame_is_writable(), av_buffer_is_writable(),
10306 + * av_buffer_make_writable()
10308 +int av_frame_make_writable(AVFrame *frame);
10311 + * Copy the frame data from src to dst.
10313 + * This function does not allocate anything, dst must be already initialized and
10314 + * allocated with the same parameters as src.
10316 + * This function only copies the frame data (i.e. the contents of the data /
10317 + * extended data arrays), not any other properties.
10319 + * @return >= 0 on success, a negative AVERROR on error.
10321 +int av_frame_copy(AVFrame *dst, const AVFrame *src);
10324 + * Copy only "metadata" fields from src to dst.
10326 + * Metadata for the purpose of this function are those fields that do not affect
10327 + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
10328 + * aspect ratio (for video), but not width/height or channel layout.
10329 + * Side data is also copied.
10331 +int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
10334 + * Get the buffer reference a given data plane is stored in.
10336 + * @param plane index of the data plane of interest in frame->extended_data.
10338 + * @return the buffer reference that contains the plane or NULL if the input
10339 + * frame is not valid.
10341 +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
10344 + * Add a new side data to a frame.
10346 + * @param frame a frame to which the side data should be added
10347 + * @param type type of the added side data
10348 + * @param size size of the side data
10350 + * @return newly added side data on success, NULL on error
10352 +AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
10353 + enum AVFrameSideDataType type,
10357 + * Add a new side data to a frame from an existing AVBufferRef
10359 + * @param frame a frame to which the side data should be added
10360 + * @param type the type of the added side data
10361 + * @param buf an AVBufferRef to add as side data. The ownership of
10362 + * the reference is transferred to the frame.
10364 + * @return newly added side data on success, NULL on error. On failure
10365 + * the frame is unchanged and the AVBufferRef remains owned by
10368 +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
10369 + enum AVFrameSideDataType type,
10370 + AVBufferRef *buf);
10373 + * @return a pointer to the side data of a given type on success, NULL if there
10374 + * is no side data with such type in this frame.
10376 +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
10377 + enum AVFrameSideDataType type);
10380 + * If side data of the supplied type exists in the frame, free it and remove it
10381 + * from the frame.
10383 +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
10387 + * Flags for frame cropping.
10391 + * Apply the maximum possible cropping, even if it requires setting the
10392 + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
10393 + * to FFmpeg API is generally not allowed, and causes undefined behavior
10394 + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
10395 + * are explicitly documented to accept it. Use this flag only if you
10396 + * absolutely know what you are doing.
10398 + AV_FRAME_CROP_UNALIGNED = 1 << 0,
10402 + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
10403 + * crop_bottom fields. If cropping is successful, the function will adjust the
10404 + * data pointers and the width/height fields, and set the crop fields to 0.
10406 + * In all cases, the cropping boundaries will be rounded to the inherent
10407 + * alignment of the pixel format. In some cases, such as for opaque hwaccel
10408 + * formats, the left/top cropping is ignored. The crop fields are set to 0 even
10409 + * if the cropping was rounded or ignored.
10411 + * @param frame the frame which should be cropped
10412 + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
10414 + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
10415 + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
10417 +int av_frame_apply_cropping(AVFrame *frame, int flags);
10420 + * @return a string identifying the side data type
10422 +const char *av_frame_side_data_name(enum AVFrameSideDataType type);
10428 +#endif /* AVUTIL_FRAME_H */
10429 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10430 new file mode 100644
10432 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
10435 + * This file is part of FFmpeg.
10437 + * FFmpeg is free software; you can redistribute it and/or
10438 + * modify it under the terms of the GNU Lesser General Public
10439 + * License as published by the Free Software Foundation; either
10440 + * version 2.1 of the License, or (at your option) any later version.
10442 + * FFmpeg is distributed in the hope that it will be useful,
10443 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10444 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10445 + * Lesser General Public License for more details.
10447 + * You should have received a copy of the GNU Lesser General Public
10448 + * License along with FFmpeg; if not, write to the Free Software
10449 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
10452 +#ifndef AVUTIL_HWCONTEXT_H
10453 +#define AVUTIL_HWCONTEXT_H
10455 +#include "buffer.h"
10456 +#include "frame.h"
10458 +#include "pixfmt.h"
10460 +enum AVHWDeviceType {
10461 + AV_HWDEVICE_TYPE_NONE,
10462 + AV_HWDEVICE_TYPE_VDPAU,
10463 + AV_HWDEVICE_TYPE_CUDA,
10464 + AV_HWDEVICE_TYPE_VAAPI,
10465 + AV_HWDEVICE_TYPE_DXVA2,
10466 + AV_HWDEVICE_TYPE_QSV,
10467 + AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
10468 + AV_HWDEVICE_TYPE_D3D11VA,
10469 + AV_HWDEVICE_TYPE_DRM,
10470 + AV_HWDEVICE_TYPE_OPENCL,
10471 + AV_HWDEVICE_TYPE_MEDIACODEC,
10474 +typedef struct AVHWDeviceInternal AVHWDeviceInternal;
10477 + * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
10478 + * i.e. state that is not tied to a concrete processing configuration.
10479 + * E.g., in an API that supports hardware-accelerated encoding and decoding,
10480 + * this struct will (if possible) wrap the state that is common to both encoding
10481 + * and decoding and from which specific instances of encoders or decoders can be
10484 + * This struct is reference-counted with the AVBuffer mechanism. The
10485 + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
10486 + * points to the actual AVHWDeviceContext. Further objects derived from
10487 + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
10488 + * specific properties) will hold an internal reference to it. After all the
10489 + * references are released, the AVHWDeviceContext itself will be freed,
10490 + * optionally invoking a user-specified callback for uninitializing the hardware
10493 +typedef struct AVHWDeviceContext {
10495 + * A class for logging. Set by av_hwdevice_ctx_alloc().
10497 + const AVClass *av_class;
10500 + * Private data used internally by libavutil. Must not be accessed in any
10501 + * way by the caller.
10503 + AVHWDeviceInternal *internal;
10506 + * This field identifies the underlying API used for hardware access.
10508 + * This field is set when this struct is allocated and never changed
10511 + enum AVHWDeviceType type;
10514 + * The format-specific data, allocated and freed by libavutil along with
10517 + * Should be cast by the user to the format-specific context defined in the
10518 + * corresponding header (hwcontext_*.h) and filled as described in the
10519 + * documentation before calling av_hwdevice_ctx_init().
10521 + * After calling av_hwdevice_ctx_init() this struct should not be modified
10527 + * This field may be set by the caller before calling av_hwdevice_ctx_init().
10529 + * If non-NULL, this callback will be called when the last reference to
10530 + * this context is unreferenced, immediately before it is freed.
10532 + * @note when other objects (e.g an AVHWFramesContext) are derived from this
10533 + * struct, this callback will be invoked after all such child objects
10534 + * are fully uninitialized and their respective destructors invoked.
10536 + void (*free)(struct AVHWDeviceContext *ctx);
10539 + * Arbitrary user data, to be used e.g. by the free() callback.
10541 + void *user_opaque;
10542 +} AVHWDeviceContext;
10544 +typedef struct AVHWFramesInternal AVHWFramesInternal;
10547 + * This struct describes a set or pool of "hardware" frames (i.e. those with
10548 + * data not located in normal system memory). All the frames in the pool are
10549 + * assumed to be allocated in the same way and interchangeable.
10551 + * This struct is reference-counted with the AVBuffer mechanism and tied to a
10552 + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
10553 + * yields a reference, whose data field points to the actual AVHWFramesContext
10556 +typedef struct AVHWFramesContext {
10558 + * A class for logging.
10560 + const AVClass *av_class;
10563 + * Private data used internally by libavutil. Must not be accessed in any
10564 + * way by the caller.
10566 + AVHWFramesInternal *internal;
10569 + * A reference to the parent AVHWDeviceContext. This reference is owned and
10570 + * managed by the enclosing AVHWFramesContext, but the caller may derive
10571 + * additional references from it.
10573 + AVBufferRef *device_ref;
10576 + * The parent AVHWDeviceContext. This is simply a pointer to
10577 + * device_ref->data provided for convenience.
10579 + * Set by libavutil in av_hwframe_ctx_init().
10581 + AVHWDeviceContext *device_ctx;
10584 + * The format-specific data, allocated and freed automatically along with
10587 + * Should be cast by the user to the format-specific context defined in the
10588 + * corresponding header (hwframe_*.h) and filled as described in the
10589 + * documentation before calling av_hwframe_ctx_init().
10591 + * After any frames using this context are created, the contents of this
10592 + * struct should not be modified by the caller.
10597 + * This field may be set by the caller before calling av_hwframe_ctx_init().
10599 + * If non-NULL, this callback will be called when the last reference to
10600 + * this context is unreferenced, immediately before it is freed.
10602 + void (*free)(struct AVHWFramesContext *ctx);
10605 + * Arbitrary user data, to be used e.g. by the free() callback.
10607 + void *user_opaque;
10610 + * A pool from which the frames are allocated by av_hwframe_get_buffer().
10611 + * This field may be set by the caller before calling av_hwframe_ctx_init().
10612 + * The buffers returned by calling av_buffer_pool_get() on this pool must
10613 + * have the properties described in the documentation in the corresponding hw
10614 + * type's header (hwcontext_*.h). The pool will be freed strictly before
10615 + * this struct's free() callback is invoked.
10617 + * This field may be NULL, then libavutil will attempt to allocate a pool
10618 + * internally. Note that certain device types enforce pools allocated at
10619 + * fixed size (frame count), which cannot be extended dynamically. In such a
10620 + * case, initial_pool_size must be set appropriately.
10622 + AVBufferPool *pool;
10625 + * Initial size of the frame pool. If a device type does not support
10626 + * dynamically resizing the pool, then this is also the maximum pool size.
10628 + * May be set by the caller before calling av_hwframe_ctx_init(). Must be
10629 + * set if pool is NULL and the device type does not support dynamic pools.
10631 + int initial_pool_size;
10634 + * The pixel format identifying the underlying HW surface type.
10636 + * Must be a hwaccel format, i.e. the corresponding descriptor must have the
10637 + * AV_PIX_FMT_FLAG_HWACCEL flag set.
10639 + * Must be set by the user before calling av_hwframe_ctx_init().
10641 + enum AVPixelFormat format;
10644 + * The pixel format identifying the actual data layout of the hardware
10647 + * Must be set by the caller before calling av_hwframe_ctx_init().
10649 + * @note when the underlying API does not provide the exact data layout, but
10650 + * only the colorspace/bit depth, this field should be set to the fully
10651 + * planar version of that format (e.g. for 8-bit 420 YUV it should be
10652 + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
10654 + enum AVPixelFormat sw_format;
10657 + * The allocated dimensions of the frames in this pool.
10659 + * Must be set by the user before calling av_hwframe_ctx_init().
10661 + int width, height;
10662 +} AVHWFramesContext;
10665 + * Look up an AVHWDeviceType by name.
10667 + * @param name String name of the device type (case-insensitive).
10668 + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
10671 +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
10673 +/** Get the string name of an AVHWDeviceType.
10675 + * @param type Type from enum AVHWDeviceType.
10676 + * @return Pointer to a static string containing the name, or NULL if the type
10679 +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
10682 + * Iterate over supported device types.
10684 + * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
10685 + * returned by this function in subsequent iterations.
10686 + * @return The next usable device type from enum AVHWDeviceType, or
10687 + * AV_HWDEVICE_TYPE_NONE if there are no more.
10689 +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
10692 + * Allocate an AVHWDeviceContext for a given hardware type.
10694 + * @param type the type of the hardware device to allocate.
10695 + * @return a reference to the newly created AVHWDeviceContext on success or NULL
10698 +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
10701 + * Finalize the device context before use. This function must be called after
10702 + * the context is filled with all the required information and before it is
10703 + * used in any way.
10705 + * @param ref a reference to the AVHWDeviceContext
10706 + * @return 0 on success, a negative AVERROR code on failure
10708 +int av_hwdevice_ctx_init(AVBufferRef *ref);
10711 + * Open a device of the specified type and create an AVHWDeviceContext for it.
10713 + * This is a convenience function intended to cover the simple cases. Callers
10714 + * who need to fine-tune device creation/management should open the device
10715 + * manually and then wrap it in an AVHWDeviceContext using
10716 + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
10718 + * The returned context is already initialized and ready for use, the caller
10719 + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
10720 + * the created AVHWDeviceContext are set by this function and should not be
10721 + * touched by the caller.
10723 + * @param device_ctx On success, a reference to the newly-created device context
10724 + * will be written here. The reference is owned by the caller
10725 + * and must be released with av_buffer_unref() when no longer
10726 + * needed. On failure, NULL will be written to this pointer.
10727 + * @param type The type of the device to create.
10728 + * @param device A type-specific string identifying the device to open.
10729 + * @param opts A dictionary of additional (type-specific) options to use in
10730 + * opening the device. The dictionary remains owned by the caller.
10731 + * @param flags currently unused
10733 + * @return 0 on success, a negative AVERROR code on failure.
10735 +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
10736 + const char *device, AVDictionary *opts, int flags);
10739 + * Create a new device of the specified type from an existing device.
10741 + * If the source device is a device of the target type or was originally
10742 + * derived from such a device (possibly through one or more intermediate
10743 + * devices of other types), then this will return a reference to the
10744 + * existing device of the same type as is requested.
10746 + * Otherwise, it will attempt to derive a new device from the given source
10747 + * device. If direct derivation to the new type is not implemented, it will
10748 + * attempt the same derivation from each ancestor of the source device in
10749 + * turn looking for an implemented derivation method.
10751 + * @param dst_ctx On success, a reference to the newly-created
10752 + * AVHWDeviceContext.
10753 + * @param type The type of the new device to create.
10754 + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
10755 + * used to create the new device.
10756 + * @param flags Currently unused; should be set to zero.
10757 + * @return Zero on success, a negative AVERROR code on failure.
10759 +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
10760 + enum AVHWDeviceType type,
10761 + AVBufferRef *src_ctx, int flags);
10765 + * Allocate an AVHWFramesContext tied to a given device context.
10767 + * @param device_ctx a reference to a AVHWDeviceContext. This function will make
10768 + * a new reference for internal use, the one passed to the
10769 + * function remains owned by the caller.
10770 + * @return a reference to the newly created AVHWFramesContext on success or NULL
10773 +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
10776 + * Finalize the context before use. This function must be called after the
10777 + * context is filled with all the required information and before it is attached
10780 + * @param ref a reference to the AVHWFramesContext
10781 + * @return 0 on success, a negative AVERROR code on failure
10783 +int av_hwframe_ctx_init(AVBufferRef *ref);
10786 + * Allocate a new frame attached to the given AVHWFramesContext.
10788 + * @param hwframe_ctx a reference to an AVHWFramesContext
10789 + * @param frame an empty (freshly allocated or unreffed) frame to be filled with
10790 + * newly allocated buffers.
10791 + * @param flags currently unused, should be set to zero
10792 + * @return 0 on success, a negative AVERROR code on failure
10794 +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
10797 + * Copy data to or from a hw surface. At least one of dst/src must have an
10798 + * AVHWFramesContext attached.
10800 + * If src has an AVHWFramesContext attached, then the format of dst (if set)
10801 + * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
10802 + * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
10803 + * If dst has an AVHWFramesContext attached, then the format of src must use one
10804 + * of the formats returned by av_hwframe_transfer_get_formats(dst,
10805 + * AV_HWFRAME_TRANSFER_DIRECTION_TO)
10807 + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
10808 + * data buffers will be allocated by this function using av_frame_get_buffer().
10809 + * If dst->format is set, then this format will be used, otherwise (when
10810 + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
10812 + * The two frames must have matching allocated dimensions (i.e. equal to
10813 + * AVHWFramesContext.width/height), since not all device types support
10814 + * transferring a sub-rectangle of the whole surface. The display dimensions
10815 + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
10816 + * also have to be equal for both frames. When the display dimensions are
10817 + * smaller than the allocated dimensions, the content of the padding in the
10818 + * destination frame is unspecified.
10820 + * @param dst the destination frame. dst is not touched on failure.
10821 + * @param src the source frame.
10822 + * @param flags currently unused, should be set to zero
10823 + * @return 0 on success, a negative AVERROR error code on failure.
10825 +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
10827 +enum AVHWFrameTransferDirection {
10829 + * Transfer the data from the queried hw frame.
10831 + AV_HWFRAME_TRANSFER_DIRECTION_FROM,
10834 + * Transfer the data to the queried hw frame.
10836 + AV_HWFRAME_TRANSFER_DIRECTION_TO,
10840 + * Get a list of possible source or target formats usable in
10841 + * av_hwframe_transfer_data().
10843 + * @param hwframe_ctx the frame context to obtain the information for
10844 + * @param dir the direction of the transfer
10845 + * @param formats the pointer to the output format list will be written here.
10846 + * The list is terminated with AV_PIX_FMT_NONE and must be freed
10847 + * by the caller when no longer needed using av_free().
10848 + * If this function returns successfully, the format list will
10849 + * have at least one item (not counting the terminator).
10850 + * On failure, the contents of this pointer are unspecified.
10851 + * @param flags currently unused, should be set to zero
10852 + * @return 0 on success, a negative AVERROR code on failure.
10854 +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
10855 + enum AVHWFrameTransferDirection dir,
10856 + enum AVPixelFormat **formats, int flags);
10860 + * This struct describes the constraints on hardware frames attached to
10861 + * a given device with a hardware-specific configuration. This is returned
10862 + * by av_hwdevice_get_hwframe_constraints() and must be freed by
10863 + * av_hwframe_constraints_free() after use.
10865 +typedef struct AVHWFramesConstraints {
10867 + * A list of possible values for format in the hw_frames_ctx,
10868 + * terminated by AV_PIX_FMT_NONE. This member will always be filled.
10870 + enum AVPixelFormat *valid_hw_formats;
10873 + * A list of possible values for sw_format in the hw_frames_ctx,
10874 + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
10877 + enum AVPixelFormat *valid_sw_formats;
10880 + * The minimum size of frames in this hw_frames_ctx.
10881 + * (Zero if not known.)
10887 + * The maximum size of frames in this hw_frames_ctx.
10888 + * (INT_MAX if not known / no limit.)
10892 +} AVHWFramesConstraints;
10895 + * Allocate a HW-specific configuration structure for a given HW device.
10896 + * After use, the user must free all members as required by the specific
10897 + * hardware structure being used, then free the structure itself with
10900 + * @param device_ctx a reference to the associated AVHWDeviceContext.
10901 + * @return The newly created HW-specific configuration structure on
10902 + * success or NULL on failure.
10904 +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
10907 + * Get the constraints on HW frames given a device and the HW-specific
10908 + * configuration to be used with that device. If no HW-specific
10909 + * configuration is provided, returns the maximum possible capabilities
10912 + * @param ref a reference to the associated AVHWDeviceContext.
10913 + * @param hwconfig a filled HW-specific configuration structure, or NULL
10914 + * to return the maximum possible capabilities of the device.
10915 + * @return AVHWFramesConstraints structure describing the constraints
10916 + * on the device, or NULL if not available.
10918 +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
10919 + const void *hwconfig);
10922 + * Free an AVHWFrameConstraints structure.
10924 + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
10926 +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
10930 + * Flags to apply to frame mappings.
10934 + * The mapping must be readable.
10936 + AV_HWFRAME_MAP_READ = 1 << 0,
10938 + * The mapping must be writeable.
10940 + AV_HWFRAME_MAP_WRITE = 1 << 1,
10942 + * The mapped frame will be overwritten completely in subsequent
10943 + * operations, so the current frame data need not be loaded. Any values
10944 + * which are not overwritten are unspecified.
10946 + AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
10948 + * The mapping must be direct. That is, there must not be any copying in
10949 + * the map or unmap steps. Note that performance of direct mappings may
10950 + * be much lower than normal memory.
10952 + AV_HWFRAME_MAP_DIRECT = 1 << 3,
10956 + * Map a hardware frame.
10958 + * This has a number of different possible effects, depending on the format
10959 + * and origin of the src and dst frames. On input, src should be a usable
10960 + * frame with valid buffers and dst should be blank (typically as just created
10961 + * by av_frame_alloc()). src should have an associated hwframe context, and
10962 + * dst may optionally have a format and associated hwframe context.
10964 + * If src was created by mapping a frame from the hwframe context of dst,
10965 + * then this function undoes the mapping - dst is replaced by a reference to
10966 + * the frame that src was originally mapped from.
10968 + * If both src and dst have an associated hwframe context, then this function
10969 + * attempts to map the src frame from its hardware context to that of dst and
10970 + * then fill dst with appropriate data to be usable there. This will only be
10971 + * possible if the hwframe contexts and associated devices are compatible -
10972 + * given compatible devices, av_hwframe_ctx_create_derived() can be used to
10973 + * create a hwframe context for dst in which mapping should be possible.
10975 + * If src has a hwframe context but dst does not, then the src frame is
10976 + * mapped to normal memory and should thereafter be usable as a normal frame.
10977 + * If the format is set on dst, then the mapping will attempt to create dst
10978 + * with that format and fail if it is not possible. If format is unset (is
10979 + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
10980 + * format to use is (probably the sw_format of the src hwframe context).
10982 + * A return value of AVERROR(ENOSYS) indicates that the mapping is not
10983 + * possible with the given arguments and hwframe setup, while other return
10984 + * values indicate that it failed somehow.
10986 + * @param dst Destination frame, to contain the mapping.
10987 + * @param src Source frame, to be mapped.
10988 + * @param flags Some combination of AV_HWFRAME_MAP_* flags.
10989 + * @return Zero on success, negative AVERROR code on failure.
10991 +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
10995 + * Create and initialise an AVHWFramesContext as a mapping of another existing
10996 + * AVHWFramesContext on a different device.
10998 + * av_hwframe_ctx_init() should not be called after this.
11000 + * @param derived_frame_ctx On success, a reference to the newly created
11001 + * AVHWFramesContext.
11002 + * @param derived_device_ctx A reference to the device to create the new
11003 + * AVHWFramesContext on.
11004 + * @param source_frame_ctx A reference to an existing AVHWFramesContext
11005 + * which will be mapped to the derived context.
11006 + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the
11007 + * mapping parameters to apply to frames which are allocated
11008 + * in the derived device.
11009 + * @return Zero on success, negative AVERROR code on failure.
11011 +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
11012 + enum AVPixelFormat format,
11013 + AVBufferRef *derived_device_ctx,
11014 + AVBufferRef *source_frame_ctx,
11017 +#endif /* AVUTIL_HWCONTEXT_H */
11018 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
11019 new file mode 100644
11021 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
11024 + * Copyright (c) 2011 Mans Rullgard
11026 + * This file is part of FFmpeg.
11028 + * FFmpeg is free software; you can redistribute it and/or
11029 + * modify it under the terms of the GNU Lesser General Public
11030 + * License as published by the Free Software Foundation; either
11031 + * version 2.1 of the License, or (at your option) any later version.
11033 + * FFmpeg is distributed in the hope that it will be useful,
11034 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11035 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11036 + * Lesser General Public License for more details.
11038 + * You should have received a copy of the GNU Lesser General Public
11039 + * License along with FFmpeg; if not, write to the Free Software
11040 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11043 +#ifndef AVUTIL_INTFLOAT_H
11044 +#define AVUTIL_INTFLOAT_H
11046 +#include <stdint.h>
11047 +#include "attributes.h"
11049 +union av_intfloat32 {
11054 +union av_intfloat64 {
11060 + * Reinterpret a 32-bit integer as a float.
11062 +static av_always_inline float av_int2float(uint32_t i)
11064 + union av_intfloat32 v;
11070 + * Reinterpret a float as a 32-bit integer.
11072 +static av_always_inline uint32_t av_float2int(float f)
11074 + union av_intfloat32 v;
11080 + * Reinterpret a 64-bit integer as a double.
11082 +static av_always_inline double av_int2double(uint64_t i)
11084 + union av_intfloat64 v;
11090 + * Reinterpret a double as a 64-bit integer.
11092 +static av_always_inline uint64_t av_double2int(double f)
11094 + union av_intfloat64 v;
11099 +#endif /* AVUTIL_INTFLOAT_H */
11100 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11101 new file mode 100644
11103 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
11106 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11108 + * This file is part of FFmpeg.
11110 + * FFmpeg is free software; you can redistribute it and/or
11111 + * modify it under the terms of the GNU Lesser General Public
11112 + * License as published by the Free Software Foundation; either
11113 + * version 2.1 of the License, or (at your option) any later version.
11115 + * FFmpeg is distributed in the hope that it will be useful,
11116 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11117 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11118 + * Lesser General Public License for more details.
11120 + * You should have received a copy of the GNU Lesser General Public
11121 + * License along with FFmpeg; if not, write to the Free Software
11122 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11125 +#ifndef AVUTIL_LOG_H
11126 +#define AVUTIL_LOG_H
11128 +#include <stdarg.h>
11129 +#include "avutil.h"
11130 +#include "attributes.h"
11131 +#include "version.h"
11134 + AV_CLASS_CATEGORY_NA = 0,
11135 + AV_CLASS_CATEGORY_INPUT,
11136 + AV_CLASS_CATEGORY_OUTPUT,
11137 + AV_CLASS_CATEGORY_MUXER,
11138 + AV_CLASS_CATEGORY_DEMUXER,
11139 + AV_CLASS_CATEGORY_ENCODER,
11140 + AV_CLASS_CATEGORY_DECODER,
11141 + AV_CLASS_CATEGORY_FILTER,
11142 + AV_CLASS_CATEGORY_BITSTREAM_FILTER,
11143 + AV_CLASS_CATEGORY_SWSCALER,
11144 + AV_CLASS_CATEGORY_SWRESAMPLER,
11145 + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
11146 + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
11147 + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
11148 + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
11149 + AV_CLASS_CATEGORY_DEVICE_OUTPUT,
11150 + AV_CLASS_CATEGORY_DEVICE_INPUT,
11151 + AV_CLASS_CATEGORY_NB ///< not part of ABI/API
11154 +#define AV_IS_INPUT_DEVICE(category) \
11155 + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
11156 + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
11157 + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
11159 +#define AV_IS_OUTPUT_DEVICE(category) \
11160 + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
11161 + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
11162 + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
11164 +struct AVOptionRanges;
11167 + * Describe the class of an AVClass context structure. That is an
11168 + * arbitrary struct of which the first field is a pointer to an
11169 + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
11171 +typedef struct AVClass {
11173 + * The name of the class; usually it is the same name as the
11174 + * context structure type to which the AVClass is associated.
11176 + const char* class_name;
11179 + * A pointer to a function which returns the name of a context
11180 + * instance ctx associated with the class.
11182 + const char* (*item_name)(void* ctx);
11185 + * a pointer to the first option specified in the class if any or NULL
11187 + * @see av_set_default_options()
11189 + const struct AVOption *option;
11192 + * LIBAVUTIL_VERSION with which this structure was created.
11193 + * This is used to allow fields to be added without requiring major
11194 + * version bumps everywhere.
11200 + * Offset in the structure where log_level_offset is stored.
11201 + * 0 means there is no such variable
11203 + int log_level_offset_offset;
11206 + * Offset in the structure where a pointer to the parent context for
11207 + * logging is stored. For example a decoder could pass its AVCodecContext
11208 + * to eval as such a parent context, which an av_log() implementation
11209 + * could then leverage to display the parent context.
11210 + * The offset can be NULL.
11212 + int parent_log_context_offset;
11215 + * Return next AVOptions-enabled child or NULL
11217 + void* (*child_next)(void *obj, void *prev);
11220 + * Return an AVClass corresponding to the next potential
11221 + * AVOptions-enabled child.
11223 + * The difference between child_next and this is that
11224 + * child_next iterates over _already existing_ objects, while
11225 + * child_class_next iterates over _all possible_ children.
11227 + const struct AVClass* (*child_class_next)(const struct AVClass *prev);
11230 + * Category used for visualization (like color)
11231 + * This is only set if the category is equal for all objects using this class.
11232 + * available since version (51 << 16 | 56 << 8 | 100)
11234 + AVClassCategory category;
11237 + * Callback to return the category.
11238 + * available since version (51 << 16 | 59 << 8 | 100)
11240 + AVClassCategory (*get_category)(void* ctx);
11243 + * Callback to return the supported/allowed ranges.
11244 + * available since version (52.12)
11246 + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
11250 + * @addtogroup lavu_log
11254 + * @defgroup lavu_log_constants Logging Constants
11260 + * Print no output.
11262 +#define AV_LOG_QUIET -8
11265 + * Something went really wrong and we will crash now.
11267 +#define AV_LOG_PANIC 0
11270 + * Something went wrong and recovery is not possible.
11271 + * For example, no header was found for a format which depends
11272 + * on headers or an illegal combination of parameters is used.
11274 +#define AV_LOG_FATAL 8
11277 + * Something went wrong and cannot losslessly be recovered.
11278 + * However, not all future data is affected.
11280 +#define AV_LOG_ERROR 16
11283 + * Something somehow does not look correct. This may or may not
11284 + * lead to problems. An example would be the use of '-vstrict -2'.
11286 +#define AV_LOG_WARNING 24
11289 + * Standard information.
11291 +#define AV_LOG_INFO 32
11294 + * Detailed information.
11296 +#define AV_LOG_VERBOSE 40
11299 + * Stuff which is only useful for libav* developers.
11301 +#define AV_LOG_DEBUG 48
11304 + * Extremely verbose debugging, useful for libav* development.
11306 +#define AV_LOG_TRACE 56
11308 +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
11315 + * Sets additional colors for extended debugging sessions.
11317 + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
11319 + * Requires 256color terminal support. Uses outside debugging is not
11322 +#define AV_LOG_C(x) ((x) << 8)
11325 + * Send the specified message to the log if the level is less than or equal
11326 + * to the current av_log_level. By default, all logging messages are sent to
11327 + * stderr. This behavior can be altered by setting a different logging callback
11329 + * @see av_log_set_callback
11331 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11332 + * pointer to an AVClass struct or NULL if general log.
11333 + * @param level The importance level of the message expressed using a @ref
11334 + * lavu_log_constants "Logging Constant".
11335 + * @param fmt The format string (printf-compatible) that specifies how
11336 + * subsequent arguments are converted to output.
11338 +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
11342 + * Send the specified message to the log if the level is less than or equal
11343 + * to the current av_log_level. By default, all logging messages are sent to
11344 + * stderr. This behavior can be altered by setting a different logging callback
11346 + * @see av_log_set_callback
11348 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11349 + * pointer to an AVClass struct.
11350 + * @param level The importance level of the message expressed using a @ref
11351 + * lavu_log_constants "Logging Constant".
11352 + * @param fmt The format string (printf-compatible) that specifies how
11353 + * subsequent arguments are converted to output.
11354 + * @param vl The arguments referenced by the format string.
11356 +void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
11359 + * Get the current log level
11361 + * @see lavu_log_constants
11363 + * @return Current log level
11365 +int av_log_get_level(void);
11368 + * Set the log level
11370 + * @see lavu_log_constants
11372 + * @param level Logging level
11374 +void av_log_set_level(int level);
11377 + * Set the logging callback
11379 + * @note The callback must be thread safe, even if the application does not use
11380 + * threads itself as some codecs are multithreaded.
11382 + * @see av_log_default_callback
11384 + * @param callback A logging function with a compatible signature.
11386 +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
11389 + * Default logging callback
11391 + * It prints the message to stderr, optionally colorizing it.
11393 + * @param avcl A pointer to an arbitrary struct of which the first field is a
11394 + * pointer to an AVClass struct.
11395 + * @param level The importance level of the message expressed using a @ref
11396 + * lavu_log_constants "Logging Constant".
11397 + * @param fmt The format string (printf-compatible) that specifies how
11398 + * subsequent arguments are converted to output.
11399 + * @param vl The arguments referenced by the format string.
11401 +void av_log_default_callback(void *avcl, int level, const char *fmt,
11405 + * Return the context name
11407 + * @param ctx The AVClass context
11409 + * @return The AVClass class_name
11411 +const char* av_default_item_name(void* ctx);
11412 +AVClassCategory av_default_get_category(void *ptr);
11415 + * Format a line of log the same way as the default callback.
11416 + * @param line buffer to receive the formatted line
11417 + * @param line_size size of the buffer
11418 + * @param print_prefix used to store whether the prefix must be printed;
11419 + * must point to a persistent integer initially set to 1
11421 +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
11422 + char *line, int line_size, int *print_prefix);
11425 + * Format a line of log the same way as the default callback.
11426 + * @param line buffer to receive the formatted line;
11427 + * may be NULL if line_size is 0
11428 + * @param line_size size of the buffer; at most line_size-1 characters will
11429 + * be written to the buffer, plus one null terminator
11430 + * @param print_prefix used to store whether the prefix must be printed;
11431 + * must point to a persistent integer initially set to 1
11432 + * @return Returns a negative value if an error occurred, otherwise returns
11433 + * the number of characters that would have been written for a
11434 + * sufficiently large buffer, not including the terminating null
11435 + * character. If the return value is not less than line_size, it means
11436 + * that the log message was truncated to fit the buffer.
11438 +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
11439 + char *line, int line_size, int *print_prefix);
11442 + * Skip repeated messages, this requires the user app to use av_log() instead of
11443 + * (f)printf as the 2 would otherwise interfere and lead to
11444 + * "Last message repeated x times" messages below (f)printf messages with some
11446 + * Also to receive the last, "last repeated" line if any, the user app must
11447 + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
11449 +#define AV_LOG_SKIP_REPEATED 1
11452 + * Include the log severity in messages originating from codecs.
11454 + * Results in messages such as:
11455 + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
11457 +#define AV_LOG_PRINT_LEVEL 2
11459 +void av_log_set_flags(int arg);
11460 +int av_log_get_flags(void);
11466 +#endif /* AVUTIL_LOG_H */
11467 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11468 new file mode 100644
11470 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
11473 + * This file is part of FFmpeg.
11475 + * FFmpeg is free software; you can redistribute it and/or
11476 + * modify it under the terms of the GNU Lesser General Public
11477 + * License as published by the Free Software Foundation; either
11478 + * version 2.1 of the License, or (at your option) any later version.
11480 + * FFmpeg is distributed in the hope that it will be useful,
11481 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11482 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11483 + * Lesser General Public License for more details.
11485 + * You should have received a copy of the GNU Lesser General Public
11486 + * License along with FFmpeg; if not, write to the Free Software
11487 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11493 + * Utility Preprocessor macros
11496 +#ifndef AVUTIL_MACROS_H
11497 +#define AVUTIL_MACROS_H
11500 + * @addtogroup preproc_misc Preprocessor String Macros
11502 + * String manipulation macros
11507 +#define AV_STRINGIFY(s) AV_TOSTRING(s)
11508 +#define AV_TOSTRING(s) #s
11510 +#define AV_GLUE(a, b) a ## b
11511 +#define AV_JOIN(a, b) AV_GLUE(a, b)
11517 +#define AV_PRAGMA(s) _Pragma(#s)
11519 +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
11521 +#endif /* AVUTIL_MACROS_H */
11522 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11523 new file mode 100644
11525 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
11528 + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
11530 + * This file is part of FFmpeg.
11532 + * FFmpeg is free software; you can redistribute it and/or
11533 + * modify it under the terms of the GNU Lesser General Public
11534 + * License as published by the Free Software Foundation; either
11535 + * version 2.1 of the License, or (at your option) any later version.
11537 + * FFmpeg is distributed in the hope that it will be useful,
11538 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11539 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11540 + * Lesser General Public License for more details.
11542 + * You should have received a copy of the GNU Lesser General Public
11543 + * License along with FFmpeg; if not, write to the Free Software
11544 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11549 + * @addtogroup lavu_math
11550 + * Mathematical utilities for working with timestamp and time base.
11553 +#ifndef AVUTIL_MATHEMATICS_H
11554 +#define AVUTIL_MATHEMATICS_H
11556 +#include <stdint.h>
11558 +#include "attributes.h"
11559 +#include "rational.h"
11560 +#include "intfloat.h"
11563 +#define M_E 2.7182818284590452354 /* e */
11566 +#define M_LN2 0.69314718055994530942 /* log_e 2 */
11569 +#define M_LN10 2.30258509299404568402 /* log_e 10 */
11572 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
11575 +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
11578 +#define M_PI 3.14159265358979323846 /* pi */
11581 +#define M_PI_2 1.57079632679489661923 /* pi/2 */
11584 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
11587 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
11590 +#define NAN av_int2float(0x7fc00000)
11593 +#define INFINITY av_int2float(0x7f800000)
11597 + * @addtogroup lavu_math
11603 + * Rounding methods.
11606 + AV_ROUND_ZERO = 0, ///< Round toward zero.
11607 + AV_ROUND_INF = 1, ///< Round away from zero.
11608 + AV_ROUND_DOWN = 2, ///< Round toward -infinity.
11609 + AV_ROUND_UP = 3, ///< Round toward +infinity.
11610 + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
11612 + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
11613 + * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
11615 + * Unlike other values of the enumeration AVRounding, this value is a
11616 + * bitmask that must be used in conjunction with another value of the
11617 + * enumeration through a bitwise OR, in order to set behavior for normal
11621 + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11622 + * // Rescaling 3:
11623 + * // Calculating 3 * 1 / 2
11624 + * // 3 / 2 is rounded up to 2
11627 + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
11628 + * // Rescaling AV_NOPTS_VALUE:
11629 + * // AV_NOPTS_VALUE == INT64_MIN
11630 + * // AV_NOPTS_VALUE is passed through
11631 + * // => AV_NOPTS_VALUE
11634 + AV_ROUND_PASS_MINMAX = 8192,
11638 + * Compute the greatest common divisor of two integer operands.
11640 + * @param a,b Operands
11641 + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
11642 + * if a == 0 and b == 0, returns 0.
11644 +int64_t av_const av_gcd(int64_t a, int64_t b);
11647 + * Rescale a 64-bit integer with rounding to nearest.
11649 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11650 + * directly can overflow.
11652 + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
11654 + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
11656 +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
11659 + * Rescale a 64-bit integer with specified rounding.
11661 + * The operation is mathematically equivalent to `a * b / c`, but writing that
11662 + * directly can overflow, and does not support different rounding methods.
11664 + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
11666 +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
11669 + * Rescale a 64-bit integer by 2 rational numbers.
11671 + * The operation is mathematically equivalent to `a * bq / cq`.
11673 + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
11675 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
11677 +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
11680 + * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
11682 + * The operation is mathematically equivalent to `a * bq / cq`.
11684 + * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
11686 +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
11687 + enum AVRounding rnd) av_const;
11690 + * Compare two timestamps each in its own time base.
11692 + * @return One of the following values:
11693 + * - -1 if `ts_a` is before `ts_b`
11694 + * - 1 if `ts_a` is after `ts_b`
11695 + * - 0 if they represent the same position
11698 + * The result of the function is undefined if one of the timestamps is outside
11699 + * the `int64_t` range when represented in the other's timebase.
11701 +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
11704 + * Compare the remainders of two integer operands divided by a common divisor.
11706 + * In other words, compare the least significant `log2(mod)` bits of integers
11710 + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2)
11711 + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
11714 + * @param a,b Operands
11715 + * @param mod Divisor; must be a power of 2
11717 + * - a negative value if `a % mod < b % mod`
11718 + * - a positive value if `a % mod > b % mod`
11719 + * - zero if `a % mod == b % mod`
11721 +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
11724 + * Rescale a timestamp while preserving known durations.
11726 + * This function is designed to be called per audio packet to scale the input
11727 + * timestamp to a different time base. Compared to a simple av_rescale_q()
11728 + * call, this function is robust against possible inconsistent frame durations.
11730 + * The `last` parameter is a state variable that must be preserved for all
11731 + * subsequent calls for the same stream. For the first call, `*last` should be
11732 + * initialized to #AV_NOPTS_VALUE.
11734 + * @param[in] in_tb Input time base
11735 + * @param[in] in_ts Input timestamp
11736 + * @param[in] fs_tb Duration time base; typically this is finer-grained
11737 + * (greater) than `in_tb` and `out_tb`
11738 + * @param[in] duration Duration till the next call to this function (i.e.
11739 + * duration of the current packet/frame)
11740 + * @param[in,out] last Pointer to a timestamp expressed in terms of
11741 + * `fs_tb`, acting as a state variable
11742 + * @param[in] out_tb Output timebase
11743 + * @return Timestamp expressed in terms of `out_tb`
11745 + * @note In the context of this function, "duration" is in term of samples, not
11748 +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
11751 + * Add a value to a timestamp.
11753 + * This function guarantees that when the same value is repeatly added that
11754 + * no accumulation of rounding errors occurs.
11756 + * @param[in] ts Input timestamp
11757 + * @param[in] ts_tb Input timestamp time base
11758 + * @param[in] inc Value to be added
11759 + * @param[in] inc_tb Time base of `inc`
11761 +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
11768 +#endif /* AVUTIL_MATHEMATICS_H */
11769 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11770 new file mode 100644
11772 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
11775 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11777 + * This file is part of FFmpeg.
11779 + * FFmpeg is free software; you can redistribute it and/or
11780 + * modify it under the terms of the GNU Lesser General Public
11781 + * License as published by the Free Software Foundation; either
11782 + * version 2.1 of the License, or (at your option) any later version.
11784 + * FFmpeg is distributed in the hope that it will be useful,
11785 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11786 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11787 + * Lesser General Public License for more details.
11789 + * You should have received a copy of the GNU Lesser General Public
11790 + * License along with FFmpeg; if not, write to the Free Software
11791 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11796 + * @ingroup lavu_mem
11797 + * Memory handling functions
11800 +#ifndef AVUTIL_MEM_H
11801 +#define AVUTIL_MEM_H
11803 +#include <limits.h>
11804 +#include <stdint.h>
11806 +#include "attributes.h"
11807 +#include "error.h"
11808 +#include "avutil.h"
11811 + * @addtogroup lavu_mem
11812 + * Utilities for manipulating memory.
11814 + * FFmpeg has several applications of memory that are not required of a typical
11815 + * program. For example, the computing-heavy components like video decoding and
11816 + * encoding can be sped up significantly through the use of aligned memory.
11818 + * However, for each of FFmpeg's applications of memory, there might not be a
11819 + * recognized or standardized API for that specific use. Memory alignment, for
11820 + * instance, varies wildly depending on operating systems, architectures, and
11821 + * compilers. Hence, this component of @ref libavutil is created to make
11822 + * dealing with memory consistently possible on all platforms.
11826 + * @defgroup lavu_mem_macros Alignment Macros
11827 + * Helper macros for declaring aligned variables.
11832 + * @def DECLARE_ALIGNED(n,t,v)
11833 + * Declare a variable that is aligned in memory.
11836 + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
11837 + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
11839 + * // The default-alignment equivalent would be
11840 + * uint16_t aligned_int = 42;
11841 + * uint8_t aligned_array[128];
11844 + * @param n Minimum alignment in bytes
11845 + * @param t Type of the variable (or array element)
11846 + * @param v Name of the variable
11850 + * @def DECLARE_ASM_ALIGNED(n,t,v)
11851 + * Declare an aligned variable appropriate for use in inline assembly code.
11854 + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11857 + * @param n Minimum alignment in bytes
11858 + * @param t Type of the variable (or array element)
11859 + * @param v Name of the variable
11863 + * @def DECLARE_ASM_CONST(n,t,v)
11864 + * Declare a static constant aligned variable appropriate for use in inline
11868 + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
11871 + * @param n Minimum alignment in bytes
11872 + * @param t Type of the variable (or array element)
11873 + * @param v Name of the variable
11876 +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
11877 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11878 + #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11879 + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
11880 +#elif defined(__DJGPP__)
11881 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
11882 + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11883 + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
11884 +#elif defined(__GNUC__) || defined(__clang__)
11885 + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
11886 + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
11887 + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
11888 +#elif defined(_MSC_VER)
11889 + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
11890 + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
11891 + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
11893 + #define DECLARE_ALIGNED(n,t,v) t v
11894 + #define DECLARE_ASM_ALIGNED(n,t,v) t v
11895 + #define DECLARE_ASM_CONST(n,t,v) static const t v
11903 + * @defgroup lavu_mem_attrs Function Attributes
11904 + * Function attributes applicable to memory handling functions.
11906 + * These function attributes can help compilers emit more useful warnings, or
11907 + * generate better code.
11912 + * @def av_malloc_attrib
11913 + * Function attribute denoting a malloc-like function.
11915 + * @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>
11918 +#if AV_GCC_VERSION_AT_LEAST(3,1)
11919 + #define av_malloc_attrib __attribute__((__malloc__))
11921 + #define av_malloc_attrib
11925 + * @def av_alloc_size(...)
11926 + * Function attribute used on a function that allocates memory, whose size is
11927 + * given by the specified parameter(s).
11930 + * void *av_malloc(size_t size) av_alloc_size(1);
11931 + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
11934 + * @param ... One or two parameter indexes, separated by a comma
11936 + * @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>
11939 +#if AV_GCC_VERSION_AT_LEAST(4,3)
11940 + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
11942 + #define av_alloc_size(...)
11950 + * @defgroup lavu_mem_funcs Heap Management
11951 + * Functions responsible for allocating, freeing, and copying memory.
11953 + * All memory allocation functions have a built-in upper limit of `INT_MAX`
11954 + * bytes. This may be changed with av_max_alloc(), although exercise extreme
11955 + * caution when doing so.
11961 + * Allocate a memory block with alignment suitable for all memory accesses
11962 + * (including vectors if available on the CPU).
11964 + * @param size Size in bytes for the memory block to be allocated
11965 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11967 + * @see av_mallocz()
11969 +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
11972 + * Allocate a memory block with alignment suitable for all memory accesses
11973 + * (including vectors if available on the CPU) and zero all the bytes of the
11976 + * @param size Size in bytes for the memory block to be allocated
11977 + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
11978 + * @see av_malloc()
11980 +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
11983 + * Allocate a memory block for an array with av_malloc().
11985 + * The allocated memory will have size `size * nmemb` bytes.
11987 + * @param nmemb Number of element
11988 + * @param size Size of a single element
11989 + * @return Pointer to the allocated block, or `NULL` if the block cannot
11991 + * @see av_malloc()
11993 +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
11996 + * Allocate a memory block for an array with av_mallocz().
11998 + * The allocated memory will have size `size * nmemb` bytes.
12000 + * @param nmemb Number of elements
12001 + * @param size Size of the single element
12002 + * @return Pointer to the allocated block, or `NULL` if the block cannot
12005 + * @see av_mallocz()
12006 + * @see av_malloc_array()
12008 +av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
12011 + * Non-inlined equivalent of av_mallocz_array().
12013 + * Created for symmetry with the calloc() C function.
12015 +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
12018 + * Allocate, reallocate, or free a block of memory.
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 ptr Pointer to a memory block already allocated with
12025 + * av_realloc() or `NULL`
12026 + * @param size Size in bytes of the memory block to be allocated or
12029 + * @return Pointer to a newly-reallocated block or `NULL` if the block
12030 + * cannot be reallocated or the function is used to free the memory block
12032 + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
12033 + * correctly aligned.
12034 + * @see av_fast_realloc()
12035 + * @see av_reallocp()
12037 +void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
12040 + * Allocate, reallocate, or free a block of memory through a pointer to a
12043 + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
12044 + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
12045 + * shrink that block of memory according to `size`.
12047 + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated
12048 + * with av_realloc(), or a pointer to `NULL`. The pointer
12049 + * is updated on success, or freed on failure.
12050 + * @param[in] size Size in bytes for the memory block to be allocated or
12053 + * @return Zero on success, an AVERROR error code on failure
12055 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12056 + * correctly aligned.
12058 +av_warn_unused_result
12059 +int av_reallocp(void *ptr, size_t size);
12062 + * Allocate, reallocate, or free a block of memory.
12064 + * This function does the same thing as av_realloc(), except:
12065 + * - It takes two size arguments and allocates `nelem * elsize` bytes,
12066 + * after checking the result of the multiplication for integer overflow.
12067 + * - It frees the input block in case of failure, thus avoiding the memory
12068 + * leak with the classic
12070 + * buf = realloc(buf);
12076 +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
12079 + * Allocate, reallocate, or free an array.
12081 + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
12082 + * `nmemb` is zero, free the memory block pointed to by `ptr`.
12084 + * @param ptr Pointer to a memory block already allocated with
12085 + * av_realloc() or `NULL`
12086 + * @param nmemb Number of elements in the array
12087 + * @param size Size of the single element of the array
12089 + * @return Pointer to a newly-reallocated block or NULL if the block
12090 + * cannot be reallocated or the function is used to free the memory block
12092 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12093 + * correctly aligned.
12094 + * @see av_reallocp_array()
12096 +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
12099 + * Allocate, reallocate, or free an array through a pointer to a pointer.
12101 + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
12102 + * zero, free the memory block pointed to by `*ptr`.
12104 + * @param[in,out] ptr Pointer to a pointer to a memory block already
12105 + * allocated with av_realloc(), or a pointer to `NULL`.
12106 + * The pointer is updated on success, or freed on failure.
12107 + * @param[in] nmemb Number of elements
12108 + * @param[in] size Size of the single element
12110 + * @return Zero on success, an AVERROR error code on failure
12112 + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
12113 + * correctly aligned.
12115 +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
12118 + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
12120 + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
12122 + * If the given buffer is not large enough, and reallocation fails, `NULL` is
12123 + * returned and `*size` is set to 0, but the original buffer is not changed or
12126 + * A typical use pattern follows:
12129 + * uint8_t *buf = ...;
12130 + * uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed);
12131 + * if (!new_buf) {
12132 + * // Allocation failed; clean up original buffer
12133 + * av_freep(&buf);
12134 + * return AVERROR(ENOMEM);
12138 + * @param[in,out] ptr Already allocated buffer, or `NULL`
12139 + * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
12140 + * changed to `min_size` in case of success or 0 in
12141 + * case of failure
12142 + * @param[in] min_size New size of buffer `ptr`
12143 + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
12144 + * buffer if the buffer was not large enough, or `NULL` in case of
12146 + * @see av_realloc()
12147 + * @see av_fast_malloc()
12149 +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
12152 + * Allocate a buffer, reusing the given one if large enough.
12154 + * Contrary to av_fast_realloc(), the current buffer contents might not be
12155 + * preserved and on error the old buffer is freed, thus no special handling to
12156 + * avoid memleaks is necessary.
12158 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12159 + * `size_needed` is greater than 0.
12162 + * uint8_t *buf = ...;
12163 + * av_fast_malloc(&buf, ¤t_size, size_needed);
12165 + * // Allocation failed; buf already freed
12166 + * return AVERROR(ENOMEM);
12170 + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
12171 + * `*ptr` will be overwritten with pointer to new
12172 + * buffer on success or `NULL` on failure
12173 + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
12174 + * changed to `min_size` in case of success or 0 in
12175 + * case of failure
12176 + * @param[in] min_size New size of buffer `*ptr`
12177 + * @see av_realloc()
12178 + * @see av_fast_mallocz()
12180 +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
12183 + * Allocate and clear a buffer, reusing the given one if large enough.
12185 + * Like av_fast_malloc(), but all newly allocated space is initially cleared.
12186 + * Reused buffer is not cleared.
12188 + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
12189 + * `size_needed` is greater than 0.
12191 + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
12192 + * `*ptr` will be overwritten with pointer to new
12193 + * buffer on success or `NULL` on failure
12194 + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
12195 + * changed to `min_size` in case of success or 0 in
12196 + * case of failure
12197 + * @param[in] min_size New size of buffer `*ptr`
12198 + * @see av_fast_malloc()
12200 +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
12203 + * Free a memory block which has been allocated with a function of av_malloc()
12204 + * or av_realloc() family.
12206 + * @param ptr Pointer to the memory block which should be freed.
12208 + * @note `ptr = NULL` is explicitly allowed.
12209 + * @note It is recommended that you use av_freep() instead, to prevent leaving
12210 + * behind dangling pointers.
12211 + * @see av_freep()
12213 +void av_free(void *ptr);
12216 + * Free a memory block which has been allocated with a function of av_malloc()
12217 + * or av_realloc() family, and set the pointer pointing to it to `NULL`.
12220 + * uint8_t *buf = av_malloc(16);
12222 + * // buf now contains a dangling pointer to freed memory, and accidental
12223 + * // dereference of buf will result in a use-after-free, which may be a
12224 + * // security risk.
12226 + * uint8_t *buf = av_malloc(16);
12227 + * av_freep(&buf);
12228 + * // buf is now NULL, and accidental dereference will only result in a
12229 + * // NULL-pointer dereference.
12232 + * @param ptr Pointer to the pointer to the memory block which should be freed
12233 + * @note `*ptr = NULL` is safe and leads to no action.
12236 +void av_freep(void *ptr);
12239 + * Duplicate a string.
12241 + * @param s String to be duplicated
12242 + * @return Pointer to a newly-allocated string containing a
12243 + * copy of `s` or `NULL` if the string cannot be allocated
12244 + * @see av_strndup()
12246 +char *av_strdup(const char *s) av_malloc_attrib;
12249 + * Duplicate a substring of a string.
12251 + * @param s String to be duplicated
12252 + * @param len Maximum length of the resulting string (not counting the
12253 + * terminating byte)
12254 + * @return Pointer to a newly-allocated string containing a
12255 + * substring of `s` or `NULL` if the string cannot be allocated
12257 +char *av_strndup(const char *s, size_t len) av_malloc_attrib;
12260 + * Duplicate a buffer with av_malloc().
12262 + * @param p Buffer to be duplicated
12263 + * @param size Size in bytes of the buffer copied
12264 + * @return Pointer to a newly allocated buffer containing a
12265 + * copy of `p` or `NULL` if the buffer cannot be allocated
12267 +void *av_memdup(const void *p, size_t size);
12270 + * Overlapping memcpy() implementation.
12272 + * @param dst Destination buffer
12273 + * @param back Number of bytes back to start copying (i.e. the initial size of
12274 + * the overlapping window); must be > 0
12275 + * @param cnt Number of bytes to copy; must be >= 0
12277 + * @note `cnt > back` is valid, this will copy the bytes we just copied,
12278 + * thus creating a repeating pattern with a period length of `back`.
12280 +void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
12287 + * @defgroup lavu_mem_dynarray Dynamic Array
12289 + * Utilities to make an array grow when needed.
12291 + * Sometimes, the programmer would want to have an array that can grow when
12292 + * needed. The libavutil dynamic array utilities fill that need.
12294 + * libavutil supports two systems of appending elements onto a dynamically
12295 + * allocated array, the first one storing the pointer to the value in the
12296 + * array, and the second storing the value directly. In both systems, the
12297 + * caller is responsible for maintaining a variable containing the length of
12298 + * the array, as well as freeing of the array after use.
12300 + * The first system stores pointers to values in a block of dynamically
12301 + * allocated memory. Since only pointers are stored, the function does not need
12302 + * to know the size of the type. Both av_dynarray_add() and
12303 + * av_dynarray_add_nofree() implement this system.
12306 + * type **array = NULL; //< an array of pointers to values
12307 + * int nb = 0; //< a variable to keep track of the length of the array
12309 + * type to_be_added = ...;
12310 + * type to_be_added2 = ...;
12312 + * av_dynarray_add(&array, &nb, &to_be_added);
12314 + * return AVERROR(ENOMEM);
12316 + * av_dynarray_add(&array, &nb, &to_be_added2);
12318 + * return AVERROR(ENOMEM);
12322 + * // &to_be_added == array[0]
12323 + * // &to_be_added2 == array[1]
12325 + * av_freep(&array);
12328 + * The second system stores the value directly in a block of memory. As a
12329 + * result, the function has to know the size of the type. av_dynarray2_add()
12330 + * implements this mechanism.
12333 + * type *array = NULL; //< an array of values
12334 + * int nb = 0; //< a variable to keep track of the length of the array
12336 + * type to_be_added = ...;
12337 + * type to_be_added2 = ...;
12339 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
12341 + * return AVERROR(ENOMEM);
12342 + * memcpy(addr, &to_be_added, sizeof(to_be_added));
12344 + * // Shortcut of the above.
12345 + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
12346 + * (const void *)&to_be_added2);
12348 + * return AVERROR(ENOMEM);
12352 + * // to_be_added == array[0]
12353 + * // to_be_added2 == array[1]
12355 + * av_freep(&array);
12362 + * Add the pointer to an element to a dynamic array.
12364 + * The array to grow is supposed to be an array of pointers to
12365 + * structures, and the element to add must be a pointer to an already
12366 + * allocated structure.
12368 + * The array is reallocated when its size reaches powers of 2.
12369 + * Therefore, the amortized cost of adding an element is constant.
12371 + * In case of success, the pointer to the array is updated in order to
12372 + * point to the new grown array, and the number pointed to by `nb_ptr`
12373 + * is incremented.
12374 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12375 + * `*nb_ptr` is set to 0.
12377 + * @param[in,out] tab_ptr Pointer to the array to grow
12378 + * @param[in,out] nb_ptr Pointer to the number of elements in the array
12379 + * @param[in] elem Element to add
12380 + * @see av_dynarray_add_nofree(), av_dynarray2_add()
12382 +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
12385 + * Add an element to a dynamic array.
12387 + * Function has the same functionality as av_dynarray_add(),
12388 + * but it doesn't free memory on fails. It returns error code
12389 + * instead and leave current buffer untouched.
12391 + * @return >=0 on success, negative otherwise
12392 + * @see av_dynarray_add(), av_dynarray2_add()
12394 +av_warn_unused_result
12395 +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
12398 + * Add an element of size `elem_size` to a dynamic array.
12400 + * The array is reallocated when its number of elements reaches powers of 2.
12401 + * Therefore, the amortized cost of adding an element is constant.
12403 + * In case of success, the pointer to the array is updated in order to
12404 + * point to the new grown array, and the number pointed to by `nb_ptr`
12405 + * is incremented.
12406 + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
12407 + * `*nb_ptr` is set to 0.
12409 + * @param[in,out] tab_ptr Pointer to the array to grow
12410 + * @param[in,out] nb_ptr Pointer to the number of elements in the array
12411 + * @param[in] elem_size Size in bytes of an element in the array
12412 + * @param[in] elem_data Pointer to the data of the element to add. If
12413 + * `NULL`, the space of the newly added element is
12414 + * allocated but left uninitialized.
12416 + * @return Pointer to the data of the element to copy in the newly allocated
12418 + * @see av_dynarray_add(), av_dynarray_add_nofree()
12420 +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
12421 + const uint8_t *elem_data);
12428 + * @defgroup lavu_mem_misc Miscellaneous Functions
12430 + * Other functions related to memory allocation.
12436 + * Multiply two `size_t` values checking for overflow.
12438 + * @param[in] a,b Operands of multiplication
12439 + * @param[out] r Pointer to the result of the operation
12440 + * @return 0 on success, AVERROR(EINVAL) on overflow
12442 +static inline int av_size_mult(size_t a, size_t b, size_t *r)
12444 + size_t t = a * b;
12445 + /* Hack inspired from glibc: don't try the division if nelem and elsize
12446 + * are both less than sqrt(SIZE_MAX). */
12447 + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
12448 + return AVERROR(EINVAL);
12454 + * Set the maximum size that may be allocated in one block.
12456 + * The value specified with this function is effective for all libavutil's @ref
12457 + * lavu_mem_funcs "heap management functions."
12459 + * By default, the max value is defined as `INT_MAX`.
12461 + * @param max Value to be set as the new maximum size
12463 + * @warning Exercise extreme caution when using this function. Don't touch
12464 + * this if you do not understand the full consequence of doing so.
12466 +void av_max_alloc(size_t max);
12473 +#endif /* AVUTIL_MEM_H */
12474 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12475 new file mode 100644
12477 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
12480 + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
12482 + * This file is part of FFmpeg.
12484 + * FFmpeg is free software; you can redistribute it and/or
12485 + * modify it under the terms of the GNU Lesser General Public
12486 + * License as published by the Free Software Foundation; either
12487 + * version 2.1 of the License, or (at your option) any later version.
12489 + * FFmpeg is distributed in the hope that it will be useful,
12490 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12491 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12492 + * Lesser General Public License for more details.
12494 + * You should have received a copy of the GNU Lesser General Public
12495 + * License along with FFmpeg; if not, write to the Free Software
12496 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12499 +#ifndef AVUTIL_PIXFMT_H
12500 +#define AVUTIL_PIXFMT_H
12504 + * pixel format definitions
12507 +#include "libavutil/avconfig.h"
12508 +#include "version.h"
12510 +#define AVPALETTE_SIZE 1024
12511 +#define AVPALETTE_COUNT 256
12517 + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
12518 + * color is put together as:
12519 + * (A << 24) | (R << 16) | (G << 8) | B
12520 + * This is stored as BGRA on little-endian CPU architectures and ARGB on
12521 + * big-endian CPUs.
12524 + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
12525 + * image data is stored in AVFrame.data[0]. The palette is transported in
12526 + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
12527 + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
12528 + * also endian-specific). Note also that the individual RGB32 palette
12529 + * components stored in AVFrame.data[1] should be in the range 0..255.
12530 + * This is important as many custom PAL8 video codecs that were designed
12531 + * to run on the IBM VGA graphics adapter use 6-bit palette components.
12534 + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
12535 + * for pal8. This palette is filled in automatically by the function
12536 + * allocating the picture.
12538 +enum AVPixelFormat {
12539 + AV_PIX_FMT_NONE = -1,
12540 + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
12541 + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
12542 + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
12543 + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
12544 + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12545 + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
12546 + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
12547 + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
12548 + AV_PIX_FMT_GRAY8, ///< Y , 8bpp
12549 + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
12550 + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
12551 + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
12552 + 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
12553 + 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
12554 + 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
12555 + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
12556 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
12557 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
12558 + 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
12559 + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
12560 + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
12561 + 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
12562 + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
12563 + 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)
12564 + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
12566 + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
12567 + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
12568 + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
12569 + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
12571 + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
12572 + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
12573 + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
12574 + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
12575 + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
12576 + 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
12577 + 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
12579 + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
12580 + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
12581 + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
12582 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
12584 + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
12585 + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
12586 + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
12587 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
12590 + /** @name Deprecated pixel formats */
12592 + 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
12593 + 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
12594 + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
12596 + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
12599 + * Hardware acceleration through VA-API, data[3] contains a
12602 + AV_PIX_FMT_VAAPI,
12605 + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12606 + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12607 + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12608 + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12609 + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12610 + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12611 + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
12613 + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
12614 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
12615 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
12616 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
12617 + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
12619 + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12620 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
12622 + 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
12623 + 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
12626 + * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
12627 + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
12628 + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
12630 + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12631 + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12632 + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12633 + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12634 + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12635 + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12636 + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12637 + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12638 + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12639 + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12640 + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12641 + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12642 + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
12643 + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
12644 + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
12645 + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
12646 + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
12647 + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
12648 + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
12649 + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
12650 + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
12651 + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
12652 + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
12653 + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
12654 + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
12655 + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
12656 + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12657 + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12658 + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12659 + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12660 + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12661 + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12662 + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12663 + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12664 + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
12665 + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
12666 + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
12667 + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
12668 + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
12669 + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
12671 + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
12673 + 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
12674 + 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
12675 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
12676 + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12677 + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12679 + 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
12680 + 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
12681 + 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
12682 + 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
12684 + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
12686 + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
12687 + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
12689 + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
12690 + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
12691 + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
12693 + * HW acceleration through QSV, data[3] contains a pointer to the
12694 + * mfxFrameSurface1 structure.
12698 + * HW acceleration though MMAL, data[3] contains a pointer to the
12699 + * MMAL_BUFFER_HEADER_T structure.
12703 + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
12706 + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
12707 + * exactly as for system memory frames.
12711 + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
12712 + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
12713 + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
12714 + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
12716 + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12717 + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12718 + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
12719 + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
12720 + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12721 + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12722 + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
12723 + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
12724 + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12725 + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12726 + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
12727 + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
12728 + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian
12729 + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
12730 + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
12731 + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
12732 + 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
12734 + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
12735 + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
12736 + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
12737 + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
12738 + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
12739 + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
12740 + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
12741 + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
12742 + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
12743 + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
12744 + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
12745 + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
12747 + AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
12749 + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12750 + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12751 + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
12752 + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
12753 + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
12754 + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
12756 + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
12758 + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
12759 + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
12761 + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
12762 + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian
12764 + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
12765 + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
12767 + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
12769 + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian
12770 + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian
12771 + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian
12772 + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian
12774 + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
12775 + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
12778 + * Hardware surfaces for Direct3D11.
12780 + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
12781 + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
12783 + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
12784 + * texture array index of the frame as intptr_t if the ID3D11Texture2D is
12785 + * an array texture (or always 0 if it's a normal texture).
12787 + AV_PIX_FMT_D3D11,
12789 + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian
12790 + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian
12792 + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian
12793 + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian
12794 + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
12795 + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
12798 + * DRM-managed buffers exposed through PRIME buffer sharing.
12800 + * data[0] points to an AVDRMFrameDescriptor.
12802 + AV_PIX_FMT_DRM_PRIME,
12804 + * Hardware surfaces for OpenCL.
12806 + * data[i] contain 2D image objects (typed in C as cl_mem, used
12807 + * in OpenCL as image2d_t) for each plane of the surface.
12809 + AV_PIX_FMT_OPENCL,
12811 + 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
12814 +#if AV_HAVE_BIGENDIAN
12815 +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
12817 +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
12820 +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
12821 +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
12822 +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
12823 +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
12824 +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
12825 +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
12827 +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE)
12828 +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
12829 +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
12830 +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
12831 +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
12832 +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
12833 +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
12834 +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
12835 +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
12836 +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
12837 +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
12838 +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
12839 +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
12840 +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
12841 +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
12843 +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
12844 +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
12845 +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
12846 +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
12847 +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
12848 +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
12849 +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
12850 +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
12851 +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
12852 +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
12853 +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
12854 +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
12855 +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
12856 +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
12857 +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
12858 +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
12859 +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
12861 +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
12862 +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
12863 +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
12864 +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
12865 +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
12866 +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
12867 +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
12868 +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
12870 +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
12871 +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
12872 +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
12873 +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
12875 +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
12876 +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
12878 +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
12879 +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
12880 +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
12881 +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
12882 +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
12883 +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
12884 +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
12885 +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
12886 +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
12888 +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
12889 +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
12890 +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
12891 +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
12892 +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
12895 + * Chromaticity coordinates of the source primaries.
12896 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
12898 +enum AVColorPrimaries {
12899 + AVCOL_PRI_RESERVED0 = 0,
12900 + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
12901 + AVCOL_PRI_UNSPECIFIED = 2,
12902 + AVCOL_PRI_RESERVED = 3,
12903 + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12905 + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
12906 + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12907 + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
12908 + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
12909 + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
12910 + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
12911 + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
12912 + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
12913 + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
12914 + AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
12915 + AVCOL_PRI_NB ///< Not part of ABI
12919 + * Color Transfer Characteristic.
12920 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
12922 +enum AVColorTransferCharacteristic {
12923 + AVCOL_TRC_RESERVED0 = 0,
12924 + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
12925 + AVCOL_TRC_UNSPECIFIED = 2,
12926 + AVCOL_TRC_RESERVED = 3,
12927 + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
12928 + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
12929 + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
12930 + AVCOL_TRC_SMPTE240M = 7,
12931 + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
12932 + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
12933 + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
12934 + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
12935 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
12936 + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
12937 + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
12938 + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
12939 + AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
12940 + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084,
12941 + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
12942 + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
12943 + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
12944 + AVCOL_TRC_NB ///< Not part of ABI
12948 + * YUV colorspace type.
12949 + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
12951 +enum AVColorSpace {
12952 + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
12953 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
12954 + AVCOL_SPC_UNSPECIFIED = 2,
12955 + AVCOL_SPC_RESERVED = 3,
12956 + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
12957 + 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
12958 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
12959 + AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
12960 + AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
12961 + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
12962 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
12963 + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
12964 + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
12965 + AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
12966 + AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
12967 + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
12968 + AVCOL_SPC_NB ///< Not part of ABI
12972 + * MPEG vs JPEG YUV range.
12974 +enum AVColorRange {
12975 + AVCOL_RANGE_UNSPECIFIED = 0,
12976 + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
12977 + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
12978 + AVCOL_RANGE_NB ///< Not part of ABI
12982 + * Location of chroma samples.
12984 + * Illustration showing the location of the first (top left) chroma sample of the
12985 + * image, the left shows only luma, the right
12986 + * shows the location of the chroma sample, the 2 could be imagined to overlay
12987 + * each other but are drawn separately due to limitations of ASCII
12989 + * 1st 2nd 1st 2nd horizontal luma sample positions
12992 + *1st luma line > |X X ... |3 4 X ... X are luma samples,
12993 + * | |1 2 1-6 are possible chroma positions
12994 + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
12996 +enum AVChromaLocation {
12997 + AVCHROMA_LOC_UNSPECIFIED = 0,
12998 + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
12999 + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
13000 + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
13001 + AVCHROMA_LOC_TOP = 4,
13002 + AVCHROMA_LOC_BOTTOMLEFT = 5,
13003 + AVCHROMA_LOC_BOTTOM = 6,
13004 + AVCHROMA_LOC_NB ///< Not part of ABI
13007 +#endif /* AVUTIL_PIXFMT_H */
13008 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
13009 new file mode 100644
13011 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
13014 + * rational numbers
13015 + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
13017 + * This file is part of FFmpeg.
13019 + * FFmpeg is free software; you can redistribute it and/or
13020 + * modify it under the terms of the GNU Lesser General Public
13021 + * License as published by the Free Software Foundation; either
13022 + * version 2.1 of the License, or (at your option) any later version.
13024 + * FFmpeg is distributed in the hope that it will be useful,
13025 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13026 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13027 + * Lesser General Public License for more details.
13029 + * You should have received a copy of the GNU Lesser General Public
13030 + * License along with FFmpeg; if not, write to the Free Software
13031 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13036 + * @ingroup lavu_math_rational
13037 + * Utilties for rational number calculation.
13038 + * @author Michael Niedermayer <michaelni@gmx.at>
13041 +#ifndef AVUTIL_RATIONAL_H
13042 +#define AVUTIL_RATIONAL_H
13044 +#include <stdint.h>
13045 +#include <limits.h>
13046 +#include "attributes.h"
13049 + * @defgroup lavu_math_rational AVRational
13050 + * @ingroup lavu_math
13051 + * Rational number calculation.
13053 + * While rational numbers can be expressed as floating-point numbers, the
13054 + * conversion process is a lossy one, so are floating-point operations. On the
13055 + * other hand, the nature of FFmpeg demands highly accurate calculation of
13056 + * timestamps. This set of rational number utilities serves as a generic
13057 + * interface for manipulating rational numbers as pairs of numerators and
13060 + * Many of the functions that operate on AVRational's have the suffix `_q`, in
13061 + * reference to the mathematical symbol "â„š" (Q) which denotes the set of all
13062 + * rational numbers.
13068 + * Rational number (pair of numerator and denominator).
13070 +typedef struct AVRational{
13071 + int num; ///< Numerator
13072 + int den; ///< Denominator
13076 + * Create an AVRational.
13078 + * Useful for compilers that do not support compound literals.
13080 + * @note The return value is not reduced.
13081 + * @see av_reduce()
13083 +static inline AVRational av_make_q(int num, int den)
13085 + AVRational r = { num, den };
13090 + * Compare two rationals.
13092 + * @param a First rational
13093 + * @param b Second rational
13095 + * @return One of the following values:
13096 + * - 0 if `a == b`
13098 + * - -1 if `a < b`
13099 + * - `INT_MIN` if one of the values is of the form `0 / 0`
13101 +static inline int av_cmp_q(AVRational a, AVRational b){
13102 + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
13104 + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
13105 + else if(b.den && a.den) return 0;
13106 + else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
13107 + else return INT_MIN;
13111 + * Convert an AVRational to a `double`.
13112 + * @param a AVRational to convert
13113 + * @return `a` in floating-point form
13116 +static inline double av_q2d(AVRational a){
13117 + return a.num / (double) a.den;
13121 + * Reduce a fraction.
13123 + * This is useful for framerate calculations.
13125 + * @param[out] dst_num Destination numerator
13126 + * @param[out] dst_den Destination denominator
13127 + * @param[in] num Source numerator
13128 + * @param[in] den Source denominator
13129 + * @param[in] max Maximum allowed values for `dst_num` & `dst_den`
13130 + * @return 1 if the operation is exact, 0 otherwise
13132 +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
13135 + * Multiply two rationals.
13136 + * @param b First rational
13137 + * @param c Second rational
13140 +AVRational av_mul_q(AVRational b, AVRational c) av_const;
13143 + * Divide one rational by another.
13144 + * @param b First rational
13145 + * @param c Second rational
13148 +AVRational av_div_q(AVRational b, AVRational c) av_const;
13151 + * Add two rationals.
13152 + * @param b First rational
13153 + * @param c Second rational
13156 +AVRational av_add_q(AVRational b, AVRational c) av_const;
13159 + * Subtract one rational from another.
13160 + * @param b First rational
13161 + * @param c Second rational
13164 +AVRational av_sub_q(AVRational b, AVRational c) av_const;
13167 + * Invert a rational.
13171 +static av_always_inline AVRational av_inv_q(AVRational q)
13173 + AVRational r = { q.den, q.num };
13178 + * Convert a double precision floating point number to a rational.
13180 + * In case of infinity, the returned value is expressed as `{1, 0}` or
13181 + * `{-1, 0}` depending on the sign.
13183 + * @param d `double` to convert
13184 + * @param max Maximum allowed numerator and denominator
13185 + * @return `d` in AVRational form
13188 +AVRational av_d2q(double d, int max) av_const;
13191 + * Find which of the two rationals is closer to another rational.
13193 + * @param q Rational to be compared against
13194 + * @param q1,q2 Rationals to be tested
13195 + * @return One of the following values:
13196 + * - 1 if `q1` is nearer to `q` than `q2`
13197 + * - -1 if `q2` is nearer to `q` than `q1`
13198 + * - 0 if they have the same distance
13200 +int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
13203 + * Find the value in a list of rationals nearest a given reference rational.
13205 + * @param q Reference rational
13206 + * @param q_list Array of rationals terminated by `{0, 0}`
13207 + * @return Index of the nearest value found in the array
13209 +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
13212 + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
13215 + * @param q Rational to be converted
13216 + * @return Equivalent floating-point value, expressed as an unsigned 32-bit
13218 + * @note The returned value is platform-indepedant.
13220 +uint32_t av_q2intfloat(AVRational q);
13226 +#endif /* AVUTIL_RATIONAL_H */
13227 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13228 new file mode 100644
13230 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
13233 + * This file is part of FFmpeg.
13235 + * FFmpeg is free software; you can redistribute it and/or
13236 + * modify it under the terms of the GNU Lesser General Public
13237 + * License as published by the Free Software Foundation; either
13238 + * version 2.1 of the License, or (at your option) any later version.
13240 + * FFmpeg is distributed in the hope that it will be useful,
13241 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13242 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13243 + * Lesser General Public License for more details.
13245 + * You should have received a copy of the GNU Lesser General Public
13246 + * License along with FFmpeg; if not, write to the Free Software
13247 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13250 +#ifndef AVUTIL_SAMPLEFMT_H
13251 +#define AVUTIL_SAMPLEFMT_H
13253 +#include <stdint.h>
13255 +#include "avutil.h"
13256 +#include "attributes.h"
13259 + * @addtogroup lavu_audio
13262 + * @defgroup lavu_sampfmts Audio sample formats
13264 + * Audio sample format enumeration and related convenience functions.
13269 + * Audio sample formats
13271 + * - The data described by the sample format is always in native-endian order.
13272 + * Sample values can be expressed by native C types, hence the lack of a signed
13273 + * 24-bit sample format even though it is a common raw audio data format.
13275 + * - The floating-point formats are based on full volume being in the range
13276 + * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
13278 + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
13279 + * (such as AVFrame in libavcodec) is as follows:
13282 + * For planar sample formats, each audio channel is in a separate data plane,
13283 + * and linesize is the buffer size, in bytes, for a single plane. All data
13284 + * planes must be the same size. For packed sample formats, only the first data
13285 + * plane is used, and samples for each channel are interleaved. In this case,
13286 + * linesize is the buffer size, in bytes, for the 1 plane.
13289 +enum AVSampleFormat {
13290 + AV_SAMPLE_FMT_NONE = -1,
13291 + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
13292 + AV_SAMPLE_FMT_S16, ///< signed 16 bits
13293 + AV_SAMPLE_FMT_S32, ///< signed 32 bits
13294 + AV_SAMPLE_FMT_FLT, ///< float
13295 + AV_SAMPLE_FMT_DBL, ///< double
13297 + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
13298 + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
13299 + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
13300 + AV_SAMPLE_FMT_FLTP, ///< float, planar
13301 + AV_SAMPLE_FMT_DBLP, ///< double, planar
13302 + AV_SAMPLE_FMT_S64, ///< signed 64 bits
13303 + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
13305 + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
13309 + * Return the name of sample_fmt, or NULL if sample_fmt is not
13312 +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
13315 + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
13318 +enum AVSampleFormat av_get_sample_fmt(const char *name);
13321 + * Return the planar<->packed alternative form of the given sample format, or
13322 + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
13323 + * requested planar/packed format, the format returned is the same as the
13326 +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
13329 + * Get the packed alternative form of the given sample format.
13331 + * If the passed sample_fmt is already in packed format, the format returned is
13332 + * the same as the input.
13334 + * @return the packed alternative form of the given sample format or
13335 + AV_SAMPLE_FMT_NONE on error.
13337 +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
13340 + * Get the planar alternative form of the given sample format.
13342 + * If the passed sample_fmt is already in planar format, the format returned is
13343 + * the same as the input.
13345 + * @return the planar alternative form of the given sample format or
13346 + AV_SAMPLE_FMT_NONE on error.
13348 +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
13351 + * Generate a string corresponding to the sample format with
13352 + * sample_fmt, or a header if sample_fmt is negative.
13354 + * @param buf the buffer where to write the string
13355 + * @param buf_size the size of buf
13356 + * @param sample_fmt the number of the sample format to print the
13357 + * corresponding info string, or a negative value to print the
13358 + * corresponding header.
13359 + * @return the pointer to the filled buffer or NULL if sample_fmt is
13360 + * unknown or in case of other errors
13362 +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
13365 + * Return number of bytes per sample.
13367 + * @param sample_fmt the sample format
13368 + * @return number of bytes per sample or zero if unknown for the given
13371 +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
13374 + * Check if the sample format is planar.
13376 + * @param sample_fmt the sample format to inspect
13377 + * @return 1 if the sample format is planar, 0 if it is interleaved
13379 +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
13382 + * Get the required buffer size for the given audio parameters.
13384 + * @param[out] linesize calculated linesize, may be NULL
13385 + * @param nb_channels the number of channels
13386 + * @param nb_samples the number of samples in a single channel
13387 + * @param sample_fmt the sample format
13388 + * @param align buffer size alignment (0 = default, 1 = no alignment)
13389 + * @return required buffer size, or negative error code on failure
13391 +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
13392 + enum AVSampleFormat sample_fmt, int align);
13397 + * @defgroup lavu_sampmanip Samples manipulation
13399 + * Functions that manipulate audio samples
13404 + * Fill plane data pointers and linesize for samples with sample
13405 + * format sample_fmt.
13407 + * The audio_data array is filled with the pointers to the samples data planes:
13408 + * for planar, set the start point of each channel's data within the buffer,
13409 + * for packed, set the start point of the entire buffer only.
13411 + * The value pointed to by linesize is set to the aligned size of each
13412 + * channel's data buffer for planar layout, or to the aligned size of the
13413 + * buffer for all channels for packed layout.
13415 + * The buffer in buf must be big enough to contain all the samples
13416 + * (use av_samples_get_buffer_size() to compute its minimum size),
13417 + * otherwise the audio_data pointers will point to invalid data.
13419 + * @see enum AVSampleFormat
13420 + * The documentation for AVSampleFormat describes the data layout.
13422 + * @param[out] audio_data array to be filled with the pointer for each channel
13423 + * @param[out] linesize calculated linesize, may be NULL
13424 + * @param buf the pointer to a buffer containing the samples
13425 + * @param nb_channels the number of channels
13426 + * @param nb_samples the number of samples in a single channel
13427 + * @param sample_fmt the sample format
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 minimum size in bytes required for the buffer in case
13431 + * of success at the next bump
13433 +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
13434 + const uint8_t *buf,
13435 + int nb_channels, int nb_samples,
13436 + enum AVSampleFormat sample_fmt, int align);
13439 + * Allocate a samples buffer for nb_samples samples, and fill data pointers and
13440 + * linesize accordingly.
13441 + * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
13442 + * Allocated data will be initialized to silence.
13444 + * @see enum AVSampleFormat
13445 + * The documentation for AVSampleFormat describes the data layout.
13447 + * @param[out] audio_data array to be filled with the pointer for each channel
13448 + * @param[out] linesize aligned size for audio buffer(s), may be NULL
13449 + * @param nb_channels number of audio channels
13450 + * @param nb_samples number of samples per channel
13451 + * @param align buffer size alignment (0 = default, 1 = no alignment)
13452 + * @return >=0 on success or a negative error code on failure
13453 + * @todo return the size of the allocated buffer in case of success at the next bump
13454 + * @see av_samples_fill_arrays()
13455 + * @see av_samples_alloc_array_and_samples()
13457 +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
13458 + int nb_samples, enum AVSampleFormat sample_fmt, int align);
13461 + * Allocate a data pointers array, samples buffer for nb_samples
13462 + * samples, and fill data pointers and linesize accordingly.
13464 + * This is the same as av_samples_alloc(), but also allocates the data
13465 + * pointers array.
13467 + * @see av_samples_alloc()
13469 +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
13470 + int nb_samples, enum AVSampleFormat sample_fmt, int align);
13473 + * Copy samples from src to dst.
13475 + * @param dst destination array of pointers to data planes
13476 + * @param src source array of pointers to data planes
13477 + * @param dst_offset offset in samples at which the data will be written to dst
13478 + * @param src_offset offset in samples at which the data will be read from src
13479 + * @param nb_samples number of samples to be copied
13480 + * @param nb_channels number of audio channels
13481 + * @param sample_fmt audio sample format
13483 +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
13484 + int src_offset, int nb_samples, int nb_channels,
13485 + enum AVSampleFormat sample_fmt);
13488 + * Fill an audio buffer with silence.
13490 + * @param audio_data array of pointers to data planes
13491 + * @param offset offset in samples at which to start filling
13492 + * @param nb_samples number of samples to fill
13493 + * @param nb_channels number of audio channels
13494 + * @param sample_fmt audio sample format
13496 +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
13497 + int nb_channels, enum AVSampleFormat sample_fmt);
13503 +#endif /* AVUTIL_SAMPLEFMT_H */
13504 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13505 new file mode 100644
13507 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
13510 + * copyright (c) 2003 Fabrice Bellard
13512 + * This file is part of FFmpeg.
13514 + * FFmpeg is free software; you can redistribute it and/or
13515 + * modify it under the terms of the GNU Lesser General Public
13516 + * License as published by the Free Software Foundation; either
13517 + * version 2.1 of the License, or (at your option) any later version.
13519 + * FFmpeg is distributed in the hope that it will be useful,
13520 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13521 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13522 + * Lesser General Public License for more details.
13524 + * You should have received a copy of the GNU Lesser General Public
13525 + * License along with FFmpeg; if not, write to the Free Software
13526 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13532 + * Libavutil version macros
13535 +#ifndef AVUTIL_VERSION_H
13536 +#define AVUTIL_VERSION_H
13538 +#include "macros.h"
13541 + * @addtogroup version_utils
13543 + * Useful to check and match library version in order to maintain
13544 + * backward compatibility.
13546 + * The FFmpeg libraries follow a versioning sheme very similar to
13547 + * Semantic Versioning (http://semver.org/)
13548 + * The difference is that the component called PATCH is called MICRO in FFmpeg
13549 + * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
13550 + * Also we do not increase MICRO for every bugfix or change in git master.
13552 + * Prior to FFmpeg 3.2 point releases did not change any lib version number to
13553 + * avoid aliassing different git master checkouts.
13554 + * Starting with FFmpeg 3.2, the released library versions will occupy
13555 + * a separate MAJOR.MINOR that is not used on the master development branch.
13556 + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
13557 + * for the release and master will continue at 55.12.100 after it. Each new
13558 + * point release will then bump the MICRO improving the usefulness of the lib
13564 +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
13565 +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
13566 +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
13569 + * Extract version components from the full ::AV_VERSION_INT int as returned
13570 + * by functions like ::avformat_version() and ::avcodec_version()
13572 +#define AV_VERSION_MAJOR(a) ((a) >> 16)
13573 +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
13574 +#define AV_VERSION_MICRO(a) ((a) & 0xFF)
13581 + * @defgroup lavu_ver Version and Build diagnostics
13583 + * Macros and function useful to check at compiletime and at runtime
13584 + * which version of libavutil is in use.
13589 +#define LIBAVUTIL_VERSION_MAJOR 56
13590 +#define LIBAVUTIL_VERSION_MINOR 14
13591 +#define LIBAVUTIL_VERSION_MICRO 100
13593 +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
13594 + LIBAVUTIL_VERSION_MINOR, \
13595 + LIBAVUTIL_VERSION_MICRO)
13596 +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
13597 + LIBAVUTIL_VERSION_MINOR, \
13598 + LIBAVUTIL_VERSION_MICRO)
13599 +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
13601 +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
13604 + * @defgroup lavu_depr_guards Deprecation Guards
13605 + * FF_API_* defines may be placed below to indicate public API that will be
13606 + * dropped at a future version bump. The defines themselves are not part of
13607 + * the public API and may change, break or disappear at any time.
13609 + * @note, when bumping the major version it is recommended to manually
13610 + * disable each FF_API_* in its own commit instead of disabling them all
13611 + * at once through the bump. This improves the git bisect-ability of the change.
13616 +#ifndef FF_API_VAAPI
13617 +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57)
13619 +#ifndef FF_API_FRAME_QP
13620 +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57)
13622 +#ifndef FF_API_PLUS1_MINUS1
13623 +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)
13625 +#ifndef FF_API_ERROR_FRAME
13626 +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57)
13628 +#ifndef FF_API_PKT_PTS
13629 +#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57)
13631 +#ifndef FF_API_CRYPTO_SIZE_T
13632 +#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
13634 +#ifndef FF_API_FRAME_GET_SET
13635 +#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
13637 +#ifndef FF_API_PSEUDOPAL
13638 +#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
13647 +#endif /* AVUTIL_VERSION_H */
13648 diff --git a/dom/media/platforms/ffmpeg/ffmpeg58/moz.build b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13649 new file mode 100644
13651 +++ b/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
13653 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
13654 +# vim: set filetype=python:
13655 +# This Source Code Form is subject to the terms of the Mozilla Public
13656 +# License, v. 2.0. If a copy of the MPL was not distributed with this
13657 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
13659 +UNIFIED_SOURCES += [
13660 + '../FFmpegAudioDecoder.cpp',
13661 + '../FFmpegDataDecoder.cpp',
13662 + '../FFmpegDecoderModule.cpp',
13663 + '../FFmpegVideoDecoder.cpp',
13665 +LOCAL_INCLUDES += [
13670 +if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
13671 + CXXFLAGS += [ '-Wno-deprecated-declarations' ]
13672 +if CONFIG['CC_TYPE'] == 'clang':
13674 + '-Wno-unknown-attributes',
13677 +FINAL_LIBRARY = 'xul'
13678 diff --git a/dom/media/platforms/ffmpeg/moz.build b/dom/media/platforms/ffmpeg/moz.build
13679 --- a/dom/media/platforms/ffmpeg/moz.build
13680 +++ b/dom/media/platforms/ffmpeg/moz.build
13681 @@ -8,15 +8,16 @@ EXPORTS += [
13682 'FFmpegRuntimeLinker.h',
13693 UNIFIED_SOURCES += [
13694 'FFmpegRuntimeLinker.cpp',
13697 FINAL_LIBRARY = 'xul'