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

(-)Makefile (-2 / +1 lines)
Lines 2-10 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	palemoon
4
PORTNAME=	palemoon
5
DISTVERSION=	27.9.0
5
DISTVERSION=	27.9.1
6
DISTVERSIONSUFFIX=_Release
6
DISTVERSIONSUFFIX=_Release
7
PORTREVISION=	1
8
CATEGORIES=	www ipv6
7
CATEGORIES=	www ipv6
9
8
10
MAINTAINER=	lichray@gmail.com
9
MAINTAINER=	lichray@gmail.com
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1524298267
1
TIMESTAMP = 1525897958
2
SHA256 (MoonchildProductions-Pale-Moon-27.9.0_Release_GH0.tar.gz) = d5186c1f002af2301ac20c085804c621c54d3f7fe2c1ab54a1acf9e0b185e8b3
2
SHA256 (MoonchildProductions-Pale-Moon-27.9.1_Release_GH0.tar.gz) = 581164f3067bfb25559f227d36e7780296c460923849c82edb05b3f074076b32
3
SIZE (MoonchildProductions-Pale-Moon-27.9.0_Release_GH0.tar.gz) = 175235763
3
SIZE (MoonchildProductions-Pale-Moon-27.9.1_Release_GH0.tar.gz) = 175356518
(-)files/patch-bug1435212 (-13657 lines)
Lines 1-13657 Link Here
1
commit abe6e049cdd3
2
Author: Jean-Yves Avenard <jyavenard@mozilla.com>
3
Date:   Thu Apr 19 10:19:15 2018 +0200
4
5
    Bug 1435212 - Add support for FFmpeg 4.0. r=bryce
6
    
7
    MozReview-Commit-ID: JlDFSUyGQu
8
    
9
    --HG--
10
    extra : rebase_source : 310135ac5453b01164910bd3bf50b6107dcbc710
11
---
12
 dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp   |    6 +
13
 dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp    |   13 +-
14
 dom/media/platforms/ffmpeg/FFmpegLibs.h            |    4 +-
15
 dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp |    4 +
16
 dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp  |    2 +-
17
 .../ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1       |  504 ++
18
 .../ffmpeg/ffmpeg58/include/libavcodec/avcodec.h   | 6146 ++++++++++++++++++++
19
 .../ffmpeg/ffmpeg58/include/libavcodec/avfft.h     |  118 +
20
 .../ffmpeg/ffmpeg58/include/libavcodec/vaapi.h     |   86 +
21
 .../ffmpeg/ffmpeg58/include/libavcodec/vdpau.h     |  176 +
22
 .../ffmpeg/ffmpeg58/include/libavcodec/version.h   |  137 +
23
 .../ffmpeg/ffmpeg58/include/libavutil/attributes.h |  167 +
24
 .../ffmpeg/ffmpeg58/include/libavutil/avconfig.h   |    6 +
25
 .../ffmpeg/ffmpeg58/include/libavutil/avutil.h     |  365 ++
26
 .../ffmpeg/ffmpeg58/include/libavutil/buffer.h     |  291 +
27
 .../ffmpeg58/include/libavutil/channel_layout.h    |  232 +
28
 .../ffmpeg/ffmpeg58/include/libavutil/common.h     |  560 ++
29
 .../ffmpeg/ffmpeg58/include/libavutil/cpu.h        |  130 +
30
 .../ffmpeg/ffmpeg58/include/libavutil/dict.h       |  200 +
31
 .../ffmpeg/ffmpeg58/include/libavutil/error.h      |  126 +
32
 .../ffmpeg/ffmpeg58/include/libavutil/frame.h      |  893 +++
33
 .../ffmpeg/ffmpeg58/include/libavutil/hwcontext.h  |  584 ++
34
 .../ffmpeg/ffmpeg58/include/libavutil/intfloat.h   |   77 +
35
 .../ffmpeg/ffmpeg58/include/libavutil/log.h        |  362 ++
36
 .../ffmpeg/ffmpeg58/include/libavutil/macros.h     |   50 +
37
 .../ffmpeg58/include/libavutil/mathematics.h       |  242 +
38
 .../ffmpeg/ffmpeg58/include/libavutil/mem.h        |  700 +++
39
 .../ffmpeg/ffmpeg58/include/libavutil/pixfmt.h     |  529 ++
40
 .../ffmpeg/ffmpeg58/include/libavutil/rational.h   |  214 +
41
 .../ffmpeg/ffmpeg58/include/libavutil/samplefmt.h  |  272 +
42
 .../ffmpeg/ffmpeg58/include/libavutil/version.h    |  139 +
43
 dom/media/platforms/ffmpeg/ffmpeg58/moz.build      |   25 +
44
 dom/media/platforms/ffmpeg/moz.build               |    1 +
45
 33 files changed, 13355 insertions(+), 6 deletions(-)
46
47
diff --git dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
48
index 4600ad6d247c..a9c7089fa880 100644
49
--- dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
50
+++ dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
51
@@ -77,15 +77,21 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
52
     mCodecContext->extradata_size = mExtraData->Length();
53
     // FFmpeg may use SIMD instructions to access the data which reads the
54
     // data in 32 bytes block. Must ensure we have enough data to read.
55
+#if LIBAVCODEC_VERSION_MAJOR >= 58
56
+    mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
57
+#else
58
     mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
59
+#endif
60
     mCodecContext->extradata = mExtraData->Elements();
61
   } else {
62
     mCodecContext->extradata_size = 0;
63
   }
64
 
65
+#if LIBAVCODEC_VERSION_MAJOR < 57
66
   if (codec->capabilities & CODEC_CAP_DR1) {
67
     mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
68
   }
69
+#endif
70
 
71
   if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
72
     mLib->avcodec_close(mCodecContext);
73
diff --git dom/media/platforms/ffmpeg/FFmpegFunctionList.h dom/media/platforms/ffmpeg/FFmpegFunctionList.h
74
index 6b8b38487d56..d08eee3fc8e8 100644
75
--- dom/media/platforms/ffmpeg/FFmpegFunctionList.h
76
+++ dom/media/platforms/ffmpeg/FFmpegFunctionList.h
77
@@ -31,8 +31,8 @@ AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
78
 #if defined(LIBAVCODEC_VERSION_MAJOR) || defined(LIBAVCODEC_ALLVERSION)
79
 #if LIBAVCODEC_VERSION_MAJOR >= 55 || defined(LIBAVCODEC_ALLVERSION)
80
 /* libavutil v55 and later only */
81
-AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
82
-AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
83
-AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
84
+AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
85
+AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
86
+AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
87
 #endif
88
 #endif
89
diff --git dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
90
index 6b8b38487d56..d08eee3fc8e8 100644
91
--- dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
92
+++ dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h
93
@@ -22,12 +22,14 @@ enum {
94
   AV_FUNC_55 = 1 << 2,
95
   AV_FUNC_56 = 1 << 3,
96
   AV_FUNC_57 = 1 << 4,
97
+  AV_FUNC_58 = 1 << 5,
98
   AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
99
   AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
100
   AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
101
   AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
102
   AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
103
-  AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
104
+  AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
105
+  AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
106
   AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
107
 };
108
 
109
diff --git dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
110
index f671e6e61bc4..b7ab49329502 100644
111
--- dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
112
+++ dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
113
@@ -23,12 +23,15 @@ template <int V> class FFmpegDecoderModule (public)
114
 
115
 static const char* sLibs[] = {
116
 #if defined(XP_DARWIN)
117
+  "libavcodec.58.dylib",
118
   "libavcodec.57.dylib",
119
   "libavcodec.56.dylib",
120
   "libavcodec.55.dylib",
121
   "libavcodec.54.dylib",
122
   "libavcodec.53.dylib",
123
 #else
124
+  "libavcodec.so.58",
125
+  "libavcodec-ffmpeg.so.58",
126
   "libavcodec-ffmpeg.so.57",
127
   "libavcodec-ffmpeg.so.56",
128
   "libavcodec.so.57",
129
@@ -129,6 +132,15 @@ FFmpegRuntimeLinker::Bind(const char* aLibName)
130
       }
131
       version = AV_FUNC_57;
132
       break;
133
+    case 58:
134
+      if (micro < 100) {
135
+        // A micro version >= 100 indicates that it's FFmpeg (as opposed to LibAV).
136
+        // Due to current AVCodecContext binary incompatibility we can only
137
+        // support FFmpeg at this point.
138
+        return false;
139
+      }
140
+      version = AV_FUNC_58;
141
+      break;
142
     default:
143
       // Not supported at this stage.
144
       return false;
145
@@ -168,6 +180,7 @@ FFmpegRuntimeLinker::CreateDecoderModule()
146
     case 55:
147
     case 56: module = FFmpegDecoderModule<55>::Create(); break;
148
     case 57: module = FFmpegDecoderModule<57>::Create(); break;
149
+    case 58: module = FFmpegDecoderModule<58>::Create(); break;
150
     default: module = nullptr;
151
   }
152
   return module.forget();
153
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
154
new file mode 100644
155
index 000000000000..00b4fedfe7e7
156
--- /dev/null
157
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
158
@@ -0,0 +1,504 @@
159
+                  GNU LESSER GENERAL PUBLIC LICENSE
160
+                       Version 2.1, February 1999
161
+
162
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
163
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
164
+ Everyone is permitted to copy and distribute verbatim copies
165
+ of this license document, but changing it is not allowed.
166
+
167
+[This is the first released version of the Lesser GPL.  It also counts
168
+ as the successor of the GNU Library Public License, version 2, hence
169
+ the version number 2.1.]
170
+
171
+                            Preamble
172
+
173
+  The licenses for most software are designed to take away your
174
+freedom to share and change it.  By contrast, the GNU General Public
175
+Licenses are intended to guarantee your freedom to share and change
176
+free software--to make sure the software is free for all its users.
177
+
178
+  This license, the Lesser General Public License, applies to some
179
+specially designated software packages--typically libraries--of the
180
+Free Software Foundation and other authors who decide to use it.  You
181
+can use it too, but we suggest you first think carefully about whether
182
+this license or the ordinary General Public License is the better
183
+strategy to use in any particular case, based on the explanations below.
184
+
185
+  When we speak of free software, we are referring to freedom of use,
186
+not price.  Our General Public Licenses are designed to make sure that
187
+you have the freedom to distribute copies of free software (and charge
188
+for this service if you wish); that you receive source code or can get
189
+it if you want it; that you can change the software and use pieces of
190
+it in new free programs; and that you are informed that you can do
191
+these things.
192
+
193
+  To protect your rights, we need to make restrictions that forbid
194
+distributors to deny you these rights or to ask you to surrender these
195
+rights.  These restrictions translate to certain responsibilities for
196
+you if you distribute copies of the library or if you modify it.
197
+
198
+  For example, if you distribute copies of the library, whether gratis
199
+or for a fee, you must give the recipients all the rights that we gave
200
+you.  You must make sure that they, too, receive or can get the source
201
+code.  If you link other code with the library, you must provide
202
+complete object files to the recipients, so that they can relink them
203
+with the library after making changes to the library and recompiling
204
+it.  And you must show them these terms so they know their rights.
205
+
206
+  We protect your rights with a two-step method: (1) we copyright the
207
+library, and (2) we offer you this license, which gives you legal
208
+permission to copy, distribute and/or modify the library.
209
+
210
+  To protect each distributor, we want to make it very clear that
211
+there is no warranty for the free library.  Also, if the library is
212
+modified by someone else and passed on, the recipients should know
213
+that what they have is not the original version, so that the original
214
+author's reputation will not be affected by problems that might be
215
+introduced by others.
216
+
217
+  Finally, software patents pose a constant threat to the existence of
218
+any free program.  We wish to make sure that a company cannot
219
+effectively restrict the users of a free program by obtaining a
220
+restrictive license from a patent holder.  Therefore, we insist that
221
+any patent license obtained for a version of the library must be
222
+consistent with the full freedom of use specified in this license.
223
+
224
+  Most GNU software, including some libraries, is covered by the
225
+ordinary GNU General Public License.  This license, the GNU Lesser
226
+General Public License, applies to certain designated libraries, and
227
+is quite different from the ordinary General Public License.  We use
228
+this license for certain libraries in order to permit linking those
229
+libraries into non-free programs.
230
+
231
+  When a program is linked with a library, whether statically or using
232
+a shared library, the combination of the two is legally speaking a
233
+combined work, a derivative of the original library.  The ordinary
234
+General Public License therefore permits such linking only if the
235
+entire combination fits its criteria of freedom.  The Lesser General
236
+Public License permits more lax criteria for linking other code with
237
+the library.
238
+
239
+  We call this license the "Lesser" General Public License because it
240
+does Less to protect the user's freedom than the ordinary General
241
+Public License.  It also provides other free software developers Less
242
+of an advantage over competing non-free programs.  These disadvantages
243
+are the reason we use the ordinary General Public License for many
244
+libraries.  However, the Lesser license provides advantages in certain
245
+special circumstances.
246
+
247
+  For example, on rare occasions, there may be a special need to
248
+encourage the widest possible use of a certain library, so that it becomes
249
+a de-facto standard.  To achieve this, non-free programs must be
250
+allowed to use the library.  A more frequent case is that a free
251
+library does the same job as widely used non-free libraries.  In this
252
+case, there is little to gain by limiting the free library to free
253
+software only, so we use the Lesser General Public License.
254
+
255
+  In other cases, permission to use a particular library in non-free
256
+programs enables a greater number of people to use a large body of
257
+free software.  For example, permission to use the GNU C Library in
258
+non-free programs enables many more people to use the whole GNU
259
+operating system, as well as its variant, the GNU/Linux operating
260
+system.
261
+
262
+  Although the Lesser General Public License is Less protective of the
263
+users' freedom, it does ensure that the user of a program that is
264
+linked with the Library has the freedom and the wherewithal to run
265
+that program using a modified version of the Library.
266
+
267
+  The precise terms and conditions for copying, distribution and
268
+modification follow.  Pay close attention to the difference between a
269
+"work based on the library" and a "work that uses the library".  The
270
+former contains code derived from the library, whereas the latter must
271
+be combined with the library in order to run.
272
+
273
+                  GNU LESSER GENERAL PUBLIC LICENSE
274
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
275
+
276
+  0. This License Agreement applies to any software library or other
277
+program which contains a notice placed by the copyright holder or
278
+other authorized party saying it may be distributed under the terms of
279
+this Lesser General Public License (also called "this License").
280
+Each licensee is addressed as "you".
281
+
282
+  A "library" means a collection of software functions and/or data
283
+prepared so as to be conveniently linked with application programs
284
+(which use some of those functions and data) to form executables.
285
+
286
+  The "Library", below, refers to any such software library or work
287
+which has been distributed under these terms.  A "work based on the
288
+Library" means either the Library or any derivative work under
289
+copyright law: that is to say, a work containing the Library or a
290
+portion of it, either verbatim or with modifications and/or translated
291
+straightforwardly into another language.  (Hereinafter, translation is
292
+included without limitation in the term "modification".)
293
+
294
+  "Source code" for a work means the preferred form of the work for
295
+making modifications to it.  For a library, complete source code means
296
+all the source code for all modules it contains, plus any associated
297
+interface definition files, plus the scripts used to control compilation
298
+and installation of the library.
299
+
300
+  Activities other than copying, distribution and modification are not
301
+covered by this License; they are outside its scope.  The act of
302
+running a program using the Library is not restricted, and output from
303
+such a program is covered only if its contents constitute a work based
304
+on the Library (independent of the use of the Library in a tool for
305
+writing it).  Whether that is true depends on what the Library does
306
+and what the program that uses the Library does.
307
+
308
+  1. You may copy and distribute verbatim copies of the Library's
309
+complete source code as you receive it, in any medium, provided that
310
+you conspicuously and appropriately publish on each copy an
311
+appropriate copyright notice and disclaimer of warranty; keep intact
312
+all the notices that refer to this License and to the absence of any
313
+warranty; and distribute a copy of this License along with the
314
+Library.
315
+
316
+  You may charge a fee for the physical act of transferring a copy,
317
+and you may at your option offer warranty protection in exchange for a
318
+fee.
319
+
320
+  2. You may modify your copy or copies of the Library or any portion
321
+of it, thus forming a work based on the Library, and copy and
322
+distribute such modifications or work under the terms of Section 1
323
+above, provided that you also meet all of these conditions:
324
+
325
+    a) The modified work must itself be a software library.
326
+
327
+    b) You must cause the files modified to carry prominent notices
328
+    stating that you changed the files and the date of any change.
329
+
330
+    c) You must cause the whole of the work to be licensed at no
331
+    charge to all third parties under the terms of this License.
332
+
333
+    d) If a facility in the modified Library refers to a function or a
334
+    table of data to be supplied by an application program that uses
335
+    the facility, other than as an argument passed when the facility
336
+    is invoked, then you must make a good faith effort to ensure that,
337
+    in the event an application does not supply such function or
338
+    table, the facility still operates, and performs whatever part of
339
+    its purpose remains meaningful.
340
+
341
+    (For example, a function in a library to compute square roots has
342
+    a purpose that is entirely well-defined independent of the
343
+    application.  Therefore, Subsection 2d requires that any
344
+    application-supplied function or table used by this function must
345
+    be optional: if the application does not supply it, the square
346
+    root function must still compute square roots.)
347
+
348
+These requirements apply to the modified work as a whole.  If
349
+identifiable sections of that work are not derived from the Library,
350
+and can be reasonably considered independent and separate works in
351
+themselves, then this License, and its terms, do not apply to those
352
+sections when you distribute them as separate works.  But when you
353
+distribute the same sections as part of a whole which is a work based
354
+on the Library, the distribution of the whole must be on the terms of
355
+this License, whose permissions for other licensees extend to the
356
+entire whole, and thus to each and every part regardless of who wrote
357
+it.
358
+
359
+Thus, it is not the intent of this section to claim rights or contest
360
+your rights to work written entirely by you; rather, the intent is to
361
+exercise the right to control the distribution of derivative or
362
+collective works based on the Library.
363
+
364
+In addition, mere aggregation of another work not based on the Library
365
+with the Library (or with a work based on the Library) on a volume of
366
+a storage or distribution medium does not bring the other work under
367
+the scope of this License.
368
+
369
+  3. You may opt to apply the terms of the ordinary GNU General Public
370
+License instead of this License to a given copy of the Library.  To do
371
+this, you must alter all the notices that refer to this License, so
372
+that they refer to the ordinary GNU General Public License, version 2,
373
+instead of to this License.  (If a newer version than version 2 of the
374
+ordinary GNU General Public License has appeared, then you can specify
375
+that version instead if you wish.)  Do not make any other change in
376
+these notices.
377
+
378
+  Once this change is made in a given copy, it is irreversible for
379
+that copy, so the ordinary GNU General Public License applies to all
380
+subsequent copies and derivative works made from that copy.
381
+
382
+  This option is useful when you wish to copy part of the code of
383
+the Library into a program that is not a library.
384
+
385
+  4. You may copy and distribute the Library (or a portion or
386
+derivative of it, under Section 2) in object code or executable form
387
+under the terms of Sections 1 and 2 above provided that you accompany
388
+it with the complete corresponding machine-readable source code, which
389
+must be distributed under the terms of Sections 1 and 2 above on a
390
+medium customarily used for software interchange.
391
+
392
+  If distribution of object code is made by offering access to copy
393
+from a designated place, then offering equivalent access to copy the
394
+source code from the same place satisfies the requirement to
395
+distribute the source code, even though third parties are not
396
+compelled to copy the source along with the object code.
397
+
398
+  5. A program that contains no derivative of any portion of the
399
+Library, but is designed to work with the Library by being compiled or
400
+linked with it, is called a "work that uses the Library".  Such a
401
+work, in isolation, is not a derivative work of the Library, and
402
+therefore falls outside the scope of this License.
403
+
404
+  However, linking a "work that uses the Library" with the Library
405
+creates an executable that is a derivative of the Library (because it
406
+contains portions of the Library), rather than a "work that uses the
407
+library".  The executable is therefore covered by this License.
408
+Section 6 states terms for distribution of such executables.
409
+
410
+  When a "work that uses the Library" uses material from a header file
411
+that is part of the Library, the object code for the work may be a
412
+derivative work of the Library even though the source code is not.
413
+Whether this is true is especially significant if the work can be
414
+linked without the Library, or if the work is itself a library.  The
415
+threshold for this to be true is not precisely defined by law.
416
+
417
+  If such an object file uses only numerical parameters, data
418
+structure layouts and accessors, and small macros and small inline
419
+functions (ten lines or less in length), then the use of the object
420
+file is unrestricted, regardless of whether it is legally a derivative
421
+work.  (Executables containing this object code plus portions of the
422
+Library will still fall under Section 6.)
423
+
424
+  Otherwise, if the work is a derivative of the Library, you may
425
+distribute the object code for the work under the terms of Section 6.
426
+Any executables containing that work also fall under Section 6,
427
+whether or not they are linked directly with the Library itself.
428
+
429
+  6. As an exception to the Sections above, you may also combine or
430
+link a "work that uses the Library" with the Library to produce a
431
+work containing portions of the Library, and distribute that work
432
+under terms of your choice, provided that the terms permit
433
+modification of the work for the customer's own use and reverse
434
+engineering for debugging such modifications.
435
+
436
+  You must give prominent notice with each copy of the work that the
437
+Library is used in it and that the Library and its use are covered by
438
+this License.  You must supply a copy of this License.  If the work
439
+during execution displays copyright notices, you must include the
440
+copyright notice for the Library among them, as well as a reference
441
+directing the user to the copy of this License.  Also, you must do one
442
+of these things:
443
+
444
+    a) Accompany the work with the complete corresponding
445
+    machine-readable source code for the Library including whatever
446
+    changes were used in the work (which must be distributed under
447
+    Sections 1 and 2 above); and, if the work is an executable linked
448
+    with the Library, with the complete machine-readable "work that
449
+    uses the Library", as object code and/or source code, so that the
450
+    user can modify the Library and then relink to produce a modified
451
+    executable containing the modified Library.  (It is understood
452
+    that the user who changes the contents of definitions files in the
453
+    Library will not necessarily be able to recompile the application
454
+    to use the modified definitions.)
455
+
456
+    b) Use a suitable shared library mechanism for linking with the
457
+    Library.  A suitable mechanism is one that (1) uses at run time a
458
+    copy of the library already present on the user's computer system,
459
+    rather than copying library functions into the executable, and (2)
460
+    will operate properly with a modified version of the library, if
461
+    the user installs one, as long as the modified version is
462
+    interface-compatible with the version that the work was made with.
463
+
464
+    c) Accompany the work with a written offer, valid for at
465
+    least three years, to give the same user the materials
466
+    specified in Subsection 6a, above, for a charge no more
467
+    than the cost of performing this distribution.
468
+
469
+    d) If distribution of the work is made by offering access to copy
470
+    from a designated place, offer equivalent access to copy the above
471
+    specified materials from the same place.
472
+
473
+    e) Verify that the user has already received a copy of these
474
+    materials or that you have already sent this user a copy.
475
+
476
+  For an executable, the required form of the "work that uses the
477
+Library" must include any data and utility programs needed for
478
+reproducing the executable from it.  However, as a special exception,
479
+the materials to be distributed need not include anything that is
480
+normally distributed (in either source or binary form) with the major
481
+components (compiler, kernel, and so on) of the operating system on
482
+which the executable runs, unless that component itself accompanies
483
+the executable.
484
+
485
+  It may happen that this requirement contradicts the license
486
+restrictions of other proprietary libraries that do not normally
487
+accompany the operating system.  Such a contradiction means you cannot
488
+use both them and the Library together in an executable that you
489
+distribute.
490
+
491
+  7. You may place library facilities that are a work based on the
492
+Library side-by-side in a single library together with other library
493
+facilities not covered by this License, and distribute such a combined
494
+library, provided that the separate distribution of the work based on
495
+the Library and of the other library facilities is otherwise
496
+permitted, and provided that you do these two things:
497
+
498
+    a) Accompany the combined library with a copy of the same work
499
+    based on the Library, uncombined with any other library
500
+    facilities.  This must be distributed under the terms of the
501
+    Sections above.
502
+
503
+    b) Give prominent notice with the combined library of the fact
504
+    that part of it is a work based on the Library, and explaining
505
+    where to find the accompanying uncombined form of the same work.
506
+
507
+  8. You may not copy, modify, sublicense, link with, or distribute
508
+the Library except as expressly provided under this License.  Any
509
+attempt otherwise to copy, modify, sublicense, link with, or
510
+distribute the Library is void, and will automatically terminate your
511
+rights under this License.  However, parties who have received copies,
512
+or rights, from you under this License will not have their licenses
513
+terminated so long as such parties remain in full compliance.
514
+
515
+  9. You are not required to accept this License, since you have not
516
+signed it.  However, nothing else grants you permission to modify or
517
+distribute the Library or its derivative works.  These actions are
518
+prohibited by law if you do not accept this License.  Therefore, by
519
+modifying or distributing the Library (or any work based on the
520
+Library), you indicate your acceptance of this License to do so, and
521
+all its terms and conditions for copying, distributing or modifying
522
+the Library or works based on it.
523
+
524
+  10. Each time you redistribute the Library (or any work based on the
525
+Library), the recipient automatically receives a license from the
526
+original licensor to copy, distribute, link with or modify the Library
527
+subject to these terms and conditions.  You may not impose any further
528
+restrictions on the recipients' exercise of the rights granted herein.
529
+You are not responsible for enforcing compliance by third parties with
530
+this License.
531
+
532
+  11. If, as a consequence of a court judgment or allegation of patent
533
+infringement or for any other reason (not limited to patent issues),
534
+conditions are imposed on you (whether by court order, agreement or
535
+otherwise) that contradict the conditions of this License, they do not
536
+excuse you from the conditions of this License.  If you cannot
537
+distribute so as to satisfy simultaneously your obligations under this
538
+License and any other pertinent obligations, then as a consequence you
539
+may not distribute the Library at all.  For example, if a patent
540
+license would not permit royalty-free redistribution of the Library by
541
+all those who receive copies directly or indirectly through you, then
542
+the only way you could satisfy both it and this License would be to
543
+refrain entirely from distribution of the Library.
544
+
545
+If any portion of this section is held invalid or unenforceable under any
546
+particular circumstance, the balance of the section is intended to apply,
547
+and the section as a whole is intended to apply in other circumstances.
548
+
549
+It is not the purpose of this section to induce you to infringe any
550
+patents or other property right claims or to contest validity of any
551
+such claims; this section has the sole purpose of protecting the
552
+integrity of the free software distribution system which is
553
+implemented by public license practices.  Many people have made
554
+generous contributions to the wide range of software distributed
555
+through that system in reliance on consistent application of that
556
+system; it is up to the author/donor to decide if he or she is willing
557
+to distribute software through any other system and a licensee cannot
558
+impose that choice.
559
+
560
+This section is intended to make thoroughly clear what is believed to
561
+be a consequence of the rest of this License.
562
+
563
+  12. If the distribution and/or use of the Library is restricted in
564
+certain countries either by patents or by copyrighted interfaces, the
565
+original copyright holder who places the Library under this License may add
566
+an explicit geographical distribution limitation excluding those countries,
567
+so that distribution is permitted only in or among countries not thus
568
+excluded.  In such case, this License incorporates the limitation as if
569
+written in the body of this License.
570
+
571
+  13. The Free Software Foundation may publish revised and/or new
572
+versions of the Lesser General Public License from time to time.
573
+Such new versions will be similar in spirit to the present version,
574
+but may differ in detail to address new problems or concerns.
575
+
576
+Each version is given a distinguishing version number.  If the Library
577
+specifies a version number of this License which applies to it and
578
+"any later version", you have the option of following the terms and
579
+conditions either of that version or of any later version published by
580
+the Free Software Foundation.  If the Library does not specify a
581
+license version number, you may choose any version ever published by
582
+the Free Software Foundation.
583
+
584
+  14. If you wish to incorporate parts of the Library into other free
585
+programs whose distribution conditions are incompatible with these,
586
+write to the author to ask for permission.  For software which is
587
+copyrighted by the Free Software Foundation, write to the Free
588
+Software Foundation; we sometimes make exceptions for this.  Our
589
+decision will be guided by the two goals of preserving the free status
590
+of all derivatives of our free software and of promoting the sharing
591
+and reuse of software generally.
592
+
593
+                            NO WARRANTY
594
+
595
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
596
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
597
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
598
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
599
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
600
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
601
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
602
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
603
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
604
+
605
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
606
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
607
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
608
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
609
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
610
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
611
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
612
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
613
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
614
+DAMAGES.
615
+
616
+                     END OF TERMS AND CONDITIONS
617
+
618
+           How to Apply These Terms to Your New Libraries
619
+
620
+  If you develop a new library, and you want it to be of the greatest
621
+possible use to the public, we recommend making it free software that
622
+everyone can redistribute and change.  You can do so by permitting
623
+redistribution under these terms (or, alternatively, under the terms of the
624
+ordinary General Public License).
625
+
626
+  To apply these terms, attach the following notices to the library.  It is
627
+safest to attach them to the start of each source file to most effectively
628
+convey the exclusion of warranty; and each file should have at least the
629
+"copyright" line and a pointer to where the full notice is found.
630
+
631
+    <one line to give the library's name and a brief idea of what it does.>
632
+    Copyright (C) <year>  <name of author>
633
+
634
+    This library is free software; you can redistribute it and/or
635
+    modify it under the terms of the GNU Lesser General Public
636
+    License as published by the Free Software Foundation; either
637
+    version 2.1 of the License, or (at your option) any later version.
638
+
639
+    This library is distributed in the hope that it will be useful,
640
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
641
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
642
+    Lesser General Public License for more details.
643
+
644
+    You should have received a copy of the GNU Lesser General Public
645
+    License along with this library; if not, write to the Free Software
646
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
647
+
648
+Also add information on how to contact you by electronic and paper mail.
649
+
650
+You should also get your employer (if you work as a programmer) or your
651
+school, if any, to sign a "copyright disclaimer" for the library, if
652
+necessary.  Here is a sample; alter the names:
653
+
654
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
655
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
656
+
657
+  <signature of Ty Coon>, 1 April 1990
658
+  Ty Coon, President of Vice
659
+
660
+That's all there is to it!
661
+
662
+
663
diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
664
new file mode 100644
665
index 000000000000..fb0c6fae70b3
666
--- /dev/null
667
+++ dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
668
@@ -0,0 +1,6146 @@
669
+/*
670
+ * copyright (c) 2001 Fabrice Bellard
671
+ *
672
+ * This file is part of FFmpeg.
673
+ *
674
+ * FFmpeg is free software; you can redistribute it and/or
675
+ * modify it under the terms of the GNU Lesser General Public
676
+ * License as published by the Free Software Foundation; either
677
+ * version 2.1 of the License, or (at your option) any later version.
678
+ *
679
+ * FFmpeg is distributed in the hope that it will be useful,
680
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
681
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
682
+ * Lesser General Public License for more details.
683
+ *
684
+ * You should have received a copy of the GNU Lesser General Public
685
+ * License along with FFmpeg; if not, write to the Free Software
686
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
687
+ */
688
+
689
+#ifndef AVCODEC_AVCODEC_H
690
+#define AVCODEC_AVCODEC_H
691
+
692
+/**
693
+ * @file
694
+ * @ingroup libavc
695
+ * Libavcodec external API header
696
+ */
697
+
698
+#include <errno.h>
699
+#include "libavutil/samplefmt.h"
700
+#include "libavutil/attributes.h"
701
+#include "libavutil/avutil.h"
702
+#include "libavutil/buffer.h"
703
+#include "libavutil/cpu.h"
704
+#include "libavutil/channel_layout.h"
705
+#include "libavutil/dict.h"
706
+#include "libavutil/frame.h"
707
+#include "libavutil/hwcontext.h"
708
+#include "libavutil/log.h"
709
+#include "libavutil/pixfmt.h"
710
+#include "libavutil/rational.h"
711
+
712
+#include "version.h"
713
+
714
+/**
715
+ * @defgroup libavc libavcodec
716
+ * Encoding/Decoding Library
717
+ *
718
+ * @{
719
+ *
720
+ * @defgroup lavc_decoding Decoding
721
+ * @{
722
+ * @}
723
+ *
724
+ * @defgroup lavc_encoding Encoding
725
+ * @{
726
+ * @}
727
+ *
728
+ * @defgroup lavc_codec Codecs
729
+ * @{
730
+ * @defgroup lavc_codec_native Native Codecs
731
+ * @{
732
+ * @}
733
+ * @defgroup lavc_codec_wrappers External library wrappers
734
+ * @{
735
+ * @}
736
+ * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
737
+ * @{
738
+ * @}
739
+ * @}
740
+ * @defgroup lavc_internal Internal
741
+ * @{
742
+ * @}
743
+ * @}
744
+ */
745
+
746
+/**
747
+ * @ingroup libavc
748
+ * @defgroup lavc_encdec send/receive encoding and decoding API overview
749
+ * @{
750
+ *
751
+ * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
752
+ * avcodec_receive_packet() functions provide an encode/decode API, which
753
+ * decouples input and output.
754
+ *
755
+ * The API is very similar for encoding/decoding and audio/video, and works as
756
+ * follows:
757
+ * - Set up and open the AVCodecContext as usual.
758
+ * - Send valid input:
759
+ *   - For decoding, call avcodec_send_packet() to give the decoder raw
760
+ *     compressed data in an AVPacket.
761
+ *   - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
762
+ *     containing uncompressed audio or video.
763
+ *   In both cases, it is recommended that AVPackets and AVFrames are
764
+ *   refcounted, or libavcodec might have to copy the input data. (libavformat
765
+ *   always returns refcounted AVPackets, and av_frame_get_buffer() allocates
766
+ *   refcounted AVFrames.)
767
+ * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
768
+ *   functions and process their output:
769
+ *   - For decoding, call avcodec_receive_frame(). On success, it will return
770
+ *     an AVFrame containing uncompressed audio or video data.
771
+ *   - For encoding, call avcodec_receive_packet(). On success, it will return
772
+ *     an AVPacket with a compressed frame.
773
+ *   Repeat this call until it returns AVERROR(EAGAIN) or an error. The
774
+ *   AVERROR(EAGAIN) return value means that new input data is required to
775
+ *   return new output. In this case, continue with sending input. For each
776
+ *   input frame/packet, the codec will typically return 1 output frame/packet,
777
+ *   but it can also be 0 or more than 1.
778
+ *
779
+ * At the beginning of decoding or encoding, the codec might accept multiple
780
+ * input frames/packets without returning a frame, until its internal buffers
781
+ * are filled. This situation is handled transparently if you follow the steps
782
+ * outlined above.
783
+ *
784
+ * In theory, sending input can result in EAGAIN - this should happen only if
785
+ * not all output was received. You can use this to structure alternative decode
786
+ * or encode loops other than the one suggested above. For example, you could
787
+ * try sending new input on each iteration, and try to receive output if that
788
+ * returns EAGAIN.
789
+ *
790
+ * End of stream situations. These require "flushing" (aka draining) the codec,
791
+ * as the codec might buffer multiple frames or packets internally for
792
+ * performance or out of necessity (consider B-frames).
793
+ * This is handled as follows:
794
+ * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
795
+ *   or avcodec_send_frame() (encoding) functions. This will enter draining
796
+ *   mode.
797
+ * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
798
+ *   (encoding) in a loop until AVERROR_EOF is returned. The functions will
799
+ *   not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
800
+ * - Before decoding can be resumed again, the codec has to be reset with
801
+ *   avcodec_flush_buffers().
802
+ *
803
+ * Using the API as outlined above is highly recommended. But it is also
804
+ * possible to call functions outside of this rigid schema. For example, you can
805
+ * call avcodec_send_packet() repeatedly without calling
806
+ * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
807
+ * until the codec's internal buffer has been filled up (which is typically of
808
+ * size 1 per output frame, after initial input), and then reject input with
809
+ * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
810
+ * read at least some output.
811
+ *
812
+ * Not all codecs will follow a rigid and predictable dataflow; the only
813
+ * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
814
+ * one end implies that a receive/send call on the other end will succeed, or
815
+ * at least will not fail with AVERROR(EAGAIN). In general, no codec will
816
+ * permit unlimited buffering of input or output.
817
+ *
818
+ * This API replaces the following legacy functions:
819
+ * - avcodec_decode_video2() and avcodec_decode_audio4():
820
+ *   Use avcodec_send_packet() to feed input to the decoder, then use
821
+ *   avcodec_receive_frame() to receive decoded frames after each packet.
822
+ *   Unlike with the old video decoding API, multiple frames might result from
823
+ *   a packet. For audio, splitting the input packet into frames by partially
824
+ *   decoding packets becomes transparent to the API user. You never need to
825
+ *   feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
826
+ *   no data was read from the packet).
827
+ *   Additionally, sending a flush/draining packet is required only once.
828
+ * - avcodec_encode_video2()/avcodec_encode_audio2():
829
+ *   Use avcodec_send_frame() to feed input to the encoder, then use
830
+ *   avcodec_receive_packet() to receive encoded packets.
831
+ *   Providing user-allocated buffers for avcodec_receive_packet() is not
832
+ *   possible.
833
+ * - The new API does not handle subtitles yet.
834
+ *
835
+ * Mixing new and old function calls on the same AVCodecContext is not allowed,
836
+ * and will result in undefined behavior.
837
+ *
838
+ * Some codecs might require using the new API; using the old API will return
839
+ * an error when calling it. All codecs support the new API.
840
+ *
841
+ * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
842
+ * would be an invalid state, which could put the codec user into an endless
843
+ * loop. The API has no concept of time either: it cannot happen that trying to
844
+ * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
845
+ * later accepts the packet (with no other receive/flush API calls involved).
846
+ * The API is a strict state machine, and the passage of time is not supposed
847
+ * to influence it. Some timing-dependent behavior might still be deemed
848
+ * acceptable in certain cases. But it must never result in both send/receive
849
+ * returning EAGAIN at the same time at any point. It must also absolutely be
850
+ * avoided that the current state is "unstable" and can "flip-flop" between
851
+ * the send/receive APIs allowing progress. For example, it's not allowed that
852
+ * the codec randomly decides that it actually wants to consume a packet now
853
+ * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
854
+ * avcodec_send_packet() call.
855
+ * @}
856
+ */
857
+
858
+/**
859
+ * @defgroup lavc_core Core functions/structures.
860
+ * @ingroup libavc
861
+ *
862
+ * Basic definitions, functions for querying libavcodec capabilities,
863
+ * allocating core structures, etc.
864
+ * @{
865
+ */
866
+
867
+
868
+/**
869
+ * Identify the syntax and semantics of the bitstream.
870
+ * The principle is roughly:
871
+ * Two decoders with the same ID can decode the same streams.
872
+ * Two encoders with the same ID can encode compatible streams.
873
+ * There may be slight deviations from the principle due to implementation
874
+ * details.
875
+ *
876
+ * If you add a codec ID to this list, add it so that
877
+ * 1. no value of an existing codec ID changes (that would break ABI),
878
+ * 2. it is as close as possible to similar codecs
879
+ *
880
+ * After adding new codec IDs, do not forget to add an entry to the codec
881
+ * descriptor list and bump libavcodec minor version.
882
+ */
883
+enum AVCodecID {
884
+    AV_CODEC_ID_NONE,
885
+
886
+    /* video codecs */
887
+    AV_CODEC_ID_MPEG1VIDEO,
888
+    AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
889
+    AV_CODEC_ID_H261,
890
+    AV_CODEC_ID_H263,
891
+    AV_CODEC_ID_RV10,
892
+    AV_CODEC_ID_RV20,
893
+    AV_CODEC_ID_MJPEG,
894
+    AV_CODEC_ID_MJPEGB,
895
+    AV_CODEC_ID_LJPEG,
896
+    AV_CODEC_ID_SP5X,
897
+    AV_CODEC_ID_JPEGLS,
898
+    AV_CODEC_ID_MPEG4,
899
+    AV_CODEC_ID_RAWVIDEO,
900
+    AV_CODEC_ID_MSMPEG4V1,
901
+    AV_CODEC_ID_MSMPEG4V2,
902
+    AV_CODEC_ID_MSMPEG4V3,
903
+    AV_CODEC_ID_WMV1,
904
+    AV_CODEC_ID_WMV2,
905
+    AV_CODEC_ID_H263P,
906
+    AV_CODEC_ID_H263I,
907
+    AV_CODEC_ID_FLV1,
908
+    AV_CODEC_ID_SVQ1,
909
+    AV_CODEC_ID_SVQ3,
910
+    AV_CODEC_ID_DVVIDEO,
911
+    AV_CODEC_ID_HUFFYUV,
912
+    AV_CODEC_ID_CYUV,
913
+    AV_CODEC_ID_H264,
914
+    AV_CODEC_ID_INDEO3,
915
+    AV_CODEC_ID_VP3,
916
+    AV_CODEC_ID_THEORA,
917
+    AV_CODEC_ID_ASV1,
918
+    AV_CODEC_ID_ASV2,
919
+    AV_CODEC_ID_FFV1,
920
+    AV_CODEC_ID_4XM,
921
+    AV_CODEC_ID_VCR1,
922
+    AV_CODEC_ID_CLJR,
923
+    AV_CODEC_ID_MDEC,
924
+    AV_CODEC_ID_ROQ,
925
+    AV_CODEC_ID_INTERPLAY_VIDEO,
926
+    AV_CODEC_ID_XAN_WC3,
927
+    AV_CODEC_ID_XAN_WC4,
928
+    AV_CODEC_ID_RPZA,
929
+    AV_CODEC_ID_CINEPAK,
930
+    AV_CODEC_ID_WS_VQA,
931
+    AV_CODEC_ID_MSRLE,
932
+    AV_CODEC_ID_MSVIDEO1,
933
+    AV_CODEC_ID_IDCIN,
934
+    AV_CODEC_ID_8BPS,
935
+    AV_CODEC_ID_SMC,
936
+    AV_CODEC_ID_FLIC,
937
+    AV_CODEC_ID_TRUEMOTION1,
938
+    AV_CODEC_ID_VMDVIDEO,
939
+    AV_CODEC_ID_MSZH,
940
+    AV_CODEC_ID_ZLIB,
941
+    AV_CODEC_ID_QTRLE,
942
+    AV_CODEC_ID_TSCC,
943
+    AV_CODEC_ID_ULTI,
944
+    AV_CODEC_ID_QDRAW,
945
+    AV_CODEC_ID_VIXL,
946
+    AV_CODEC_ID_QPEG,
947
+    AV_CODEC_ID_PNG,
948
+    AV_CODEC_ID_PPM,
949
+    AV_CODEC_ID_PBM,
950
+    AV_CODEC_ID_PGM,
951
+    AV_CODEC_ID_PGMYUV,
952
+    AV_CODEC_ID_PAM,
953
+    AV_CODEC_ID_FFVHUFF,
954
+    AV_CODEC_ID_RV30,
955
+    AV_CODEC_ID_RV40,
956
+    AV_CODEC_ID_VC1,
957
+    AV_CODEC_ID_WMV3,
958
+    AV_CODEC_ID_LOCO,
959
+    AV_CODEC_ID_WNV1,
960
+    AV_CODEC_ID_AASC,
961
+    AV_CODEC_ID_INDEO2,
962
+    AV_CODEC_ID_FRAPS,
963
+    AV_CODEC_ID_TRUEMOTION2,
964
+    AV_CODEC_ID_BMP,
965
+    AV_CODEC_ID_CSCD,
966
+    AV_CODEC_ID_MMVIDEO,
967
+    AV_CODEC_ID_ZMBV,
968
+    AV_CODEC_ID_AVS,
969
+    AV_CODEC_ID_SMACKVIDEO,
970
+    AV_CODEC_ID_NUV,
971
+    AV_CODEC_ID_KMVC,
972
+    AV_CODEC_ID_FLASHSV,
973
+    AV_CODEC_ID_CAVS,
974
+    AV_CODEC_ID_JPEG2000,
975
+    AV_CODEC_ID_VMNC,
976
+    AV_CODEC_ID_VP5,
977
+    AV_CODEC_ID_VP6,
978
+    AV_CODEC_ID_VP6F,
979
+    AV_CODEC_ID_TARGA,
980
+    AV_CODEC_ID_DSICINVIDEO,
981
+    AV_CODEC_ID_TIERTEXSEQVIDEO,
982
+    AV_CODEC_ID_TIFF,
983
+    AV_CODEC_ID_GIF,
984
+    AV_CODEC_ID_DXA,
985
+    AV_CODEC_ID_DNXHD,
986
+    AV_CODEC_ID_THP,
987
+    AV_CODEC_ID_SGI,
988
+    AV_CODEC_ID_C93,
989
+    AV_CODEC_ID_BETHSOFTVID,
990
+    AV_CODEC_ID_PTX,
991
+    AV_CODEC_ID_TXD,
992
+    AV_CODEC_ID_VP6A,
993
+    AV_CODEC_ID_AMV,
994
+    AV_CODEC_ID_VB,
995
+    AV_CODEC_ID_PCX,
996
+    AV_CODEC_ID_SUNRAST,
997
+    AV_CODEC_ID_INDEO4,
998
+    AV_CODEC_ID_INDEO5,
999
+    AV_CODEC_ID_MIMIC,
1000
+    AV_CODEC_ID_RL2,
1001
+    AV_CODEC_ID_ESCAPE124,
1002
+    AV_CODEC_ID_DIRAC,
1003
+    AV_CODEC_ID_BFI,
1004
+    AV_CODEC_ID_CMV,
1005
+    AV_CODEC_ID_MOTIONPIXELS,
1006
+    AV_CODEC_ID_TGV,
1007
+    AV_CODEC_ID_TGQ,
1008
+    AV_CODEC_ID_TQI,
1009
+    AV_CODEC_ID_AURA,
1010
+    AV_CODEC_ID_AURA2,
1011
+    AV_CODEC_ID_V210X,
1012
+    AV_CODEC_ID_TMV,
1013
+    AV_CODEC_ID_V210,
1014
+    AV_CODEC_ID_DPX,
1015
+    AV_CODEC_ID_MAD,
1016
+    AV_CODEC_ID_FRWU,
1017
+    AV_CODEC_ID_FLASHSV2,
1018
+    AV_CODEC_ID_CDGRAPHICS,
1019
+    AV_CODEC_ID_R210,
1020
+    AV_CODEC_ID_ANM,
1021
+    AV_CODEC_ID_BINKVIDEO,
1022
+    AV_CODEC_ID_IFF_ILBM,
1023
+#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
1024
+    AV_CODEC_ID_KGV1,
1025
+    AV_CODEC_ID_YOP,
1026
+    AV_CODEC_ID_VP8,
1027
+    AV_CODEC_ID_PICTOR,
1028
+    AV_CODEC_ID_ANSI,
1029
+    AV_CODEC_ID_A64_MULTI,
1030
+    AV_CODEC_ID_A64_MULTI5,
1031
+    AV_CODEC_ID_R10K,
1032
+    AV_CODEC_ID_MXPEG,
1033
+    AV_CODEC_ID_LAGARITH,
1034
+    AV_CODEC_ID_PRORES,
1035
+    AV_CODEC_ID_JV,
1036
+    AV_CODEC_ID_DFA,
1037
+    AV_CODEC_ID_WMV3IMAGE,
1038
+    AV_CODEC_ID_VC1IMAGE,
1039
+    AV_CODEC_ID_UTVIDEO,
1040
+    AV_CODEC_ID_BMV_VIDEO,
1041
+    AV_CODEC_ID_VBLE,
1042
+    AV_CODEC_ID_DXTORY,
1043
+    AV_CODEC_ID_V410,
1044
+    AV_CODEC_ID_XWD,
1045
+    AV_CODEC_ID_CDXL,
1046
+    AV_CODEC_ID_XBM,
1047
+    AV_CODEC_ID_ZEROCODEC,
1048
+    AV_CODEC_ID_MSS1,
1049
+    AV_CODEC_ID_MSA1,
1050
+    AV_CODEC_ID_TSCC2,
1051
+    AV_CODEC_ID_MTS2,
1052
+    AV_CODEC_ID_CLLC,
1053
+    AV_CODEC_ID_MSS2,
1054
+    AV_CODEC_ID_VP9,
1055
+    AV_CODEC_ID_AIC,
1056
+    AV_CODEC_ID_ESCAPE130,
1057
+    AV_CODEC_ID_G2M,
1058
+    AV_CODEC_ID_WEBP,
1059
+    AV_CODEC_ID_HNM4_VIDEO,
1060
+    AV_CODEC_ID_HEVC,
1061
+#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
1062
+    AV_CODEC_ID_FIC,
1063
+    AV_CODEC_ID_ALIAS_PIX,
1064
+    AV_CODEC_ID_BRENDER_PIX,
1065
+    AV_CODEC_ID_PAF_VIDEO,
1066
+    AV_CODEC_ID_EXR,
1067
+    AV_CODEC_ID_VP7,
1068
+    AV_CODEC_ID_SANM,
1069
+    AV_CODEC_ID_SGIRLE,
1070
+    AV_CODEC_ID_MVC1,
1071
+    AV_CODEC_ID_MVC2,
1072
+    AV_CODEC_ID_HQX,
1073
+    AV_CODEC_ID_TDSC,
1074
+    AV_CODEC_ID_HQ_HQA,
1075
+    AV_CODEC_ID_HAP,
1076
+    AV_CODEC_ID_DDS,
1077
+    AV_CODEC_ID_DXV,
1078
+    AV_CODEC_ID_SCREENPRESSO,
1079
+    AV_CODEC_ID_RSCC,
1080
+
1081
+    AV_CODEC_ID_Y41P = 0x8000,
1082
+    AV_CODEC_ID_AVRP,
1083
+    AV_CODEC_ID_012V,
1084
+    AV_CODEC_ID_AVUI,
1085
+    AV_CODEC_ID_AYUV,
1086
+    AV_CODEC_ID_TARGA_Y216,
1087
+    AV_CODEC_ID_V308,
1088
+    AV_CODEC_ID_V408,
1089
+    AV_CODEC_ID_YUV4,
1090
+    AV_CODEC_ID_AVRN,
1091
+    AV_CODEC_ID_CPIA,
1092
+    AV_CODEC_ID_XFACE,
1093
+    AV_CODEC_ID_SNOW,
1094
+    AV_CODEC_ID_SMVJPEG,
1095
+    AV_CODEC_ID_APNG,
1096
+    AV_CODEC_ID_DAALA,
1097
+    AV_CODEC_ID_CFHD,
1098
+    AV_CODEC_ID_TRUEMOTION2RT,
1099
+    AV_CODEC_ID_M101,
1100
+    AV_CODEC_ID_MAGICYUV,
1101
+    AV_CODEC_ID_SHEERVIDEO,
1102
+    AV_CODEC_ID_YLC,
1103
+    AV_CODEC_ID_PSD,
1104
+    AV_CODEC_ID_PIXLET,
1105
+    AV_CODEC_ID_SPEEDHQ,
1106
+    AV_CODEC_ID_FMVC,
1107
+    AV_CODEC_ID_SCPR,
1108
+    AV_CODEC_ID_CLEARVIDEO,
1109
+    AV_CODEC_ID_XPM,
1110
+    AV_CODEC_ID_AV1,
1111
+    AV_CODEC_ID_BITPACKED,
1112
+    AV_CODEC_ID_MSCC,
1113
+    AV_CODEC_ID_SRGC,
1114
+    AV_CODEC_ID_SVG,
1115
+    AV_CODEC_ID_GDV,
1116
+    AV_CODEC_ID_FITS,
1117
+
1118
+    /* various PCM "codecs" */
1119
+    AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
1120
+    AV_CODEC_ID_PCM_S16LE = 0x10000,
1121
+    AV_CODEC_ID_PCM_S16BE,
1122
+    AV_CODEC_ID_PCM_U16LE,
1123
+    AV_CODEC_ID_PCM_U16BE,
1124
+    AV_CODEC_ID_PCM_S8,
1125
+    AV_CODEC_ID_PCM_U8,
1126
+    AV_CODEC_ID_PCM_MULAW,
1127
+    AV_CODEC_ID_PCM_ALAW,
1128
+    AV_CODEC_ID_PCM_S32LE,
1129
+    AV_CODEC_ID_PCM_S32BE,
1130
+    AV_CODEC_ID_PCM_U32LE,
1131
+    AV_CODEC_ID_PCM_U32BE,
1132
+    AV_CODEC_ID_PCM_S24LE,
1133
+    AV_CODEC_ID_PCM_S24BE,
1134
+    AV_CODEC_ID_PCM_U24LE,
1135
+    AV_CODEC_ID_PCM_U24BE,
1136
+    AV_CODEC_ID_PCM_S24DAUD,
1137
+    AV_CODEC_ID_PCM_ZORK,
1138
+    AV_CODEC_ID_PCM_S16LE_PLANAR,
1139
+    AV_CODEC_ID_PCM_DVD,
1140
+    AV_CODEC_ID_PCM_F32BE,
1141
+    AV_CODEC_ID_PCM_F32LE,
1142
+    AV_CODEC_ID_PCM_F64BE,
1143
+    AV_CODEC_ID_PCM_F64LE,
1144
+    AV_CODEC_ID_PCM_BLURAY,
1145
+    AV_CODEC_ID_PCM_LXF,
1146
+    AV_CODEC_ID_S302M,
1147
+    AV_CODEC_ID_PCM_S8_PLANAR,
1148
+    AV_CODEC_ID_PCM_S24LE_PLANAR,
1149
+    AV_CODEC_ID_PCM_S32LE_PLANAR,
1150
+    AV_CODEC_ID_PCM_S16BE_PLANAR,
1151
+
1152
+    AV_CODEC_ID_PCM_S64LE = 0x10800,
1153
+    AV_CODEC_ID_PCM_S64BE,
1154
+    AV_CODEC_ID_PCM_F16LE,
1155
+    AV_CODEC_ID_PCM_F24LE,
1156
+
1157
+    /* various ADPCM codecs */
1158
+    AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
1159
+    AV_CODEC_ID_ADPCM_IMA_WAV,
1160
+    AV_CODEC_ID_ADPCM_IMA_DK3,
1161
+    AV_CODEC_ID_ADPCM_IMA_DK4,
1162
+    AV_CODEC_ID_ADPCM_IMA_WS,
1163
+    AV_CODEC_ID_ADPCM_IMA_SMJPEG,
1164
+    AV_CODEC_ID_ADPCM_MS,
1165
+    AV_CODEC_ID_ADPCM_4XM,
1166
+    AV_CODEC_ID_ADPCM_XA,
1167
+    AV_CODEC_ID_ADPCM_ADX,
1168
+    AV_CODEC_ID_ADPCM_EA,
1169
+    AV_CODEC_ID_ADPCM_G726,
1170
+    AV_CODEC_ID_ADPCM_CT,
1171
+    AV_CODEC_ID_ADPCM_SWF,
1172
+    AV_CODEC_ID_ADPCM_YAMAHA,
1173
+    AV_CODEC_ID_ADPCM_SBPRO_4,
1174
+    AV_CODEC_ID_ADPCM_SBPRO_3,
1175
+    AV_CODEC_ID_ADPCM_SBPRO_2,
1176
+    AV_CODEC_ID_ADPCM_THP,
1177
+    AV_CODEC_ID_ADPCM_IMA_AMV,
1178
+    AV_CODEC_ID_ADPCM_EA_R1,
1179
+    AV_CODEC_ID_ADPCM_EA_R3,
1180
+    AV_CODEC_ID_ADPCM_EA_R2,
1181
+    AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
1182
+    AV_CODEC_ID_ADPCM_IMA_EA_EACS,
1183
+    AV_CODEC_ID_ADPCM_EA_XAS,
1184
+    AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
1185
+    AV_CODEC_ID_ADPCM_IMA_ISS,
1186
+    AV_CODEC_ID_ADPCM_G722,
1187
+    AV_CODEC_ID_ADPCM_IMA_APC,
1188
+    AV_CODEC_ID_ADPCM_VIMA,
1189
+
1190
+    AV_CODEC_ID_ADPCM_AFC = 0x11800,
1191
+    AV_CODEC_ID_ADPCM_IMA_OKI,
1192
+    AV_CODEC_ID_ADPCM_DTK,
1193
+    AV_CODEC_ID_ADPCM_IMA_RAD,
1194
+    AV_CODEC_ID_ADPCM_G726LE,
1195
+    AV_CODEC_ID_ADPCM_THP_LE,
1196
+    AV_CODEC_ID_ADPCM_PSX,
1197
+    AV_CODEC_ID_ADPCM_AICA,
1198
+    AV_CODEC_ID_ADPCM_IMA_DAT4,
1199
+    AV_CODEC_ID_ADPCM_MTAF,
1200
+
1201
+    /* AMR */
1202
+    AV_CODEC_ID_AMR_NB = 0x12000,
1203
+    AV_CODEC_ID_AMR_WB,
1204
+
1205
+    /* RealAudio codecs*/
1206
+    AV_CODEC_ID_RA_144 = 0x13000,
1207
+    AV_CODEC_ID_RA_288,
1208
+
1209
+    /* various DPCM codecs */
1210
+    AV_CODEC_ID_ROQ_DPCM = 0x14000,
1211
+    AV_CODEC_ID_INTERPLAY_DPCM,
1212
+    AV_CODEC_ID_XAN_DPCM,
1213
+    AV_CODEC_ID_SOL_DPCM,
1214
+
1215
+    AV_CODEC_ID_SDX2_DPCM = 0x14800,
1216
+    AV_CODEC_ID_GREMLIN_DPCM,
1217
+
1218
+    /* audio codecs */
1219
+    AV_CODEC_ID_MP2 = 0x15000,
1220
+    AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
1221
+    AV_CODEC_ID_AAC,
1222
+    AV_CODEC_ID_AC3,
1223
+    AV_CODEC_ID_DTS,
1224
+    AV_CODEC_ID_VORBIS,
1225
+    AV_CODEC_ID_DVAUDIO,
1226
+    AV_CODEC_ID_WMAV1,
1227
+    AV_CODEC_ID_WMAV2,
1228
+    AV_CODEC_ID_MACE3,
1229
+    AV_CODEC_ID_MACE6,
1230
+    AV_CODEC_ID_VMDAUDIO,
1231
+    AV_CODEC_ID_FLAC,
1232
+    AV_CODEC_ID_MP3ADU,
1233
+    AV_CODEC_ID_MP3ON4,
1234
+    AV_CODEC_ID_SHORTEN,
1235
+    AV_CODEC_ID_ALAC,
1236
+    AV_CODEC_ID_WESTWOOD_SND1,
1237
+    AV_CODEC_ID_GSM, ///< as in Berlin toast format
1238
+    AV_CODEC_ID_QDM2,
1239
+    AV_CODEC_ID_COOK,
1240
+    AV_CODEC_ID_TRUESPEECH,
1241
+    AV_CODEC_ID_TTA,
1242
+    AV_CODEC_ID_SMACKAUDIO,
1243
+    AV_CODEC_ID_QCELP,
1244
+    AV_CODEC_ID_WAVPACK,
1245
+    AV_CODEC_ID_DSICINAUDIO,
1246
+    AV_CODEC_ID_IMC,
1247
+    AV_CODEC_ID_MUSEPACK7,
1248
+    AV_CODEC_ID_MLP,
1249
+    AV_CODEC_ID_GSM_MS, /* as found in WAV */
1250
+    AV_CODEC_ID_ATRAC3,
1251
+    AV_CODEC_ID_APE,
1252
+    AV_CODEC_ID_NELLYMOSER,
1253
+    AV_CODEC_ID_MUSEPACK8,
1254
+    AV_CODEC_ID_SPEEX,
1255
+    AV_CODEC_ID_WMAVOICE,
1256
+    AV_CODEC_ID_WMAPRO,
1257
+    AV_CODEC_ID_WMALOSSLESS,
1258
+    AV_CODEC_ID_ATRAC3P,
1259
+    AV_CODEC_ID_EAC3,
1260
+    AV_CODEC_ID_SIPR,
1261
+    AV_CODEC_ID_MP1,
1262
+    AV_CODEC_ID_TWINVQ,
1263
+    AV_CODEC_ID_TRUEHD,
1264
+    AV_CODEC_ID_MP4ALS,
1265
+    AV_CODEC_ID_ATRAC1,
1266
+    AV_CODEC_ID_BINKAUDIO_RDFT,
1267
+    AV_CODEC_ID_BINKAUDIO_DCT,
1268
+    AV_CODEC_ID_AAC_LATM,
1269
+    AV_CODEC_ID_QDMC,
1270
+    AV_CODEC_ID_CELT,
1271
+    AV_CODEC_ID_G723_1,
1272
+    AV_CODEC_ID_G729,
1273
+    AV_CODEC_ID_8SVX_EXP,
1274
+    AV_CODEC_ID_8SVX_FIB,
1275
+    AV_CODEC_ID_BMV_AUDIO,
1276
+    AV_CODEC_ID_RALF,
1277
+    AV_CODEC_ID_IAC,
1278
+    AV_CODEC_ID_ILBC,
1279
+    AV_CODEC_ID_OPUS,
1280
+    AV_CODEC_ID_COMFORT_NOISE,
1281
+    AV_CODEC_ID_TAK,
1282
+    AV_CODEC_ID_METASOUND,
1283
+    AV_CODEC_ID_PAF_AUDIO,
1284
+    AV_CODEC_ID_ON2AVC,
1285
+    AV_CODEC_ID_DSS_SP,
1286
+    AV_CODEC_ID_CODEC2,
1287
+
1288
+    AV_CODEC_ID_FFWAVESYNTH = 0x15800,
1289
+    AV_CODEC_ID_SONIC,
1290
+    AV_CODEC_ID_SONIC_LS,
1291
+    AV_CODEC_ID_EVRC,
1292
+    AV_CODEC_ID_SMV,
1293
+    AV_CODEC_ID_DSD_LSBF,
1294
+    AV_CODEC_ID_DSD_MSBF,
1295
+    AV_CODEC_ID_DSD_LSBF_PLANAR,
1296
+    AV_CODEC_ID_DSD_MSBF_PLANAR,
1297
+    AV_CODEC_ID_4GV,
1298
+    AV_CODEC_ID_INTERPLAY_ACM,
1299
+    AV_CODEC_ID_XMA1,
1300
+    AV_CODEC_ID_XMA2,
1301
+    AV_CODEC_ID_DST,
1302
+    AV_CODEC_ID_ATRAC3AL,
1303
+    AV_CODEC_ID_ATRAC3PAL,
1304
+    AV_CODEC_ID_DOLBY_E,
1305
+    AV_CODEC_ID_APTX,
1306
+    AV_CODEC_ID_APTX_HD,
1307
+    AV_CODEC_ID_SBC,
1308
+
1309
+    /* subtitle codecs */
1310
+    AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
1311
+    AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
1312
+    AV_CODEC_ID_DVB_SUBTITLE,
1313
+    AV_CODEC_ID_TEXT,  ///< raw UTF-8 text
1314
+    AV_CODEC_ID_XSUB,
1315
+    AV_CODEC_ID_SSA,
1316
+    AV_CODEC_ID_MOV_TEXT,
1317
+    AV_CODEC_ID_HDMV_PGS_SUBTITLE,
1318
+    AV_CODEC_ID_DVB_TELETEXT,
1319
+    AV_CODEC_ID_SRT,
1320
+
1321
+    AV_CODEC_ID_MICRODVD   = 0x17800,
1322
+    AV_CODEC_ID_EIA_608,
1323
+    AV_CODEC_ID_JACOSUB,
1324
+    AV_CODEC_ID_SAMI,
1325
+    AV_CODEC_ID_REALTEXT,
1326
+    AV_CODEC_ID_STL,
1327
+    AV_CODEC_ID_SUBVIEWER1,
1328
+    AV_CODEC_ID_SUBVIEWER,
1329
+    AV_CODEC_ID_SUBRIP,
1330
+    AV_CODEC_ID_WEBVTT,
1331
+    AV_CODEC_ID_MPL2,
1332
+    AV_CODEC_ID_VPLAYER,
1333
+    AV_CODEC_ID_PJS,
1334
+    AV_CODEC_ID_ASS,
1335
+    AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
1336
+
1337
+    /* other specific kind of codecs (generally used for attachments) */
1338
+    AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
1339
+    AV_CODEC_ID_TTF = 0x18000,
1340
+
1341
+    AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
1342
+    AV_CODEC_ID_BINTEXT    = 0x18800,
1343
+    AV_CODEC_ID_XBIN,
1344
+    AV_CODEC_ID_IDF,
1345
+    AV_CODEC_ID_OTF,
1346
+    AV_CODEC_ID_SMPTE_KLV,
1347
+    AV_CODEC_ID_DVD_NAV,
1348
+    AV_CODEC_ID_TIMED_ID3,
1349
+    AV_CODEC_ID_BIN_DATA,
1350
+
1351
+
1352
+    AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
1353
+
1354
+    AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
1355
+                                * stream (only used by libavformat) */
1356
+    AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
1357
+                                * stream (only used by libavformat) */
1358
+    AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
1359
+    AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
1360
+};
1361
+
1362
+/**
1363
+ * This struct describes the properties of a single codec described by an
1364
+ * AVCodecID.
1365
+ * @see avcodec_descriptor_get()
1366
+ */
1367
+typedef struct AVCodecDescriptor {
1368
+    enum AVCodecID     id;
1369
+    enum AVMediaType type;
1370
+    /**
1371
+     * Name of the codec described by this descriptor. It is non-empty and
1372
+     * unique for each codec descriptor. It should contain alphanumeric
1373
+     * characters and '_' only.
1374
+     */
1375
+    const char      *name;
1376
+    /**
1377
+     * A more descriptive name for this codec. May be NULL.
1378
+     */
1379
+    const char *long_name;
1380
+    /**
1381
+     * Codec properties, a combination of AV_CODEC_PROP_* flags.
1382
+     */
1383
+    int             props;
1384
+    /**
1385
+     * MIME type(s) associated with the codec.
1386
+     * May be NULL; if not, a NULL-terminated array of MIME types.
1387
+     * The first item is always non-NULL and is the preferred MIME type.
1388
+     */
1389
+    const char *const *mime_types;
1390
+    /**
1391
+     * If non-NULL, an array of profiles recognized for this codec.
1392
+     * Terminated with FF_PROFILE_UNKNOWN.
1393
+     */
1394
+    const struct AVProfile *profiles;
1395
+} AVCodecDescriptor;
1396
+
1397
+/**
1398
+ * Codec uses only intra compression.
1399
+ * Video and audio codecs only.
1400
+ */
1401
+#define AV_CODEC_PROP_INTRA_ONLY    (1 << 0)
1402
+/**
1403
+ * Codec supports lossy compression. Audio and video codecs only.
1404
+ * @note a codec may support both lossy and lossless
1405
+ * compression modes
1406
+ */
1407
+#define AV_CODEC_PROP_LOSSY         (1 << 1)
1408
+/**
1409
+ * Codec supports lossless compression. Audio and video codecs only.
1410
+ */
1411
+#define AV_CODEC_PROP_LOSSLESS      (1 << 2)
1412
+/**
1413
+ * Codec supports frame reordering. That is, the coded order (the order in which
1414
+ * the encoded packets are output by the encoders / stored / input to the
1415
+ * decoders) may be different from the presentation order of the corresponding
1416
+ * frames.
1417
+ *
1418
+ * For codecs that do not have this property set, PTS and DTS should always be
1419
+ * equal.
1420
+ */
1421
+#define AV_CODEC_PROP_REORDER       (1 << 3)
1422
+/**
1423
+ * Subtitle codec is bitmap based
1424
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
1425
+ */
1426
+#define AV_CODEC_PROP_BITMAP_SUB    (1 << 16)
1427
+/**
1428
+ * Subtitle codec is text based.
1429
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
1430
+ */
1431
+#define AV_CODEC_PROP_TEXT_SUB      (1 << 17)
1432
+
1433
+/**
1434
+ * @ingroup lavc_decoding
1435
+ * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
1436
+ * This is mainly needed because some optimized bitstream readers read
1437
+ * 32 or 64 bit at once and could read over the end.<br>
1438
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged
1439
+ * MPEG bitstreams could cause overread and segfault.
1440
+ */
1441
+#define AV_INPUT_BUFFER_PADDING_SIZE 64
1442
+
1443
+/**
1444
+ * @ingroup lavc_encoding
1445
+ * minimum encoding buffer size
1446
+ * Used to avoid some checks during header writing.
1447
+ */
1448
+#define AV_INPUT_BUFFER_MIN_SIZE 16384
1449
+
1450
+/**
1451
+ * @ingroup lavc_decoding
1452
+ */
1453
+enum AVDiscard{
1454
+    /* We leave some space between them for extensions (drop some
1455
+     * keyframes for intra-only or drop just some bidir frames). */
1456
+    AVDISCARD_NONE    =-16, ///< discard nothing
1457
+    AVDISCARD_DEFAULT =  0, ///< discard useless packets like 0 size packets in avi
1458
+    AVDISCARD_NONREF  =  8, ///< discard all non reference
1459
+    AVDISCARD_BIDIR   = 16, ///< discard all bidirectional frames
1460
+    AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
1461
+    AVDISCARD_NONKEY  = 32, ///< discard all frames except keyframes
1462
+    AVDISCARD_ALL     = 48, ///< discard all
1463
+};
1464
+
1465
+enum AVAudioServiceType {
1466
+    AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
1467
+    AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
1468
+    AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
1469
+    AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
1470
+    AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
1471
+    AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
1472
+    AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
1473
+    AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
1474
+    AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
1475
+    AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
1476
+};
1477
+
1478
+/**
1479
+ * @ingroup lavc_encoding
1480
+ */
1481
+typedef struct RcOverride{
1482
+    int start_frame;
1483
+    int end_frame;
1484
+    int qscale; // If this is 0 then quality_factor will be used instead.
1485
+    float quality_factor;
1486
+} RcOverride;
1487
+
1488
+/* encoding support
1489
+   These flags can be passed in AVCodecContext.flags before initialization.
1490
+   Note: Not everything is supported yet.
1491
+*/
1492
+
1493
+/**
1494
+ * Allow decoders to produce frames with data planes that are not aligned
1495
+ * to CPU requirements (e.g. due to cropping).
1496
+ */
1497
+#define AV_CODEC_FLAG_UNALIGNED       (1 <<  0)
1498
+/**
1499
+ * Use fixed qscale.
1500
+ */
1501
+#define AV_CODEC_FLAG_QSCALE          (1 <<  1)
1502
+/**
1503
+ * 4 MV per MB allowed / advanced prediction for H.263.
1504
+ */
1505
+#define AV_CODEC_FLAG_4MV             (1 <<  2)
1506
+/**
1507
+ * Output even those frames that might be corrupted.
1508
+ */
1509
+#define AV_CODEC_FLAG_OUTPUT_CORRUPT  (1 <<  3)
1510
+/**
1511
+ * Use qpel MC.
1512
+ */
1513
+#define AV_CODEC_FLAG_QPEL            (1 <<  4)
1514
+/**
1515
+ * Use internal 2pass ratecontrol in first pass mode.
1516
+ */
1517
+#define AV_CODEC_FLAG_PASS1           (1 <<  9)
1518
+/**
1519
+ * Use internal 2pass ratecontrol in second pass mode.
1520
+ */
1521
+#define AV_CODEC_FLAG_PASS2           (1 << 10)
1522
+/**
1523
+ * loop filter.
1524
+ */
1525
+#define AV_CODEC_FLAG_LOOP_FILTER     (1 << 11)
1526
+/**
1527
+ * Only decode/encode grayscale.
1528
+ */
1529
+#define AV_CODEC_FLAG_GRAY            (1 << 13)
1530
+/**
1531
+ * error[?] variables will be set during encoding.
1532
+ */
1533
+#define AV_CODEC_FLAG_PSNR            (1 << 15)
1534
+/**
1535
+ * Input bitstream might be truncated at a random location
1536
+ * instead of only at frame boundaries.
1537
+ */
1538
+#define AV_CODEC_FLAG_TRUNCATED       (1 << 16)
1539
+/**
1540
+ * Use interlaced DCT.
1541
+ */
1542
+#define AV_CODEC_FLAG_INTERLACED_DCT  (1 << 18)
1543
+/**
1544
+ * Force low delay.
1545
+ */
1546
+#define AV_CODEC_FLAG_LOW_DELAY       (1 << 19)
1547
+/**
1548
+ * Place global headers in extradata instead of every keyframe.
1549
+ */
1550
+#define AV_CODEC_FLAG_GLOBAL_HEADER   (1 << 22)
1551
+/**
1552
+ * Use only bitexact stuff (except (I)DCT).
1553
+ */
1554
+#define AV_CODEC_FLAG_BITEXACT        (1 << 23)
1555
+/* Fx : Flag for H.263+ extra options */
1556
+/**
1557
+ * H.263 advanced intra coding / MPEG-4 AC prediction
1558
+ */
1559
+#define AV_CODEC_FLAG_AC_PRED         (1 << 24)
1560
+/**
1561
+ * interlaced motion estimation
1562
+ */
1563
+#define AV_CODEC_FLAG_INTERLACED_ME   (1 << 29)
1564
+#define AV_CODEC_FLAG_CLOSED_GOP      (1U << 31)
1565
+
1566
+/**
1567
+ * Allow non spec compliant speedup tricks.
1568
+ */
1569
+#define AV_CODEC_FLAG2_FAST           (1 <<  0)
1570
+/**
1571
+ * Skip bitstream encoding.
1572
+ */
1573
+#define AV_CODEC_FLAG2_NO_OUTPUT      (1 <<  2)
1574
+/**
1575
+ * Place global headers at every keyframe instead of in extradata.
1576
+ */
1577
+#define AV_CODEC_FLAG2_LOCAL_HEADER   (1 <<  3)
1578
+
1579
+/**
1580
+ * timecode is in drop frame format. DEPRECATED!!!!
1581
+ */
1582
+#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
1583
+
1584
+/**
1585
+ * Input bitstream might be truncated at a packet boundaries
1586
+ * instead of only at frame boundaries.
1587
+ */
1588
+#define AV_CODEC_FLAG2_CHUNKS         (1 << 15)
1589
+/**
1590
+ * Discard cropping information from SPS.
1591
+ */
1592
+#define AV_CODEC_FLAG2_IGNORE_CROP    (1 << 16)
1593
+
1594
+/**
1595
+ * Show all frames before the first keyframe
1596
+ */
1597
+#define AV_CODEC_FLAG2_SHOW_ALL       (1 << 22)
1598
+/**
1599
+ * Export motion vectors through frame side data
1600
+ */
1601
+#define AV_CODEC_FLAG2_EXPORT_MVS     (1 << 28)
1602
+/**
1603
+ * Do not skip samples and export skip information as frame side data
1604
+ */
1605
+#define AV_CODEC_FLAG2_SKIP_MANUAL    (1 << 29)
1606
+/**
1607
+ * Do not reset ASS ReadOrder field on flush (subtitles decoding)
1608
+ */
1609
+#define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
1610
+
1611
+/* Unsupported options :
1612
+ *              Syntax Arithmetic coding (SAC)
1613
+ *              Reference Picture Selection
1614
+ *              Independent Segment Decoding */
1615
+/* /Fx */
1616
+/* codec capabilities */
1617
+
1618
+/**
1619
+ * Decoder can use draw_horiz_band callback.
1620
+ */
1621
+#define AV_CODEC_CAP_DRAW_HORIZ_BAND     (1 <<  0)
1622
+/**
1623
+ * Codec uses get_buffer() for allocating buffers and supports custom allocators.
1624
+ * If not set, it might not use get_buffer() at all or use operations that
1625
+ * assume the buffer was allocated by avcodec_default_get_buffer.
1626
+ */
1627
+#define AV_CODEC_CAP_DR1                 (1 <<  1)
1628
+#define AV_CODEC_CAP_TRUNCATED           (1 <<  3)
1629
+/**
1630
+ * Encoder or decoder requires flushing with NULL input at the end in order to
1631
+ * give the complete and correct output.
1632
+ *
1633
+ * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
1634
+ *       with NULL data. The user can still send NULL data to the public encode
1635
+ *       or decode function, but libavcodec will not pass it along to the codec
1636
+ *       unless this flag is set.
1637
+ *
1638
+ * Decoders:
1639
+ * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
1640
+ * avpkt->size=0 at the end to get the delayed data until the decoder no longer
1641
+ * returns frames.
1642
+ *
1643
+ * Encoders:
1644
+ * The encoder needs to be fed with NULL data at the end of encoding until the
1645
+ * encoder no longer returns data.
1646
+ *
1647
+ * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
1648
+ *       flag also means that the encoder must set the pts and duration for
1649
+ *       each output packet. If this flag is not set, the pts and duration will
1650
+ *       be determined by libavcodec from the input frame.
1651
+ */
1652
+#define AV_CODEC_CAP_DELAY               (1 <<  5)
1653
+/**
1654
+ * Codec can be fed a final frame with a smaller size.
1655
+ * This can be used to prevent truncation of the last audio samples.
1656
+ */
1657
+#define AV_CODEC_CAP_SMALL_LAST_FRAME    (1 <<  6)
1658
+
1659
+/**
1660
+ * Codec can output multiple frames per AVPacket
1661
+ * Normally demuxers return one frame at a time, demuxers which do not do
1662
+ * are connected to a parser to split what they return into proper frames.
1663
+ * This flag is reserved to the very rare category of codecs which have a
1664
+ * bitstream that cannot be split into frames without timeconsuming
1665
+ * operations like full decoding. Demuxers carrying such bitstreams thus
1666
+ * may return multiple frames in a packet. This has many disadvantages like
1667
+ * prohibiting stream copy in many cases thus it should only be considered
1668
+ * as a last resort.
1669
+ */
1670
+#define AV_CODEC_CAP_SUBFRAMES           (1 <<  8)
1671
+/**
1672
+ * Codec is experimental and is thus avoided in favor of non experimental
1673
+ * encoders
1674
+ */
1675
+#define AV_CODEC_CAP_EXPERIMENTAL        (1 <<  9)
1676
+/**
1677
+ * Codec should fill in channel configuration and samplerate instead of container
1678
+ */
1679
+#define AV_CODEC_CAP_CHANNEL_CONF        (1 << 10)
1680
+/**
1681
+ * Codec supports frame-level multithreading.
1682
+ */
1683
+#define AV_CODEC_CAP_FRAME_THREADS       (1 << 12)
1684
+/**
1685
+ * Codec supports slice-based (or partition-based) multithreading.
1686
+ */
1687
+#define AV_CODEC_CAP_SLICE_THREADS       (1 << 13)
1688
+/**
1689
+ * Codec supports changed parameters at any point.
1690
+ */
1691
+#define AV_CODEC_CAP_PARAM_CHANGE        (1 << 14)
1692
+/**
1693
+ * Codec supports avctx->thread_count == 0 (auto).
1694
+ */
1695
+#define AV_CODEC_CAP_AUTO_THREADS        (1 << 15)
1696
+/**
1697
+ * Audio encoder supports receiving a different number of samples in each call.
1698
+ */
1699
+#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
1700
+/**
1701
+ * Decoder is not a preferred choice for probing.
1702
+ * This indicates that the decoder is not a good choice for probing.
1703
+ * It could for example be an expensive to spin up hardware decoder,
1704
+ * or it could simply not provide a lot of useful information about
1705
+ * the stream.
1706
+ * A decoder marked with this flag should only be used as last resort
1707
+ * choice for probing.
1708
+ */
1709
+#define AV_CODEC_CAP_AVOID_PROBING       (1 << 17)
1710
+/**
1711
+ * Codec is intra only.
1712
+ */
1713
+#define AV_CODEC_CAP_INTRA_ONLY       0x40000000
1714
+/**
1715
+ * Codec is lossless.
1716
+ */
1717
+#define AV_CODEC_CAP_LOSSLESS         0x80000000
1718
+
1719
+/**
1720
+ * Codec is backed by a hardware implementation. Typically used to
1721
+ * identify a non-hwaccel hardware decoder. For information about hwaccels, use
1722
+ * avcodec_get_hw_config() instead.
1723
+ */
1724
+#define AV_CODEC_CAP_HARDWARE            (1 << 18)
1725
+
1726
+/**
1727
+ * Codec is potentially backed by a hardware implementation, but not
1728
+ * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
1729
+ * implementation provides some sort of internal fallback.
1730
+ */
1731
+#define AV_CODEC_CAP_HYBRID              (1 << 19)
1732
+
1733
+/**
1734
+ * Pan Scan area.
1735
+ * This specifies the area which should be displayed.
1736
+ * Note there may be multiple such areas for one frame.
1737
+ */
1738
+typedef struct AVPanScan {
1739
+    /**
1740
+     * id
1741
+     * - encoding: Set by user.
1742
+     * - decoding: Set by libavcodec.
1743
+     */
1744
+    int id;
1745
+
1746
+    /**
1747
+     * width and height in 1/16 pel
1748
+     * - encoding: Set by user.
1749
+     * - decoding: Set by libavcodec.
1750
+     */
1751
+    int width;
1752
+    int height;
1753
+
1754
+    /**
1755
+     * position of the top left corner in 1/16 pel for up to 3 fields/frames
1756
+     * - encoding: Set by user.
1757
+     * - decoding: Set by libavcodec.
1758
+     */
1759
+    int16_t position[3][2];
1760
+} AVPanScan;
1761
+
1762
+/**
1763
+ * This structure describes the bitrate properties of an encoded bitstream. It
1764
+ * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
1765
+ * parameters for H.264/HEVC.
1766
+ */
1767
+typedef struct AVCPBProperties {
1768
+    /**
1769
+     * Maximum bitrate of the stream, in bits per second.
1770
+     * Zero if unknown or unspecified.
1771
+     */
1772
+    int max_bitrate;
1773
+    /**
1774
+     * Minimum bitrate of the stream, in bits per second.
1775
+     * Zero if unknown or unspecified.
1776
+     */
1777
+    int min_bitrate;
1778
+    /**
1779
+     * Average bitrate of the stream, in bits per second.
1780
+     * Zero if unknown or unspecified.
1781
+     */
1782
+    int avg_bitrate;
1783
+
1784
+    /**
1785
+     * The size of the buffer to which the ratecontrol is applied, in bits.
1786
+     * Zero if unknown or unspecified.
1787
+     */
1788
+    int buffer_size;
1789
+
1790
+    /**
1791
+     * The delay between the time the packet this structure is associated with
1792
+     * is received and the time when it should be decoded, in periods of a 27MHz
1793
+     * clock.
1794
+     *
1795
+     * UINT64_MAX when unknown or unspecified.
1796
+     */
1797
+    uint64_t vbv_delay;
1798
+} AVCPBProperties;
1799
+
1800
+/**
1801
+ * The decoder will keep a reference to the frame and may reuse it later.
1802
+ */
1803
+#define AV_GET_BUFFER_FLAG_REF (1 << 0)
1804
+
1805
+/**
1806
+ * @defgroup lavc_packet AVPacket
1807
+ *
1808
+ * Types and functions for working with AVPacket.
1809
+ * @{
1810
+ */
1811
+enum AVPacketSideDataType {
1812
+    /**
1813
+     * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
1814
+     * bytes worth of palette. This side data signals that a new palette is
1815
+     * present.
1816
+     */
1817
+    AV_PKT_DATA_PALETTE,
1818
+
1819
+    /**
1820
+     * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
1821
+     * that the extradata buffer was changed and the receiving side should
1822
+     * act upon it appropriately. The new extradata is embedded in the side
1823
+     * data buffer and should be immediately used for processing the current
1824
+     * frame or packet.
1825
+     */
1826
+    AV_PKT_DATA_NEW_EXTRADATA,
1827
+
1828
+    /**
1829
+     * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
1830
+     * @code
1831
+     * u32le param_flags
1832
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
1833
+     *     s32le channel_count
1834
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
1835
+     *     u64le channel_layout
1836
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
1837
+     *     s32le sample_rate
1838
+     * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
1839
+     *     s32le width
1840
+     *     s32le height
1841
+     * @endcode
1842
+     */
1843
+    AV_PKT_DATA_PARAM_CHANGE,
1844
+
1845
+    /**
1846
+     * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
1847
+     * structures with info about macroblocks relevant to splitting the
1848
+     * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
1849
+     * That is, it does not necessarily contain info about all macroblocks,
1850
+     * as long as the distance between macroblocks in the info is smaller
1851
+     * than the target payload size.
1852
+     * Each MB info structure is 12 bytes, and is laid out as follows:
1853
+     * @code
1854
+     * u32le bit offset from the start of the packet
1855
+     * u8    current quantizer at the start of the macroblock
1856
+     * u8    GOB number
1857
+     * u16le macroblock address within the GOB
1858
+     * u8    horizontal MV predictor
1859
+     * u8    vertical MV predictor
1860
+     * u8    horizontal MV predictor for block number 3
1861
+     * u8    vertical MV predictor for block number 3
1862
+     * @endcode
1863
+     */
1864
+    AV_PKT_DATA_H263_MB_INFO,
1865
+
1866
+    /**
1867
+     * This side data should be associated with an audio stream and contains
1868
+     * ReplayGain information in form of the AVReplayGain struct.
1869
+     */
1870
+    AV_PKT_DATA_REPLAYGAIN,
1871
+
1872
+    /**
1873
+     * This side data contains a 3x3 transformation matrix describing an affine
1874
+     * transformation that needs to be applied to the decoded video frames for
1875
+     * correct presentation.
1876
+     *
1877
+     * See libavutil/display.h for a detailed description of the data.
1878
+     */
1879
+    AV_PKT_DATA_DISPLAYMATRIX,
1880
+
1881
+    /**
1882
+     * This side data should be associated with a video stream and contains
1883
+     * Stereoscopic 3D information in form of the AVStereo3D struct.
1884
+     */
1885
+    AV_PKT_DATA_STEREO3D,
1886
+
1887
+    /**
1888
+     * This side data should be associated with an audio stream and corresponds
1889
+     * to enum AVAudioServiceType.
1890
+     */
1891
+    AV_PKT_DATA_AUDIO_SERVICE_TYPE,
1892
+
1893
+    /**
1894
+     * This side data contains quality related information from the encoder.
1895
+     * @code
1896
+     * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
1897
+     * u8    picture type
1898
+     * u8    error count
1899
+     * u16   reserved
1900
+     * u64le[error count] sum of squared differences between encoder in and output
1901
+     * @endcode
1902
+     */
1903
+    AV_PKT_DATA_QUALITY_STATS,
1904
+
1905
+    /**
1906
+     * This side data contains an integer value representing the stream index
1907
+     * of a "fallback" track.  A fallback track indicates an alternate
1908
+     * track to use when the current track can not be decoded for some reason.
1909
+     * e.g. no decoder available for codec.
1910
+     */
1911
+    AV_PKT_DATA_FALLBACK_TRACK,
1912
+
1913
+    /**
1914
+     * This side data corresponds to the AVCPBProperties struct.
1915
+     */
1916
+    AV_PKT_DATA_CPB_PROPERTIES,
1917
+
1918
+    /**
1919
+     * Recommmends skipping the specified number of samples
1920
+     * @code
1921
+     * u32le number of samples to skip from start of this packet
1922
+     * u32le number of samples to skip from end of this packet
1923
+     * u8    reason for start skip
1924
+     * u8    reason for end   skip (0=padding silence, 1=convergence)
1925
+     * @endcode
1926
+     */
1927
+    AV_PKT_DATA_SKIP_SAMPLES,
1928
+
1929
+    /**
1930
+     * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
1931
+     * the packet may contain "dual mono" audio specific to Japanese DTV
1932
+     * and if it is true, recommends only the selected channel to be used.
1933
+     * @code
1934
+     * u8    selected channels (0=mail/left, 1=sub/right, 2=both)
1935
+     * @endcode
1936
+     */
1937
+    AV_PKT_DATA_JP_DUALMONO,
1938
+
1939
+    /**
1940
+     * A list of zero terminated key/value strings. There is no end marker for
1941
+     * the list, so it is required to rely on the side data size to stop.
1942
+     */
1943
+    AV_PKT_DATA_STRINGS_METADATA,
1944
+
1945
+    /**
1946
+     * Subtitle event position
1947
+     * @code
1948
+     * u32le x1
1949
+     * u32le y1
1950
+     * u32le x2
1951
+     * u32le y2
1952
+     * @endcode
1953
+     */
1954
+    AV_PKT_DATA_SUBTITLE_POSITION,
1955
+
1956
+    /**
1957
+     * Data found in BlockAdditional element of matroska container. There is
1958
+     * no end marker for the data, so it is required to rely on the side data
1959
+     * size to recognize the end. 8 byte id (as found in BlockAddId) followed
1960
+     * by data.
1961
+     */
1962
+    AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
1963
+
1964
+    /**
1965
+     * The optional first identifier line of a WebVTT cue.
1966
+     */
1967
+    AV_PKT_DATA_WEBVTT_IDENTIFIER,
1968
+
1969
+    /**
1970
+     * The optional settings (rendering instructions) that immediately
1971
+     * follow the timestamp specifier of a WebVTT cue.
1972
+     */
1973
+    AV_PKT_DATA_WEBVTT_SETTINGS,
1974
+
1975
+    /**
1976
+     * A list of zero terminated key/value strings. There is no end marker for
1977
+     * the list, so it is required to rely on the side data size to stop. This
1978
+     * side data includes updated metadata which appeared in the stream.
1979
+     */
1980
+    AV_PKT_DATA_METADATA_UPDATE,
1981
+
1982
+    /**
1983
+     * MPEGTS stream ID, this is required to pass the stream ID
1984
+     * information from the demuxer to the corresponding muxer.
1985
+     */
1986
+    AV_PKT_DATA_MPEGTS_STREAM_ID,
1987
+
1988
+    /**
1989
+     * Mastering display metadata (based on SMPTE-2086:2014). This metadata
1990
+     * should be associated with a video stream and contains data in the form
1991
+     * of the AVMasteringDisplayMetadata struct.
1992
+     */
1993
+    AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
1994
+
1995
+    /**
1996
+     * This side data should be associated with a video stream and corresponds
1997
+     * to the AVSphericalMapping structure.
1998
+     */
1999
+    AV_PKT_DATA_SPHERICAL,
2000
+
2001
+    /**
2002
+     * Content light level (based on CTA-861.3). This metadata should be
2003
+     * associated with a video stream and contains data in the form of the
2004
+     * AVContentLightMetadata struct.
2005
+     */
2006
+    AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
2007
+
2008
+    /**
2009
+     * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
2010
+     * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
2011
+     * The number of bytes of CC data is AVPacketSideData.size.
2012
+     */
2013
+    AV_PKT_DATA_A53_CC,
2014
+
2015
+    /**
2016
+     * This side data is encryption initialization data.
2017
+     * The format is not part of ABI, use av_encryption_init_info_* methods to
2018
+     * access.
2019
+     */
2020
+    AV_PKT_DATA_ENCRYPTION_INIT_INFO,
2021
+
2022
+    /**
2023
+     * This side data contains encryption info for how to decrypt the packet.
2024
+     * The format is not part of ABI, use av_encryption_info_* methods to access.
2025
+     */
2026
+    AV_PKT_DATA_ENCRYPTION_INFO,
2027
+
2028
+    /**
2029
+     * The number of side data types.
2030
+     * This is not part of the public API/ABI in the sense that it may
2031
+     * change when new side data types are added.
2032
+     * This must stay the last enum value.
2033
+     * If its value becomes huge, some code using it
2034
+     * needs to be updated as it assumes it to be smaller than other limits.
2035
+     */
2036
+    AV_PKT_DATA_NB
2037
+};
2038
+
2039
+#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
2040
+
2041
+typedef struct AVPacketSideData {
2042
+    uint8_t *data;
2043
+    int      size;
2044
+    enum AVPacketSideDataType type;
2045
+} AVPacketSideData;
2046
+
2047
+/**
2048
+ * This structure stores compressed data. It is typically exported by demuxers
2049
+ * and then passed as input to decoders, or received as output from encoders and
2050
+ * then passed to muxers.
2051
+ *
2052
+ * For video, it should typically contain one compressed frame. For audio it may
2053
+ * contain several compressed frames. Encoders are allowed to output empty
2054
+ * packets, with no compressed data, containing only side data
2055
+ * (e.g. to update some stream parameters at the end of encoding).
2056
+ *
2057
+ * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
2058
+ * ABI. Thus it may be allocated on stack and no new fields can be added to it
2059
+ * without libavcodec and libavformat major bump.
2060
+ *
2061
+ * The semantics of data ownership depends on the buf field.
2062
+ * If it is set, the packet data is dynamically allocated and is
2063
+ * valid indefinitely until a call to av_packet_unref() reduces the
2064
+ * reference count to 0.
2065
+ *
2066
+ * If the buf field is not set av_packet_ref() would make a copy instead
2067
+ * of increasing the reference count.
2068
+ *
2069
+ * The side data is always allocated with av_malloc(), copied by
2070
+ * av_packet_ref() and freed by av_packet_unref().
2071
+ *
2072
+ * @see av_packet_ref
2073
+ * @see av_packet_unref
2074
+ */
2075
+typedef struct AVPacket {
2076
+    /**
2077
+     * A reference to the reference-counted buffer where the packet data is
2078
+     * stored.
2079
+     * May be NULL, then the packet data is not reference-counted.
2080
+     */
2081
+    AVBufferRef *buf;
2082
+    /**
2083
+     * Presentation timestamp in AVStream->time_base units; the time at which
2084
+     * the decompressed packet will be presented to the user.
2085
+     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2086
+     * pts MUST be larger or equal to dts as presentation cannot happen before
2087
+     * decompression, unless one wants to view hex dumps. Some formats misuse
2088
+     * the terms dts and pts/cts to mean something different. Such timestamps
2089
+     * must be converted to true pts/dts before they are stored in AVPacket.
2090
+     */
2091
+    int64_t pts;
2092
+    /**
2093
+     * Decompression timestamp in AVStream->time_base units; the time at which
2094
+     * the packet is decompressed.
2095
+     * Can be AV_NOPTS_VALUE if it is not stored in the file.
2096
+     */
2097
+    int64_t dts;
2098
+    uint8_t *data;
2099
+    int   size;
2100
+    int   stream_index;
2101
+    /**
2102
+     * A combination of AV_PKT_FLAG values
2103
+     */
2104
+    int   flags;
2105
+    /**
2106
+     * Additional packet data that can be provided by the container.
2107
+     * Packet can contain several types of side information.
2108
+     */
2109
+    AVPacketSideData *side_data;
2110
+    int side_data_elems;
2111
+
2112
+    /**
2113
+     * Duration of this packet in AVStream->time_base units, 0 if unknown.
2114
+     * Equals next_pts - this_pts in presentation order.
2115
+     */
2116
+    int64_t duration;
2117
+
2118
+    int64_t pos;                            ///< byte position in stream, -1 if unknown
2119
+
2120
+#if FF_API_CONVERGENCE_DURATION
2121
+    /**
2122
+     * @deprecated Same as the duration field, but as int64_t. This was required
2123
+     * for Matroska subtitles, whose duration values could overflow when the
2124
+     * duration field was still an int.
2125
+     */
2126
+    attribute_deprecated
2127
+    int64_t convergence_duration;
2128
+#endif
2129
+} AVPacket;
2130
+#define AV_PKT_FLAG_KEY     0x0001 ///< The packet contains a keyframe
2131
+#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
2132
+/**
2133
+ * Flag is used to discard packets which are required to maintain valid
2134
+ * decoder state but are not required for output and should be dropped
2135
+ * after decoding.
2136
+ **/
2137
+#define AV_PKT_FLAG_DISCARD   0x0004
2138
+/**
2139
+ * The packet comes from a trusted source.
2140
+ *
2141
+ * Otherwise-unsafe constructs such as arbitrary pointers to data
2142
+ * outside the packet may be followed.
2143
+ */
2144
+#define AV_PKT_FLAG_TRUSTED   0x0008
2145
+/**
2146
+ * Flag is used to indicate packets that contain frames that can
2147
+ * be discarded by the decoder.  I.e. Non-reference frames.
2148
+ */
2149
+#define AV_PKT_FLAG_DISPOSABLE 0x0010
2150
+
2151
+
2152
+enum AVSideDataParamChangeFlags {
2153
+    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
2154
+    AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
2155
+    AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
2156
+    AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
2157
+};
2158
+/**
2159
+ * @}
2160
+ */
2161
+
2162
+struct AVCodecInternal;
2163
+
2164
+enum AVFieldOrder {
2165
+    AV_FIELD_UNKNOWN,
2166
+    AV_FIELD_PROGRESSIVE,
2167
+    AV_FIELD_TT,          //< Top coded_first, top displayed first
2168
+    AV_FIELD_BB,          //< Bottom coded first, bottom displayed first
2169
+    AV_FIELD_TB,          //< Top coded first, bottom displayed first
2170
+    AV_FIELD_BT,          //< Bottom coded first, top displayed first
2171
+};
2172
+
2173
+/**
2174
+ * main external API structure.
2175
+ * New fields can be added to the end with minor version bumps.
2176
+ * Removal, reordering and changes to existing fields require a major
2177
+ * version bump.
2178
+ * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
2179
+ * applications.
2180
+ * The name string for AVOptions options matches the associated command line
2181
+ * parameter name and can be found in libavcodec/options_table.h
2182
+ * The AVOption/command line parameter names differ in some cases from the C
2183
+ * structure field names for historic reasons or brevity.
2184
+ * sizeof(AVCodecContext) must not be used outside libav*.
2185
+ */
2186
+typedef struct AVCodecContext {
2187
+    /**
2188
+     * information on struct for av_log
2189
+     * - set by avcodec_alloc_context3
2190
+     */
2191
+    const AVClass *av_class;
2192
+    int log_level_offset;
2193
+
2194
+    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
2195
+    const struct AVCodec  *codec;
2196
+    enum AVCodecID     codec_id; /* see AV_CODEC_ID_xxx */
2197
+
2198
+    /**
2199
+     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
2200
+     * This is used to work around some encoder bugs.
2201
+     * A demuxer should set this to what is stored in the field used to identify the codec.
2202
+     * If there are multiple such fields in a container then the demuxer should choose the one
2203
+     * which maximizes the information about the used codec.
2204
+     * If the codec tag field in a container is larger than 32 bits then the demuxer should
2205
+     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
2206
+     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
2207
+     * first.
2208
+     * - encoding: Set by user, if not then the default based on codec_id will be used.
2209
+     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
2210
+     */
2211
+    unsigned int codec_tag;
2212
+
2213
+    void *priv_data;
2214
+
2215
+    /**
2216
+     * Private context used for internal data.
2217
+     *
2218
+     * Unlike priv_data, this is not codec-specific. It is used in general
2219
+     * libavcodec functions.
2220
+     */
2221
+    struct AVCodecInternal *internal;
2222
+
2223
+    /**
2224
+     * Private data of the user, can be used to carry app specific stuff.
2225
+     * - encoding: Set by user.
2226
+     * - decoding: Set by user.
2227
+     */
2228
+    void *opaque;
2229
+
2230
+    /**
2231
+     * the average bitrate
2232
+     * - encoding: Set by user; unused for constant quantizer encoding.
2233
+     * - decoding: Set by user, may be overwritten by libavcodec
2234
+     *             if this info is available in the stream
2235
+     */
2236
+    int64_t bit_rate;
2237
+
2238
+    /**
2239
+     * number of bits the bitstream is allowed to diverge from the reference.
2240
+     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
2241
+     * - encoding: Set by user; unused for constant quantizer encoding.
2242
+     * - decoding: unused
2243
+     */
2244
+    int bit_rate_tolerance;
2245
+
2246
+    /**
2247
+     * Global quality for codecs which cannot change it per frame.
2248
+     * This should be proportional to MPEG-1/2/4 qscale.
2249
+     * - encoding: Set by user.
2250
+     * - decoding: unused
2251
+     */
2252
+    int global_quality;
2253
+
2254
+    /**
2255
+     * - encoding: Set by user.
2256
+     * - decoding: unused
2257
+     */
2258
+    int compression_level;
2259
+#define FF_COMPRESSION_DEFAULT -1
2260
+
2261
+    /**
2262
+     * AV_CODEC_FLAG_*.
2263
+     * - encoding: Set by user.
2264
+     * - decoding: Set by user.
2265
+     */
2266
+    int flags;
2267
+
2268
+    /**
2269
+     * AV_CODEC_FLAG2_*
2270
+     * - encoding: Set by user.
2271
+     * - decoding: Set by user.
2272
+     */
2273
+    int flags2;
2274
+
2275
+    /**
2276
+     * some codecs need / can use extradata like Huffman tables.
2277
+     * MJPEG: Huffman tables
2278
+     * rv10: additional flags
2279
+     * MPEG-4: global headers (they can be in the bitstream or here)
2280
+     * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
2281
+     * than extradata_size to avoid problems if it is read with the bitstream reader.
2282
+     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
2283
+     * - encoding: Set/allocated/freed by libavcodec.
2284
+     * - decoding: Set/allocated/freed by user.
2285
+     */
2286
+    uint8_t *extradata;
2287
+    int extradata_size;
2288
+
2289
+    /**
2290
+     * This is the fundamental unit of time (in seconds) in terms
2291
+     * of which frame timestamps are represented. For fixed-fps content,
2292
+     * timebase should be 1/framerate and timestamp increments should be
2293
+     * identically 1.
2294
+     * This often, but not always is the inverse of the frame rate or field rate
2295
+     * for video. 1/time_base is not the average frame rate if the frame rate is not
2296
+     * constant.
2297
+     *
2298
+     * Like containers, elementary streams also can store timestamps, 1/time_base
2299
+     * is the unit in which these timestamps are specified.
2300
+     * As example of such codec time base see ISO/IEC 14496-2:2001(E)
2301
+     * vop_time_increment_resolution and fixed_vop_rate
2302
+     * (fixed_vop_rate == 0 implies that it is different from the framerate)
2303
+     *
2304
+     * - encoding: MUST be set by user.
2305
+     * - decoding: the use of this field for decoding is deprecated.
2306
+     *             Use framerate instead.
2307
+     */
2308
+    AVRational time_base;
2309
+
2310
+    /**
2311
+     * For some codecs, the time base is closer to the field rate than the frame rate.
2312
+     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
2313
+     * if no telecine is used ...
2314
+     *
2315
+     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2316
+     */
2317
+    int ticks_per_frame;
2318
+
2319
+    /**
2320
+     * Codec delay.
2321
+     *
2322
+     * Encoding: Number of frames delay there will be from the encoder input to
2323
+     *           the decoder output. (we assume the decoder matches the spec)
2324
+     * Decoding: Number of frames delay in addition to what a standard decoder
2325
+     *           as specified in the spec would produce.
2326
+     *
2327
+     * Video:
2328
+     *   Number of frames the decoded output will be delayed relative to the
2329
+     *   encoded input.
2330
+     *
2331
+     * Audio:
2332
+     *   For encoding, this field is unused (see initial_padding).
2333
+     *
2334
+     *   For decoding, this is the number of samples the decoder needs to
2335
+     *   output before the decoder's output is valid. When seeking, you should
2336
+     *   start decoding this many samples prior to your desired seek point.
2337
+     *
2338
+     * - encoding: Set by libavcodec.
2339
+     * - decoding: Set by libavcodec.
2340
+     */
2341
+    int delay;
2342
+
2343
+
2344
+    /* video only */
2345
+    /**
2346
+     * picture width / height.
2347
+     *
2348
+     * @note Those fields may not match the values of the last
2349
+     * AVFrame output by avcodec_decode_video2 due frame
2350
+     * reordering.
2351
+     *
2352
+     * - encoding: MUST be set by user.
2353
+     * - decoding: May be set by the user before opening the decoder if known e.g.
2354
+     *             from the container. Some decoders will require the dimensions
2355
+     *             to be set by the caller. During decoding, the decoder may
2356
+     *             overwrite those values as required while parsing the data.
2357
+     */
2358
+    int width, height;
2359
+
2360
+    /**
2361
+     * Bitstream width / height, may be different from width/height e.g. when
2362
+     * the decoded frame is cropped before being output or lowres is enabled.
2363
+     *
2364
+     * @note Those field may not match the value of the last
2365
+     * AVFrame output by avcodec_receive_frame() due frame
2366
+     * reordering.
2367
+     *
2368
+     * - encoding: unused
2369
+     * - decoding: May be set by the user before opening the decoder if known
2370
+     *             e.g. from the container. During decoding, the decoder may
2371
+     *             overwrite those values as required while parsing the data.
2372
+     */
2373
+    int coded_width, coded_height;
2374
+
2375
+    /**
2376
+     * the number of pictures in a group of pictures, or 0 for intra_only
2377
+     * - encoding: Set by user.
2378
+     * - decoding: unused
2379
+     */
2380
+    int gop_size;
2381
+
2382
+    /**
2383
+     * Pixel format, see AV_PIX_FMT_xxx.
2384
+     * May be set by the demuxer if known from headers.
2385
+     * May be overridden by the decoder if it knows better.
2386
+     *
2387
+     * @note This field may not match the value of the last
2388
+     * AVFrame output by avcodec_receive_frame() due frame
2389
+     * reordering.
2390
+     *
2391
+     * - encoding: Set by user.
2392
+     * - decoding: Set by user if known, overridden by libavcodec while
2393
+     *             parsing the data.
2394
+     */
2395
+    enum AVPixelFormat pix_fmt;
2396
+
2397
+    /**
2398
+     * If non NULL, 'draw_horiz_band' is called by the libavcodec
2399
+     * decoder to draw a horizontal band. It improves cache usage. Not
2400
+     * all codecs can do that. You must check the codec capabilities
2401
+     * beforehand.
2402
+     * When multithreading is used, it may be called from multiple threads
2403
+     * at the same time; threads might draw different parts of the same AVFrame,
2404
+     * or multiple AVFrames, and there is no guarantee that slices will be drawn
2405
+     * in order.
2406
+     * The function is also used by hardware acceleration APIs.
2407
+     * It is called at least once during frame decoding to pass
2408
+     * the data needed for hardware render.
2409
+     * In that mode instead of pixel data, AVFrame points to
2410
+     * a structure specific to the acceleration API. The application
2411
+     * reads the structure and can change some fields to indicate progress
2412
+     * or mark state.
2413
+     * - encoding: unused
2414
+     * - decoding: Set by user.
2415
+     * @param height the height of the slice
2416
+     * @param y the y position of the slice
2417
+     * @param type 1->top field, 2->bottom field, 3->frame
2418
+     * @param offset offset into the AVFrame.data from which the slice should be read
2419
+     */
2420
+    void (*draw_horiz_band)(struct AVCodecContext *s,
2421
+                            const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
2422
+                            int y, int type, int height);
2423
+
2424
+    /**
2425
+     * callback to negotiate the pixelFormat
2426
+     * @param fmt is the list of formats which are supported by the codec,
2427
+     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
2428
+     * The first is always the native one.
2429
+     * @note The callback may be called again immediately if initialization for
2430
+     * the selected (hardware-accelerated) pixel format failed.
2431
+     * @warning Behavior is undefined if the callback returns a value not
2432
+     * in the fmt list of formats.
2433
+     * @return the chosen format
2434
+     * - encoding: unused
2435
+     * - decoding: Set by user, if not set the native format will be chosen.
2436
+     */
2437
+    enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
2438
+
2439
+    /**
2440
+     * maximum number of B-frames between non-B-frames
2441
+     * Note: The output will be delayed by max_b_frames+1 relative to the input.
2442
+     * - encoding: Set by user.
2443
+     * - decoding: unused
2444
+     */
2445
+    int max_b_frames;
2446
+
2447
+    /**
2448
+     * qscale factor between IP and B-frames
2449
+     * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
2450
+     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2451
+     * - encoding: Set by user.
2452
+     * - decoding: unused
2453
+     */
2454
+    float b_quant_factor;
2455
+
2456
+#if FF_API_PRIVATE_OPT
2457
+    /** @deprecated use encoder private options instead */
2458
+    attribute_deprecated
2459
+    int b_frame_strategy;
2460
+#endif
2461
+
2462
+    /**
2463
+     * qscale offset between IP and B-frames
2464
+     * - encoding: Set by user.
2465
+     * - decoding: unused
2466
+     */
2467
+    float b_quant_offset;
2468
+
2469
+    /**
2470
+     * Size of the frame reordering buffer in the decoder.
2471
+     * For MPEG-2 it is 1 IPB or 0 low delay IP.
2472
+     * - encoding: Set by libavcodec.
2473
+     * - decoding: Set by libavcodec.
2474
+     */
2475
+    int has_b_frames;
2476
+
2477
+#if FF_API_PRIVATE_OPT
2478
+    /** @deprecated use encoder private options instead */
2479
+    attribute_deprecated
2480
+    int mpeg_quant;
2481
+#endif
2482
+
2483
+    /**
2484
+     * qscale factor between P- and I-frames
2485
+     * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
2486
+     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
2487
+     * - encoding: Set by user.
2488
+     * - decoding: unused
2489
+     */
2490
+    float i_quant_factor;
2491
+
2492
+    /**
2493
+     * qscale offset between P and I-frames
2494
+     * - encoding: Set by user.
2495
+     * - decoding: unused
2496
+     */
2497
+    float i_quant_offset;
2498
+
2499
+    /**
2500
+     * luminance masking (0-> disabled)
2501
+     * - encoding: Set by user.
2502
+     * - decoding: unused
2503
+     */
2504
+    float lumi_masking;
2505
+
2506
+    /**
2507
+     * temporary complexity masking (0-> disabled)
2508
+     * - encoding: Set by user.
2509
+     * - decoding: unused
2510
+     */
2511
+    float temporal_cplx_masking;
2512
+
2513
+    /**
2514
+     * spatial complexity masking (0-> disabled)
2515
+     * - encoding: Set by user.
2516
+     * - decoding: unused
2517
+     */
2518
+    float spatial_cplx_masking;
2519
+
2520
+    /**
2521
+     * p block masking (0-> disabled)
2522
+     * - encoding: Set by user.
2523
+     * - decoding: unused
2524
+     */
2525
+    float p_masking;
2526
+
2527
+    /**
2528
+     * darkness masking (0-> disabled)
2529
+     * - encoding: Set by user.
2530
+     * - decoding: unused
2531
+     */
2532
+    float dark_masking;
2533
+
2534
+    /**
2535
+     * slice count
2536
+     * - encoding: Set by libavcodec.
2537
+     * - decoding: Set by user (or 0).
2538
+     */
2539
+    int slice_count;
2540
+
2541
+#if FF_API_PRIVATE_OPT
2542
+    /** @deprecated use encoder private options instead */
2543
+    attribute_deprecated
2544
+     int prediction_method;
2545
+#define FF_PRED_LEFT   0
2546
+#define FF_PRED_PLANE  1
2547
+#define FF_PRED_MEDIAN 2
2548
+#endif
2549
+
2550
+    /**
2551
+     * slice offsets in the frame in bytes
2552
+     * - encoding: Set/allocated by libavcodec.
2553
+     * - decoding: Set/allocated by user (or NULL).
2554
+     */
2555
+    int *slice_offset;
2556
+
2557
+    /**
2558
+     * sample aspect ratio (0 if unknown)
2559
+     * That is the width of a pixel divided by the height of the pixel.
2560
+     * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
2561
+     * - encoding: Set by user.
2562
+     * - decoding: Set by libavcodec.
2563
+     */
2564
+    AVRational sample_aspect_ratio;
2565
+
2566
+    /**
2567
+     * motion estimation comparison function
2568
+     * - encoding: Set by user.
2569
+     * - decoding: unused
2570
+     */
2571
+    int me_cmp;
2572
+    /**
2573
+     * subpixel motion estimation comparison function
2574
+     * - encoding: Set by user.
2575
+     * - decoding: unused
2576
+     */
2577
+    int me_sub_cmp;
2578
+    /**
2579
+     * macroblock comparison function (not supported yet)
2580
+     * - encoding: Set by user.
2581
+     * - decoding: unused
2582
+     */
2583
+    int mb_cmp;
2584
+    /**
2585
+     * interlaced DCT comparison function
2586
+     * - encoding: Set by user.
2587
+     * - decoding: unused
2588
+     */
2589
+    int ildct_cmp;
2590
+#define FF_CMP_SAD          0
2591
+#define FF_CMP_SSE          1
2592
+#define FF_CMP_SATD         2
2593
+#define FF_CMP_DCT          3
2594
+#define FF_CMP_PSNR         4
2595
+#define FF_CMP_BIT          5
2596
+#define FF_CMP_RD           6
2597
+#define FF_CMP_ZERO         7
2598
+#define FF_CMP_VSAD         8
2599
+#define FF_CMP_VSSE         9
2600
+#define FF_CMP_NSSE         10
2601
+#define FF_CMP_W53          11
2602
+#define FF_CMP_W97          12
2603
+#define FF_CMP_DCTMAX       13
2604
+#define FF_CMP_DCT264       14
2605
+#define FF_CMP_MEDIAN_SAD   15
2606
+#define FF_CMP_CHROMA       256
2607
+
2608
+    /**
2609
+     * ME diamond size & shape
2610
+     * - encoding: Set by user.
2611
+     * - decoding: unused
2612
+     */
2613
+    int dia_size;
2614
+
2615
+    /**
2616
+     * amount of previous MV predictors (2a+1 x 2a+1 square)
2617
+     * - encoding: Set by user.
2618
+     * - decoding: unused
2619
+     */
2620
+    int last_predictor_count;
2621
+
2622
+#if FF_API_PRIVATE_OPT
2623
+    /** @deprecated use encoder private options instead */
2624
+    attribute_deprecated
2625
+    int pre_me;
2626
+#endif
2627
+
2628
+    /**
2629
+     * motion estimation prepass comparison function
2630
+     * - encoding: Set by user.
2631
+     * - decoding: unused
2632
+     */
2633
+    int me_pre_cmp;
2634
+
2635
+    /**
2636
+     * ME prepass diamond size & shape
2637
+     * - encoding: Set by user.
2638
+     * - decoding: unused
2639
+     */
2640
+    int pre_dia_size;
2641
+
2642
+    /**
2643
+     * subpel ME quality
2644
+     * - encoding: Set by user.
2645
+     * - decoding: unused
2646
+     */
2647
+    int me_subpel_quality;
2648
+
2649
+    /**
2650
+     * maximum motion estimation search range in subpel units
2651
+     * If 0 then no limit.
2652
+     *
2653
+     * - encoding: Set by user.
2654
+     * - decoding: unused
2655
+     */
2656
+    int me_range;
2657
+
2658
+    /**
2659
+     * slice flags
2660
+     * - encoding: unused
2661
+     * - decoding: Set by user.
2662
+     */
2663
+    int slice_flags;
2664
+#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
2665
+#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
2666
+#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
2667
+
2668
+    /**
2669
+     * macroblock decision mode
2670
+     * - encoding: Set by user.
2671
+     * - decoding: unused
2672
+     */
2673
+    int mb_decision;
2674
+#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
2675
+#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
2676
+#define FF_MB_DECISION_RD     2        ///< rate distortion
2677
+
2678
+    /**
2679
+     * custom intra quantization matrix
2680
+     * - encoding: Set by user, can be NULL.
2681
+     * - decoding: Set by libavcodec.
2682
+     */
2683
+    uint16_t *intra_matrix;
2684
+
2685
+    /**
2686
+     * custom inter quantization matrix
2687
+     * - encoding: Set by user, can be NULL.
2688
+     * - decoding: Set by libavcodec.
2689
+     */
2690
+    uint16_t *inter_matrix;
2691
+
2692
+#if FF_API_PRIVATE_OPT
2693
+    /** @deprecated use encoder private options instead */
2694
+    attribute_deprecated
2695
+    int scenechange_threshold;
2696
+
2697
+    /** @deprecated use encoder private options instead */
2698
+    attribute_deprecated
2699
+    int noise_reduction;
2700
+#endif
2701
+
2702
+    /**
2703
+     * precision of the intra DC coefficient - 8
2704
+     * - encoding: Set by user.
2705
+     * - decoding: Set by libavcodec
2706
+     */
2707
+    int intra_dc_precision;
2708
+
2709
+    /**
2710
+     * Number of macroblock rows at the top which are skipped.
2711
+     * - encoding: unused
2712
+     * - decoding: Set by user.
2713
+     */
2714
+    int skip_top;
2715
+
2716
+    /**
2717
+     * Number of macroblock rows at the bottom which are skipped.
2718
+     * - encoding: unused
2719
+     * - decoding: Set by user.
2720
+     */
2721
+    int skip_bottom;
2722
+
2723
+    /**
2724
+     * minimum MB Lagrange multiplier
2725
+     * - encoding: Set by user.
2726
+     * - decoding: unused
2727
+     */
2728
+    int mb_lmin;
2729
+
2730
+    /**
2731
+     * maximum MB Lagrange multiplier
2732
+     * - encoding: Set by user.
2733
+     * - decoding: unused
2734
+     */
2735
+    int mb_lmax;
2736
+
2737
+#if FF_API_PRIVATE_OPT
2738
+    /**
2739
+     * @deprecated use encoder private options instead
2740
+     */
2741
+    attribute_deprecated
2742
+    int me_penalty_compensation;
2743
+#endif
2744
+
2745
+    /**
2746
+     * - encoding: Set by user.
2747
+     * - decoding: unused
2748
+     */
2749
+    int bidir_refine;
2750
+
2751
+#if FF_API_PRIVATE_OPT
2752
+    /** @deprecated use encoder private options instead */
2753
+    attribute_deprecated
2754
+    int brd_scale;
2755
+#endif
2756
+
2757
+    /**
2758
+     * minimum GOP size
2759
+     * - encoding: Set by user.
2760
+     * - decoding: unused
2761
+     */
2762
+    int keyint_min;
2763
+
2764
+    /**
2765
+     * number of reference frames
2766
+     * - encoding: Set by user.
2767
+     * - decoding: Set by lavc.
2768
+     */
2769
+    int refs;
2770
+
2771
+#if FF_API_PRIVATE_OPT
2772
+    /** @deprecated use encoder private options instead */
2773
+    attribute_deprecated
2774
+    int chromaoffset;
2775
+#endif
2776
+
2777
+    /**
2778
+     * Note: Value depends upon the compare function used for fullpel ME.
2779
+     * - encoding: Set by user.
2780
+     * - decoding: unused
2781
+     */
2782
+    int mv0_threshold;
2783
+
2784
+#if FF_API_PRIVATE_OPT
2785
+    /** @deprecated use encoder private options instead */
2786
+    attribute_deprecated
2787
+    int b_sensitivity;
2788
+#endif
2789
+
2790
+    /**
2791
+     * Chromaticity coordinates of the source primaries.
2792
+     * - encoding: Set by user
2793
+     * - decoding: Set by libavcodec
2794
+     */
2795
+    enum AVColorPrimaries color_primaries;
2796
+
2797
+    /**
2798
+     * Color Transfer Characteristic.
2799
+     * - encoding: Set by user
2800
+     * - decoding: Set by libavcodec
2801
+     */
2802
+    enum AVColorTransferCharacteristic color_trc;
2803
+
2804
+    /**
2805
+     * YUV colorspace type.
2806
+     * - encoding: Set by user
2807
+     * - decoding: Set by libavcodec
2808
+     */
2809
+    enum AVColorSpace colorspace;
2810
+
2811
+    /**
2812
+     * MPEG vs JPEG YUV range.
2813
+     * - encoding: Set by user
2814
+     * - decoding: Set by libavcodec
2815
+     */
2816
+    enum AVColorRange color_range;
2817
+
2818
+    /**
2819
+     * This defines the location of chroma samples.
2820
+     * - encoding: Set by user
2821
+     * - decoding: Set by libavcodec
2822
+     */
2823
+    enum AVChromaLocation chroma_sample_location;
2824
+
2825
+    /**
2826
+     * Number of slices.
2827
+     * Indicates number of picture subdivisions. Used for parallelized
2828
+     * decoding.
2829
+     * - encoding: Set by user
2830
+     * - decoding: unused
2831
+     */
2832
+    int slices;
2833
+
2834
+    /** Field order
2835
+     * - encoding: set by libavcodec
2836
+     * - decoding: Set by user.
2837
+     */
2838
+    enum AVFieldOrder field_order;
2839
+
2840
+    /* audio only */
2841
+    int sample_rate; ///< samples per second
2842
+    int channels;    ///< number of audio channels
2843
+
2844
+    /**
2845
+     * audio sample format
2846
+     * - encoding: Set by user.
2847
+     * - decoding: Set by libavcodec.
2848
+     */
2849
+    enum AVSampleFormat sample_fmt;  ///< sample format
2850
+
2851
+    /* The following data should not be initialized. */
2852
+    /**
2853
+     * Number of samples per channel in an audio frame.
2854
+     *
2855
+     * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
2856
+     *   except the last must contain exactly frame_size samples per channel.
2857
+     *   May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
2858
+     *   frame size is not restricted.
2859
+     * - decoding: may be set by some decoders to indicate constant frame size
2860
+     */
2861
+    int frame_size;
2862
+
2863
+    /**
2864
+     * Frame counter, set by libavcodec.
2865
+     *
2866
+     * - decoding: total number of frames returned from the decoder so far.
2867
+     * - encoding: total number of frames passed to the encoder so far.
2868
+     *
2869
+     *   @note the counter is not incremented if encoding/decoding resulted in
2870
+     *   an error.
2871
+     */
2872
+    int frame_number;
2873
+
2874
+    /**
2875
+     * number of bytes per packet if constant and known or 0
2876
+     * Used by some WAV based audio codecs.
2877
+     */
2878
+    int block_align;
2879
+
2880
+    /**
2881
+     * Audio cutoff bandwidth (0 means "automatic")
2882
+     * - encoding: Set by user.
2883
+     * - decoding: unused
2884
+     */
2885
+    int cutoff;
2886
+
2887
+    /**
2888
+     * Audio channel layout.
2889
+     * - encoding: set by user.
2890
+     * - decoding: set by user, may be overwritten by libavcodec.
2891
+     */
2892
+    uint64_t channel_layout;
2893
+
2894
+    /**
2895
+     * Request decoder to use this channel layout if it can (0 for default)
2896
+     * - encoding: unused
2897
+     * - decoding: Set by user.
2898
+     */
2899
+    uint64_t request_channel_layout;
2900
+
2901
+    /**
2902
+     * Type of service that the audio stream conveys.
2903
+     * - encoding: Set by user.
2904
+     * - decoding: Set by libavcodec.
2905
+     */
2906
+    enum AVAudioServiceType audio_service_type;
2907
+
2908
+    /**
2909
+     * desired sample format
2910
+     * - encoding: Not used.
2911
+     * - decoding: Set by user.
2912
+     * Decoder will decode to this format if it can.
2913
+     */
2914
+    enum AVSampleFormat request_sample_fmt;
2915
+
2916
+    /**
2917
+     * This callback is called at the beginning of each frame to get data
2918
+     * buffer(s) for it. There may be one contiguous buffer for all the data or
2919
+     * there may be a buffer per each data plane or anything in between. What
2920
+     * this means is, you may set however many entries in buf[] you feel necessary.
2921
+     * Each buffer must be reference-counted using the AVBuffer API (see description
2922
+     * of buf[] below).
2923
+     *
2924
+     * The following fields will be set in the frame before this callback is
2925
+     * called:
2926
+     * - format
2927
+     * - width, height (video only)
2928
+     * - sample_rate, channel_layout, nb_samples (audio only)
2929
+     * Their values may differ from the corresponding values in
2930
+     * AVCodecContext. This callback must use the frame values, not the codec
2931
+     * context values, to calculate the required buffer size.
2932
+     *
2933
+     * This callback must fill the following fields in the frame:
2934
+     * - data[]
2935
+     * - linesize[]
2936
+     * - extended_data:
2937
+     *   * if the data is planar audio with more than 8 channels, then this
2938
+     *     callback must allocate and fill extended_data to contain all pointers
2939
+     *     to all data planes. data[] must hold as many pointers as it can.
2940
+     *     extended_data must be allocated with av_malloc() and will be freed in
2941
+     *     av_frame_unref().
2942
+     *   * otherwise extended_data must point to data
2943
+     * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
2944
+     *   the frame's data and extended_data pointers must be contained in these. That
2945
+     *   is, one AVBufferRef for each allocated chunk of memory, not necessarily one
2946
+     *   AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
2947
+     *   and av_buffer_ref().
2948
+     * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
2949
+     *   this callback and filled with the extra buffers if there are more
2950
+     *   buffers than buf[] can hold. extended_buf will be freed in
2951
+     *   av_frame_unref().
2952
+     *
2953
+     * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
2954
+     * avcodec_default_get_buffer2() instead of providing buffers allocated by
2955
+     * some other means.
2956
+     *
2957
+     * Each data plane must be aligned to the maximum required by the target
2958
+     * CPU.
2959
+     *
2960
+     * @see avcodec_default_get_buffer2()
2961
+     *
2962
+     * Video:
2963
+     *
2964
+     * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
2965
+     * (read and/or written to if it is writable) later by libavcodec.
2966
+     *
2967
+     * avcodec_align_dimensions2() should be used to find the required width and
2968
+     * height, as they normally need to be rounded up to the next multiple of 16.
2969
+     *
2970
+     * Some decoders do not support linesizes changing between frames.
2971
+     *
2972
+     * If frame multithreading is used and thread_safe_callbacks is set,
2973
+     * this callback may be called from a different thread, but not from more
2974
+     * than one at once. Does not need to be reentrant.
2975
+     *
2976
+     * @see avcodec_align_dimensions2()
2977
+     *
2978
+     * Audio:
2979
+     *
2980
+     * Decoders request a buffer of a particular size by setting
2981
+     * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
2982
+     * however, utilize only part of the buffer by setting AVFrame.nb_samples
2983
+     * to a smaller value in the output frame.
2984
+     *
2985
+     * As a convenience, av_samples_get_buffer_size() and
2986
+     * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
2987
+     * functions to find the required data size and to fill data pointers and
2988
+     * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
2989
+     * since all planes must be the same size.
2990
+     *
2991
+     * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
2992
+     *
2993
+     * - encoding: unused
2994
+     * - decoding: Set by libavcodec, user can override.
2995
+     */
2996
+    int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
2997
+
2998
+    /**
2999
+     * If non-zero, the decoded audio and video frames returned from
3000
+     * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
3001
+     * and are valid indefinitely. The caller must free them with
3002
+     * av_frame_unref() when they are not needed anymore.
3003
+     * Otherwise, the decoded frames must not be freed by the caller and are
3004
+     * only valid until the next decode call.
3005
+     *
3006
+     * This is always automatically enabled if avcodec_receive_frame() is used.
3007
+     *
3008
+     * - encoding: unused
3009
+     * - decoding: set by the caller before avcodec_open2().
3010
+     */
3011
+    attribute_deprecated
3012
+    int refcounted_frames;
3013
+
3014
+    /* - encoding parameters */
3015
+    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
3016
+    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
3017
+
3018
+    /**
3019
+     * minimum quantizer
3020
+     * - encoding: Set by user.
3021
+     * - decoding: unused
3022
+     */
3023
+    int qmin;
3024
+
3025
+    /**
3026
+     * maximum quantizer
3027
+     * - encoding: Set by user.
3028
+     * - decoding: unused
3029
+     */
3030
+    int qmax;
3031
+
3032
+    /**
3033
+     * maximum quantizer difference between frames
3034
+     * - encoding: Set by user.
3035
+     * - decoding: unused
3036
+     */
3037
+    int max_qdiff;
3038
+
3039
+    /**
3040
+     * decoder bitstream buffer size
3041
+     * - encoding: Set by user.
3042
+     * - decoding: unused
3043
+     */
3044
+    int rc_buffer_size;
3045
+
3046
+    /**
3047
+     * ratecontrol override, see RcOverride
3048
+     * - encoding: Allocated/set/freed by user.
3049
+     * - decoding: unused
3050
+     */
3051
+    int rc_override_count;
3052
+    RcOverride *rc_override;
3053
+
3054
+    /**
3055
+     * maximum bitrate
3056
+     * - encoding: Set by user.
3057
+     * - decoding: Set by user, may be overwritten by libavcodec.
3058
+     */
3059
+    int64_t rc_max_rate;
3060
+
3061
+    /**
3062
+     * minimum bitrate
3063
+     * - encoding: Set by user.
3064
+     * - decoding: unused
3065
+     */
3066
+    int64_t rc_min_rate;
3067
+
3068
+    /**
3069
+     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
3070
+     * - encoding: Set by user.
3071
+     * - decoding: unused.
3072
+     */
3073
+    float rc_max_available_vbv_use;
3074
+
3075
+    /**
3076
+     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
3077
+     * - encoding: Set by user.
3078
+     * - decoding: unused.
3079
+     */
3080
+    float rc_min_vbv_overflow_use;
3081
+
3082
+    /**
3083
+     * Number of bits which should be loaded into the rc buffer before decoding starts.
3084
+     * - encoding: Set by user.
3085
+     * - decoding: unused
3086
+     */
3087
+    int rc_initial_buffer_occupancy;
3088
+
3089
+#if FF_API_CODER_TYPE
3090
+#define FF_CODER_TYPE_VLC       0
3091
+#define FF_CODER_TYPE_AC        1
3092
+#define FF_CODER_TYPE_RAW       2
3093
+#define FF_CODER_TYPE_RLE       3
3094
+    /**
3095
+     * @deprecated use encoder private options instead
3096
+     */
3097
+    attribute_deprecated
3098
+    int coder_type;
3099
+#endif /* FF_API_CODER_TYPE */
3100
+
3101
+#if FF_API_PRIVATE_OPT
3102
+    /** @deprecated use encoder private options instead */
3103
+    attribute_deprecated
3104
+    int context_model;
3105
+#endif
3106
+
3107
+#if FF_API_PRIVATE_OPT
3108
+    /** @deprecated use encoder private options instead */
3109
+    attribute_deprecated
3110
+    int frame_skip_threshold;
3111
+
3112
+    /** @deprecated use encoder private options instead */
3113
+    attribute_deprecated
3114
+    int frame_skip_factor;
3115
+
3116
+    /** @deprecated use encoder private options instead */
3117
+    attribute_deprecated
3118
+    int frame_skip_exp;
3119
+
3120
+    /** @deprecated use encoder private options instead */
3121
+    attribute_deprecated
3122
+    int frame_skip_cmp;
3123
+#endif /* FF_API_PRIVATE_OPT */
3124
+
3125
+    /**
3126
+     * trellis RD quantization
3127
+     * - encoding: Set by user.
3128
+     * - decoding: unused
3129
+     */
3130
+    int trellis;
3131
+
3132
+#if FF_API_PRIVATE_OPT
3133
+    /** @deprecated use encoder private options instead */
3134
+    attribute_deprecated
3135
+    int min_prediction_order;
3136
+
3137
+    /** @deprecated use encoder private options instead */
3138
+    attribute_deprecated
3139
+    int max_prediction_order;
3140
+
3141
+    /** @deprecated use encoder private options instead */
3142
+    attribute_deprecated
3143
+    int64_t timecode_frame_start;
3144
+#endif
3145
+
3146
+#if FF_API_RTP_CALLBACK
3147
+    /**
3148
+     * @deprecated unused
3149
+     */
3150
+    /* The RTP callback: This function is called    */
3151
+    /* every time the encoder has a packet to send. */
3152
+    /* It depends on the encoder if the data starts */
3153
+    /* with a Start Code (it should). H.263 does.   */
3154
+    /* mb_nb contains the number of macroblocks     */
3155
+    /* encoded in the RTP payload.                  */
3156
+    attribute_deprecated
3157
+    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
3158
+#endif
3159
+
3160
+#if FF_API_PRIVATE_OPT
3161
+    /** @deprecated use encoder private options instead */
3162
+    attribute_deprecated
3163
+    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
3164
+                            /* do its best to deliver a chunk with size     */
3165
+                            /* below rtp_payload_size, the chunk will start */
3166
+                            /* with a start code on some codecs like H.263. */
3167
+                            /* This doesn't take account of any particular  */
3168
+                            /* headers inside the transmitted RTP payload.  */
3169
+#endif
3170
+
3171
+#if FF_API_STAT_BITS
3172
+    /* statistics, used for 2-pass encoding */
3173
+    attribute_deprecated
3174
+    int mv_bits;
3175
+    attribute_deprecated
3176
+    int header_bits;
3177
+    attribute_deprecated
3178
+    int i_tex_bits;
3179
+    attribute_deprecated
3180
+    int p_tex_bits;
3181
+    attribute_deprecated
3182
+    int i_count;
3183
+    attribute_deprecated
3184
+    int p_count;
3185
+    attribute_deprecated
3186
+    int skip_count;
3187
+    attribute_deprecated
3188
+    int misc_bits;
3189
+
3190
+    /** @deprecated this field is unused */
3191
+    attribute_deprecated
3192
+    int frame_bits;
3193
+#endif
3194
+
3195
+    /**
3196
+     * pass1 encoding statistics output buffer
3197
+     * - encoding: Set by libavcodec.
3198
+     * - decoding: unused
3199
+     */
3200
+    char *stats_out;
3201
+
3202
+    /**
3203
+     * pass2 encoding statistics input buffer
3204
+     * Concatenated stuff from stats_out of pass1 should be placed here.
3205
+     * - encoding: Allocated/set/freed by user.
3206
+     * - decoding: unused
3207
+     */
3208
+    char *stats_in;
3209
+
3210
+    /**
3211
+     * Work around bugs in encoders which sometimes cannot be detected automatically.
3212
+     * - encoding: Set by user
3213
+     * - decoding: Set by user
3214
+     */
3215
+    int workaround_bugs;
3216
+#define FF_BUG_AUTODETECT       1  ///< autodetection
3217
+#define FF_BUG_XVID_ILACE       4
3218
+#define FF_BUG_UMP4             8
3219
+#define FF_BUG_NO_PADDING       16
3220
+#define FF_BUG_AMV              32
3221
+#define FF_BUG_QPEL_CHROMA      64
3222
+#define FF_BUG_STD_QPEL         128
3223
+#define FF_BUG_QPEL_CHROMA2     256
3224
+#define FF_BUG_DIRECT_BLOCKSIZE 512
3225
+#define FF_BUG_EDGE             1024
3226
+#define FF_BUG_HPEL_CHROMA      2048
3227
+#define FF_BUG_DC_CLIP          4096
3228
+#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
3229
+#define FF_BUG_TRUNCATED       16384
3230
+#define FF_BUG_IEDGE           32768
3231
+
3232
+    /**
3233
+     * strictly follow the standard (MPEG-4, ...).
3234
+     * - encoding: Set by user.
3235
+     * - decoding: Set by user.
3236
+     * Setting this to STRICT or higher means the encoder and decoder will
3237
+     * generally do stupid things, whereas setting it to unofficial or lower
3238
+     * will mean the encoder might produce output that is not supported by all
3239
+     * spec-compliant decoders. Decoders don't differentiate between normal,
3240
+     * unofficial and experimental (that is, they always try to decode things
3241
+     * when they can) unless they are explicitly asked to behave stupidly
3242
+     * (=strictly conform to the specs)
3243
+     */
3244
+    int strict_std_compliance;
3245
+#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
3246
+#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
3247
+#define FF_COMPLIANCE_NORMAL        0
3248
+#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
3249
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
3250
+
3251
+    /**
3252
+     * error concealment flags
3253
+     * - encoding: unused
3254
+     * - decoding: Set by user.
3255
+     */
3256
+    int error_concealment;
3257
+#define FF_EC_GUESS_MVS   1
3258
+#define FF_EC_DEBLOCK     2
3259
+#define FF_EC_FAVOR_INTER 256
3260
+
3261
+    /**
3262
+     * debug
3263
+     * - encoding: Set by user.
3264
+     * - decoding: Set by user.
3265
+     */
3266
+    int debug;
3267
+#define FF_DEBUG_PICT_INFO   1
3268
+#define FF_DEBUG_RC          2
3269
+#define FF_DEBUG_BITSTREAM   4
3270
+#define FF_DEBUG_MB_TYPE     8
3271
+#define FF_DEBUG_QP          16
3272
+#if FF_API_DEBUG_MV
3273
+/**
3274
+ * @deprecated this option does nothing
3275
+ */
3276
+#define FF_DEBUG_MV          32
3277
+#endif
3278
+#define FF_DEBUG_DCT_COEFF   0x00000040
3279
+#define FF_DEBUG_SKIP        0x00000080
3280
+#define FF_DEBUG_STARTCODE   0x00000100
3281
+#define FF_DEBUG_ER          0x00000400
3282
+#define FF_DEBUG_MMCO        0x00000800
3283
+#define FF_DEBUG_BUGS        0x00001000
3284
+#if FF_API_DEBUG_MV
3285
+#define FF_DEBUG_VIS_QP      0x00002000
3286
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
3287
+#endif
3288
+#define FF_DEBUG_BUFFERS     0x00008000
3289
+#define FF_DEBUG_THREADS     0x00010000
3290
+#define FF_DEBUG_GREEN_MD    0x00800000
3291
+#define FF_DEBUG_NOMC        0x01000000
3292
+
3293
+#if FF_API_DEBUG_MV
3294
+    /**
3295
+     * debug
3296
+     * - encoding: Set by user.
3297
+     * - decoding: Set by user.
3298
+     */
3299
+    int debug_mv;
3300
+#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 // visualize forward predicted MVs of P-frames
3301
+#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 // visualize forward predicted MVs of B-frames
3302
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
3303
+#endif
3304
+
3305
+    /**
3306
+     * Error recognition; may misdetect some more or less valid parts as errors.
3307
+     * - encoding: unused
3308
+     * - decoding: Set by user.
3309
+     */
3310
+    int err_recognition;
3311
+
3312
+/**
3313
+ * Verify checksums embedded in the bitstream (could be of either encoded or
3314
+ * decoded data, depending on the codec) and print an error message on mismatch.
3315
+ * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
3316
+ * decoder returning an error.
3317
+ */
3318
+#define AV_EF_CRCCHECK  (1<<0)
3319
+#define AV_EF_BITSTREAM (1<<1)          ///< detect bitstream specification deviations
3320
+#define AV_EF_BUFFER    (1<<2)          ///< detect improper bitstream length
3321
+#define AV_EF_EXPLODE   (1<<3)          ///< abort decoding on minor error detection
3322
+
3323
+#define AV_EF_IGNORE_ERR (1<<15)        ///< ignore errors and continue
3324
+#define AV_EF_CAREFUL    (1<<16)        ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
3325
+#define AV_EF_COMPLIANT  (1<<17)        ///< consider all spec non compliances as errors
3326
+#define AV_EF_AGGRESSIVE (1<<18)        ///< consider things that a sane encoder should not do as an error
3327
+
3328
+
3329
+    /**
3330
+     * opaque 64-bit number (generally a PTS) that will be reordered and
3331
+     * output in AVFrame.reordered_opaque
3332
+     * - encoding: unused
3333
+     * - decoding: Set by user.
3334
+     */
3335
+    int64_t reordered_opaque;
3336
+
3337
+    /**
3338
+     * Hardware accelerator in use
3339
+     * - encoding: unused.
3340
+     * - decoding: Set by libavcodec
3341
+     */
3342
+    const struct AVHWAccel *hwaccel;
3343
+
3344
+    /**
3345
+     * Hardware accelerator context.
3346
+     * For some hardware accelerators, a global context needs to be
3347
+     * provided by the user. In that case, this holds display-dependent
3348
+     * data FFmpeg cannot instantiate itself. Please refer to the
3349
+     * FFmpeg HW accelerator documentation to know how to fill this
3350
+     * is. e.g. for VA API, this is a struct vaapi_context.
3351
+     * - encoding: unused
3352
+     * - decoding: Set by user
3353
+     */
3354
+    void *hwaccel_context;
3355
+
3356
+    /**
3357
+     * error
3358
+     * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
3359
+     * - decoding: unused
3360
+     */
3361
+    uint64_t error[AV_NUM_DATA_POINTERS];
3362
+
3363
+    /**
3364
+     * DCT algorithm, see FF_DCT_* below
3365
+     * - encoding: Set by user.
3366
+     * - decoding: unused
3367
+     */
3368
+    int dct_algo;
3369
+#define FF_DCT_AUTO    0
3370
+#define FF_DCT_FASTINT 1
3371
+#define FF_DCT_INT     2
3372
+#define FF_DCT_MMX     3
3373
+#define FF_DCT_ALTIVEC 5
3374
+#define FF_DCT_FAAN    6
3375
+
3376
+    /**
3377
+     * IDCT algorithm, see FF_IDCT_* below.
3378
+     * - encoding: Set by user.
3379
+     * - decoding: Set by user.
3380
+     */
3381
+    int idct_algo;
3382
+#define FF_IDCT_AUTO          0
3383
+#define FF_IDCT_INT           1
3384
+#define FF_IDCT_SIMPLE        2
3385
+#define FF_IDCT_SIMPLEMMX     3
3386
+#define FF_IDCT_ARM           7
3387
+#define FF_IDCT_ALTIVEC       8
3388
+#define FF_IDCT_SIMPLEARM     10
3389
+#define FF_IDCT_XVID          14
3390
+#define FF_IDCT_SIMPLEARMV5TE 16
3391
+#define FF_IDCT_SIMPLEARMV6   17
3392
+#define FF_IDCT_FAAN          20
3393
+#define FF_IDCT_SIMPLENEON    22
3394
+#define FF_IDCT_NONE          24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
3395
+#define FF_IDCT_SIMPLEAUTO    128
3396
+
3397
+    /**
3398
+     * bits per sample/pixel from the demuxer (needed for huffyuv).
3399
+     * - encoding: Set by libavcodec.
3400
+     * - decoding: Set by user.
3401
+     */
3402
+     int bits_per_coded_sample;
3403
+
3404
+    /**
3405
+     * Bits per sample/pixel of internal libavcodec pixel/sample format.
3406
+     * - encoding: set by user.
3407
+     * - decoding: set by libavcodec.
3408
+     */
3409
+    int bits_per_raw_sample;
3410
+
3411
+#if FF_API_LOWRES
3412
+    /**
3413
+     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3414
+     * - encoding: unused
3415
+     * - decoding: Set by user.
3416
+     */
3417
+     int lowres;
3418
+#endif
3419
+
3420
+#if FF_API_CODED_FRAME
3421
+    /**
3422
+     * the picture in the bitstream
3423
+     * - encoding: Set by libavcodec.
3424
+     * - decoding: unused
3425
+     *
3426
+     * @deprecated use the quality factor packet side data instead
3427
+     */
3428
+    attribute_deprecated AVFrame *coded_frame;
3429
+#endif
3430
+
3431
+    /**
3432
+     * thread count
3433
+     * is used to decide how many independent tasks should be passed to execute()
3434
+     * - encoding: Set by user.
3435
+     * - decoding: Set by user.
3436
+     */
3437
+    int thread_count;
3438
+
3439
+    /**
3440
+     * Which multithreading methods to use.
3441
+     * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
3442
+     * so clients which cannot provide future frames should not use it.
3443
+     *
3444
+     * - encoding: Set by user, otherwise the default is used.
3445
+     * - decoding: Set by user, otherwise the default is used.
3446
+     */
3447
+    int thread_type;
3448
+#define FF_THREAD_FRAME   1 ///< Decode more than one frame at once
3449
+#define FF_THREAD_SLICE   2 ///< Decode more than one part of a single frame at once
3450
+
3451
+    /**
3452
+     * Which multithreading methods are in use by the codec.
3453
+     * - encoding: Set by libavcodec.
3454
+     * - decoding: Set by libavcodec.
3455
+     */
3456
+    int active_thread_type;
3457
+
3458
+    /**
3459
+     * Set by the client if its custom get_buffer() callback can be called
3460
+     * synchronously from another thread, which allows faster multithreaded decoding.
3461
+     * draw_horiz_band() will be called from other threads regardless of this setting.
3462
+     * Ignored if the default get_buffer() is used.
3463
+     * - encoding: Set by user.
3464
+     * - decoding: Set by user.
3465
+     */
3466
+    int thread_safe_callbacks;
3467
+
3468
+    /**
3469
+     * The codec may call this to execute several independent things.
3470
+     * It will return only after finishing all tasks.
3471
+     * The user may replace this with some multithreaded implementation,
3472
+     * the default implementation will execute the parts serially.
3473
+     * @param count the number of things to execute
3474
+     * - encoding: Set by libavcodec, user can override.
3475
+     * - decoding: Set by libavcodec, user can override.
3476
+     */
3477
+    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
3478
+
3479
+    /**
3480
+     * The codec may call this to execute several independent things.
3481
+     * It will return only after finishing all tasks.
3482
+     * The user may replace this with some multithreaded implementation,
3483
+     * the default implementation will execute the parts serially.
3484
+     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
3485
+     * @param c context passed also to func
3486
+     * @param count the number of things to execute
3487
+     * @param arg2 argument passed unchanged to func
3488
+     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
3489
+     * @param func function that will be called count times, with jobnr from 0 to count-1.
3490
+     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
3491
+     *             two instances of func executing at the same time will have the same threadnr.
3492
+     * @return always 0 currently, but code should handle a future improvement where when any call to func
3493
+     *         returns < 0 no further calls to func may be done and < 0 is returned.
3494
+     * - encoding: Set by libavcodec, user can override.
3495
+     * - decoding: Set by libavcodec, user can override.
3496
+     */
3497
+    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
3498
+
3499
+    /**
3500
+     * noise vs. sse weight for the nsse comparison function
3501
+     * - encoding: Set by user.
3502
+     * - decoding: unused
3503
+     */
3504
+     int nsse_weight;
3505
+
3506
+    /**
3507
+     * profile
3508
+     * - encoding: Set by user.
3509
+     * - decoding: Set by libavcodec.
3510
+     */
3511
+     int profile;
3512
+#define FF_PROFILE_UNKNOWN -99
3513
+#define FF_PROFILE_RESERVED -100
3514
+
3515
+#define FF_PROFILE_AAC_MAIN 0
3516
+#define FF_PROFILE_AAC_LOW  1
3517
+#define FF_PROFILE_AAC_SSR  2
3518
+#define FF_PROFILE_AAC_LTP  3
3519
+#define FF_PROFILE_AAC_HE   4
3520
+#define FF_PROFILE_AAC_HE_V2 28
3521
+#define FF_PROFILE_AAC_LD   22
3522
+#define FF_PROFILE_AAC_ELD  38
3523
+#define FF_PROFILE_MPEG2_AAC_LOW 128
3524
+#define FF_PROFILE_MPEG2_AAC_HE  131
3525
+
3526
+#define FF_PROFILE_DNXHD         0
3527
+#define FF_PROFILE_DNXHR_LB      1
3528
+#define FF_PROFILE_DNXHR_SQ      2
3529
+#define FF_PROFILE_DNXHR_HQ      3
3530
+#define FF_PROFILE_DNXHR_HQX     4
3531
+#define FF_PROFILE_DNXHR_444     5
3532
+
3533
+#define FF_PROFILE_DTS         20
3534
+#define FF_PROFILE_DTS_ES      30
3535
+#define FF_PROFILE_DTS_96_24   40
3536
+#define FF_PROFILE_DTS_HD_HRA  50
3537
+#define FF_PROFILE_DTS_HD_MA   60
3538
+#define FF_PROFILE_DTS_EXPRESS 70
3539
+
3540
+#define FF_PROFILE_MPEG2_422    0
3541
+#define FF_PROFILE_MPEG2_HIGH   1
3542
+#define FF_PROFILE_MPEG2_SS     2
3543
+#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
3544
+#define FF_PROFILE_MPEG2_MAIN   4
3545
+#define FF_PROFILE_MPEG2_SIMPLE 5
3546
+
3547
+#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
3548
+#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
3549
+
3550
+#define FF_PROFILE_H264_BASELINE             66
3551
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
3552
+#define FF_PROFILE_H264_MAIN                 77
3553
+#define FF_PROFILE_H264_EXTENDED             88
3554
+#define FF_PROFILE_H264_HIGH                 100
3555
+#define FF_PROFILE_H264_HIGH_10              110
3556
+#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
3557
+#define FF_PROFILE_H264_MULTIVIEW_HIGH       118
3558
+#define FF_PROFILE_H264_HIGH_422             122
3559
+#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
3560
+#define FF_PROFILE_H264_STEREO_HIGH          128
3561
+#define FF_PROFILE_H264_HIGH_444             144
3562
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
3563
+#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
3564
+#define FF_PROFILE_H264_CAVLC_444            44
3565
+
3566
+#define FF_PROFILE_VC1_SIMPLE   0
3567
+#define FF_PROFILE_VC1_MAIN     1
3568
+#define FF_PROFILE_VC1_COMPLEX  2
3569
+#define FF_PROFILE_VC1_ADVANCED 3
3570
+
3571
+#define FF_PROFILE_MPEG4_SIMPLE                     0
3572
+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE            1
3573
+#define FF_PROFILE_MPEG4_CORE                       2
3574
+#define FF_PROFILE_MPEG4_MAIN                       3
3575
+#define FF_PROFILE_MPEG4_N_BIT                      4
3576
+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE           5
3577
+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION      6
3578
+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE     7
3579
+#define FF_PROFILE_MPEG4_HYBRID                     8
3580
+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME         9
3581
+#define FF_PROFILE_MPEG4_CORE_SCALABLE             10
3582
+#define FF_PROFILE_MPEG4_ADVANCED_CODING           11
3583
+#define FF_PROFILE_MPEG4_ADVANCED_CORE             12
3584
+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
3585
+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO             14
3586
+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE           15
3587
+
3588
+#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0   1
3589
+#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1   2
3590
+#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION  32768
3591
+#define FF_PROFILE_JPEG2000_DCINEMA_2K              3
3592
+#define FF_PROFILE_JPEG2000_DCINEMA_4K              4
3593
+
3594
+#define FF_PROFILE_VP9_0                            0
3595
+#define FF_PROFILE_VP9_1                            1
3596
+#define FF_PROFILE_VP9_2                            2
3597
+#define FF_PROFILE_VP9_3                            3
3598
+
3599
+#define FF_PROFILE_HEVC_MAIN                        1
3600
+#define FF_PROFILE_HEVC_MAIN_10                     2
3601
+#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
3602
+#define FF_PROFILE_HEVC_REXT                        4
3603
+
3604
+#define FF_PROFILE_AV1_MAIN                         0
3605
+#define FF_PROFILE_AV1_HIGH                         1
3606
+#define FF_PROFILE_AV1_PROFESSIONAL                 2
3607
+
3608
+#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT            0xc0
3609
+#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
3610
+#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT         0xc2
3611
+#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS                0xc3
3612
+#define FF_PROFILE_MJPEG_JPEG_LS                         0xf7
3613
+
3614
+#define FF_PROFILE_SBC_MSBC                         1
3615
+
3616
+    /**
3617
+     * level
3618
+     * - encoding: Set by user.
3619
+     * - decoding: Set by libavcodec.
3620
+     */
3621
+     int level;
3622
+#define FF_LEVEL_UNKNOWN -99
3623
+
3624
+    /**
3625
+     * Skip loop filtering for selected frames.
3626
+     * - encoding: unused
3627
+     * - decoding: Set by user.
3628
+     */
3629
+    enum AVDiscard skip_loop_filter;
3630
+
3631
+    /**
3632
+     * Skip IDCT/dequantization for selected frames.
3633
+     * - encoding: unused
3634
+     * - decoding: Set by user.
3635
+     */
3636
+    enum AVDiscard skip_idct;
3637
+
3638
+    /**
3639
+     * Skip decoding for selected frames.
3640
+     * - encoding: unused
3641
+     * - decoding: Set by user.
3642
+     */
3643
+    enum AVDiscard skip_frame;
3644
+
3645
+    /**
3646
+     * Header containing style information for text subtitles.
3647
+     * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
3648
+     * [Script Info] and [V4+ Styles] section, plus the [Events] line and
3649
+     * the Format line following. It shouldn't include any Dialogue line.
3650
+     * - encoding: Set/allocated/freed by user (before avcodec_open2())
3651
+     * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
3652
+     */
3653
+    uint8_t *subtitle_header;
3654
+    int subtitle_header_size;
3655
+
3656
+#if FF_API_VBV_DELAY
3657
+    /**
3658
+     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
3659
+     * Used for compliant TS muxing.
3660
+     * - encoding: Set by libavcodec.
3661
+     * - decoding: unused.
3662
+     * @deprecated this value is now exported as a part of
3663
+     * AV_PKT_DATA_CPB_PROPERTIES packet side data
3664
+     */
3665
+    attribute_deprecated
3666
+    uint64_t vbv_delay;
3667
+#endif
3668
+
3669
+#if FF_API_SIDEDATA_ONLY_PKT
3670
+    /**
3671
+     * Encoding only and set by default. Allow encoders to output packets
3672
+     * that do not contain any encoded data, only side data.
3673
+     *
3674
+     * Some encoders need to output such packets, e.g. to update some stream
3675
+     * parameters at the end of encoding.
3676
+     *
3677
+     * @deprecated this field disables the default behaviour and
3678
+     *             it is kept only for compatibility.
3679
+     */
3680
+    attribute_deprecated
3681
+    int side_data_only_packets;
3682
+#endif
3683
+
3684
+    /**
3685
+     * Audio only. The number of "priming" samples (padding) inserted by the
3686
+     * encoder at the beginning of the audio. I.e. this number of leading
3687
+     * decoded samples must be discarded by the caller to get the original audio
3688
+     * without leading padding.
3689
+     *
3690
+     * - decoding: unused
3691
+     * - encoding: Set by libavcodec. The timestamps on the output packets are
3692
+     *             adjusted by the encoder so that they always refer to the
3693
+     *             first sample of the data actually contained in the packet,
3694
+     *             including any added padding.  E.g. if the timebase is
3695
+     *             1/samplerate and the timestamp of the first input sample is
3696
+     *             0, the timestamp of the first output packet will be
3697
+     *             -initial_padding.
3698
+     */
3699
+    int initial_padding;
3700
+
3701
+    /**
3702
+     * - decoding: For codecs that store a framerate value in the compressed
3703
+     *             bitstream, the decoder may export it here. { 0, 1} when
3704
+     *             unknown.
3705
+     * - encoding: May be used to signal the framerate of CFR content to an
3706
+     *             encoder.
3707
+     */
3708
+    AVRational framerate;
3709
+
3710
+    /**
3711
+     * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
3712
+     * - encoding: unused.
3713
+     * - decoding: Set by libavcodec before calling get_format()
3714
+     */
3715
+    enum AVPixelFormat sw_pix_fmt;
3716
+
3717
+    /**
3718
+     * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3719
+     * - encoding unused.
3720
+     * - decoding set by user.
3721
+     */
3722
+    AVRational pkt_timebase;
3723
+
3724
+    /**
3725
+     * AVCodecDescriptor
3726
+     * - encoding: unused.
3727
+     * - decoding: set by libavcodec.
3728
+     */
3729
+    const AVCodecDescriptor *codec_descriptor;
3730
+
3731
+#if !FF_API_LOWRES
3732
+    /**
3733
+     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
3734
+     * - encoding: unused
3735
+     * - decoding: Set by user.
3736
+     */
3737
+     int lowres;
3738
+#endif
3739
+
3740
+    /**
3741
+     * Current statistics for PTS correction.
3742
+     * - decoding: maintained and used by libavcodec, not intended to be used by user apps
3743
+     * - encoding: unused
3744
+     */
3745
+    int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
3746
+    int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
3747
+    int64_t pts_correction_last_pts;       /// PTS of the last frame
3748
+    int64_t pts_correction_last_dts;       /// DTS of the last frame
3749
+
3750
+    /**
3751
+     * Character encoding of the input subtitles file.
3752
+     * - decoding: set by user
3753
+     * - encoding: unused
3754
+     */
3755
+    char *sub_charenc;
3756
+
3757
+    /**
3758
+     * Subtitles character encoding mode. Formats or codecs might be adjusting
3759
+     * this setting (if they are doing the conversion themselves for instance).
3760
+     * - decoding: set by libavcodec
3761
+     * - encoding: unused
3762
+     */
3763
+    int sub_charenc_mode;
3764
+#define FF_SUB_CHARENC_MODE_DO_NOTHING  -1  ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
3765
+#define FF_SUB_CHARENC_MODE_AUTOMATIC    0  ///< libavcodec will select the mode itself
3766
+#define FF_SUB_CHARENC_MODE_PRE_DECODER  1  ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
3767
+#define FF_SUB_CHARENC_MODE_IGNORE       2  ///< neither convert the subtitles, nor check them for valid UTF-8
3768
+
3769
+    /**
3770
+     * Skip processing alpha if supported by codec.
3771
+     * Note that if the format uses pre-multiplied alpha (common with VP6,
3772
+     * and recommended due to better video quality/compression)
3773
+     * the image will look as if alpha-blended onto a black background.
3774
+     * However for formats that do not use pre-multiplied alpha
3775
+     * there might be serious artefacts (though e.g. libswscale currently
3776
+     * assumes pre-multiplied alpha anyway).
3777
+     *
3778
+     * - decoding: set by user
3779
+     * - encoding: unused
3780
+     */
3781
+    int skip_alpha;
3782
+
3783
+    /**
3784
+     * Number of samples to skip after a discontinuity
3785
+     * - decoding: unused
3786
+     * - encoding: set by libavcodec
3787
+     */
3788
+    int seek_preroll;
3789
+
3790
+#if !FF_API_DEBUG_MV
3791
+    /**
3792
+     * debug motion vectors
3793
+     * - encoding: Set by user.
3794
+     * - decoding: Set by user.
3795
+     */
3796
+    int debug_mv;
3797
+#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
3798
+#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
3799
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
3800
+#endif
3801
+
3802
+    /**
3803
+     * custom intra quantization matrix
3804
+     * - encoding: Set by user, can be NULL.
3805
+     * - decoding: unused.
3806
+     */
3807
+    uint16_t *chroma_intra_matrix;
3808
+
3809
+    /**
3810
+     * dump format separator.
3811
+     * can be ", " or "\n      " or anything else
3812
+     * - encoding: Set by user.
3813
+     * - decoding: Set by user.
3814
+     */
3815
+    uint8_t *dump_separator;
3816
+
3817
+    /**
3818
+     * ',' separated list of allowed decoders.
3819
+     * If NULL then all are allowed
3820
+     * - encoding: unused
3821
+     * - decoding: set by user
3822
+     */
3823
+    char *codec_whitelist;
3824
+
3825
+    /**
3826
+     * Properties of the stream that gets decoded
3827
+     * - encoding: unused
3828
+     * - decoding: set by libavcodec
3829
+     */
3830
+    unsigned properties;
3831
+#define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
3832
+#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3833
+
3834
+    /**
3835
+     * Additional data associated with the entire coded stream.
3836
+     *
3837
+     * - decoding: unused
3838
+     * - encoding: may be set by libavcodec after avcodec_open2().
3839
+     */
3840
+    AVPacketSideData *coded_side_data;
3841
+    int            nb_coded_side_data;
3842
+
3843
+    /**
3844
+     * A reference to the AVHWFramesContext describing the input (for encoding)
3845
+     * or output (decoding) frames. The reference is set by the caller and
3846
+     * afterwards owned (and freed) by libavcodec - it should never be read by
3847
+     * the caller after being set.
3848
+     *
3849
+     * - decoding: This field should be set by the caller from the get_format()
3850
+     *             callback. The previous reference (if any) will always be
3851
+     *             unreffed by libavcodec before the get_format() call.
3852
+     *
3853
+     *             If the default get_buffer2() is used with a hwaccel pixel
3854
+     *             format, then this AVHWFramesContext will be used for
3855
+     *             allocating the frame buffers.
3856
+     *
3857
+     * - encoding: For hardware encoders configured to use a hwaccel pixel
3858
+     *             format, this field should be set by the caller to a reference
3859
+     *             to the AVHWFramesContext describing input frames.
3860
+     *             AVHWFramesContext.format must be equal to
3861
+     *             AVCodecContext.pix_fmt.
3862
+     *
3863
+     *             This field should be set before avcodec_open2() is called.
3864
+     */
3865
+    AVBufferRef *hw_frames_ctx;
3866
+
3867
+    /**
3868
+     * Control the form of AVSubtitle.rects[N]->ass
3869
+     * - decoding: set by user
3870
+     * - encoding: unused
3871
+     */
3872
+    int sub_text_format;
3873
+#define FF_SUB_TEXT_FMT_ASS              0
3874
+#if FF_API_ASS_TIMING
3875
+#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
3876
+#endif
3877
+
3878
+    /**
3879
+     * Audio only. The amount of padding (in samples) appended by the encoder to
3880
+     * the end of the audio. I.e. this number of decoded samples must be
3881
+     * discarded by the caller from the end of the stream to get the original
3882
+     * audio without any trailing padding.
3883
+     *
3884
+     * - decoding: unused
3885
+     * - encoding: unused
3886
+     */
3887
+    int trailing_padding;
3888
+
3889
+    /**
3890
+     * The number of pixels per image to maximally accept.
3891
+     *
3892
+     * - decoding: set by user
3893
+     * - encoding: set by user
3894
+     */
3895
+    int64_t max_pixels;
3896
+
3897
+    /**
3898
+     * A reference to the AVHWDeviceContext describing the device which will
3899
+     * be used by a hardware encoder/decoder.  The reference is set by the
3900
+     * caller and afterwards owned (and freed) by libavcodec.
3901
+     *
3902
+     * This should be used if either the codec device does not require
3903
+     * hardware frames or any that are used are to be allocated internally by
3904
+     * libavcodec.  If the user wishes to supply any of the frames used as
3905
+     * encoder input or decoder output then hw_frames_ctx should be used
3906
+     * instead.  When hw_frames_ctx is set in get_format() for a decoder, this
3907
+     * field will be ignored while decoding the associated stream segment, but
3908
+     * may again be used on a following one after another get_format() call.
3909
+     *
3910
+     * For both encoders and decoders this field should be set before
3911
+     * avcodec_open2() is called and must not be written to thereafter.
3912
+     *
3913
+     * Note that some decoders may require this field to be set initially in
3914
+     * order to support hw_frames_ctx at all - in that case, all frames
3915
+     * contexts used must be created on the same device.
3916
+     */
3917
+    AVBufferRef *hw_device_ctx;
3918
+
3919
+    /**
3920
+     * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
3921
+     * decoding (if active).
3922
+     * - encoding: unused
3923
+     * - decoding: Set by user (either before avcodec_open2(), or in the
3924
+     *             AVCodecContext.get_format callback)
3925
+     */
3926
+    int hwaccel_flags;
3927
+
3928
+    /**
3929
+     * Video decoding only. Certain video codecs support cropping, meaning that
3930
+     * only a sub-rectangle of the decoded frame is intended for display.  This
3931
+     * option controls how cropping is handled by libavcodec.
3932
+     *
3933
+     * When set to 1 (the default), libavcodec will apply cropping internally.
3934
+     * I.e. it will modify the output frame width/height fields and offset the
3935
+     * data pointers (only by as much as possible while preserving alignment, or
3936
+     * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
3937
+     * the frames output by the decoder refer only to the cropped area. The
3938
+     * crop_* fields of the output frames will be zero.
3939
+     *
3940
+     * When set to 0, the width/height fields of the output frames will be set
3941
+     * to the coded dimensions and the crop_* fields will describe the cropping
3942
+     * rectangle. Applying the cropping is left to the caller.
3943
+     *
3944
+     * @warning When hardware acceleration with opaque output frames is used,
3945
+     * libavcodec is unable to apply cropping from the top/left border.
3946
+     *
3947
+     * @note when this option is set to zero, the width/height fields of the
3948
+     * AVCodecContext and output AVFrames have different meanings. The codec
3949
+     * context fields store display dimensions (with the coded dimensions in
3950
+     * coded_width/height), while the frame fields store the coded dimensions
3951
+     * (with the display dimensions being determined by the crop_* fields).
3952
+     */
3953
+    int apply_cropping;
3954
+
3955
+    /*
3956
+     * Video decoding only.  Sets the number of extra hardware frames which
3957
+     * the decoder will allocate for use by the caller.  This must be set
3958
+     * before avcodec_open2() is called.
3959
+     *
3960
+     * Some hardware decoders require all frames that they will use for
3961
+     * output to be defined in advance before decoding starts.  For such
3962
+     * decoders, the hardware frame pool must therefore be of a fixed size.
3963
+     * The extra frames set here are on top of any number that the decoder
3964
+     * needs internally in order to operate normally (for example, frames
3965
+     * used as reference pictures).
3966
+     */
3967
+    int extra_hw_frames;
3968
+} AVCodecContext;
3969
+
3970
+#if FF_API_CODEC_GET_SET
3971
+/**
3972
+ * Accessors for some AVCodecContext fields. These used to be provided for ABI
3973
+ * compatibility, and do not need to be used anymore.
3974
+ */
3975
+attribute_deprecated
3976
+AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
3977
+attribute_deprecated
3978
+void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
3979
+
3980
+attribute_deprecated
3981
+const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
3982
+attribute_deprecated
3983
+void                     av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
3984
+
3985
+attribute_deprecated
3986
+unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
3987
+
3988
+#if FF_API_LOWRES
3989
+attribute_deprecated
3990
+int  av_codec_get_lowres(const AVCodecContext *avctx);
3991
+attribute_deprecated
3992
+void av_codec_set_lowres(AVCodecContext *avctx, int val);
3993
+#endif
3994
+
3995
+attribute_deprecated
3996
+int  av_codec_get_seek_preroll(const AVCodecContext *avctx);
3997
+attribute_deprecated
3998
+void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
3999
+
4000
+attribute_deprecated
4001
+uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
4002
+attribute_deprecated
4003
+void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
4004
+#endif
4005
+
4006
+/**
4007
+ * AVProfile.
4008
+ */
4009
+typedef struct AVProfile {
4010
+    int profile;
4011
+    const char *name; ///< short name for the profile
4012
+} AVProfile;
4013
+
4014
+enum {
4015
+    /**
4016
+     * The codec supports this format via the hw_device_ctx interface.
4017
+     *
4018
+     * When selecting this format, AVCodecContext.hw_device_ctx should
4019
+     * have been set to a device of the specified type before calling
4020
+     * avcodec_open2().
4021
+     */
4022
+    AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
4023
+    /**
4024
+     * The codec supports this format via the hw_frames_ctx interface.
4025
+     *
4026
+     * When selecting this format for a decoder,
4027
+     * AVCodecContext.hw_frames_ctx should be set to a suitable frames
4028
+     * context inside the get_format() callback.  The frames context
4029
+     * must have been created on a device of the specified type.
4030
+     */
4031
+    AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
4032
+    /**
4033
+     * The codec supports this format by some internal method.
4034
+     *
4035
+     * This format can be selected without any additional configuration -
4036
+     * no device or frames context is required.
4037
+     */
4038
+    AV_CODEC_HW_CONFIG_METHOD_INTERNAL      = 0x04,
4039
+    /**
4040
+     * The codec supports this format by some ad-hoc method.
4041
+     *
4042
+     * Additional settings and/or function calls are required.  See the
4043
+     * codec-specific documentation for details.  (Methods requiring
4044
+     * this sort of configuration are deprecated and others should be
4045
+     * used in preference.)
4046
+     */
4047
+    AV_CODEC_HW_CONFIG_METHOD_AD_HOC        = 0x08,
4048
+};
4049
+
4050
+typedef struct AVCodecHWConfig {
4051
+    /**
4052
+     * A hardware pixel format which the codec can use.
4053
+     */
4054
+    enum AVPixelFormat pix_fmt;
4055
+    /**
4056
+     * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
4057
+     * setup methods which can be used with this configuration.
4058
+     */
4059
+    int methods;
4060
+    /**
4061
+     * The device type associated with the configuration.
4062
+     *
4063
+     * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
4064
+     * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
4065
+     */
4066
+    enum AVHWDeviceType device_type;
4067
+} AVCodecHWConfig;
4068
+
4069
+typedef struct AVCodecDefault AVCodecDefault;
4070
+
4071
+struct AVSubtitle;
4072
+
4073
+/**
4074
+ * AVCodec.
4075
+ */
4076
+typedef struct AVCodec {
4077
+    /**
4078
+     * Name of the codec implementation.
4079
+     * The name is globally unique among encoders and among decoders (but an
4080
+     * encoder and a decoder can share the same name).
4081
+     * This is the primary way to find a codec from the user perspective.
4082
+     */
4083
+    const char *name;
4084
+    /**
4085
+     * Descriptive name for the codec, meant to be more human readable than name.
4086
+     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
4087
+     */
4088
+    const char *long_name;
4089
+    enum AVMediaType type;
4090
+    enum AVCodecID id;
4091
+    /**
4092
+     * Codec capabilities.
4093
+     * see AV_CODEC_CAP_*
4094
+     */
4095
+    int capabilities;
4096
+    const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
4097
+    const enum AVPixelFormat *pix_fmts;     ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
4098
+    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
4099
+    const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
4100
+    const uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
4101
+    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
4102
+    const AVClass *priv_class;              ///< AVClass for the private context
4103
+    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
4104
+
4105
+    /**
4106
+     * Group name of the codec implementation.
4107
+     * This is a short symbolic name of the wrapper backing this codec. A
4108
+     * wrapper uses some kind of external implementation for the codec, such
4109
+     * as an external library, or a codec implementation provided by the OS or
4110
+     * the hardware.
4111
+     * If this field is NULL, this is a builtin, libavcodec native codec.
4112
+     * If non-NULL, this will be the suffix in AVCodec.name in most cases
4113
+     * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
4114
+     */
4115
+    const char *wrapper_name;
4116
+
4117
+    /*****************************************************************
4118
+     * No fields below this line are part of the public API. They
4119
+     * may not be used outside of libavcodec and can be changed and
4120
+     * removed at will.
4121
+     * New public fields should be added right above.
4122
+     *****************************************************************
4123
+     */
4124
+    int priv_data_size;
4125
+    struct AVCodec *next;
4126
+    /**
4127
+     * @name Frame-level threading support functions
4128
+     * @{
4129
+     */
4130
+    /**
4131
+     * If defined, called on thread contexts when they are created.
4132
+     * If the codec allocates writable tables in init(), re-allocate them here.
4133
+     * priv_data will be set to a copy of the original.
4134
+     */
4135
+    int (*init_thread_copy)(AVCodecContext *);
4136
+    /**
4137
+     * Copy necessary context variables from a previous thread context to the current one.
4138
+     * If not defined, the next thread will start automatically; otherwise, the codec
4139
+     * must call ff_thread_finish_setup().
4140
+     *
4141
+     * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
4142
+     */
4143
+    int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
4144
+    /** @} */
4145
+
4146
+    /**
4147
+     * Private codec-specific defaults.
4148
+     */
4149
+    const AVCodecDefault *defaults;
4150
+
4151
+    /**
4152
+     * Initialize codec static data, called from avcodec_register().
4153
+     *
4154
+     * This is not intended for time consuming operations as it is
4155
+     * run for every codec regardless of that codec being used.
4156
+     */
4157
+    void (*init_static_data)(struct AVCodec *codec);
4158
+
4159
+    int (*init)(AVCodecContext *);
4160
+    int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
4161
+                      const struct AVSubtitle *sub);
4162
+    /**
4163
+     * Encode data to an AVPacket.
4164
+     *
4165
+     * @param      avctx          codec context
4166
+     * @param      avpkt          output AVPacket (may contain a user-provided buffer)
4167
+     * @param[in]  frame          AVFrame containing the raw data to be encoded
4168
+     * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
4169
+     *                            non-empty packet was returned in avpkt.
4170
+     * @return 0 on success, negative error code on failure
4171
+     */
4172
+    int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
4173
+                   int *got_packet_ptr);
4174
+    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
4175
+    int (*close)(AVCodecContext *);
4176
+    /**
4177
+     * Encode API with decoupled packet/frame dataflow. The API is the
4178
+     * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
4179
+     * that:
4180
+     * - never called if the codec is closed or the wrong type,
4181
+     * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
4182
+     * - only one drain frame is ever passed down,
4183
+     */
4184
+    int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
4185
+    int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
4186
+
4187
+    /**
4188
+     * Decode API with decoupled packet/frame dataflow. This function is called
4189
+     * to get one output frame. It should call ff_decode_get_packet() to obtain
4190
+     * input data.
4191
+     */
4192
+    int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
4193
+    /**
4194
+     * Flush buffers.
4195
+     * Will be called when seeking
4196
+     */
4197
+    void (*flush)(AVCodecContext *);
4198
+    /**
4199
+     * Internal codec capabilities.
4200
+     * See FF_CODEC_CAP_* in internal.h
4201
+     */
4202
+    int caps_internal;
4203
+
4204
+    /**
4205
+     * Decoding only, a comma-separated list of bitstream filters to apply to
4206
+     * packets before decoding.
4207
+     */
4208
+    const char *bsfs;
4209
+
4210
+    /**
4211
+     * Array of pointers to hardware configurations supported by the codec,
4212
+     * or NULL if no hardware supported.  The array is terminated by a NULL
4213
+     * pointer.
4214
+     *
4215
+     * The user can only access this field via avcodec_get_hw_config().
4216
+     */
4217
+    const struct AVCodecHWConfigInternal **hw_configs;
4218
+} AVCodec;
4219
+
4220
+#if FF_API_CODEC_GET_SET
4221
+attribute_deprecated
4222
+int av_codec_get_max_lowres(const AVCodec *codec);
4223
+#endif
4224
+
4225
+struct MpegEncContext;
4226
+
4227
+/**
4228
+ * Retrieve supported hardware configurations for a codec.
4229
+ *
4230
+ * Values of index from zero to some maximum return the indexed configuration
4231
+ * descriptor; all other values return NULL.  If the codec does not support
4232
+ * any hardware configurations then it will always return NULL.
4233
+ */
4234
+const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
4235
+
4236
+/**
4237
+ * @defgroup lavc_hwaccel AVHWAccel
4238
+ *
4239
+ * @note  Nothing in this structure should be accessed by the user.  At some
4240
+ *        point in future it will not be externally visible at all.
4241
+ *
4242
+ * @{
4243
+ */
4244
+typedef struct AVHWAccel {
4245
+    /**
4246
+     * Name of the hardware accelerated codec.
4247
+     * The name is globally unique among encoders and among decoders (but an
4248
+     * encoder and a decoder can share the same name).
4249
+     */
4250
+    const char *name;
4251
+
4252
+    /**
4253
+     * Type of codec implemented by the hardware accelerator.
4254
+     *
4255
+     * See AVMEDIA_TYPE_xxx
4256
+     */
4257
+    enum AVMediaType type;
4258
+
4259
+    /**
4260
+     * Codec implemented by the hardware accelerator.
4261
+     *
4262
+     * See AV_CODEC_ID_xxx
4263
+     */
4264
+    enum AVCodecID id;
4265
+
4266
+    /**
4267
+     * Supported pixel format.
4268
+     *
4269
+     * Only hardware accelerated formats are supported here.
4270
+     */
4271
+    enum AVPixelFormat pix_fmt;
4272
+
4273
+    /**
4274
+     * Hardware accelerated codec capabilities.
4275
+     * see AV_HWACCEL_CODEC_CAP_*
4276
+     */
4277
+    int capabilities;
4278
+
4279
+    /*****************************************************************
4280
+     * No fields below this line are part of the public API. They
4281
+     * may not be used outside of libavcodec and can be changed and
4282
+     * removed at will.
4283
+     * New public fields should be added right above.
4284
+     *****************************************************************
4285
+     */
4286
+
4287
+    /**
4288
+     * Allocate a custom buffer
4289
+     */
4290
+    int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
4291
+
4292
+    /**
4293
+     * Called at the beginning of each frame or field picture.
4294
+     *
4295
+     * Meaningful frame information (codec specific) is guaranteed to
4296
+     * be parsed at this point. This function is mandatory.
4297
+     *
4298
+     * Note that buf can be NULL along with buf_size set to 0.
4299
+     * Otherwise, this means the whole frame is available at this point.
4300
+     *
4301
+     * @param avctx the codec context
4302
+     * @param buf the frame data buffer base
4303
+     * @param buf_size the size of the frame in bytes
4304
+     * @return zero if successful, a negative value otherwise
4305
+     */
4306
+    int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4307
+
4308
+    /**
4309
+     * Callback for parameter data (SPS/PPS/VPS etc).
4310
+     *
4311
+     * Useful for hardware decoders which keep persistent state about the
4312
+     * video parameters, and need to receive any changes to update that state.
4313
+     *
4314
+     * @param avctx the codec context
4315
+     * @param type the nal unit type
4316
+     * @param buf the nal unit data buffer
4317
+     * @param buf_size the size of the nal unit in bytes
4318
+     * @return zero if successful, a negative value otherwise
4319
+     */
4320
+    int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
4321
+
4322
+    /**
4323
+     * Callback for each slice.
4324
+     *
4325
+     * Meaningful slice information (codec specific) is guaranteed to
4326
+     * be parsed at this point. This function is mandatory.
4327
+     * The only exception is XvMC, that works on MB level.
4328
+     *
4329
+     * @param avctx the codec context
4330
+     * @param buf the slice data buffer base
4331
+     * @param buf_size the size of the slice in bytes
4332
+     * @return zero if successful, a negative value otherwise
4333
+     */
4334
+    int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
4335
+
4336
+    /**
4337
+     * Called at the end of each frame or field picture.
4338
+     *
4339
+     * The whole picture is parsed at this point and can now be sent
4340
+     * to the hardware accelerator. This function is mandatory.
4341
+     *
4342
+     * @param avctx the codec context
4343
+     * @return zero if successful, a negative value otherwise
4344
+     */
4345
+    int (*end_frame)(AVCodecContext *avctx);
4346
+
4347
+    /**
4348
+     * Size of per-frame hardware accelerator private data.
4349
+     *
4350
+     * Private data is allocated with av_mallocz() before
4351
+     * AVCodecContext.get_buffer() and deallocated after
4352
+     * AVCodecContext.release_buffer().
4353
+     */
4354
+    int frame_priv_data_size;
4355
+
4356
+    /**
4357
+     * Called for every Macroblock in a slice.
4358
+     *
4359
+     * XvMC uses it to replace the ff_mpv_reconstruct_mb().
4360
+     * Instead of decoding to raw picture, MB parameters are
4361
+     * stored in an array provided by the video driver.
4362
+     *
4363
+     * @param s the mpeg context
4364
+     */
4365
+    void (*decode_mb)(struct MpegEncContext *s);
4366
+
4367
+    /**
4368
+     * Initialize the hwaccel private data.
4369
+     *
4370
+     * This will be called from ff_get_format(), after hwaccel and
4371
+     * hwaccel_context are set and the hwaccel private data in AVCodecInternal
4372
+     * is allocated.
4373
+     */
4374
+    int (*init)(AVCodecContext *avctx);
4375
+
4376
+    /**
4377
+     * Uninitialize the hwaccel private data.
4378
+     *
4379
+     * This will be called from get_format() or avcodec_close(), after hwaccel
4380
+     * and hwaccel_context are already uninitialized.
4381
+     */
4382
+    int (*uninit)(AVCodecContext *avctx);
4383
+
4384
+    /**
4385
+     * Size of the private data to allocate in
4386
+     * AVCodecInternal.hwaccel_priv_data.
4387
+     */
4388
+    int priv_data_size;
4389
+
4390
+    /**
4391
+     * Internal hwaccel capabilities.
4392
+     */
4393
+    int caps_internal;
4394
+
4395
+    /**
4396
+     * Fill the given hw_frames context with current codec parameters. Called
4397
+     * from get_format. Refer to avcodec_get_hw_frames_parameters() for
4398
+     * details.
4399
+     *
4400
+     * This CAN be called before AVHWAccel.init is called, and you must assume
4401
+     * that avctx->hwaccel_priv_data is invalid.
4402
+     */
4403
+    int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
4404
+} AVHWAccel;
4405
+
4406
+/**
4407
+ * HWAccel is experimental and is thus avoided in favor of non experimental
4408
+ * codecs
4409
+ */
4410
+#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
4411
+
4412
+/**
4413
+ * Hardware acceleration should be used for decoding even if the codec level
4414
+ * used is unknown or higher than the maximum supported level reported by the
4415
+ * hardware driver.
4416
+ *
4417
+ * It's generally a good idea to pass this flag unless you have a specific
4418
+ * reason not to, as hardware tends to under-report supported levels.
4419
+ */
4420
+#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
4421
+
4422
+/**
4423
+ * Hardware acceleration can output YUV pixel formats with a different chroma
4424
+ * sampling than 4:2:0 and/or other than 8 bits per component.
4425
+ */
4426
+#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
4427
+
4428
+/**
4429
+ * Hardware acceleration should still be attempted for decoding when the
4430
+ * codec profile does not match the reported capabilities of the hardware.
4431
+ *
4432
+ * For example, this can be used to try to decode baseline profile H.264
4433
+ * streams in hardware - it will often succeed, because many streams marked
4434
+ * as baseline profile actually conform to constrained baseline profile.
4435
+ *
4436
+ * @warning If the stream is actually not supported then the behaviour is
4437
+ *          undefined, and may include returning entirely incorrect output
4438
+ *          while indicating success.
4439
+ */
4440
+#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
4441
+
4442
+/**
4443
+ * @}
4444
+ */
4445
+
4446
+#if FF_API_AVPICTURE
4447
+/**
4448
+ * @defgroup lavc_picture AVPicture
4449
+ *
4450
+ * Functions for working with AVPicture
4451
+ * @{
4452
+ */
4453
+
4454
+/**
4455
+ * Picture data structure.
4456
+ *
4457
+ * Up to four components can be stored into it, the last component is
4458
+ * alpha.
4459
+ * @deprecated use AVFrame or imgutils functions instead
4460
+ */
4461
+typedef struct AVPicture {
4462
+    attribute_deprecated
4463
+    uint8_t *data[AV_NUM_DATA_POINTERS];    ///< pointers to the image data planes
4464
+    attribute_deprecated
4465
+    int linesize[AV_NUM_DATA_POINTERS];     ///< number of bytes per line
4466
+} AVPicture;
4467
+
4468
+/**
4469
+ * @}
4470
+ */
4471
+#endif
4472
+
4473
+enum AVSubtitleType {
4474
+    SUBTITLE_NONE,
4475
+
4476
+    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
4477
+
4478
+    /**
4479
+     * Plain text, the text field must be set by the decoder and is
4480
+     * authoritative. ass and pict fields may contain approximations.
4481
+     */
4482
+    SUBTITLE_TEXT,
4483
+
4484
+    /**
4485
+     * Formatted text, the ass field must be set by the decoder and is
4486
+     * authoritative. pict and text fields may contain approximations.
4487
+     */
4488
+    SUBTITLE_ASS,
4489
+};
4490
+
4491
+#define AV_SUBTITLE_FLAG_FORCED 0x00000001
4492
+
4493
+typedef struct AVSubtitleRect {
4494
+    int x;         ///< top left corner  of pict, undefined when pict is not set
4495
+    int y;         ///< top left corner  of pict, undefined when pict is not set
4496
+    int w;         ///< width            of pict, undefined when pict is not set
4497
+    int h;         ///< height           of pict, undefined when pict is not set
4498
+    int nb_colors; ///< number of colors in pict, undefined when pict is not set
4499
+
4500
+#if FF_API_AVPICTURE
4501
+    /**
4502
+     * @deprecated unused
4503
+     */
4504
+    attribute_deprecated
4505
+    AVPicture pict;
4506
+#endif
4507
+    /**
4508
+     * data+linesize for the bitmap of this subtitle.
4509
+     * Can be set for text/ass as well once they are rendered.
4510
+     */
4511
+    uint8_t *data[4];
4512
+    int linesize[4];
4513
+
4514
+    enum AVSubtitleType type;
4515
+
4516
+    char *text;                     ///< 0 terminated plain UTF-8 text
4517
+
4518
+    /**
4519
+     * 0 terminated ASS/SSA compatible event line.
4520
+     * The presentation of this is unaffected by the other values in this
4521
+     * struct.
4522
+     */
4523
+    char *ass;
4524
+
4525
+    int flags;
4526
+} AVSubtitleRect;
4527
+
4528
+typedef struct AVSubtitle {
4529
+    uint16_t format; /* 0 = graphics */
4530
+    uint32_t start_display_time; /* relative to packet pts, in ms */
4531
+    uint32_t end_display_time; /* relative to packet pts, in ms */
4532
+    unsigned num_rects;
4533
+    AVSubtitleRect **rects;
4534
+    int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
4535
+} AVSubtitle;
4536
+
4537
+/**
4538
+ * This struct describes the properties of an encoded stream.
4539
+ *
4540
+ * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
4541
+ * be allocated with avcodec_parameters_alloc() and freed with
4542
+ * avcodec_parameters_free().
4543
+ */
4544
+typedef struct AVCodecParameters {
4545
+    /**
4546
+     * General type of the encoded data.
4547
+     */
4548
+    enum AVMediaType codec_type;
4549
+    /**
4550
+     * Specific type of the encoded data (the codec used).
4551
+     */
4552
+    enum AVCodecID   codec_id;
4553
+    /**
4554
+     * Additional information about the codec (corresponds to the AVI FOURCC).
4555
+     */
4556
+    uint32_t         codec_tag;
4557
+
4558
+    /**
4559
+     * Extra binary data needed for initializing the decoder, codec-dependent.
4560
+     *
4561
+     * Must be allocated with av_malloc() and will be freed by
4562
+     * avcodec_parameters_free(). The allocated size of extradata must be at
4563
+     * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
4564
+     * bytes zeroed.
4565
+     */
4566
+    uint8_t *extradata;
4567
+    /**
4568
+     * Size of the extradata content in bytes.
4569
+     */
4570
+    int      extradata_size;
4571
+
4572
+    /**
4573
+     * - video: the pixel format, the value corresponds to enum AVPixelFormat.
4574
+     * - audio: the sample format, the value corresponds to enum AVSampleFormat.
4575
+     */
4576
+    int format;
4577
+
4578
+    /**
4579
+     * The average bitrate of the encoded data (in bits per second).
4580
+     */
4581
+    int64_t bit_rate;
4582
+
4583
+    /**
4584
+     * The number of bits per sample in the codedwords.
4585
+     *
4586
+     * This is basically the bitrate per sample. It is mandatory for a bunch of
4587
+     * formats to actually decode them. It's the number of bits for one sample in
4588
+     * the actual coded bitstream.
4589
+     *
4590
+     * This could be for example 4 for ADPCM
4591
+     * For PCM formats this matches bits_per_raw_sample
4592
+     * Can be 0
4593
+     */
4594
+    int bits_per_coded_sample;
4595
+
4596
+    /**
4597
+     * This is the number of valid bits in each output sample. If the
4598
+     * sample format has more bits, the least significant bits are additional
4599
+     * padding bits, which are always 0. Use right shifts to reduce the sample
4600
+     * to its actual size. For example, audio formats with 24 bit samples will
4601
+     * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
4602
+     * To get the original sample use "(int32_t)sample >> 8"."
4603
+     *
4604
+     * For ADPCM this might be 12 or 16 or similar
4605
+     * Can be 0
4606
+     */
4607
+    int bits_per_raw_sample;
4608
+
4609
+    /**
4610
+     * Codec-specific bitstream restrictions that the stream conforms to.
4611
+     */
4612
+    int profile;
4613
+    int level;
4614
+
4615
+    /**
4616
+     * Video only. The dimensions of the video frame in pixels.
4617
+     */
4618
+    int width;
4619
+    int height;
4620
+
4621
+    /**
4622
+     * Video only. The aspect ratio (width / height) which a single pixel
4623
+     * should have when displayed.
4624
+     *
4625
+     * When the aspect ratio is unknown / undefined, the numerator should be
4626
+     * set to 0 (the denominator may have any value).
4627
+     */
4628
+    AVRational sample_aspect_ratio;
4629
+
4630
+    /**
4631
+     * Video only. The order of the fields in interlaced video.
4632
+     */
4633
+    enum AVFieldOrder                  field_order;
4634
+
4635
+    /**
4636
+     * Video only. Additional colorspace characteristics.
4637
+     */
4638
+    enum AVColorRange                  color_range;
4639
+    enum AVColorPrimaries              color_primaries;
4640
+    enum AVColorTransferCharacteristic color_trc;
4641
+    enum AVColorSpace                  color_space;
4642
+    enum AVChromaLocation              chroma_location;
4643
+
4644
+    /**
4645
+     * Video only. Number of delayed frames.
4646
+     */
4647
+    int video_delay;
4648
+
4649
+    /**
4650
+     * Audio only. The channel layout bitmask. May be 0 if the channel layout is
4651
+     * unknown or unspecified, otherwise the number of bits set must be equal to
4652
+     * the channels field.
4653
+     */
4654
+    uint64_t channel_layout;
4655
+    /**
4656
+     * Audio only. The number of audio channels.
4657
+     */
4658
+    int      channels;
4659
+    /**
4660
+     * Audio only. The number of audio samples per second.
4661
+     */
4662
+    int      sample_rate;
4663
+    /**
4664
+     * Audio only. The number of bytes per coded audio frame, required by some
4665
+     * formats.
4666
+     *
4667
+     * Corresponds to nBlockAlign in WAVEFORMATEX.
4668
+     */
4669
+    int      block_align;
4670
+    /**
4671
+     * Audio only. Audio frame size, if known. Required by some formats to be static.
4672
+     */
4673
+    int      frame_size;
4674
+
4675
+    /**
4676
+     * Audio only. The amount of padding (in samples) inserted by the encoder at
4677
+     * the beginning of the audio. I.e. this number of leading decoded samples
4678
+     * must be discarded by the caller to get the original audio without leading
4679
+     * padding.
4680
+     */
4681
+    int initial_padding;
4682
+    /**
4683
+     * Audio only. The amount of padding (in samples) appended by the encoder to
4684
+     * the end of the audio. I.e. this number of decoded samples must be
4685
+     * discarded by the caller from the end of the stream to get the original
4686
+     * audio without any trailing padding.
4687
+     */
4688
+    int trailing_padding;
4689
+    /**
4690
+     * Audio only. Number of samples to skip after a discontinuity.
4691
+     */
4692
+    int seek_preroll;
4693
+} AVCodecParameters;
4694
+
4695
+/**
4696
+ * Iterate over all registered codecs.
4697
+ *
4698
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
4699
+ *               point to NULL to start the iteration.
4700
+ *
4701
+ * @return the next registered codec or NULL when the iteration is
4702
+ *         finished
4703
+ */
4704
+const AVCodec *av_codec_iterate(void **opaque);
4705
+
4706
+#if FF_API_NEXT
4707
+/**
4708
+ * If c is NULL, returns the first registered codec,
4709
+ * if c is non-NULL, returns the next registered codec after c,
4710
+ * or NULL if c is the last one.
4711
+ */
4712
+attribute_deprecated
4713
+AVCodec *av_codec_next(const AVCodec *c);
4714
+#endif
4715
+
4716
+/**
4717
+ * Return the LIBAVCODEC_VERSION_INT constant.
4718
+ */
4719
+unsigned avcodec_version(void);
4720
+
4721
+/**
4722
+ * Return the libavcodec build-time configuration.
4723
+ */
4724
+const char *avcodec_configuration(void);
4725
+
4726
+/**
4727
+ * Return the libavcodec license.
4728
+ */
4729
+const char *avcodec_license(void);
4730
+
4731
+#if FF_API_NEXT
4732
+/**
4733
+ * Register the codec codec and initialize libavcodec.
4734
+ *
4735
+ * @warning either this function or avcodec_register_all() must be called
4736
+ * before any other libavcodec functions.
4737
+ *
4738
+ * @see avcodec_register_all()
4739
+ */
4740
+attribute_deprecated
4741
+void avcodec_register(AVCodec *codec);
4742
+
4743
+/**
4744
+ * Register all the codecs, parsers and bitstream filters which were enabled at
4745
+ * configuration time. If you do not call this function you can select exactly
4746
+ * which formats you want to support, by using the individual registration
4747
+ * functions.
4748
+ *
4749
+ * @see avcodec_register
4750
+ * @see av_register_codec_parser
4751
+ * @see av_register_bitstream_filter
4752
+ */
4753
+attribute_deprecated
4754
+void avcodec_register_all(void);
4755
+#endif
4756
+
4757
+/**
4758
+ * Allocate an AVCodecContext and set its fields to default values. The
4759
+ * resulting struct should be freed with avcodec_free_context().
4760
+ *
4761
+ * @param codec if non-NULL, allocate private data and initialize defaults
4762
+ *              for the given codec. It is illegal to then call avcodec_open2()
4763
+ *              with a different codec.
4764
+ *              If NULL, then the codec-specific defaults won't be initialized,
4765
+ *              which may result in suboptimal default settings (this is
4766
+ *              important mainly for encoders, e.g. libx264).
4767
+ *
4768
+ * @return An AVCodecContext filled with default values or NULL on failure.
4769
+ */
4770
+AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
4771
+
4772
+/**
4773
+ * Free the codec context and everything associated with it and write NULL to
4774
+ * the provided pointer.
4775
+ */
4776
+void avcodec_free_context(AVCodecContext **avctx);
4777
+
4778
+#if FF_API_GET_CONTEXT_DEFAULTS
4779
+/**
4780
+ * @deprecated This function should not be used, as closing and opening a codec
4781
+ * context multiple time is not supported. A new codec context should be
4782
+ * allocated for each new use.
4783
+ */
4784
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
4785
+#endif
4786
+
4787
+/**
4788
+ * Get the AVClass for AVCodecContext. It can be used in combination with
4789
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4790
+ *
4791
+ * @see av_opt_find().
4792
+ */
4793
+const AVClass *avcodec_get_class(void);
4794
+
4795
+#if FF_API_COPY_CONTEXT
4796
+/**
4797
+ * Get the AVClass for AVFrame. It can be used in combination with
4798
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4799
+ *
4800
+ * @see av_opt_find().
4801
+ */
4802
+const AVClass *avcodec_get_frame_class(void);
4803
+
4804
+/**
4805
+ * Get the AVClass for AVSubtitleRect. It can be used in combination with
4806
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
4807
+ *
4808
+ * @see av_opt_find().
4809
+ */
4810
+const AVClass *avcodec_get_subtitle_rect_class(void);
4811
+
4812
+/**
4813
+ * Copy the settings of the source AVCodecContext into the destination
4814
+ * AVCodecContext. The resulting destination codec context will be
4815
+ * unopened, i.e. you are required to call avcodec_open2() before you
4816
+ * can use this AVCodecContext to decode/encode video/audio data.
4817
+ *
4818
+ * @param dest target codec context, should be initialized with
4819
+ *             avcodec_alloc_context3(NULL), but otherwise uninitialized
4820
+ * @param src source codec context
4821
+ * @return AVERROR() on error (e.g. memory allocation error), 0 on success
4822
+ *
4823
+ * @deprecated The semantics of this function are ill-defined and it should not
4824
+ * be used. If you need to transfer the stream parameters from one codec context
4825
+ * to another, use an intermediate AVCodecParameters instance and the
4826
+ * avcodec_parameters_from_context() / avcodec_parameters_to_context()
4827
+ * functions.
4828
+ */
4829
+attribute_deprecated
4830
+int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
4831
+#endif
4832
+
4833
+/**
4834
+ * Allocate a new AVCodecParameters and set its fields to default values
4835
+ * (unknown/invalid/0). The returned struct must be freed with
4836
+ * avcodec_parameters_free().
4837
+ */
4838
+AVCodecParameters *avcodec_parameters_alloc(void);
4839
+
4840
+/**
4841
+ * Free an AVCodecParameters instance and everything associated with it and
4842
+ * write NULL to the supplied pointer.
4843
+ */
4844
+void avcodec_parameters_free(AVCodecParameters **par);
4845
+
4846
+/**
4847
+ * Copy the contents of src to dst. Any allocated fields in dst are freed and
4848
+ * replaced with newly allocated duplicates of the corresponding fields in src.
4849
+ *
4850
+ * @return >= 0 on success, a negative AVERROR code on failure.
4851
+ */
4852
+int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
4853
+
4854
+/**
4855
+ * Fill the parameters struct based on the values from the supplied codec
4856
+ * context. Any allocated fields in par are freed and replaced with duplicates
4857
+ * of the corresponding fields in codec.
4858
+ *
4859
+ * @return >= 0 on success, a negative AVERROR code on failure
4860
+ */
4861
+int avcodec_parameters_from_context(AVCodecParameters *par,
4862
+                                    const AVCodecContext *codec);
4863
+
4864
+/**
4865
+ * Fill the codec context based on the values from the supplied codec
4866
+ * parameters. Any allocated fields in codec that have a corresponding field in
4867
+ * par are freed and replaced with duplicates of the corresponding field in par.
4868
+ * Fields in codec that do not have a counterpart in par are not touched.
4869
+ *
4870
+ * @return >= 0 on success, a negative AVERROR code on failure.
4871
+ */
4872
+int avcodec_parameters_to_context(AVCodecContext *codec,
4873
+                                  const AVCodecParameters *par);
4874
+
4875
+/**
4876
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
4877
+ * function the context has to be allocated with avcodec_alloc_context3().
4878
+ *
4879
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
4880
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
4881
+ * retrieving a codec.
4882
+ *
4883
+ * @warning This function is not thread safe!
4884
+ *
4885
+ * @note Always call this function before using decoding routines (such as
4886
+ * @ref avcodec_receive_frame()).
4887
+ *
4888
+ * @code
4889
+ * avcodec_register_all();
4890
+ * av_dict_set(&opts, "b", "2.5M", 0);
4891
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
4892
+ * if (!codec)
4893
+ *     exit(1);
4894
+ *
4895
+ * context = avcodec_alloc_context3(codec);
4896
+ *
4897
+ * if (avcodec_open2(context, codec, opts) < 0)
4898
+ *     exit(1);
4899
+ * @endcode
4900
+ *
4901
+ * @param avctx The context to initialize.
4902
+ * @param codec The codec to open this context for. If a non-NULL codec has been
4903
+ *              previously passed to avcodec_alloc_context3() or
4904
+ *              for this context, then this parameter MUST be either NULL or
4905
+ *              equal to the previously passed codec.
4906
+ * @param options A dictionary filled with AVCodecContext and codec-private options.
4907
+ *                On return this object will be filled with options that were not found.
4908
+ *
4909
+ * @return zero on success, a negative value on error
4910
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
4911
+ *      av_dict_set(), av_opt_find().
4912
+ */
4913
+int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
4914
+
4915
+/**
4916
+ * Close a given AVCodecContext and free all the data associated with it
4917
+ * (but not the AVCodecContext itself).
4918
+ *
4919
+ * Calling this function on an AVCodecContext that hasn't been opened will free
4920
+ * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
4921
+ * codec. Subsequent calls will do nothing.
4922
+ *
4923
+ * @note Do not use this function. Use avcodec_free_context() to destroy a
4924
+ * codec context (either open or closed). Opening and closing a codec context
4925
+ * multiple times is not supported anymore -- use multiple codec contexts
4926
+ * instead.
4927
+ */
4928
+int avcodec_close(AVCodecContext *avctx);
4929
+
4930
+/**
4931
+ * Free all allocated data in the given subtitle struct.
4932
+ *
4933
+ * @param sub AVSubtitle to free.
4934
+ */
4935
+void avsubtitle_free(AVSubtitle *sub);
4936
+
4937
+/**
4938
+ * @}
4939
+ */
4940
+
4941
+/**
4942
+ * @addtogroup lavc_packet
4943
+ * @{
4944
+ */
4945
+
4946
+/**
4947
+ * Allocate an AVPacket and set its fields to default values.  The resulting
4948
+ * struct must be freed using av_packet_free().
4949
+ *
4950
+ * @return An AVPacket filled with default values or NULL on failure.
4951
+ *
4952
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
4953
+ * must be allocated through other means such as av_new_packet.
4954
+ *
4955
+ * @see av_new_packet
4956
+ */
4957
+AVPacket *av_packet_alloc(void);
4958
+
4959
+/**
4960
+ * Create a new packet that references the same data as src.
4961
+ *
4962
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
4963
+ *
4964
+ * @return newly created AVPacket on success, NULL on error.
4965
+ *
4966
+ * @see av_packet_alloc
4967
+ * @see av_packet_ref
4968
+ */
4969
+AVPacket *av_packet_clone(const AVPacket *src);
4970
+
4971
+/**
4972
+ * Free the packet, if the packet is reference counted, it will be
4973
+ * unreferenced first.
4974
+ *
4975
+ * @param pkt packet to be freed. The pointer will be set to NULL.
4976
+ * @note passing NULL is a no-op.
4977
+ */
4978
+void av_packet_free(AVPacket **pkt);
4979
+
4980
+/**
4981
+ * Initialize optional fields of a packet with default values.
4982
+ *
4983
+ * Note, this does not touch the data and size members, which have to be
4984
+ * initialized separately.
4985
+ *
4986
+ * @param pkt packet
4987
+ */
4988
+void av_init_packet(AVPacket *pkt);
4989
+
4990
+/**
4991
+ * Allocate the payload of a packet and initialize its fields with
4992
+ * default values.
4993
+ *
4994
+ * @param pkt packet
4995
+ * @param size wanted payload size
4996
+ * @return 0 if OK, AVERROR_xxx otherwise
4997
+ */
4998
+int av_new_packet(AVPacket *pkt, int size);
4999
+
5000
+/**
5001
+ * Reduce packet size, correctly zeroing padding
5002
+ *
5003
+ * @param pkt packet
5004
+ * @param size new size
5005
+ */
5006
+void av_shrink_packet(AVPacket *pkt, int size);
5007
+
5008
+/**
5009
+ * Increase packet size, correctly zeroing padding
5010
+ *
5011
+ * @param pkt packet
5012
+ * @param grow_by number of bytes by which to increase the size of the packet
5013
+ */
5014
+int av_grow_packet(AVPacket *pkt, int grow_by);
5015
+
5016
+/**
5017
+ * Initialize a reference-counted packet from av_malloc()ed data.
5018
+ *
5019
+ * @param pkt packet to be initialized. This function will set the data, size,
5020
+ *        buf and destruct fields, all others are left untouched.
5021
+ * @param data Data allocated by av_malloc() to be used as packet data. If this
5022
+ *        function returns successfully, the data is owned by the underlying AVBuffer.
5023
+ *        The caller may not access the data through other means.
5024
+ * @param size size of data in bytes, without the padding. I.e. the full buffer
5025
+ *        size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
5026
+ *
5027
+ * @return 0 on success, a negative AVERROR on error
5028
+ */
5029
+int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
5030
+
5031
+#if FF_API_AVPACKET_OLD_API
5032
+/**
5033
+ * @warning This is a hack - the packet memory allocation stuff is broken. The
5034
+ * packet is allocated if it was not really allocated.
5035
+ *
5036
+ * @deprecated Use av_packet_ref or av_packet_make_refcounted
5037
+ */
5038
+attribute_deprecated
5039
+int av_dup_packet(AVPacket *pkt);
5040
+/**
5041
+ * Copy packet, including contents
5042
+ *
5043
+ * @return 0 on success, negative AVERROR on fail
5044
+ *
5045
+ * @deprecated Use av_packet_ref
5046
+ */
5047
+attribute_deprecated
5048
+int av_copy_packet(AVPacket *dst, const AVPacket *src);
5049
+
5050
+/**
5051
+ * Copy packet side data
5052
+ *
5053
+ * @return 0 on success, negative AVERROR on fail
5054
+ *
5055
+ * @deprecated Use av_packet_copy_props
5056
+ */
5057
+attribute_deprecated
5058
+int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
5059
+
5060
+/**
5061
+ * Free a packet.
5062
+ *
5063
+ * @deprecated Use av_packet_unref
5064
+ *
5065
+ * @param pkt packet to free
5066
+ */
5067
+attribute_deprecated
5068
+void av_free_packet(AVPacket *pkt);
5069
+#endif
5070
+/**
5071
+ * Allocate new information of a packet.
5072
+ *
5073
+ * @param pkt packet
5074
+ * @param type side information type
5075
+ * @param size side information size
5076
+ * @return pointer to fresh allocated data or NULL otherwise
5077
+ */
5078
+uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5079
+                                 int size);
5080
+
5081
+/**
5082
+ * Wrap an existing array as a packet side data.
5083
+ *
5084
+ * @param pkt packet
5085
+ * @param type side information type
5086
+ * @param data the side data array. It must be allocated with the av_malloc()
5087
+ *             family of functions. The ownership of the data is transferred to
5088
+ *             pkt.
5089
+ * @param size side information size
5090
+ * @return a non-negative number on success, a negative AVERROR code on
5091
+ *         failure. On failure, the packet is unchanged and the data remains
5092
+ *         owned by the caller.
5093
+ */
5094
+int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5095
+                            uint8_t *data, size_t size);
5096
+
5097
+/**
5098
+ * Shrink the already allocated side data buffer
5099
+ *
5100
+ * @param pkt packet
5101
+ * @param type side information type
5102
+ * @param size new side information size
5103
+ * @return 0 on success, < 0 on failure
5104
+ */
5105
+int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
5106
+                               int size);
5107
+
5108
+/**
5109
+ * Get side information from packet.
5110
+ *
5111
+ * @param pkt packet
5112
+ * @param type desired side information type
5113
+ * @param size pointer for side information size to store (optional)
5114
+ * @return pointer to data if present or NULL otherwise
5115
+ */
5116
+uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
5117
+                                 int *size);
5118
+
5119
+#if FF_API_MERGE_SD_API
5120
+attribute_deprecated
5121
+int av_packet_merge_side_data(AVPacket *pkt);
5122
+
5123
+attribute_deprecated
5124
+int av_packet_split_side_data(AVPacket *pkt);
5125
+#endif
5126
+
5127
+const char *av_packet_side_data_name(enum AVPacketSideDataType type);
5128
+
5129
+/**
5130
+ * Pack a dictionary for use in side_data.
5131
+ *
5132
+ * @param dict The dictionary to pack.
5133
+ * @param size pointer to store the size of the returned data
5134
+ * @return pointer to data if successful, NULL otherwise
5135
+ */
5136
+uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
5137
+/**
5138
+ * Unpack a dictionary from side_data.
5139
+ *
5140
+ * @param data data from side_data
5141
+ * @param size size of the data
5142
+ * @param dict the metadata storage dictionary
5143
+ * @return 0 on success, < 0 on failure
5144
+ */
5145
+int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
5146
+
5147
+
5148
+/**
5149
+ * Convenience function to free all the side data stored.
5150
+ * All the other fields stay untouched.
5151
+ *
5152
+ * @param pkt packet
5153
+ */
5154
+void av_packet_free_side_data(AVPacket *pkt);
5155
+
5156
+/**
5157
+ * Setup a new reference to the data described by a given packet
5158
+ *
5159
+ * If src is reference-counted, setup dst as a new reference to the
5160
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
5161
+ * data from src into it.
5162
+ *
5163
+ * All the other fields are copied from src.
5164
+ *
5165
+ * @see av_packet_unref
5166
+ *
5167
+ * @param dst Destination packet
5168
+ * @param src Source packet
5169
+ *
5170
+ * @return 0 on success, a negative AVERROR on error.
5171
+ */
5172
+int av_packet_ref(AVPacket *dst, const AVPacket *src);
5173
+
5174
+/**
5175
+ * Wipe the packet.
5176
+ *
5177
+ * Unreference the buffer referenced by the packet and reset the
5178
+ * remaining packet fields to their default values.
5179
+ *
5180
+ * @param pkt The packet to be unreferenced.
5181
+ */
5182
+void av_packet_unref(AVPacket *pkt);
5183
+
5184
+/**
5185
+ * Move every field in src to dst and reset src.
5186
+ *
5187
+ * @see av_packet_unref
5188
+ *
5189
+ * @param src Source packet, will be reset
5190
+ * @param dst Destination packet
5191
+ */
5192
+void av_packet_move_ref(AVPacket *dst, AVPacket *src);
5193
+
5194
+/**
5195
+ * Copy only "properties" fields from src to dst.
5196
+ *
5197
+ * Properties for the purpose of this function are all the fields
5198
+ * beside those related to the packet data (buf, data, size)
5199
+ *
5200
+ * @param dst Destination packet
5201
+ * @param src Source packet
5202
+ *
5203
+ * @return 0 on success AVERROR on failure.
5204
+ */
5205
+int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
5206
+
5207
+/**
5208
+ * Ensure the data described by a given packet is reference counted.
5209
+ *
5210
+ * @note This function does not ensure that the reference will be writable.
5211
+ *       Use av_packet_make_writable instead for that purpose.
5212
+ *
5213
+ * @see av_packet_ref
5214
+ * @see av_packet_make_writable
5215
+ *
5216
+ * @param pkt packet whose data should be made reference counted.
5217
+ *
5218
+ * @return 0 on success, a negative AVERROR on error. On failure, the
5219
+ *         packet is unchanged.
5220
+ */
5221
+int av_packet_make_refcounted(AVPacket *pkt);
5222
+
5223
+/**
5224
+ * Create a writable reference for the data described by a given packet,
5225
+ * avoiding data copy if possible.
5226
+ *
5227
+ * @param pkt Packet whose data should be made writable.
5228
+ *
5229
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
5230
+ *         packet is unchanged.
5231
+ */
5232
+int av_packet_make_writable(AVPacket *pkt);
5233
+
5234
+/**
5235
+ * Convert valid timing fields (timestamps / durations) in a packet from one
5236
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
5237
+ * ignored.
5238
+ *
5239
+ * @param pkt packet on which the conversion will be performed
5240
+ * @param tb_src source timebase, in which the timing fields in pkt are
5241
+ *               expressed
5242
+ * @param tb_dst destination timebase, to which the timing fields will be
5243
+ *               converted
5244
+ */
5245
+void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
5246
+
5247
+/**
5248
+ * @}
5249
+ */
5250
+
5251
+/**
5252
+ * @addtogroup lavc_decoding
5253
+ * @{
5254
+ */
5255
+
5256
+/**
5257
+ * Find a registered decoder with a matching codec ID.
5258
+ *
5259
+ * @param id AVCodecID of the requested decoder
5260
+ * @return A decoder if one was found, NULL otherwise.
5261
+ */
5262
+AVCodec *avcodec_find_decoder(enum AVCodecID id);
5263
+
5264
+/**
5265
+ * Find a registered decoder with the specified name.
5266
+ *
5267
+ * @param name name of the requested decoder
5268
+ * @return A decoder if one was found, NULL otherwise.
5269
+ */
5270
+AVCodec *avcodec_find_decoder_by_name(const char *name);
5271
+
5272
+/**
5273
+ * The default callback for AVCodecContext.get_buffer2(). It is made public so
5274
+ * it can be called by custom get_buffer2() implementations for decoders without
5275
+ * AV_CODEC_CAP_DR1 set.
5276
+ */
5277
+int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
5278
+
5279
+/**
5280
+ * Modify width and height values so that they will result in a memory
5281
+ * buffer that is acceptable for the codec if you do not use any horizontal
5282
+ * padding.
5283
+ *
5284
+ * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5285
+ */
5286
+void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
5287
+
5288
+/**
5289
+ * Modify width and height values so that they will result in a memory
5290
+ * buffer that is acceptable for the codec if you also ensure that all
5291
+ * line sizes are a multiple of the respective linesize_align[i].
5292
+ *
5293
+ * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
5294
+ */
5295
+void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
5296
+                               int linesize_align[AV_NUM_DATA_POINTERS]);
5297
+
5298
+/**
5299
+ * Converts AVChromaLocation to swscale x/y chroma position.
5300
+ *
5301
+ * The positions represent the chroma (0,0) position in a coordinates system
5302
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5303
+ *
5304
+ * @param xpos  horizontal chroma sample position
5305
+ * @param ypos  vertical   chroma sample position
5306
+ */
5307
+int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
5308
+
5309
+/**
5310
+ * Converts swscale x/y chroma position to AVChromaLocation.
5311
+ *
5312
+ * The positions represent the chroma (0,0) position in a coordinates system
5313
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
5314
+ *
5315
+ * @param xpos  horizontal chroma sample position
5316
+ * @param ypos  vertical   chroma sample position
5317
+ */
5318
+enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
5319
+
5320
+/**
5321
+ * Decode the audio frame of size avpkt->size from avpkt->data into frame.
5322
+ *
5323
+ * Some decoders may support multiple frames in a single AVPacket. Such
5324
+ * decoders would then just decode the first frame and the return value would be
5325
+ * less than the packet size. In this case, avcodec_decode_audio4 has to be
5326
+ * called again with an AVPacket containing the remaining data in order to
5327
+ * decode the second frame, etc...  Even if no frames are returned, the packet
5328
+ * needs to be fed to the decoder with remaining data until it is completely
5329
+ * consumed or an error occurs.
5330
+ *
5331
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5332
+ * and output. This means that for some packets they will not immediately
5333
+ * produce decoded output and need to be flushed at the end of decoding to get
5334
+ * all the decoded data. Flushing is done by calling this function with packets
5335
+ * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5336
+ * returning samples. It is safe to flush even those decoders that are not
5337
+ * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
5338
+ *
5339
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5340
+ *          larger than the actual read bytes because some optimized bitstream
5341
+ *          readers read 32 or 64 bits at once and could read over the end.
5342
+ *
5343
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5344
+ * before packets may be fed to the decoder.
5345
+ *
5346
+ * @param      avctx the codec context
5347
+ * @param[out] frame The AVFrame in which to store decoded audio samples.
5348
+ *                   The decoder will allocate a buffer for the decoded frame by
5349
+ *                   calling the AVCodecContext.get_buffer2() callback.
5350
+ *                   When AVCodecContext.refcounted_frames is set to 1, the frame is
5351
+ *                   reference counted and the returned reference belongs to the
5352
+ *                   caller. The caller must release the frame using av_frame_unref()
5353
+ *                   when the frame is no longer needed. The caller may safely write
5354
+ *                   to the frame if av_frame_is_writable() returns 1.
5355
+ *                   When AVCodecContext.refcounted_frames is set to 0, the returned
5356
+ *                   reference belongs to the decoder and is valid only until the
5357
+ *                   next call to this function or until closing or flushing the
5358
+ *                   decoder. The caller may not write to it.
5359
+ * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
5360
+ *                           non-zero. Note that this field being set to zero
5361
+ *                           does not mean that an error has occurred. For
5362
+ *                           decoders with AV_CODEC_CAP_DELAY set, no given decode
5363
+ *                           call is guaranteed to produce a frame.
5364
+ * @param[in]  avpkt The input AVPacket containing the input buffer.
5365
+ *                   At least avpkt->data and avpkt->size should be set. Some
5366
+ *                   decoders might also require additional fields to be set.
5367
+ * @return A negative error code is returned if an error occurred during
5368
+ *         decoding, otherwise the number of bytes consumed from the input
5369
+ *         AVPacket is returned.
5370
+ *
5371
+* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5372
+ */
5373
+attribute_deprecated
5374
+int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
5375
+                          int *got_frame_ptr, const AVPacket *avpkt);
5376
+
5377
+/**
5378
+ * Decode the video frame of size avpkt->size from avpkt->data into picture.
5379
+ * Some decoders may support multiple frames in a single AVPacket, such
5380
+ * decoders would then just decode the first frame.
5381
+ *
5382
+ * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
5383
+ * the actual read bytes because some optimized bitstream readers read 32 or 64
5384
+ * bits at once and could read over the end.
5385
+ *
5386
+ * @warning The end of the input buffer buf should be set to 0 to ensure that
5387
+ * no overreading happens for damaged MPEG streams.
5388
+ *
5389
+ * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
5390
+ * between input and output, these need to be fed with avpkt->data=NULL,
5391
+ * avpkt->size=0 at the end to return the remaining frames.
5392
+ *
5393
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5394
+ * before packets may be fed to the decoder.
5395
+ *
5396
+ * @param avctx the codec context
5397
+ * @param[out] picture The AVFrame in which the decoded video frame will be stored.
5398
+ *             Use av_frame_alloc() to get an AVFrame. The codec will
5399
+ *             allocate memory for the actual bitmap by calling the
5400
+ *             AVCodecContext.get_buffer2() callback.
5401
+ *             When AVCodecContext.refcounted_frames is set to 1, the frame is
5402
+ *             reference counted and the returned reference belongs to the
5403
+ *             caller. The caller must release the frame using av_frame_unref()
5404
+ *             when the frame is no longer needed. The caller may safely write
5405
+ *             to the frame if av_frame_is_writable() returns 1.
5406
+ *             When AVCodecContext.refcounted_frames is set to 0, the returned
5407
+ *             reference belongs to the decoder and is valid only until the
5408
+ *             next call to this function or until closing or flushing the
5409
+ *             decoder. The caller may not write to it.
5410
+ *
5411
+ * @param[in] avpkt The input AVPacket containing the input buffer.
5412
+ *            You can create such packet with av_init_packet() and by then setting
5413
+ *            data and size, some decoders might in addition need other fields like
5414
+ *            flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
5415
+ *            fields possible.
5416
+ * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
5417
+ * @return On error a negative value is returned, otherwise the number of bytes
5418
+ * used or zero if no frame could be decompressed.
5419
+ *
5420
+ * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
5421
+ */
5422
+attribute_deprecated
5423
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
5424
+                         int *got_picture_ptr,
5425
+                         const AVPacket *avpkt);
5426
+
5427
+/**
5428
+ * Decode a subtitle message.
5429
+ * Return a negative value on error, otherwise return the number of bytes used.
5430
+ * If no subtitle could be decompressed, got_sub_ptr is zero.
5431
+ * Otherwise, the subtitle is stored in *sub.
5432
+ * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
5433
+ * simplicity, because the performance difference is expect to be negligible
5434
+ * and reusing a get_buffer written for video codecs would probably perform badly
5435
+ * due to a potentially very different allocation pattern.
5436
+ *
5437
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
5438
+ * and output. This means that for some packets they will not immediately
5439
+ * produce decoded output and need to be flushed at the end of decoding to get
5440
+ * all the decoded data. Flushing is done by calling this function with packets
5441
+ * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
5442
+ * returning subtitles. It is safe to flush even those decoders that are not
5443
+ * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
5444
+ *
5445
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5446
+ * before packets may be fed to the decoder.
5447
+ *
5448
+ * @param avctx the codec context
5449
+ * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
5450
+ *                 must be freed with avsubtitle_free if *got_sub_ptr is set.
5451
+ * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
5452
+ * @param[in] avpkt The input AVPacket containing the input buffer.
5453
+ */
5454
+int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
5455
+                            int *got_sub_ptr,
5456
+                            AVPacket *avpkt);
5457
+
5458
+/**
5459
+ * Supply raw packet data as input to a decoder.
5460
+ *
5461
+ * Internally, this call will copy relevant AVCodecContext fields, which can
5462
+ * influence decoding per-packet, and apply them when the packet is actually
5463
+ * decoded. (For example AVCodecContext.skip_frame, which might direct the
5464
+ * decoder to drop the frame contained by the packet sent with this function.)
5465
+ *
5466
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
5467
+ *          larger than the actual read bytes because some optimized bitstream
5468
+ *          readers read 32 or 64 bits at once and could read over the end.
5469
+ *
5470
+ * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
5471
+ *          on the same AVCodecContext. It will return unexpected results now
5472
+ *          or in future libavcodec versions.
5473
+ *
5474
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
5475
+ *       before packets may be fed to the decoder.
5476
+ *
5477
+ * @param avctx codec context
5478
+ * @param[in] avpkt The input AVPacket. Usually, this will be a single video
5479
+ *                  frame, or several complete audio frames.
5480
+ *                  Ownership of the packet remains with the caller, and the
5481
+ *                  decoder will not write to the packet. The decoder may create
5482
+ *                  a reference to the packet data (or copy it if the packet is
5483
+ *                  not reference-counted).
5484
+ *                  Unlike with older APIs, the packet is always fully consumed,
5485
+ *                  and if it contains multiple frames (e.g. some audio codecs),
5486
+ *                  will require you to call avcodec_receive_frame() multiple
5487
+ *                  times afterwards before you can send a new packet.
5488
+ *                  It can be NULL (or an AVPacket with data set to NULL and
5489
+ *                  size set to 0); in this case, it is considered a flush
5490
+ *                  packet, which signals the end of the stream. Sending the
5491
+ *                  first flush packet will return success. Subsequent ones are
5492
+ *                  unnecessary and will return AVERROR_EOF. If the decoder
5493
+ *                  still has frames buffered, it will return them after sending
5494
+ *                  a flush packet.
5495
+ *
5496
+ * @return 0 on success, otherwise negative error code:
5497
+ *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5498
+ *                         must read output with avcodec_receive_frame() (once
5499
+ *                         all output is read, the packet should be resent, and
5500
+ *                         the call will not fail with EAGAIN).
5501
+ *      AVERROR_EOF:       the decoder has been flushed, and no new packets can
5502
+ *                         be sent to it (also returned if more than 1 flush
5503
+ *                         packet is sent)
5504
+ *      AVERROR(EINVAL):   codec not opened, it is an encoder, or requires flush
5505
+ *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5506
+ *      other errors: legitimate decoding errors
5507
+ */
5508
+int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
5509
+
5510
+/**
5511
+ * Return decoded output data from a decoder.
5512
+ *
5513
+ * @param avctx codec context
5514
+ * @param frame This will be set to a reference-counted video or audio
5515
+ *              frame (depending on the decoder type) allocated by the
5516
+ *              decoder. Note that the function will always call
5517
+ *              av_frame_unref(frame) before doing anything else.
5518
+ *
5519
+ * @return
5520
+ *      0:                 success, a frame was returned
5521
+ *      AVERROR(EAGAIN):   output is not available in this state - user must try
5522
+ *                         to send new input
5523
+ *      AVERROR_EOF:       the decoder has been fully flushed, and there will be
5524
+ *                         no more output frames
5525
+ *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5526
+ *      other negative values: legitimate decoding errors
5527
+ */
5528
+int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
5529
+
5530
+/**
5531
+ * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
5532
+ * to retrieve buffered output packets.
5533
+ *
5534
+ * @param avctx     codec context
5535
+ * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
5536
+ *                  Ownership of the frame remains with the caller, and the
5537
+ *                  encoder will not write to the frame. The encoder may create
5538
+ *                  a reference to the frame data (or copy it if the frame is
5539
+ *                  not reference-counted).
5540
+ *                  It can be NULL, in which case it is considered a flush
5541
+ *                  packet.  This signals the end of the stream. If the encoder
5542
+ *                  still has packets buffered, it will return them after this
5543
+ *                  call. Once flushing mode has been entered, additional flush
5544
+ *                  packets are ignored, and sending frames will return
5545
+ *                  AVERROR_EOF.
5546
+ *
5547
+ *                  For audio:
5548
+ *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
5549
+ *                  can have any number of samples.
5550
+ *                  If it is not set, frame->nb_samples must be equal to
5551
+ *                  avctx->frame_size for all frames except the last.
5552
+ *                  The final frame may be smaller than avctx->frame_size.
5553
+ * @return 0 on success, otherwise negative error code:
5554
+ *      AVERROR(EAGAIN):   input is not accepted in the current state - user
5555
+ *                         must read output with avcodec_receive_packet() (once
5556
+ *                         all output is read, the packet should be resent, and
5557
+ *                         the call will not fail with EAGAIN).
5558
+ *      AVERROR_EOF:       the encoder has been flushed, and no new frames can
5559
+ *                         be sent to it
5560
+ *      AVERROR(EINVAL):   codec not opened, refcounted_frames not set, it is a
5561
+ *                         decoder, or requires flush
5562
+ *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
5563
+ *      other errors: legitimate decoding errors
5564
+ */
5565
+int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
5566
+
5567
+/**
5568
+ * Read encoded data from the encoder.
5569
+ *
5570
+ * @param avctx codec context
5571
+ * @param avpkt This will be set to a reference-counted packet allocated by the
5572
+ *              encoder. Note that the function will always call
5573
+ *              av_frame_unref(frame) before doing anything else.
5574
+ * @return 0 on success, otherwise negative error code:
5575
+ *      AVERROR(EAGAIN):   output is not available in the current state - user
5576
+ *                         must try to send input
5577
+ *      AVERROR_EOF:       the encoder has been fully flushed, and there will be
5578
+ *                         no more output packets
5579
+ *      AVERROR(EINVAL):   codec not opened, or it is an encoder
5580
+ *      other errors: legitimate decoding errors
5581
+ */
5582
+int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
5583
+
5584
+/**
5585
+ * Create and return a AVHWFramesContext with values adequate for hardware
5586
+ * decoding. This is meant to get called from the get_format callback, and is
5587
+ * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
5588
+ * This API is for decoding with certain hardware acceleration modes/APIs only.
5589
+ *
5590
+ * The returned AVHWFramesContext is not initialized. The caller must do this
5591
+ * with av_hwframe_ctx_init().
5592
+ *
5593
+ * Calling this function is not a requirement, but makes it simpler to avoid
5594
+ * codec or hardware API specific details when manually allocating frames.
5595
+ *
5596
+ * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
5597
+ * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
5598
+ * it unnecessary to call this function or having to care about
5599
+ * AVHWFramesContext initialization at all.
5600
+ *
5601
+ * There are a number of requirements for calling this function:
5602
+ *
5603
+ * - It must be called from get_format with the same avctx parameter that was
5604
+ *   passed to get_format. Calling it outside of get_format is not allowed, and
5605
+ *   can trigger undefined behavior.
5606
+ * - The function is not always supported (see description of return values).
5607
+ *   Even if this function returns successfully, hwaccel initialization could
5608
+ *   fail later. (The degree to which implementations check whether the stream
5609
+ *   is actually supported varies. Some do this check only after the user's
5610
+ *   get_format callback returns.)
5611
+ * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
5612
+ *   user decides to use a AVHWFramesContext prepared with this API function,
5613
+ *   the user must return the same hw_pix_fmt from get_format.
5614
+ * - The device_ref passed to this function must support the given hw_pix_fmt.
5615
+ * - After calling this API function, it is the user's responsibility to
5616
+ *   initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
5617
+ *   and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
5618
+ *   before returning from get_format (this is implied by the normal
5619
+ *   AVCodecContext.hw_frames_ctx API rules).
5620
+ * - The AVHWFramesContext parameters may change every time time get_format is
5621
+ *   called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
5622
+ *   you are inherently required to go through this process again on every
5623
+ *   get_format call.
5624
+ * - It is perfectly possible to call this function without actually using
5625
+ *   the resulting AVHWFramesContext. One use-case might be trying to reuse a
5626
+ *   previously initialized AVHWFramesContext, and calling this API function
5627
+ *   only to test whether the required frame parameters have changed.
5628
+ * - Fields that use dynamically allocated values of any kind must not be set
5629
+ *   by the user unless setting them is explicitly allowed by the documentation.
5630
+ *   If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
5631
+ *   the new free callback must call the potentially set previous free callback.
5632
+ *   This API call may set any dynamically allocated fields, including the free
5633
+ *   callback.
5634
+ *
5635
+ * The function will set at least the following fields on AVHWFramesContext
5636
+ * (potentially more, depending on hwaccel API):
5637
+ *
5638
+ * - All fields set by av_hwframe_ctx_alloc().
5639
+ * - Set the format field to hw_pix_fmt.
5640
+ * - Set the sw_format field to the most suited and most versatile format. (An
5641
+ *   implication is that this will prefer generic formats over opaque formats
5642
+ *   with arbitrary restrictions, if possible.)
5643
+ * - Set the width/height fields to the coded frame size, rounded up to the
5644
+ *   API-specific minimum alignment.
5645
+ * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
5646
+ *   field to the number of maximum reference surfaces possible with the codec,
5647
+ *   plus 1 surface for the user to work (meaning the user can safely reference
5648
+ *   at most 1 decoded surface at a time), plus additional buffering introduced
5649
+ *   by frame threading. If the hwaccel does not require pre-allocation, the
5650
+ *   field is left to 0, and the decoder will allocate new surfaces on demand
5651
+ *   during decoding.
5652
+ * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
5653
+ *   hardware API.
5654
+ *
5655
+ * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
5656
+ * with basic frame parameters set.
5657
+ *
5658
+ * The function is stateless, and does not change the AVCodecContext or the
5659
+ * device_ref AVHWDeviceContext.
5660
+ *
5661
+ * @param avctx The context which is currently calling get_format, and which
5662
+ *              implicitly contains all state needed for filling the returned
5663
+ *              AVHWFramesContext properly.
5664
+ * @param device_ref A reference to the AVHWDeviceContext describing the device
5665
+ *                   which will be used by the hardware decoder.
5666
+ * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
5667
+ * @param out_frames_ref On success, set to a reference to an _uninitialized_
5668
+ *                       AVHWFramesContext, created from the given device_ref.
5669
+ *                       Fields will be set to values required for decoding.
5670
+ *                       Not changed if an error is returned.
5671
+ * @return zero on success, a negative value on error. The following error codes
5672
+ *         have special semantics:
5673
+ *      AVERROR(ENOENT): the decoder does not support this functionality. Setup
5674
+ *                       is always manual, or it is a decoder which does not
5675
+ *                       support setting AVCodecContext.hw_frames_ctx at all,
5676
+ *                       or it is a software format.
5677
+ *      AVERROR(EINVAL): it is known that hardware decoding is not supported for
5678
+ *                       this configuration, or the device_ref is not supported
5679
+ *                       for the hwaccel referenced by hw_pix_fmt.
5680
+ */
5681
+int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
5682
+                                     AVBufferRef *device_ref,
5683
+                                     enum AVPixelFormat hw_pix_fmt,
5684
+                                     AVBufferRef **out_frames_ref);
5685
+
5686
+
5687
+
5688
+/**
5689
+ * @defgroup lavc_parsing Frame parsing
5690
+ * @{
5691
+ */
5692
+
5693
+enum AVPictureStructure {
5694
+    AV_PICTURE_STRUCTURE_UNKNOWN,      //< unknown
5695
+    AV_PICTURE_STRUCTURE_TOP_FIELD,    //< coded as top field
5696
+    AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
5697
+    AV_PICTURE_STRUCTURE_FRAME,        //< coded as frame
5698
+};
5699
+
5700
+typedef struct AVCodecParserContext {
5701
+    void *priv_data;
5702
+    struct AVCodecParser *parser;
5703
+    int64_t frame_offset; /* offset of the current frame */
5704
+    int64_t cur_offset; /* current offset
5705
+                           (incremented by each av_parser_parse()) */
5706
+    int64_t next_frame_offset; /* offset of the next frame */
5707
+    /* video info */
5708
+    int pict_type; /* XXX: Put it back in AVCodecContext. */
5709
+    /**
5710
+     * This field is used for proper frame duration computation in lavf.
5711
+     * It signals, how much longer the frame duration of the current frame
5712
+     * is compared to normal frame duration.
5713
+     *
5714
+     * frame_duration = (1 + repeat_pict) * time_base
5715
+     *
5716
+     * It is used by codecs like H.264 to display telecined material.
5717
+     */
5718
+    int repeat_pict; /* XXX: Put it back in AVCodecContext. */
5719
+    int64_t pts;     /* pts of the current frame */
5720
+    int64_t dts;     /* dts of the current frame */
5721
+
5722
+    /* private data */
5723
+    int64_t last_pts;
5724
+    int64_t last_dts;
5725
+    int fetch_timestamp;
5726
+
5727
+#define AV_PARSER_PTS_NB 4
5728
+    int cur_frame_start_index;
5729
+    int64_t cur_frame_offset[AV_PARSER_PTS_NB];
5730
+    int64_t cur_frame_pts[AV_PARSER_PTS_NB];
5731
+    int64_t cur_frame_dts[AV_PARSER_PTS_NB];
5732
+
5733
+    int flags;
5734
+#define PARSER_FLAG_COMPLETE_FRAMES           0x0001
5735
+#define PARSER_FLAG_ONCE                      0x0002
5736
+/// Set if the parser has a valid file offset
5737
+#define PARSER_FLAG_FETCHED_OFFSET            0x0004
5738
+#define PARSER_FLAG_USE_CODEC_TS              0x1000
5739
+
5740
+    int64_t offset;      ///< byte offset from starting packet start
5741
+    int64_t cur_frame_end[AV_PARSER_PTS_NB];
5742
+
5743
+    /**
5744
+     * Set by parser to 1 for key frames and 0 for non-key frames.
5745
+     * It is initialized to -1, so if the parser doesn't set this flag,
5746
+     * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
5747
+     * will be used.
5748
+     */
5749
+    int key_frame;
5750
+
5751
+#if FF_API_CONVERGENCE_DURATION
5752
+    /**
5753
+     * @deprecated unused
5754
+     */
5755
+    attribute_deprecated
5756
+    int64_t convergence_duration;
5757
+#endif
5758
+
5759
+    // Timestamp generation support:
5760
+    /**
5761
+     * Synchronization point for start of timestamp generation.
5762
+     *
5763
+     * Set to >0 for sync point, 0 for no sync point and <0 for undefined
5764
+     * (default).
5765
+     *
5766
+     * For example, this corresponds to presence of H.264 buffering period
5767
+     * SEI message.
5768
+     */
5769
+    int dts_sync_point;
5770
+
5771
+    /**
5772
+     * Offset of the current timestamp against last timestamp sync point in
5773
+     * units of AVCodecContext.time_base.
5774
+     *
5775
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5776
+     * contain a valid timestamp offset.
5777
+     *
5778
+     * Note that the timestamp of sync point has usually a nonzero
5779
+     * dts_ref_dts_delta, which refers to the previous sync point. Offset of
5780
+     * the next frame after timestamp sync point will be usually 1.
5781
+     *
5782
+     * For example, this corresponds to H.264 cpb_removal_delay.
5783
+     */
5784
+    int dts_ref_dts_delta;
5785
+
5786
+    /**
5787
+     * Presentation delay of current frame in units of AVCodecContext.time_base.
5788
+     *
5789
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
5790
+     * contain valid non-negative timestamp delta (presentation time of a frame
5791
+     * must not lie in the past).
5792
+     *
5793
+     * This delay represents the difference between decoding and presentation
5794
+     * time of the frame.
5795
+     *
5796
+     * For example, this corresponds to H.264 dpb_output_delay.
5797
+     */
5798
+    int pts_dts_delta;
5799
+
5800
+    /**
5801
+     * Position of the packet in file.
5802
+     *
5803
+     * Analogous to cur_frame_pts/dts
5804
+     */
5805
+    int64_t cur_frame_pos[AV_PARSER_PTS_NB];
5806
+
5807
+    /**
5808
+     * Byte position of currently parsed frame in stream.
5809
+     */
5810
+    int64_t pos;
5811
+
5812
+    /**
5813
+     * Previous frame byte position.
5814
+     */
5815
+    int64_t last_pos;
5816
+
5817
+    /**
5818
+     * Duration of the current frame.
5819
+     * For audio, this is in units of 1 / AVCodecContext.sample_rate.
5820
+     * For all other types, this is in units of AVCodecContext.time_base.
5821
+     */
5822
+    int duration;
5823
+
5824
+    enum AVFieldOrder field_order;
5825
+
5826
+    /**
5827
+     * Indicate whether a picture is coded as a frame, top field or bottom field.
5828
+     *
5829
+     * For example, H.264 field_pic_flag equal to 0 corresponds to
5830
+     * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
5831
+     * equal to 1 and bottom_field_flag equal to 0 corresponds to
5832
+     * AV_PICTURE_STRUCTURE_TOP_FIELD.
5833
+     */
5834
+    enum AVPictureStructure picture_structure;
5835
+
5836
+    /**
5837
+     * Picture number incremented in presentation or output order.
5838
+     * This field may be reinitialized at the first picture of a new sequence.
5839
+     *
5840
+     * For example, this corresponds to H.264 PicOrderCnt.
5841
+     */
5842
+    int output_picture_number;
5843
+
5844
+    /**
5845
+     * Dimensions of the decoded video intended for presentation.
5846
+     */
5847
+    int width;
5848
+    int height;
5849
+
5850
+    /**
5851
+     * Dimensions of the coded video.
5852
+     */
5853
+    int coded_width;
5854
+    int coded_height;
5855
+
5856
+    /**
5857
+     * The format of the coded data, corresponds to enum AVPixelFormat for video
5858
+     * and for enum AVSampleFormat for audio.
5859
+     *
5860
+     * Note that a decoder can have considerable freedom in how exactly it
5861
+     * decodes the data, so the format reported here might be different from the
5862
+     * one returned by a decoder.
5863
+     */
5864
+    int format;
5865
+} AVCodecParserContext;
5866
+
5867
+typedef struct AVCodecParser {
5868
+    int codec_ids[5]; /* several codec IDs are permitted */
5869
+    int priv_data_size;
5870
+    int (*parser_init)(AVCodecParserContext *s);
5871
+    /* This callback never returns an error, a negative value means that
5872
+     * the frame start was in a previous packet. */
5873
+    int (*parser_parse)(AVCodecParserContext *s,
5874
+                        AVCodecContext *avctx,
5875
+                        const uint8_t **poutbuf, int *poutbuf_size,
5876
+                        const uint8_t *buf, int buf_size);
5877
+    void (*parser_close)(AVCodecParserContext *s);
5878
+    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
5879
+    struct AVCodecParser *next;
5880
+} AVCodecParser;
5881
+
5882
+/**
5883
+ * Iterate over all registered codec parsers.
5884
+ *
5885
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
5886
+ *               point to NULL to start the iteration.
5887
+ *
5888
+ * @return the next registered codec parser or NULL when the iteration is
5889
+ *         finished
5890
+ */
5891
+const AVCodecParser *av_parser_iterate(void **opaque);
5892
+
5893
+attribute_deprecated
5894
+AVCodecParser *av_parser_next(const AVCodecParser *c);
5895
+
5896
+attribute_deprecated
5897
+void av_register_codec_parser(AVCodecParser *parser);
5898
+AVCodecParserContext *av_parser_init(int codec_id);
5899
+
5900
+/**
5901
+ * Parse a packet.
5902
+ *
5903
+ * @param s             parser context.
5904
+ * @param avctx         codec context.
5905
+ * @param poutbuf       set to pointer to parsed buffer or NULL if not yet finished.
5906
+ * @param poutbuf_size  set to size of parsed buffer or zero if not yet finished.
5907
+ * @param buf           input buffer.
5908
+ * @param buf_size      buffer size in bytes without the padding. I.e. the full buffer
5909
+                        size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
5910
+                        To signal EOF, this should be 0 (so that the last frame
5911
+                        can be output).
5912
+ * @param pts           input presentation timestamp.
5913
+ * @param dts           input decoding timestamp.
5914
+ * @param pos           input byte position in stream.
5915
+ * @return the number of bytes of the input bitstream used.
5916
+ *
5917
+ * Example:
5918
+ * @code
5919
+ *   while(in_len){
5920
+ *       len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
5921
+ *                                        in_data, in_len,
5922
+ *                                        pts, dts, pos);
5923
+ *       in_data += len;
5924
+ *       in_len  -= len;
5925
+ *
5926
+ *       if(size)
5927
+ *          decode_frame(data, size);
5928
+ *   }
5929
+ * @endcode
5930
+ */
5931
+int av_parser_parse2(AVCodecParserContext *s,
5932
+                     AVCodecContext *avctx,
5933
+                     uint8_t **poutbuf, int *poutbuf_size,
5934
+                     const uint8_t *buf, int buf_size,
5935
+                     int64_t pts, int64_t dts,
5936
+                     int64_t pos);
5937
+
5938
+/**
5939
+ * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
5940
+ * @deprecated use AVBitStreamFilter
5941
+ */
5942
+int av_parser_change(AVCodecParserContext *s,
5943
+                     AVCodecContext *avctx,
5944
+                     uint8_t **poutbuf, int *poutbuf_size,
5945
+                     const uint8_t *buf, int buf_size, int keyframe);
5946
+void av_parser_close(AVCodecParserContext *s);
5947
+
5948
+/**
5949
+ * @}
5950
+ * @}
5951
+ */
5952
+
5953
+/**
5954
+ * @addtogroup lavc_encoding
5955
+ * @{
5956
+ */
5957
+
5958
+/**
5959
+ * Find a registered encoder with a matching codec ID.
5960
+ *
5961
+ * @param id AVCodecID of the requested encoder
5962
+ * @return An encoder if one was found, NULL otherwise.
5963
+ */
5964
+AVCodec *avcodec_find_encoder(enum AVCodecID id);
5965
+
5966
+/**
5967
+ * Find a registered encoder with the specified name.
5968
+ *
5969
+ * @param name name of the requested encoder
5970
+ * @return An encoder if one was found, NULL otherwise.
5971
+ */
5972
+AVCodec *avcodec_find_encoder_by_name(const char *name);
5973
+
5974
+/**
5975
+ * Encode a frame of audio.
5976
+ *
5977
+ * Takes input samples from frame and writes the next output packet, if
5978
+ * available, to avpkt. The output packet does not necessarily contain data for
5979
+ * the most recent frame, as encoders can delay, split, and combine input frames
5980
+ * internally as needed.
5981
+ *
5982
+ * @param avctx     codec context
5983
+ * @param avpkt     output AVPacket.
5984
+ *                  The user can supply an output buffer by setting
5985
+ *                  avpkt->data and avpkt->size prior to calling the
5986
+ *                  function, but if the size of the user-provided data is not
5987
+ *                  large enough, encoding will fail. If avpkt->data and
5988
+ *                  avpkt->size are set, avpkt->destruct must also be set. All
5989
+ *                  other AVPacket fields will be reset by the encoder using
5990
+ *                  av_init_packet(). If avpkt->data is NULL, the encoder will
5991
+ *                  allocate it. The encoder will set avpkt->size to the size
5992
+ *                  of the output packet.
5993
+ *
5994
+ *                  If this function fails or produces no output, avpkt will be
5995
+ *                  freed using av_packet_unref().
5996
+ * @param[in] frame AVFrame containing the raw audio data to be encoded.
5997
+ *                  May be NULL when flushing an encoder that has the
5998
+ *                  AV_CODEC_CAP_DELAY capability set.
5999
+ *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
6000
+ *                  can have any number of samples.
6001
+ *                  If it is not set, frame->nb_samples must be equal to
6002
+ *                  avctx->frame_size for all frames except the last.
6003
+ *                  The final frame may be smaller than avctx->frame_size.
6004
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6005
+ *                            output packet is non-empty, and to 0 if it is
6006
+ *                            empty. If the function returns an error, the
6007
+ *                            packet can be assumed to be invalid, and the
6008
+ *                            value of got_packet_ptr is undefined and should
6009
+ *                            not be used.
6010
+ * @return          0 on success, negative error code on failure
6011
+ *
6012
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6013
+ */
6014
+attribute_deprecated
6015
+int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
6016
+                          const AVFrame *frame, int *got_packet_ptr);
6017
+
6018
+/**
6019
+ * Encode a frame of video.
6020
+ *
6021
+ * Takes input raw video data from frame and writes the next output packet, if
6022
+ * available, to avpkt. The output packet does not necessarily contain data for
6023
+ * the most recent frame, as encoders can delay and reorder input frames
6024
+ * internally as needed.
6025
+ *
6026
+ * @param avctx     codec context
6027
+ * @param avpkt     output AVPacket.
6028
+ *                  The user can supply an output buffer by setting
6029
+ *                  avpkt->data and avpkt->size prior to calling the
6030
+ *                  function, but if the size of the user-provided data is not
6031
+ *                  large enough, encoding will fail. All other AVPacket fields
6032
+ *                  will be reset by the encoder using av_init_packet(). If
6033
+ *                  avpkt->data is NULL, the encoder will allocate it.
6034
+ *                  The encoder will set avpkt->size to the size of the
6035
+ *                  output packet. The returned data (if any) belongs to the
6036
+ *                  caller, he is responsible for freeing it.
6037
+ *
6038
+ *                  If this function fails or produces no output, avpkt will be
6039
+ *                  freed using av_packet_unref().
6040
+ * @param[in] frame AVFrame containing the raw video data to be encoded.
6041
+ *                  May be NULL when flushing an encoder that has the
6042
+ *                  AV_CODEC_CAP_DELAY capability set.
6043
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
6044
+ *                            output packet is non-empty, and to 0 if it is
6045
+ *                            empty. If the function returns an error, the
6046
+ *                            packet can be assumed to be invalid, and the
6047
+ *                            value of got_packet_ptr is undefined and should
6048
+ *                            not be used.
6049
+ * @return          0 on success, negative error code on failure
6050
+ *
6051
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
6052
+ */
6053
+attribute_deprecated
6054
+int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
6055
+                          const AVFrame *frame, int *got_packet_ptr);
6056
+
6057
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
6058
+                            const AVSubtitle *sub);
6059
+
6060
+
6061
+/**
6062
+ * @}
6063
+ */
6064
+
6065
+#if FF_API_AVPICTURE
6066
+/**
6067
+ * @addtogroup lavc_picture
6068
+ * @{
6069
+ */
6070
+
6071
+/**
6072
+ * @deprecated unused
6073
+ */
6074
+attribute_deprecated
6075
+int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
6076
+
6077
+/**
6078
+ * @deprecated unused
6079
+ */
6080
+attribute_deprecated
6081
+void avpicture_free(AVPicture *picture);
6082
+
6083
+/**
6084
+ * @deprecated use av_image_fill_arrays() instead.
6085
+ */
6086
+attribute_deprecated
6087
+int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
6088
+                   enum AVPixelFormat pix_fmt, int width, int height);
6089
+
6090
+/**
6091
+ * @deprecated use av_image_copy_to_buffer() instead.
6092
+ */
6093
+attribute_deprecated
6094
+int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
6095
+                     int width, int height,
6096
+                     unsigned char *dest, int dest_size);
6097
+
6098
+/**
6099
+ * @deprecated use av_image_get_buffer_size() instead.
6100
+ */
6101
+attribute_deprecated
6102
+int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
6103
+
6104
+/**
6105
+ * @deprecated av_image_copy() instead.
6106
+ */
6107
+attribute_deprecated
6108
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
6109
+                     enum AVPixelFormat pix_fmt, int width, int height);
6110
+
6111
+/**
6112
+ * @deprecated unused
6113
+ */
6114
+attribute_deprecated
6115
+int av_picture_crop(AVPicture *dst, const AVPicture *src,
6116
+                    enum AVPixelFormat pix_fmt, int top_band, int left_band);
6117
+
6118
+/**
6119
+ * @deprecated unused
6120
+ */
6121
+attribute_deprecated
6122
+int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
6123
+            int padtop, int padbottom, int padleft, int padright, int *color);
6124
+
6125
+/**
6126
+ * @}
6127
+ */
6128
+#endif
6129
+
6130
+/**
6131
+ * @defgroup lavc_misc Utility functions
6132
+ * @ingroup libavc
6133
+ *
6134
+ * Miscellaneous utility functions related to both encoding and decoding
6135
+ * (or neither).
6136
+ * @{
6137
+ */
6138
+
6139
+/**
6140
+ * @defgroup lavc_misc_pixfmt Pixel formats
6141
+ *
6142
+ * Functions for working with pixel formats.
6143
+ * @{
6144
+ */
6145
+
6146
+#if FF_API_GETCHROMA
6147
+/**
6148
+ * @deprecated Use av_pix_fmt_get_chroma_sub_sample
6149
+ */
6150
+
6151
+attribute_deprecated
6152
+void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
6153
+#endif
6154
+
6155
+/**
6156
+ * Return a value representing the fourCC code associated to the
6157
+ * pixel format pix_fmt, or 0 if no associated fourCC code can be
6158
+ * found.
6159
+ */
6160
+unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
6161
+
6162
+/**
6163
+ * @deprecated see av_get_pix_fmt_loss()
6164
+ */
6165
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
6166
+                             int has_alpha);
6167
+
6168
+/**
6169
+ * Find the best pixel format to convert to given a certain source pixel
6170
+ * format.  When converting from one pixel format to another, information loss
6171
+ * may occur.  For example, when converting from RGB24 to GRAY, the color
6172
+ * information will be lost. Similarly, other losses occur when converting from
6173
+ * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
6174
+ * the given pixel formats should be used to suffer the least amount of loss.
6175
+ * The pixel formats from which it chooses one, are determined by the
6176
+ * pix_fmt_list parameter.
6177
+ *
6178
+ *
6179
+ * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
6180
+ * @param[in] src_pix_fmt source pixel format
6181
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
6182
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
6183
+ * @return The best pixel format to convert to or -1 if none was found.
6184
+ */
6185
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
6186
+                                            enum AVPixelFormat src_pix_fmt,
6187
+                                            int has_alpha, int *loss_ptr);
6188
+
6189
+/**
6190
+ * @deprecated see av_find_best_pix_fmt_of_2()
6191
+ */
6192
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6193
+                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6194
+
6195
+attribute_deprecated
6196
+enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
6197
+                                            enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
6198
+
6199
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
6200
+
6201
+/**
6202
+ * @}
6203
+ */
6204
+
6205
+#if FF_API_TAG_STRING
6206
+/**
6207
+ * Put a string representing the codec tag codec_tag in buf.
6208
+ *
6209
+ * @param buf       buffer to place codec tag in
6210
+ * @param buf_size size in bytes of buf
6211
+ * @param codec_tag codec tag to assign
6212
+ * @return the length of the string that would have been generated if
6213
+ * enough space had been available, excluding the trailing null
6214
+ *
6215
+ * @deprecated see av_fourcc_make_string() and av_fourcc2str().
6216
+ */
6217
+attribute_deprecated
6218
+size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
6219
+#endif
6220
+
6221
+void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
6222
+
6223
+/**
6224
+ * Return a name for the specified profile, if available.
6225
+ *
6226
+ * @param codec the codec that is searched for the given profile
6227
+ * @param profile the profile value for which a name is requested
6228
+ * @return A name for the profile if found, NULL otherwise.
6229
+ */
6230
+const char *av_get_profile_name(const AVCodec *codec, int profile);
6231
+
6232
+/**
6233
+ * Return a name for the specified profile, if available.
6234
+ *
6235
+ * @param codec_id the ID of the codec to which the requested profile belongs
6236
+ * @param profile the profile value for which a name is requested
6237
+ * @return A name for the profile if found, NULL otherwise.
6238
+ *
6239
+ * @note unlike av_get_profile_name(), which searches a list of profiles
6240
+ *       supported by a specific decoder or encoder implementation, this
6241
+ *       function searches the list of profiles from the AVCodecDescriptor
6242
+ */
6243
+const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
6244
+
6245
+int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
6246
+int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
6247
+//FIXME func typedef
6248
+
6249
+/**
6250
+ * Fill AVFrame audio data and linesize pointers.
6251
+ *
6252
+ * The buffer buf must be a preallocated buffer with a size big enough
6253
+ * to contain the specified samples amount. The filled AVFrame data
6254
+ * pointers will point to this buffer.
6255
+ *
6256
+ * AVFrame extended_data channel pointers are allocated if necessary for
6257
+ * planar audio.
6258
+ *
6259
+ * @param frame       the AVFrame
6260
+ *                    frame->nb_samples must be set prior to calling the
6261
+ *                    function. This function fills in frame->data,
6262
+ *                    frame->extended_data, frame->linesize[0].
6263
+ * @param nb_channels channel count
6264
+ * @param sample_fmt  sample format
6265
+ * @param buf         buffer to use for frame data
6266
+ * @param buf_size    size of buffer
6267
+ * @param align       plane size sample alignment (0 = default)
6268
+ * @return            >=0 on success, negative error code on failure
6269
+ * @todo return the size in bytes required to store the samples in
6270
+ * case of success, at the next libavutil bump
6271
+ */
6272
+int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
6273
+                             enum AVSampleFormat sample_fmt, const uint8_t *buf,
6274
+                             int buf_size, int align);
6275
+
6276
+/**
6277
+ * Reset the internal decoder state / flush internal buffers. Should be called
6278
+ * e.g. when seeking or when switching to a different stream.
6279
+ *
6280
+ * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
6281
+ * this invalidates the frames previously returned from the decoder. When
6282
+ * refcounted frames are used, the decoder just releases any references it might
6283
+ * keep internally, but the caller's reference remains valid.
6284
+ */
6285
+void avcodec_flush_buffers(AVCodecContext *avctx);
6286
+
6287
+/**
6288
+ * Return codec bits per sample.
6289
+ *
6290
+ * @param[in] codec_id the codec
6291
+ * @return Number of bits per sample or zero if unknown for the given codec.
6292
+ */
6293
+int av_get_bits_per_sample(enum AVCodecID codec_id);
6294
+
6295
+/**
6296
+ * Return the PCM codec associated with a sample format.
6297
+ * @param be  endianness, 0 for little, 1 for big,
6298
+ *            -1 (or anything else) for native
6299
+ * @return  AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
6300
+ */
6301
+enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
6302
+
6303
+/**
6304
+ * Return codec bits per sample.
6305
+ * Only return non-zero if the bits per sample is exactly correct, not an
6306
+ * approximation.
6307
+ *
6308
+ * @param[in] codec_id the codec
6309
+ * @return Number of bits per sample or zero if unknown for the given codec.
6310
+ */
6311
+int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
6312
+
6313
+/**
6314
+ * Return audio frame duration.
6315
+ *
6316
+ * @param avctx        codec context
6317
+ * @param frame_bytes  size of the frame, or 0 if unknown
6318
+ * @return             frame duration, in samples, if known. 0 if not able to
6319
+ *                     determine.
6320
+ */
6321
+int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
6322
+
6323
+/**
6324
+ * This function is the same as av_get_audio_frame_duration(), except it works
6325
+ * with AVCodecParameters instead of an AVCodecContext.
6326
+ */
6327
+int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
6328
+
6329
+#if FF_API_OLD_BSF
6330
+typedef struct AVBitStreamFilterContext {
6331
+    void *priv_data;
6332
+    const struct AVBitStreamFilter *filter;
6333
+    AVCodecParserContext *parser;
6334
+    struct AVBitStreamFilterContext *next;
6335
+    /**
6336
+     * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
6337
+     * Not for access by library users.
6338
+     */
6339
+    char *args;
6340
+} AVBitStreamFilterContext;
6341
+#endif
6342
+
6343
+typedef struct AVBSFInternal AVBSFInternal;
6344
+
6345
+/**
6346
+ * The bitstream filter state.
6347
+ *
6348
+ * This struct must be allocated with av_bsf_alloc() and freed with
6349
+ * av_bsf_free().
6350
+ *
6351
+ * The fields in the struct will only be changed (by the caller or by the
6352
+ * filter) as described in their documentation, and are to be considered
6353
+ * immutable otherwise.
6354
+ */
6355
+typedef struct AVBSFContext {
6356
+    /**
6357
+     * A class for logging and AVOptions
6358
+     */
6359
+    const AVClass *av_class;
6360
+
6361
+    /**
6362
+     * The bitstream filter this context is an instance of.
6363
+     */
6364
+    const struct AVBitStreamFilter *filter;
6365
+
6366
+    /**