paredeyes commited on
Commit
52357f2
·
verified ·
1 Parent(s): 36b3f0c

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. cmake/share/cmake-3.31/Help/command/add_compile_definitions.rst +33 -0
  2. cmake/share/cmake-3.31/Help/command/add_compile_options.rst +67 -0
  3. cmake/share/cmake-3.31/Help/command/add_custom_command.rst +699 -0
  4. cmake/share/cmake-3.31/Help/command/add_custom_target.rst +211 -0
  5. cmake/share/cmake-3.31/Help/command/add_definitions.rst +38 -0
  6. cmake/share/cmake-3.31/Templates/CPack.GenericDescription.txt +5 -0
  7. cmake/share/cmake-3.31/Templates/CPack.GenericLicense.txt +5 -0
  8. cmake/share/cmake-3.31/Templates/CPack.GenericWelcome.txt +1 -0
  9. cmake/share/cmake-3.31/Templates/CPackConfig.cmake.in +20 -0
  10. cmake/share/cmake-3.31/Templates/TestDriver.cxx.in +199 -0
  11. cmake/share/cmake-3.31/Templates/Windows/Logo.png +3 -0
  12. cmake/share/cmake-3.31/Templates/Windows/SmallLogo.png +3 -0
  13. cmake/share/cmake-3.31/Templates/Windows/SmallLogo44x44.png +3 -0
  14. cmake/share/cmake-3.31/Templates/Windows/SplashScreen.png +3 -0
  15. cmake/share/vim/vimfiles/indent/cmake.vim +99 -0
  16. cmake/share/vim/vimfiles/syntax/cmake.vim +0 -0
  17. ffmpeg/bin/ffmpeg.exe +0 -0
  18. ffmpeg/bin/ffprobe.exe +0 -0
  19. ffmpeg/bin/postproc-58.dll +0 -0
  20. ffmpeg/bin/swresample-5.dll +0 -0
  21. ffmpeg/bin/swscale-8.dll +0 -0
  22. ffmpeg/include/libavcodec/ac3_parser.h +36 -0
  23. ffmpeg/include/libavcodec/adts_parser.h +37 -0
  24. ffmpeg/include/libavcodec/avcodec.h +0 -0
  25. ffmpeg/include/libavcodec/avdct.h +88 -0
  26. ffmpeg/include/libavcodec/avfft.h +149 -0
  27. ffmpeg/include/libavcodec/bsf.h +332 -0
  28. ffmpeg/include/libavcodec/codec.h +382 -0
  29. ffmpeg/include/libavcodec/codec_desc.h +134 -0
  30. ffmpeg/include/libavcodec/codec_id.h +677 -0
  31. ffmpeg/include/libavcodec/codec_par.h +248 -0
  32. ffmpeg/include/libavcodec/d3d11va.h +109 -0
  33. ffmpeg/include/libavcodec/defs.h +337 -0
  34. ffmpeg/include/libavcodec/dirac.h +135 -0
  35. ffmpeg/include/libavcodec/dv_profile.h +82 -0
  36. ffmpeg/include/libavcodec/dxva2.h +90 -0
  37. ffmpeg/include/libavcodec/jni.h +67 -0
  38. ffmpeg/include/libavcodec/mediacodec.h +103 -0
  39. ffmpeg/include/libavcodec/packet.h +894 -0
  40. ffmpeg/include/libavcodec/qsv.h +109 -0
  41. ffmpeg/include/libavcodec/vdpau.h +171 -0
  42. ffmpeg/include/libavcodec/version.h +45 -0
  43. ffmpeg/include/libavcodec/version_major.h +61 -0
  44. ffmpeg/include/libavcodec/videotoolbox.h +85 -0
  45. ffmpeg/include/libavcodec/vorbis_parser.h +74 -0
  46. ffmpeg/include/libavdevice/avdevice.h +397 -0
  47. ffmpeg/include/libavdevice/version.h +45 -0
  48. ffmpeg/include/libavdevice/version_major.h +43 -0
  49. ffmpeg/include/libavfilter/avfilter.h +1406 -0
  50. ffmpeg/include/libavfilter/buffersink.h +166 -0
cmake/share/cmake-3.31/Help/command/add_compile_definitions.rst ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_compile_definitions
2
+ -----------------------
3
+
4
+ .. versionadded:: 3.12
5
+
6
+ Add preprocessor definitions to the compilation of source files.
7
+
8
+ .. code-block:: cmake
9
+
10
+ add_compile_definitions(<definition> ...)
11
+
12
+ Adds preprocessor definitions to the compiler command line.
13
+
14
+ The preprocessor definitions are added to the :prop_dir:`COMPILE_DEFINITIONS`
15
+ directory property for the current ``CMakeLists`` file. They are also added to
16
+ the :prop_tgt:`COMPILE_DEFINITIONS` target property for each target in the
17
+ current ``CMakeLists`` file.
18
+
19
+ Definitions are specified using the syntax ``VAR`` or ``VAR=value``.
20
+ Function-style definitions are not supported. CMake will automatically
21
+ escape the value correctly for the native build system (note that CMake
22
+ language syntax may require escapes to specify some values).
23
+
24
+ .. versionadded:: 3.26
25
+ Any leading ``-D`` on an item will be removed.
26
+
27
+ .. |command_name| replace:: ``add_compile_definitions``
28
+ .. include:: GENEX_NOTE.txt
29
+
30
+ See Also
31
+ ^^^^^^^^
32
+
33
+ * The command :command:`target_compile_definitions` adds target-specific definitions.
cmake/share/cmake-3.31/Help/command/add_compile_options.rst ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_compile_options
2
+ -------------------
3
+
4
+ Add options to the compilation of source files.
5
+
6
+ .. code-block:: cmake
7
+
8
+ add_compile_options(<option> ...)
9
+
10
+ Adds options to the :prop_dir:`COMPILE_OPTIONS` directory property.
11
+ These options are used when compiling targets from the current
12
+ directory and below.
13
+
14
+ .. note::
15
+
16
+ These options are not used when linking.
17
+ See the :command:`add_link_options` command for that.
18
+
19
+ Arguments
20
+ ^^^^^^^^^
21
+
22
+ .. |command_name| replace:: ``add_compile_options``
23
+ .. include:: GENEX_NOTE.txt
24
+
25
+ .. include:: OPTIONS_SHELL.txt
26
+
27
+ Example
28
+ ^^^^^^^
29
+
30
+ Since different compilers support different options, a typical use of
31
+ this command is in a compiler-specific conditional clause:
32
+
33
+ .. code-block:: cmake
34
+
35
+ if (MSVC)
36
+ # warning level 4
37
+ add_compile_options(/W4)
38
+ else()
39
+ # additional warnings
40
+ add_compile_options(-Wall -Wextra -Wpedantic)
41
+ endif()
42
+
43
+ To set per-language options, use the :genex:`$<COMPILE_LANGUAGE>`
44
+ or :genex:`$<COMPILE_LANGUAGE:languages>` generator expressions.
45
+
46
+ See Also
47
+ ^^^^^^^^
48
+
49
+ * This command can be used to add any options. However, for
50
+ adding preprocessor definitions and include directories it is recommended
51
+ to use the more specific commands :command:`add_compile_definitions`
52
+ and :command:`include_directories`.
53
+
54
+ * The command :command:`target_compile_options` adds target-specific options.
55
+
56
+ * This command adds compile options for all languages.
57
+ Use the :genex:`COMPILE_LANGUAGE` generator expression to specify
58
+ per-language compile options.
59
+
60
+ * The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
61
+ source file.
62
+
63
+ * :command:`add_link_options` adds options for linking.
64
+
65
+ * :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
66
+ add language-wide flags passed to all invocations of the compiler.
67
+ This includes invocations that drive compiling and those that drive linking.
cmake/share/cmake-3.31/Help/command/add_custom_command.rst ADDED
@@ -0,0 +1,699 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_custom_command
2
+ ------------------
3
+
4
+ Add a custom build rule to the generated build system.
5
+
6
+ There are two main signatures for ``add_custom_command``.
7
+
8
+ .. _`add_custom_command(OUTPUT)`:
9
+
10
+ Generating Files
11
+ ^^^^^^^^^^^^^^^^
12
+
13
+ The first signature is for adding a custom command to produce an output:
14
+
15
+ .. code-block:: cmake
16
+
17
+ add_custom_command(OUTPUT output1 [output2 ...]
18
+ COMMAND command1 [ARGS] [args1...]
19
+ [COMMAND command2 [ARGS] [args2...] ...]
20
+ [MAIN_DEPENDENCY depend]
21
+ [DEPENDS [depends...]]
22
+ [BYPRODUCTS [files...]]
23
+ [IMPLICIT_DEPENDS <lang1> depend1
24
+ [<lang2> depend2] ...]
25
+ [WORKING_DIRECTORY dir]
26
+ [COMMENT comment]
27
+ [DEPFILE depfile]
28
+ [JOB_POOL job_pool]
29
+ [JOB_SERVER_AWARE <bool>]
30
+ [VERBATIM] [APPEND] [USES_TERMINAL]
31
+ [CODEGEN]
32
+ [COMMAND_EXPAND_LISTS]
33
+ [DEPENDS_EXPLICIT_ONLY])
34
+
35
+ This defines a command to generate specified ``OUTPUT`` file(s).
36
+ A target created in the same directory (``CMakeLists.txt`` file)
37
+ that specifies any output of the custom command as a source file
38
+ is given a rule to generate the file using the command at build time.
39
+
40
+ Do not list the output in more than one independent target that
41
+ may build in parallel or the instances of the rule may conflict.
42
+ Instead, use the :command:`add_custom_target` command to drive the
43
+ command and make the other targets depend on that one. See the
44
+ `Example: Generating Files for Multiple Targets`_ below.
45
+
46
+ The options are:
47
+
48
+ ``APPEND``
49
+ Append the ``COMMAND`` and ``DEPENDS`` option values to the custom
50
+ command for the first output specified. There must have already
51
+ been a previous call to this command with the same output.
52
+
53
+ If the previous call specified the output via a generator expression,
54
+ the output specified by the current call must match in at least one
55
+ configuration after evaluating generator expressions. In this case,
56
+ the appended commands and dependencies apply to all configurations.
57
+
58
+ The ``COMMENT``, ``MAIN_DEPENDENCY``, and ``WORKING_DIRECTORY``
59
+ options are currently ignored when ``APPEND`` is given, but may be
60
+ used in the future.
61
+
62
+ ``BYPRODUCTS``
63
+ .. versionadded:: 3.2
64
+
65
+ Specify the files the command is expected to produce but whose
66
+ modification time may or may not be newer than the dependencies.
67
+ If a byproduct name is a relative path it will be interpreted
68
+ relative to the build tree directory corresponding to the
69
+ current source directory.
70
+ Each byproduct file will be marked with the :prop_sf:`GENERATED`
71
+ source file property automatically.
72
+
73
+ *See policy* :policy:`CMP0058` *for the motivation behind this feature.*
74
+
75
+ Explicit specification of byproducts is supported by the
76
+ :generator:`Ninja` generator to tell the ``ninja`` build tool
77
+ how to regenerate byproducts when they are missing. It is
78
+ also useful when other build rules (e.g. custom commands)
79
+ depend on the byproducts. Ninja requires a build rule for any
80
+ generated file on which another rule depends even if there are
81
+ order-only dependencies to ensure the byproducts will be
82
+ available before their dependents build.
83
+
84
+ The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
85
+ :prop_sf:`GENERATED` files during ``make clean``.
86
+
87
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
88
+ All byproducts must be set in the first call to
89
+ ``add_custom_command(OUTPUT...)`` for the output files.
90
+
91
+ .. versionadded:: 3.20
92
+ Arguments to ``BYPRODUCTS`` may use a restricted set of
93
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
94
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
95
+ are not permitted.
96
+
97
+ .. versionchanged:: 3.28
98
+ In targets using :ref:`file sets`, custom command byproducts are now
99
+ considered private unless they are listed in a non-private file set.
100
+ See policy :policy:`CMP0154`.
101
+
102
+ ``COMMAND``
103
+ Specify the command-line(s) to execute at build time.
104
+ At least one ``COMMAND`` would normally be given, but certain patterns
105
+ may omit it, such as adding commands in separate calls using `APPEND`.
106
+
107
+ If more than one ``COMMAND`` is specified, they will be executed in order,
108
+ but *not* necessarily composed into a stateful shell or batch script.
109
+ To run a full script, use the :command:`configure_file` command or the
110
+ :command:`file(GENERATE)` command to create it, and then specify
111
+ a ``COMMAND`` to launch it.
112
+
113
+ The optional ``ARGS`` argument is for backward compatibility and
114
+ will be ignored.
115
+
116
+ If ``COMMAND`` specifies an executable target name (created by the
117
+ :command:`add_executable` command), it will automatically be replaced
118
+ by the location of the executable created at build time if either of
119
+ the following is true:
120
+
121
+ * The target is not being cross-compiled (i.e. the
122
+ :variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
123
+ * .. versionadded:: 3.6
124
+ The target is being cross-compiled and an emulator is provided (i.e.
125
+ its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
126
+ In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
127
+ prepended to the command before the location of the target executable.
128
+
129
+ If neither of the above conditions are met, it is assumed that the
130
+ command name is a program to be found on the ``PATH`` at build time.
131
+
132
+ Arguments to ``COMMAND`` may use
133
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
134
+ Use the :genex:`TARGET_FILE` generator expression to refer to the location
135
+ of a target later in the command line (i.e. as a command argument rather
136
+ than as the command to execute).
137
+
138
+ Whenever one of the following target based generator expressions are used as
139
+ a command to execute or is mentioned in a command argument, a target-level
140
+ dependency will be added automatically so that the mentioned target will be
141
+ built before any target using this custom command
142
+ (see policy :policy:`CMP0112`).
143
+
144
+ * ``TARGET_FILE``
145
+ * ``TARGET_LINKER_FILE``
146
+ * ``TARGET_SONAME_FILE``
147
+ * ``TARGET_PDB_FILE``
148
+
149
+ This target-level dependency does NOT add a file-level dependency that would
150
+ cause the custom command to re-run whenever the executable is recompiled.
151
+ List target names with the ``DEPENDS`` option to add such file-level
152
+ dependencies.
153
+
154
+
155
+ ``COMMENT``
156
+ Display the given message before the commands are executed at
157
+ build time. This will be ignored if ``APPEND`` is given, although a future
158
+ version may use it.
159
+
160
+ .. versionadded:: 3.26
161
+ Arguments to ``COMMENT`` may use
162
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
163
+
164
+ ``DEPENDS``
165
+ Specify files on which the command depends. Each argument is converted
166
+ to a dependency as follows:
167
+
168
+ 1. If the argument is the name of a target (created by the
169
+ :command:`add_custom_target`, :command:`add_executable`, or
170
+ :command:`add_library` command) a target-level dependency is
171
+ created to make sure the target is built before any target
172
+ using this custom command. Additionally, if the target is an
173
+ executable or library, a file-level dependency is created to
174
+ cause the custom command to re-run whenever the target is
175
+ recompiled.
176
+
177
+ 2. If the argument is an absolute path, a file-level dependency
178
+ is created on that path.
179
+
180
+ 3. If the argument is the name of a source file that has been
181
+ added to a target or on which a source file property has been set,
182
+ a file-level dependency is created on that source file.
183
+
184
+ 4. If the argument is a relative path and it exists in the current
185
+ source directory, a file-level dependency is created on that
186
+ file in the current source directory.
187
+
188
+ 5. Otherwise, a file-level dependency is created on that path relative
189
+ to the current binary directory.
190
+
191
+ If any dependency is an ``OUTPUT`` of another custom command in the same
192
+ directory (``CMakeLists.txt`` file), CMake automatically brings the other
193
+ custom command into the target in which this command is built.
194
+
195
+ .. versionadded:: 3.16
196
+ A target-level dependency is added if any dependency is listed as
197
+ ``BYPRODUCTS`` of a target or any of its build events in the same
198
+ directory to ensure the byproducts will be available.
199
+
200
+ If ``DEPENDS`` is not specified, the command will run whenever
201
+ the ``OUTPUT`` is missing; if the command does not actually
202
+ create the ``OUTPUT``, the rule will always run.
203
+
204
+ .. versionadded:: 3.1
205
+ Arguments to ``DEPENDS`` may use
206
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
207
+
208
+ ``COMMAND_EXPAND_LISTS``
209
+ .. versionadded:: 3.8
210
+
211
+ Lists in ``COMMAND`` arguments will be expanded, including those
212
+ created with
213
+ :manual:`generator expressions <cmake-generator-expressions(7)>`,
214
+ allowing ``COMMAND`` arguments such as
215
+ ``${CC} "-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>" foo.cc``
216
+ to be properly expanded.
217
+
218
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
219
+ If the appended commands need this option to be set, it must be set on the
220
+ first call to ``add_custom_command(OUTPUT...)`` for the output files.
221
+
222
+ ``CODEGEN``
223
+ .. versionadded:: 3.31
224
+
225
+ Adds the custom command to a global ``codegen`` target that can be
226
+ used to execute the custom command while avoiding the majority of the
227
+ build graph.
228
+
229
+ This option is supported only by :ref:`Ninja Generators` and
230
+ :ref:`Makefile Generators`, and is ignored by other generators.
231
+ Furthermore, this option is allowed only if policy :policy:`CMP0171`
232
+ is set to ``NEW``.
233
+
234
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
235
+ It can only be set on the first call to ``add_custom_command(OUTPUT...)``
236
+ for the output files.
237
+
238
+ ``IMPLICIT_DEPENDS``
239
+ Request scanning of implicit dependencies of an input file.
240
+ The language given specifies the programming language whose
241
+ corresponding dependency scanner should be used.
242
+ Currently only ``C`` and ``CXX`` language scanners are supported.
243
+ The language has to be specified for every file in the
244
+ ``IMPLICIT_DEPENDS`` list. Dependencies discovered from the
245
+ scanning are added to those of the custom command at build time.
246
+ Note that the ``IMPLICIT_DEPENDS`` option is currently supported
247
+ only for Makefile generators and will be ignored by other generators.
248
+
249
+ .. note::
250
+
251
+ This option cannot be specified at the same time as ``DEPFILE`` option.
252
+
253
+ ``JOB_POOL``
254
+ .. versionadded:: 3.15
255
+
256
+ Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja`
257
+ generator. Incompatible with ``USES_TERMINAL``, which implies
258
+ the ``console`` pool.
259
+ Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
260
+ an error by ninja at build time.
261
+
262
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
263
+ Job pools can only be specified in the first call to
264
+ ``add_custom_command(OUTPUT...)`` for the output files.
265
+
266
+ ``JOB_SERVER_AWARE``
267
+ .. versionadded:: 3.28
268
+
269
+ Specify that the command is GNU Make job server aware.
270
+
271
+ For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and
272
+ :generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the
273
+ recipe line. See the `GNU Make Documentation`_ for more information.
274
+
275
+ This option is silently ignored by other generators.
276
+
277
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
278
+ Job server awareness can only be specified in the first call to
279
+ ``add_custom_command(OUTPUT...)`` for the output files.
280
+
281
+ .. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
282
+
283
+ ``MAIN_DEPENDENCY``
284
+ Specify the primary input source file to the command. This is
285
+ treated just like any value given to the ``DEPENDS`` option
286
+ but also suggests to Visual Studio generators where to hang
287
+ the custom command. Each source file may have at most one command
288
+ specifying it as its main dependency. A compile command (i.e. for a
289
+ library or an executable) counts as an implicit main dependency which
290
+ gets silently overwritten by a custom command specification.
291
+
292
+ This option is currently ignored if ``APPEND`` is given, but a future
293
+ version may use it.
294
+
295
+ ``OUTPUT``
296
+ Specify the output files the command is expected to produce.
297
+ Each output file will be marked with the :prop_sf:`GENERATED`
298
+ source file property automatically.
299
+ If the output of the custom command is not actually created
300
+ as a file on disk it should be marked with the :prop_sf:`SYMBOLIC`
301
+ source file property.
302
+
303
+ If an output file name is a relative path, its absolute path is
304
+ determined by interpreting it relative to:
305
+
306
+ 1. the build directory corresponding to the current source directory
307
+ (:variable:`CMAKE_CURRENT_BINARY_DIR`), or
308
+
309
+ 2. the current source directory (:variable:`CMAKE_CURRENT_SOURCE_DIR`).
310
+
311
+ The path in the build directory is preferred unless the path in the
312
+ source tree is mentioned as an absolute source file path elsewhere
313
+ in the current directory.
314
+
315
+ The output file path may not contain ``<`` or ``>`` characters.
316
+
317
+ .. versionadded:: 3.20
318
+ Arguments to ``OUTPUT`` may use a restricted set of
319
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
320
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
321
+ are not permitted.
322
+
323
+ .. versionchanged:: 3.28
324
+ In targets using :ref:`file sets`, custom command outputs are now
325
+ considered private unless they are listed in a non-private file set.
326
+ See policy :policy:`CMP0154`.
327
+
328
+ .. versionchanged:: 3.30
329
+ The output file path may now use ``#`` characters, except
330
+ when using the :generator:`Borland Makefiles` generator.
331
+
332
+ ``USES_TERMINAL``
333
+ .. versionadded:: 3.2
334
+
335
+ The command will be given direct access to the terminal if possible.
336
+ With the :generator:`Ninja` generator, this places the command in
337
+ the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
338
+
339
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
340
+ If the appended commands need access to the terminal, it must be set on
341
+ the first call to ``add_custom_command(OUTPUT...)`` for the output files.
342
+
343
+ ``VERBATIM``
344
+ All arguments to the commands will be escaped properly for the
345
+ build tool so that the invoked command receives each argument
346
+ unchanged. Note that one level of escapes is still used by the
347
+ CMake language processor before add_custom_command even sees the
348
+ arguments. Use of ``VERBATIM`` is recommended as it enables
349
+ correct behavior. When ``VERBATIM`` is not given the behavior
350
+ is platform specific because there is no protection of
351
+ tool-specific special characters.
352
+
353
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
354
+ If the appended commands need to be treated as ``VERBATIM``, it must be set
355
+ on the first call to ``add_custom_command(OUTPUT...)`` for the output files.
356
+
357
+ ``WORKING_DIRECTORY``
358
+ Execute the command with the given current working directory.
359
+ If it is a relative path, it will be interpreted relative to the
360
+ build tree directory corresponding to the current source directory.
361
+
362
+ This option is currently ignored if ``APPEND`` is given, but a future
363
+ version may use it.
364
+
365
+ .. versionadded:: 3.13
366
+ Arguments to ``WORKING_DIRECTORY`` may use
367
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
368
+
369
+ ``DEPFILE``
370
+ .. versionadded:: 3.7
371
+
372
+ Specify a depfile which holds dependencies for the custom command. It is
373
+ usually emitted by the custom command itself. This keyword may only be used
374
+ if the generator supports it, as detailed below.
375
+
376
+ The expected format, compatible with what is generated by ``gcc`` with the
377
+ option ``-M``, is independent of the generator or platform.
378
+
379
+ The formal syntax, as specified using
380
+ `BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with
381
+ the regular extensions, is the following:
382
+
383
+ .. raw:: latex
384
+
385
+ \begin{small}
386
+
387
+ .. productionlist:: depfile
388
+ depfile: `rule`*
389
+ rule: `targets` (':' (`separator` `dependencies`?)?)? `eol`
390
+ targets: `target` (`separator` `target`)* `separator`*
391
+ target: `pathname`
392
+ dependencies: `dependency` (`separator` `dependency`)* `separator`*
393
+ dependency: `pathname`
394
+ separator: (`space` | `line_continue`)+
395
+ line_continue: '\' `eol`
396
+ space: ' ' | '\t'
397
+ pathname: `character`+
398
+ character: `std_character` | `dollar` | `hash` | `whitespace`
399
+ std_character: <any character except '$', '#' or ' '>
400
+ dollar: '$$'
401
+ hash: '\#'
402
+ whitespace: '\ '
403
+ eol: '\r'? '\n'
404
+
405
+ .. raw:: latex
406
+
407
+ \end{small}
408
+
409
+ .. note::
410
+
411
+ As part of ``pathname``, any slash and backslash is interpreted as
412
+ a directory separator.
413
+
414
+ .. versionadded:: 3.7
415
+ The :generator:`Ninja` generator supports ``DEPFILE`` since the keyword
416
+ was first added.
417
+
418
+ .. versionadded:: 3.17
419
+ Added the :generator:`Ninja Multi-Config` generator, which included
420
+ support for the ``DEPFILE`` keyword.
421
+
422
+ .. versionadded:: 3.20
423
+ Added support for :ref:`Makefile Generators`.
424
+
425
+ .. note::
426
+
427
+ ``DEPFILE`` cannot be specified at the same time as the
428
+ ``IMPLICIT_DEPENDS`` option for :ref:`Makefile Generators`.
429
+
430
+ .. versionadded:: 3.21
431
+ Added support for :ref:`Visual Studio Generators` with VS 2012 and above,
432
+ and for the :generator:`Xcode` generator. Support for
433
+ :manual:`generator expressions <cmake-generator-expressions(7)>` was also
434
+ added.
435
+
436
+ .. versionadded:: 3.29
437
+ The :ref:`Ninja Generators` will now incorporate the dependencies into its
438
+ "deps log" database if the file is not listed in ``OUTPUTS`` or
439
+ ``BYPRODUCTS``.
440
+
441
+ Using ``DEPFILE`` with generators other than those listed above is an error.
442
+
443
+ If the ``DEPFILE`` argument is relative, it should be relative to
444
+ :variable:`CMAKE_CURRENT_BINARY_DIR`, and any relative paths inside the
445
+ ``DEPFILE`` should also be relative to :variable:`CMAKE_CURRENT_BINARY_DIR`.
446
+ See policy :policy:`CMP0116`, which is always ``NEW`` for
447
+ :ref:`Makefile Generators`, :ref:`Visual Studio Generators`,
448
+ and the :generator:`Xcode` generator.
449
+
450
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
451
+ Depfiles can only be set on the first call to
452
+ ``add_custom_command(OUTPUT...)`` for the output files.
453
+
454
+ ``DEPENDS_EXPLICIT_ONLY``
455
+
456
+ .. versionadded:: 3.27
457
+
458
+ Indicates that the command's ``DEPENDS`` argument represents all files
459
+ required by the command and implicit dependencies are not required.
460
+
461
+ Without this option, if any target uses the output of the custom command,
462
+ CMake will consider that target's dependencies as implicit dependencies for
463
+ the custom command in case this custom command requires files implicitly
464
+ created by those targets.
465
+
466
+ This option can be enabled on all custom commands by setting
467
+ :variable:`CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY` to ``ON``.
468
+
469
+ This keyword cannot be used with ``APPEND`` (see policy :policy:`CMP0175`).
470
+ It can only be set on the first call to ``add_custom_command(OUTPUT...)``
471
+ for the output files.
472
+
473
+ Only the :ref:`Ninja Generators` actually use this information to remove
474
+ unnecessary implicit dependencies.
475
+
476
+ See also the :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property, which may
477
+ provide another way for reducing the impact of target dependencies in some
478
+ scenarios.
479
+
480
+ Examples: Generating Files
481
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
482
+
483
+ Custom commands may be used to generate source files.
484
+ For example, the code:
485
+
486
+ .. code-block:: cmake
487
+
488
+ add_custom_command(
489
+ OUTPUT out.c
490
+ COMMAND someTool -i ${CMAKE_CURRENT_SOURCE_DIR}/in.txt
491
+ -o out.c
492
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/in.txt
493
+ VERBATIM)
494
+ add_library(myLib out.c)
495
+
496
+ adds a custom command to run ``someTool`` to generate ``out.c`` and then
497
+ compile the generated source as part of a library. The generation rule
498
+ will re-run whenever ``in.txt`` changes.
499
+
500
+ .. versionadded:: 3.20
501
+ One may use generator expressions to specify per-configuration outputs.
502
+ For example, the code:
503
+
504
+ .. code-block:: cmake
505
+
506
+ add_custom_command(
507
+ OUTPUT "out-$<CONFIG>.c"
508
+ COMMAND someTool -i ${CMAKE_CURRENT_SOURCE_DIR}/in.txt
509
+ -o "out-$<CONFIG>.c"
510
+ -c "$<CONFIG>"
511
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/in.txt
512
+ VERBATIM)
513
+ add_library(myLib "out-$<CONFIG>.c")
514
+
515
+ adds a custom command to run ``someTool`` to generate ``out-<config>.c``,
516
+ where ``<config>`` is the build configuration, and then compile the generated
517
+ source as part of a library.
518
+
519
+ .. versionadded:: 3.31
520
+ Use the ``CODEGEN`` option to add a custom command's outputs to the builtin
521
+ ``codegen`` target. This is useful to make generated code available for
522
+ static analysis without building the entire project. For example:
523
+
524
+ .. code-block:: cmake
525
+
526
+ add_executable(someTool someTool.c)
527
+
528
+ add_custom_command(
529
+ OUTPUT out.c
530
+ COMMAND someTool -o out.c
531
+ CODEGEN)
532
+
533
+ add_library(myLib out.c)
534
+
535
+ A user may build the ``codegen`` target to generate ``out.c``.
536
+ ``someTool`` is built as dependency, but ``myLib`` is not built at all.
537
+
538
+ Example: Generating Files for Multiple Targets
539
+ """"""""""""""""""""""""""""""""""""""""""""""
540
+
541
+ If multiple independent targets need the same custom command output,
542
+ it must be attached to a single custom target on which they all depend.
543
+ Consider the following example:
544
+
545
+ .. code-block:: cmake
546
+
547
+ add_custom_command(
548
+ OUTPUT table.csv
549
+ COMMAND makeTable -i ${CMAKE_CURRENT_SOURCE_DIR}/input.dat
550
+ -o table.csv
551
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.dat
552
+ VERBATIM)
553
+ add_custom_target(generate_table_csv DEPENDS table.csv)
554
+
555
+ add_custom_command(
556
+ OUTPUT foo.cxx
557
+ COMMAND genFromTable -i table.csv -case foo -o foo.cxx
558
+ DEPENDS table.csv # file-level dependency
559
+ generate_table_csv # target-level dependency
560
+ VERBATIM)
561
+ add_library(foo foo.cxx)
562
+
563
+ add_custom_command(
564
+ OUTPUT bar.cxx
565
+ COMMAND genFromTable -i table.csv -case bar -o bar.cxx
566
+ DEPENDS table.csv # file-level dependency
567
+ generate_table_csv # target-level dependency
568
+ VERBATIM)
569
+ add_library(bar bar.cxx)
570
+
571
+ Output ``foo.cxx`` is needed only by target ``foo`` and output ``bar.cxx``
572
+ is needed only by target ``bar``, but *both* targets need ``table.csv``,
573
+ transitively. Since ``foo`` and ``bar`` are independent targets that may
574
+ build concurrently, we prevent them from racing to generate ``table.csv``
575
+ by placing its custom command in a separate target, ``generate_table_csv``.
576
+ The custom commands generating ``foo.cxx`` and ``bar.cxx`` each specify a
577
+ target-level dependency on ``generate_table_csv``, so the targets using them,
578
+ ``foo`` and ``bar``, will not build until after target ``generate_table_csv``
579
+ is built.
580
+
581
+ .. _`add_custom_command(TARGET)`:
582
+
583
+ Build Events
584
+ ^^^^^^^^^^^^
585
+
586
+ The second signature adds a custom command to a target such as a
587
+ library or executable. This is useful for performing an operation
588
+ before or after building the target. The command becomes part of the
589
+ target and will only execute when the target itself is built. If the
590
+ target is already built, the command will not execute.
591
+
592
+ .. code-block:: cmake
593
+
594
+ add_custom_command(TARGET <target>
595
+ PRE_BUILD | PRE_LINK | POST_BUILD
596
+ COMMAND command1 [ARGS] [args1...]
597
+ [COMMAND command2 [ARGS] [args2...] ...]
598
+ [BYPRODUCTS [files...]]
599
+ [WORKING_DIRECTORY dir]
600
+ [COMMENT comment]
601
+ [VERBATIM]
602
+ [COMMAND_EXPAND_LISTS]
603
+ [USES_TERMINAL])
604
+
605
+ This defines a new command that will be associated with building the
606
+ specified ``<target>``. The ``<target>`` must be defined in the current
607
+ directory; targets defined in other directories may not be specified.
608
+
609
+ When the command will happen is determined by which
610
+ of the following is specified:
611
+
612
+ ``PRE_BUILD``
613
+ This option has unique behavior for the :ref:`Visual Studio Generators`.
614
+ When using one of the Visual Studio generators, the command will run before
615
+ any other rules are executed within the target. With all other generators,
616
+ this option behaves the same as ``PRE_LINK`` instead. Because of this,
617
+ it is recommended to avoid using ``PRE_BUILD`` except when it is known that
618
+ a Visual Studio generator is being used.
619
+ ``PRE_LINK``
620
+ Run after sources have been compiled but before linking the binary
621
+ or running the librarian or archiver tool of a static library.
622
+ This is not defined for targets created by the
623
+ :command:`add_custom_target` command.
624
+ ``POST_BUILD``
625
+ Run after all other rules within the target have been executed.
626
+
627
+ Projects should always specify one of the above three keywords when using
628
+ the ``TARGET`` form. See policy :policy:`CMP0175`.
629
+
630
+ All other keywords shown in the signature above have the same meaning as they
631
+ do for the :command:`add_custom_command(OUTPUT)` form of the command.
632
+ At least one ``COMMAND`` must be given, see policy :policy:`CMP0175`.
633
+
634
+ .. note::
635
+ Because generator expressions can be used in custom commands,
636
+ it is possible to define ``COMMAND`` lines or whole custom commands
637
+ which evaluate to empty strings for certain configurations.
638
+ For :ref:`Visual Studio Generators` these command
639
+ lines or custom commands will be omitted for the specific
640
+ configuration and no "empty-string-command" will be added.
641
+
642
+ This allows adding individual build events for every configuration.
643
+
644
+ .. versionadded:: 3.21
645
+ Support for target-dependent generator expressions.
646
+
647
+ .. versionadded:: 3.29
648
+ The ``<target>`` may be an :ref:`ALIAS target <Alias Targets>`.
649
+
650
+ Examples: Build Events
651
+ ^^^^^^^^^^^^^^^^^^^^^^
652
+
653
+ A ``POST_BUILD`` event may be used to post-process a binary after linking.
654
+ For example, the code:
655
+
656
+ .. code-block:: cmake
657
+
658
+ add_executable(myExe myExe.c)
659
+ add_custom_command(
660
+ TARGET myExe POST_BUILD
661
+ COMMAND someHasher -i "$<TARGET_FILE:myExe>"
662
+ -o "$<TARGET_FILE:myExe>.hash"
663
+ VERBATIM)
664
+
665
+ will run ``someHasher`` to produce a ``.hash`` file next to the executable
666
+ after linking.
667
+
668
+ .. versionadded:: 3.20
669
+ One may use generator expressions to specify per-configuration byproducts.
670
+ For example, the code:
671
+
672
+ .. code-block:: cmake
673
+
674
+ add_library(myPlugin MODULE myPlugin.c)
675
+ add_custom_command(
676
+ TARGET myPlugin POST_BUILD
677
+ COMMAND someHasher -i "$<TARGET_FILE:myPlugin>"
678
+ --as-code "myPlugin-hash-$<CONFIG>.c"
679
+ BYPRODUCTS "myPlugin-hash-$<CONFIG>.c"
680
+ VERBATIM)
681
+ add_executable(myExe myExe.c "myPlugin-hash-$<CONFIG>.c")
682
+
683
+ will run ``someHasher`` after linking ``myPlugin``, e.g. to produce a ``.c``
684
+ file containing code to check the hash of ``myPlugin`` that the ``myExe``
685
+ executable can use to verify it before loading.
686
+
687
+ Ninja Multi-Config
688
+ ^^^^^^^^^^^^^^^^^^
689
+
690
+ .. versionadded:: 3.20
691
+
692
+ ``add_custom_command`` supports the :generator:`Ninja Multi-Config`
693
+ generator's cross-config capabilities. See the generator documentation
694
+ for more information.
695
+
696
+ See Also
697
+ ^^^^^^^^
698
+
699
+ * :command:`add_custom_target`
cmake/share/cmake-3.31/Help/command/add_custom_target.rst ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_custom_target
2
+ -----------------
3
+
4
+ Add a target with no output so it will always be built.
5
+
6
+ .. code-block:: cmake
7
+
8
+ add_custom_target(Name [ALL] [command1 [args1...]]
9
+ [COMMAND command2 [args2...] ...]
10
+ [DEPENDS depend depend depend ... ]
11
+ [BYPRODUCTS [files...]]
12
+ [WORKING_DIRECTORY dir]
13
+ [COMMENT comment]
14
+ [JOB_POOL job_pool]
15
+ [JOB_SERVER_AWARE <bool>]
16
+ [VERBATIM] [USES_TERMINAL]
17
+ [COMMAND_EXPAND_LISTS]
18
+ [SOURCES src1 [src2...]])
19
+
20
+ Adds a target with the given name that executes the given commands.
21
+ The target has no output file and is *always considered out of date*
22
+ even if the commands try to create a file with the name of the target.
23
+ Use the :command:`add_custom_command` command to generate a file with
24
+ dependencies. By default nothing depends on the custom target. Use
25
+ the :command:`add_dependencies` command to add dependencies to or
26
+ from other targets.
27
+
28
+ The options are:
29
+
30
+ ``ALL``
31
+ Indicate that this target should be added to the default build
32
+ target so that it will be run every time (the command cannot be
33
+ called ``ALL``).
34
+
35
+ ``BYPRODUCTS``
36
+ .. versionadded:: 3.2
37
+
38
+ Specify the files the command is expected to produce but whose
39
+ modification time may or may not be updated on subsequent builds.
40
+ If a byproduct name is a relative path it will be interpreted
41
+ relative to the build tree directory corresponding to the
42
+ current source directory.
43
+ Each byproduct file will be marked with the :prop_sf:`GENERATED`
44
+ source file property automatically.
45
+
46
+ *See policy* :policy:`CMP0058` *for the motivation behind this feature.*
47
+
48
+ Explicit specification of byproducts is supported by the
49
+ :generator:`Ninja` generator to tell the ``ninja`` build tool
50
+ how to regenerate byproducts when they are missing. It is
51
+ also useful when other build rules (e.g. custom commands)
52
+ depend on the byproducts. Ninja requires a build rule for any
53
+ generated file on which another rule depends even if there are
54
+ order-only dependencies to ensure the byproducts will be
55
+ available before their dependents build.
56
+
57
+ The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
58
+ :prop_sf:`GENERATED` files during ``make clean``.
59
+
60
+ .. versionadded:: 3.20
61
+ Arguments to ``BYPRODUCTS`` may use a restricted set of
62
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
63
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
64
+ are not permitted.
65
+
66
+ .. versionchanged:: 3.28
67
+ In custom targets using :ref:`file sets`, byproducts are now
68
+ considered private unless they are listed in a non-private file set.
69
+ See policy :policy:`CMP0154`.
70
+
71
+ ``COMMAND``
72
+ Specify the command-line(s) to execute at build time.
73
+ If more than one ``COMMAND`` is specified they will be executed in order,
74
+ but *not* necessarily composed into a stateful shell or batch script.
75
+ (To run a full script, use the :command:`configure_file` command or the
76
+ :command:`file(GENERATE)` command to create it, and then specify
77
+ a ``COMMAND`` to launch it.)
78
+
79
+ If ``COMMAND`` specifies an executable target name (created by the
80
+ :command:`add_executable` command), it will automatically be replaced
81
+ by the location of the executable created at build time if either of
82
+ the following is true:
83
+
84
+ * The target is not being cross-compiled (i.e. the
85
+ :variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
86
+ * .. versionadded:: 3.6
87
+ The target is being cross-compiled and an emulator is provided (i.e.
88
+ its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
89
+ In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
90
+ prepended to the command before the location of the target executable.
91
+
92
+ If neither of the above conditions are met, it is assumed that the
93
+ command name is a program to be found on the ``PATH`` at build time.
94
+
95
+ Arguments to ``COMMAND`` may use
96
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
97
+ Use the :genex:`TARGET_FILE` generator expression to refer to the location
98
+ of a target later in the command line (i.e. as a command argument rather
99
+ than as the command to execute).
100
+
101
+ Whenever one of the following target based generator expressions are used as
102
+ a command to execute or is mentioned in a command argument, a target-level
103
+ dependency will be added automatically so that the mentioned target will be
104
+ built before this custom target (see policy :policy:`CMP0112`).
105
+
106
+ * ``TARGET_FILE``
107
+ * ``TARGET_LINKER_FILE``
108
+ * ``TARGET_SONAME_FILE``
109
+ * ``TARGET_PDB_FILE``
110
+
111
+ The command and arguments are optional and if not specified an empty
112
+ target will be created.
113
+
114
+ ``COMMENT``
115
+ Display the given message before the commands are executed at
116
+ build time.
117
+
118
+ .. versionadded:: 3.26
119
+ Arguments to ``COMMENT`` may use
120
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
121
+
122
+ ``DEPENDS``
123
+ Reference files and outputs of custom commands created with
124
+ :command:`add_custom_command` command calls in the same directory
125
+ (``CMakeLists.txt`` file). They will be brought up to date when
126
+ the target is built.
127
+
128
+ .. versionchanged:: 3.16
129
+ A target-level dependency is added if any dependency is a byproduct
130
+ of a target or any of its build events in the same directory to ensure
131
+ the byproducts will be available before this target is built.
132
+
133
+ Use the :command:`add_dependencies` command to add dependencies
134
+ on other targets.
135
+
136
+ ``COMMAND_EXPAND_LISTS``
137
+ .. versionadded:: 3.8
138
+
139
+ Lists in ``COMMAND`` arguments will be expanded, including those
140
+ created with
141
+ :manual:`generator expressions <cmake-generator-expressions(7)>`,
142
+ allowing ``COMMAND`` arguments such as
143
+ ``${CC} "-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>" foo.cc``
144
+ to be properly expanded.
145
+
146
+ ``JOB_POOL``
147
+ .. versionadded:: 3.15
148
+
149
+ Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja`
150
+ generator. Incompatible with ``USES_TERMINAL``, which implies
151
+ the ``console`` pool.
152
+ Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
153
+ an error by ninja at build time.
154
+
155
+ ``JOB_SERVER_AWARE``
156
+ .. versionadded:: 3.28
157
+
158
+ Specify that the command is GNU Make job server aware.
159
+
160
+ For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and
161
+ :generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the
162
+ recipe line. See the `GNU Make Documentation`_ for more information.
163
+
164
+ This option is silently ignored by other generators.
165
+
166
+ .. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
167
+
168
+ ``SOURCES``
169
+ Specify additional source files to be included in the custom target.
170
+ Specified source files will be added to IDE project files for
171
+ convenience in editing even if they have no build rules.
172
+
173
+ ``VERBATIM``
174
+ All arguments to the commands will be escaped properly for the
175
+ build tool so that the invoked command receives each argument
176
+ unchanged. Note that one level of escapes is still used by the
177
+ CMake language processor before ``add_custom_target`` even sees
178
+ the arguments. Use of ``VERBATIM`` is recommended as it enables
179
+ correct behavior. When ``VERBATIM`` is not given the behavior
180
+ is platform specific because there is no protection of
181
+ tool-specific special characters.
182
+
183
+ ``USES_TERMINAL``
184
+ .. versionadded:: 3.2
185
+
186
+ The command will be given direct access to the terminal if possible.
187
+ With the :generator:`Ninja` generator, this places the command in
188
+ the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
189
+
190
+ ``WORKING_DIRECTORY``
191
+ Execute the command with the given current working directory.
192
+ If it is a relative path it will be interpreted relative to the
193
+ build tree directory corresponding to the current source directory.
194
+
195
+ .. versionadded:: 3.13
196
+ Arguments to ``WORKING_DIRECTORY`` may use
197
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
198
+
199
+ Ninja Multi-Config
200
+ ^^^^^^^^^^^^^^^^^^
201
+
202
+ .. versionadded:: 3.20
203
+
204
+ ``add_custom_target`` supports the :generator:`Ninja Multi-Config`
205
+ generator's cross-config capabilities. See the generator documentation
206
+ for more information.
207
+
208
+ See Also
209
+ ^^^^^^^^
210
+
211
+ * :command:`add_custom_command`
cmake/share/cmake-3.31/Help/command/add_definitions.rst ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_definitions
2
+ ---------------
3
+
4
+ Add ``-D`` define flags to the compilation of source files.
5
+
6
+ .. code-block:: cmake
7
+
8
+ add_definitions(-DFOO -DBAR ...)
9
+
10
+ Adds definitions to the compiler command line for targets in the current
11
+ directory, whether added before or after this command is invoked, and for
12
+ the ones in sub-directories added after. This command can be used to add any
13
+ flags, but it is intended to add preprocessor definitions.
14
+
15
+ .. note::
16
+
17
+ This command has been superseded by alternatives:
18
+
19
+ * Use :command:`add_compile_definitions` to add preprocessor definitions.
20
+ * Use :command:`include_directories` to add include directories.
21
+ * Use :command:`add_compile_options` to add other options.
22
+
23
+ Flags beginning in ``-D`` or ``/D`` that look like preprocessor definitions are
24
+ automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory
25
+ property for the current directory. Definitions with non-trivial values
26
+ may be left in the set of flags instead of being converted for reasons of
27
+ backwards compatibility. See documentation of the
28
+ :prop_dir:`directory <COMPILE_DEFINITIONS>`,
29
+ :prop_tgt:`target <COMPILE_DEFINITIONS>`,
30
+ :prop_sf:`source file <COMPILE_DEFINITIONS>` ``COMPILE_DEFINITIONS``
31
+ properties for details on adding preprocessor definitions to specific
32
+ scopes and configurations.
33
+
34
+ See Also
35
+ ^^^^^^^^
36
+
37
+ * The :manual:`cmake-buildsystem(7)` manual for more on defining
38
+ buildsystem properties.
cmake/share/cmake-3.31/Templates/CPack.GenericDescription.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ DESCRIPTION
2
+ ===========
3
+
4
+ This is an installer created using CPack (https://cmake.org). No additional installation instructions provided.
5
+
cmake/share/cmake-3.31/Templates/CPack.GenericLicense.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ LICENSE
2
+ =======
3
+
4
+ This is an installer created using CPack (https://cmake.org). No license provided.
5
+
cmake/share/cmake-3.31/Templates/CPack.GenericWelcome.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Welcome to installation. This program will guide you through the installation of this software.
cmake/share/cmake-3.31/Templates/CPackConfig.cmake.in ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file will be configured to contain variables for CPack. These variables
2
+ # should be set in the CMake list file of the project before CPack module is
3
+ # included. The list of available CPACK_xxx variables and their associated
4
+ # documentation may be obtained using
5
+ # cpack --help-variable-list
6
+ #
7
+ # Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME)
8
+ # and some are specific to a generator
9
+ # (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables
10
+ # usually begin with CPACK_<GENNAME>_xxxx.
11
+
12
+ @_CPACK_OTHER_VARIABLES_@
13
+
14
+ if(NOT CPACK_PROPERTIES_FILE)
15
+ set(CPACK_PROPERTIES_FILE "@CMAKE_BINARY_DIR@/CPackProperties.cmake")
16
+ endif()
17
+
18
+ if(EXISTS ${CPACK_PROPERTIES_FILE})
19
+ include(${CPACK_PROPERTIES_FILE})
20
+ endif()
cmake/share/cmake-3.31/Templates/TestDriver.cxx.in ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <ctype.h> /* NOLINT */
2
+ #include <stdio.h> /* NOLINT */
3
+ #include <stdlib.h> /* NOLINT */
4
+ #include <string.h> /* NOLINT */
5
+ #include <time.h> /* NOLINT */
6
+
7
+ #if defined(_MSC_VER)
8
+ #pragma warning(disable : 4996) /* deprecation */
9
+ #endif
10
+
11
+ @CMAKE_TESTDRIVER_EXTRA_INCLUDES@
12
+
13
+ /* Forward declare test functions. */
14
+ @CMAKE_FORWARD_DECLARE_TESTS@
15
+
16
+ #ifdef __cplusplus
17
+ # define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR)
18
+ # if __cplusplus >= 201103L
19
+ # define CM_NULL nullptr
20
+ # else
21
+ # define CM_NULL NULL
22
+ # endif
23
+ # define CM_NAMESPACE_BEGIN namespace {
24
+ # define CM_NAMESPACE_END }
25
+ # define CM_LOCAL
26
+ #else
27
+ # define CM_CAST(TYPE, EXPR) (TYPE)(EXPR)
28
+ # define CM_NULL NULL
29
+ # define CM_NAMESPACE_BEGIN
30
+ # define CM_NAMESPACE_END
31
+ # define CM_LOCAL static
32
+ #endif
33
+
34
+ CM_NAMESPACE_BEGIN
35
+
36
+ /* Create map. */
37
+
38
+ typedef int (*MainFuncPointer)(int, char* []); /* NOLINT */
39
+ typedef struct /* NOLINT */
40
+ {
41
+ const char* name;
42
+ MainFuncPointer func;
43
+ } functionMapEntry;
44
+
45
+ CM_LOCAL const functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
46
+ @CMAKE_FUNCTION_TABLE_ENTRIES@
47
+ { CM_NULL, CM_NULL } /* NOLINT */
48
+ };
49
+
50
+ CM_LOCAL const int NumTests = CM_CAST(int,
51
+ sizeof(cmakeGeneratedFunctionMapEntries) / sizeof(functionMapEntry)) - 1;
52
+
53
+ /* Allocate and create a lowercased copy of string
54
+ (note that it has to be free'd manually) */
55
+ CM_LOCAL char* lowercase(const char* string)
56
+ {
57
+ char *new_string;
58
+ char *p;
59
+ size_t stringSize;
60
+
61
+ stringSize = CM_CAST(size_t, strlen(string) + 1);
62
+ new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize));
63
+
64
+ if (new_string == CM_NULL) { /* NOLINT */
65
+ return CM_NULL; /* NOLINT */
66
+ }
67
+ strcpy(new_string, string); /* NOLINT */
68
+ for (p = new_string; *p != 0; ++p) {
69
+ *p = CM_CAST(char, tolower(*p));
70
+ }
71
+ return new_string;
72
+ }
73
+
74
+ CM_LOCAL int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
75
+ int i;
76
+ for (i = 0; i < n_skipped_tests; i++) {
77
+ if (strcmp(name, skipped_tests[i]) == 0) {
78
+ return 1;
79
+ }
80
+ }
81
+
82
+ return 0;
83
+ }
84
+
85
+ CM_NAMESPACE_END
86
+
87
+ int main(int ac, char* av[])
88
+ {
89
+ int i;
90
+ int testNum = 0;
91
+ int partial_match;
92
+ int run_all;
93
+ char *arg;
94
+ int testToRun = -1;
95
+
96
+ @CMAKE_TESTDRIVER_ARGVC_FUNCTION@
97
+
98
+ /* If no test name was given */
99
+ /* process command line with user function. */
100
+ if (ac < 2) {
101
+ /* Ask for a test. */
102
+ printf("Available tests:\n");
103
+ for (i = 0; i < NumTests; ++i) {
104
+ printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
105
+ }
106
+ printf("To run a test, enter the test number: ");
107
+ fflush(stdout);
108
+ if (scanf("%d", &testNum) != 1) {
109
+ printf("Couldn't parse that input as a number\n");
110
+ return -1;
111
+ }
112
+ if (testNum >= NumTests) {
113
+ printf("%3d is an invalid test number.\n", testNum);
114
+ return -1;
115
+ }
116
+ testToRun = testNum;
117
+ ac--;
118
+ av++;
119
+ }
120
+ partial_match = 0;
121
+ run_all = 0;
122
+ arg = CM_NULL; /* NOLINT */
123
+ /* If partial match or running all tests are requested. */
124
+ if (testToRun == -1 && ac > 1) {
125
+ partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
126
+ run_all = (strcmp(av[1], "-A") == 0) ? 1 : 0;
127
+ }
128
+ if (partial_match != 0 && ac < 3) {
129
+ printf("-R needs an additional parameter.\n");
130
+ return -1;
131
+ }
132
+ if (run_all == 1) {
133
+ clock_t t;
134
+ int status = 0;
135
+ const char* status_message = CM_NULL;
136
+ printf("TAP version 13\n");
137
+ printf("1..%d\n", NumTests);
138
+ for (i = 0; i < NumTests; ++i) {
139
+ const char *name = cmakeGeneratedFunctionMapEntries[i].name;
140
+ if (ac > 2) {
141
+ if (isTestSkipped(name, ac - 2, av + 2) == 1) {
142
+ printf("ok %d %s # SKIP\n", i + 1, name);
143
+ continue;
144
+ }
145
+ }
146
+ t = clock();
147
+ status = (*cmakeGeneratedFunctionMapEntries[i].func)(ac, av);
148
+ t = clock() - t;
149
+ status_message = (status == -1) ? "not ok" : "ok";
150
+ {
151
+ double time_taken = CM_CAST(double, t) / CLOCKS_PER_SEC;
152
+ printf("%s %d %s # %f\n", status_message, i + 1, name, time_taken);
153
+ }
154
+ }
155
+ printf("All tests finished.\n");
156
+
157
+ return 0;
158
+ }
159
+
160
+ if (testToRun == -1) {
161
+ arg = lowercase(av[1 + partial_match]);
162
+ }
163
+ for (i = 0; i < NumTests && testToRun == -1; ++i) {
164
+ char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
165
+ if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
166
+ testToRun = i;
167
+ ac -= 2;
168
+ av += 2;
169
+ } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
170
+ testToRun = i;
171
+ ac--;
172
+ av++;
173
+ }
174
+ free(test_name);
175
+ }
176
+ free(arg);
177
+ if (testToRun != -1) {
178
+ int result;
179
+ @CMAKE_TESTDRIVER_BEFORE_TESTMAIN@
180
+ if (testToRun < 0 || testToRun >= NumTests) {
181
+ printf("testToRun was modified by TestDriver code to an invalid value: "
182
+ "%3d.\n",
183
+ testNum);
184
+ return -1;
185
+ }
186
+ result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
187
+ @CMAKE_TESTDRIVER_AFTER_TESTMAIN@
188
+ return result;
189
+ }
190
+
191
+ /* Nothing was run, display the test names. */
192
+ printf("Available tests:\n");
193
+ for (i = 0; i < NumTests; ++i) {
194
+ printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
195
+ }
196
+ printf("Failed: %s is an invalid test name.\n", av[1]);
197
+
198
+ return -1;
199
+ }
cmake/share/cmake-3.31/Templates/Windows/Logo.png ADDED

Git LFS Details

  • SHA256: 8a5556260d61749e920ebb51726808f4a235e935559ea2d7a20c1b92288da078
  • Pointer size: 128 Bytes
  • Size of remote file: 488 Bytes
cmake/share/cmake-3.31/Templates/Windows/SmallLogo.png ADDED

Git LFS Details

  • SHA256: f2f210f0afe57fc27c5797458ed119121690704f9ffa16092bedaea0da5a4d6a
  • Pointer size: 128 Bytes
  • Size of remote file: 167 Bytes
cmake/share/cmake-3.31/Templates/Windows/SmallLogo44x44.png ADDED

Git LFS Details

  • SHA256: f259cce553a0aa105115ddd3d63d00065619de0ce8ada4f6b07d6fa16498a42b
  • Pointer size: 128 Bytes
  • Size of remote file: 265 Bytes
cmake/share/cmake-3.31/Templates/Windows/SplashScreen.png ADDED

Git LFS Details

  • SHA256: 102c4d51610d5b9ceb9a01741fd1341417de9b3ec0f8b19252022be0d4df4a6a
  • Pointer size: 128 Bytes
  • Size of remote file: 909 Bytes
cmake/share/vim/vimfiles/indent/cmake.vim ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ " Vim indent file
2
+ " Language: CMake (ft=cmake)
3
+ " Author: Andy Cedilnik <andy.cedilnik@kitware.com>
4
+ " Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
5
+ " Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
6
+ " Last Change: 2022 Mar 22
7
+ "
8
+ " License: The CMake license applies to this file. See
9
+ " https://cmake.org/licensing
10
+ " This implies that distribution with Vim is allowed
11
+
12
+ if exists("b:did_indent")
13
+ finish
14
+ endif
15
+ let b:did_indent = 1
16
+
17
+ setlocal indentexpr=CMakeGetIndent(v:lnum)
18
+ setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
19
+
20
+ let b:undo_indent = "setl inde< indk<"
21
+
22
+ " Only define the function once.
23
+ if exists("*CMakeGetIndent")
24
+ finish
25
+ endif
26
+ let s:keepcpo= &cpo
27
+ set cpo&vim
28
+
29
+ fun! CMakeGetIndent(lnum)
30
+ let this_line = getline(a:lnum)
31
+
32
+ " Find a non-blank line above the current line.
33
+ let lnum = a:lnum
34
+ let lnum = prevnonblank(lnum - 1)
35
+ let previous_line = getline(lnum)
36
+
37
+ " Hit the start of the file, use zero indent.
38
+ if lnum == 0
39
+ return 0
40
+ endif
41
+
42
+ let ind = indent(lnum)
43
+
44
+ let or = '\|'
45
+ " Regular expressions used by line indentation function.
46
+ let cmake_regex_comment = '#.*'
47
+ let cmake_regex_identifier = '[A-Za-z][A-Za-z0-9_]*'
48
+ let cmake_regex_quoted = '"\([^"\\]\|\\.\)*"'
49
+ let cmake_regex_arguments = '\(' . cmake_regex_quoted .
50
+ \ or . '\$(' . cmake_regex_identifier . ')' .
51
+ \ or . '[^()\\#"]' . or . '\\.' . '\)*'
52
+
53
+ let cmake_indent_comment_line = '^\s*' . cmake_regex_comment
54
+ let cmake_indent_blank_regex = '^\s*$'
55
+ let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
56
+ \ '\s*(' . cmake_regex_arguments .
57
+ \ '\(' . cmake_regex_comment . '\)\?$'
58
+ let cmake_indent_close_regex = '^' . cmake_regex_arguments .
59
+ \ ')\s*' .
60
+ \ '\(' . cmake_regex_comment . '\)\?$'
61
+
62
+ let cmake_closing_parens_line = '^\s*\()\+\)\s*$'
63
+
64
+ let cmake_indent_begin_regex = '^\s*\(BLOCK\|IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
65
+ let cmake_indent_end_regex = '^\s*\(ENDBLOCK\|ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
66
+
67
+ if this_line =~? cmake_closing_parens_line
68
+ if previous_line !~? cmake_indent_open_regex
69
+ let ind = ind - shiftwidth()
70
+ endif
71
+ else
72
+ " Add
73
+ if previous_line =~? cmake_indent_comment_line " Handle comments
74
+ let ind = ind
75
+ else
76
+ if previous_line =~? cmake_indent_begin_regex
77
+ let ind = ind + shiftwidth()
78
+ endif
79
+ if previous_line =~? cmake_indent_open_regex
80
+ let ind = ind + shiftwidth()
81
+ endif
82
+ endif
83
+
84
+ " Subtract
85
+ if this_line =~? cmake_indent_end_regex
86
+ let ind = ind - shiftwidth()
87
+ endif
88
+ if previous_line !~? cmake_closing_parens_line
89
+ if previous_line =~? cmake_indent_close_regex
90
+ let ind = ind - shiftwidth()
91
+ endif
92
+ endif
93
+ endif
94
+
95
+ return ind
96
+ endfun
97
+
98
+ let &cpo = s:keepcpo
99
+ unlet s:keepcpo
cmake/share/vim/vimfiles/syntax/cmake.vim ADDED
The diff for this file is too large to render. See raw diff
 
ffmpeg/bin/ffmpeg.exe ADDED
Binary file (429 kB). View file
 
ffmpeg/bin/ffprobe.exe ADDED
Binary file (222 kB). View file
 
ffmpeg/bin/postproc-58.dll ADDED
Binary file (89.1 kB). View file
 
ffmpeg/bin/swresample-5.dll ADDED
Binary file (659 kB). View file
 
ffmpeg/bin/swscale-8.dll ADDED
Binary file (812 kB). View file
 
ffmpeg/include/libavcodec/ac3_parser.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * AC-3 parser prototypes
3
+ * Copyright (c) 2003 Fabrice Bellard
4
+ * Copyright (c) 2003 Michael Niedermayer
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_AC3_PARSER_H
24
+ #define AVCODEC_AC3_PARSER_H
25
+
26
+ #include <stddef.h>
27
+ #include <stdint.h>
28
+
29
+ /**
30
+ * Extract the bitstream ID and the frame size from AC-3 data.
31
+ */
32
+ int av_ac3_parse_header(const uint8_t *buf, size_t size,
33
+ uint8_t *bitstream_id, uint16_t *frame_size);
34
+
35
+
36
+ #endif /* AVCODEC_AC3_PARSER_H */
ffmpeg/include/libavcodec/adts_parser.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_ADTS_PARSER_H
20
+ #define AVCODEC_ADTS_PARSER_H
21
+
22
+ #include <stddef.h>
23
+ #include <stdint.h>
24
+
25
+ #define AV_AAC_ADTS_HEADER_SIZE 7
26
+
27
+ /**
28
+ * Extract the number of samples and frames from AAC data.
29
+ * @param[in] buf pointer to AAC data buffer
30
+ * @param[out] samples Pointer to where number of samples is written
31
+ * @param[out] frames Pointer to where number of frames is written
32
+ * @return Returns 0 on success, error code on failure.
33
+ */
34
+ int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
35
+ uint8_t *frames);
36
+
37
+ #endif /* AVCODEC_ADTS_PARSER_H */
ffmpeg/include/libavcodec/avcodec.h ADDED
The diff for this file is too large to render. See raw diff
 
ffmpeg/include/libavcodec/avdct.h ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_AVDCT_H
20
+ #define AVCODEC_AVDCT_H
21
+
22
+ #include "libavutil/opt.h"
23
+
24
+ /**
25
+ * AVDCT context.
26
+ * @note function pointers can be NULL if the specific features have been
27
+ * disabled at build time.
28
+ */
29
+ typedef struct AVDCT {
30
+ const AVClass *av_class;
31
+
32
+ void (*idct)(int16_t *block /* align 16 */);
33
+
34
+ /**
35
+ * IDCT input permutation.
36
+ * Several optimized IDCTs need a permutated input (relative to the
37
+ * normal order of the reference IDCT).
38
+ * This permutation must be performed before the idct_put/add.
39
+ * Note, normally this can be merged with the zigzag/alternate scan<br>
40
+ * An example to avoid confusion:
41
+ * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
42
+ * - (x -> reference DCT -> reference IDCT -> x)
43
+ * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
44
+ * -> simple_idct_mmx -> x)
45
+ * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
46
+ * -> simple_idct_mmx -> ...)
47
+ */
48
+ uint8_t idct_permutation[64];
49
+
50
+ void (*fdct)(int16_t *block /* align 16 */);
51
+
52
+
53
+ /**
54
+ * DCT algorithm.
55
+ * must use AVOptions to set this field.
56
+ */
57
+ int dct_algo;
58
+
59
+ /**
60
+ * IDCT algorithm.
61
+ * must use AVOptions to set this field.
62
+ */
63
+ int idct_algo;
64
+
65
+ void (*get_pixels)(int16_t *block /* align 16 */,
66
+ const uint8_t *pixels /* align 8 */,
67
+ ptrdiff_t line_size);
68
+
69
+ int bits_per_sample;
70
+
71
+ void (*get_pixels_unaligned)(int16_t *block /* align 16 */,
72
+ const uint8_t *pixels,
73
+ ptrdiff_t line_size);
74
+ } AVDCT;
75
+
76
+ /**
77
+ * Allocates a AVDCT context.
78
+ * This needs to be initialized with avcodec_dct_init() after optionally
79
+ * configuring it with AVOptions.
80
+ *
81
+ * To free it use av_free()
82
+ */
83
+ AVDCT *avcodec_dct_alloc(void);
84
+ int avcodec_dct_init(AVDCT *);
85
+
86
+ const AVClass *avcodec_dct_get_class(void);
87
+
88
+ #endif /* AVCODEC_AVDCT_H */
ffmpeg/include/libavcodec/avfft.h ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_AVFFT_H
20
+ #define AVCODEC_AVFFT_H
21
+
22
+ #include "libavutil/attributes.h"
23
+ #include "version_major.h"
24
+ #if FF_API_AVFFT
25
+
26
+ /**
27
+ * @file
28
+ * @ingroup lavc_fft
29
+ * FFT functions
30
+ */
31
+
32
+ /**
33
+ * @defgroup lavc_fft FFT functions
34
+ * @ingroup lavc_misc
35
+ *
36
+ * @{
37
+ */
38
+
39
+ typedef float FFTSample;
40
+
41
+ typedef struct FFTComplex {
42
+ FFTSample re, im;
43
+ } FFTComplex;
44
+
45
+ typedef struct FFTContext FFTContext;
46
+
47
+ /**
48
+ * Set up a complex FFT.
49
+ * @param nbits log2 of the length of the input array
50
+ * @param inverse if 0 perform the forward transform, if 1 perform the inverse
51
+ * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_FFT
52
+ */
53
+ attribute_deprecated
54
+ FFTContext *av_fft_init(int nbits, int inverse);
55
+
56
+ /**
57
+ * Do the permutation needed BEFORE calling ff_fft_calc().
58
+ * @deprecated without replacement
59
+ */
60
+ attribute_deprecated
61
+ void av_fft_permute(FFTContext *s, FFTComplex *z);
62
+
63
+ /**
64
+ * Do a complex FFT with the parameters defined in av_fft_init(). The
65
+ * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
66
+ * @deprecated use the av_tx_fn value returned by av_tx_init, which also does permutation
67
+ */
68
+ attribute_deprecated
69
+ void av_fft_calc(FFTContext *s, FFTComplex *z);
70
+
71
+ attribute_deprecated
72
+ void av_fft_end(FFTContext *s);
73
+
74
+ /**
75
+ * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_MDCT,
76
+ * with a flag of AV_TX_FULL_IMDCT for a replacement to av_imdct_calc.
77
+ */
78
+ attribute_deprecated
79
+ FFTContext *av_mdct_init(int nbits, int inverse, double scale);
80
+ attribute_deprecated
81
+ void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
82
+ attribute_deprecated
83
+ void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
84
+ attribute_deprecated
85
+ void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
86
+ attribute_deprecated
87
+ void av_mdct_end(FFTContext *s);
88
+
89
+ /* Real Discrete Fourier Transform */
90
+
91
+ enum RDFTransformType {
92
+ DFT_R2C,
93
+ IDFT_C2R,
94
+ IDFT_R2C,
95
+ DFT_C2R,
96
+ };
97
+
98
+ typedef struct RDFTContext RDFTContext;
99
+
100
+ /**
101
+ * Set up a real FFT.
102
+ * @param nbits log2 of the length of the input array
103
+ * @param trans the type of transform
104
+ *
105
+ * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_RDFT
106
+ */
107
+ attribute_deprecated
108
+ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
109
+ attribute_deprecated
110
+ void av_rdft_calc(RDFTContext *s, FFTSample *data);
111
+ attribute_deprecated
112
+ void av_rdft_end(RDFTContext *s);
113
+
114
+ /* Discrete Cosine Transform */
115
+
116
+ typedef struct DCTContext DCTContext;
117
+
118
+ enum DCTTransformType {
119
+ DCT_II = 0,
120
+ DCT_III,
121
+ DCT_I,
122
+ DST_I,
123
+ };
124
+
125
+ /**
126
+ * Set up DCT.
127
+ *
128
+ * @param nbits size of the input array:
129
+ * (1 << nbits) for DCT-II, DCT-III and DST-I
130
+ * (1 << nbits) + 1 for DCT-I
131
+ * @param type the type of transform
132
+ *
133
+ * @note the first element of the input of DST-I is ignored
134
+ *
135
+ * @deprecated use av_tx_init from libavutil/tx.h with an appropriate type of AV_TX_FLOAT_DCT
136
+ */
137
+ attribute_deprecated
138
+ DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
139
+ attribute_deprecated
140
+ void av_dct_calc(DCTContext *s, FFTSample *data);
141
+ attribute_deprecated
142
+ void av_dct_end (DCTContext *s);
143
+
144
+ /**
145
+ * @}
146
+ */
147
+
148
+ #endif /* FF_API_AVFFT */
149
+ #endif /* AVCODEC_AVFFT_H */
ffmpeg/include/libavcodec/bsf.h ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Bitstream filters public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_BSF_H
22
+ #define AVCODEC_BSF_H
23
+
24
+ #include "libavutil/dict.h"
25
+ #include "libavutil/log.h"
26
+ #include "libavutil/rational.h"
27
+
28
+ #include "codec_id.h"
29
+ #include "codec_par.h"
30
+ #include "packet.h"
31
+
32
+ /**
33
+ * @defgroup lavc_bsf Bitstream filters
34
+ * @ingroup libavc
35
+ *
36
+ * Bitstream filters transform encoded media data without decoding it. This
37
+ * allows e.g. manipulating various header values. Bitstream filters operate on
38
+ * @ref AVPacket "AVPackets".
39
+ *
40
+ * The bitstream filtering API is centered around two structures:
41
+ * AVBitStreamFilter and AVBSFContext. The former represents a bitstream filter
42
+ * in abstract, the latter a specific filtering process. Obtain an
43
+ * AVBitStreamFilter using av_bsf_get_by_name() or av_bsf_iterate(), then pass
44
+ * it to av_bsf_alloc() to create an AVBSFContext. Fill in the user-settable
45
+ * AVBSFContext fields, as described in its documentation, then call
46
+ * av_bsf_init() to prepare the filter context for use.
47
+ *
48
+ * Submit packets for filtering using av_bsf_send_packet(), obtain filtered
49
+ * results with av_bsf_receive_packet(). When no more input packets will be
50
+ * sent, submit a NULL AVPacket to signal the end of the stream to the filter.
51
+ * av_bsf_receive_packet() will then return trailing packets, if any are
52
+ * produced by the filter.
53
+ *
54
+ * Finally, free the filter context with av_bsf_free().
55
+ * @{
56
+ */
57
+
58
+ /**
59
+ * The bitstream filter state.
60
+ *
61
+ * This struct must be allocated with av_bsf_alloc() and freed with
62
+ * av_bsf_free().
63
+ *
64
+ * The fields in the struct will only be changed (by the caller or by the
65
+ * filter) as described in their documentation, and are to be considered
66
+ * immutable otherwise.
67
+ */
68
+ typedef struct AVBSFContext {
69
+ /**
70
+ * A class for logging and AVOptions
71
+ */
72
+ const AVClass *av_class;
73
+
74
+ /**
75
+ * The bitstream filter this context is an instance of.
76
+ */
77
+ const struct AVBitStreamFilter *filter;
78
+
79
+ /**
80
+ * Opaque filter-specific private data. If filter->priv_class is non-NULL,
81
+ * this is an AVOptions-enabled struct.
82
+ */
83
+ void *priv_data;
84
+
85
+ /**
86
+ * Parameters of the input stream. This field is allocated in
87
+ * av_bsf_alloc(), it needs to be filled by the caller before
88
+ * av_bsf_init().
89
+ */
90
+ AVCodecParameters *par_in;
91
+
92
+ /**
93
+ * Parameters of the output stream. This field is allocated in
94
+ * av_bsf_alloc(), it is set by the filter in av_bsf_init().
95
+ */
96
+ AVCodecParameters *par_out;
97
+
98
+ /**
99
+ * The timebase used for the timestamps of the input packets. Set by the
100
+ * caller before av_bsf_init().
101
+ */
102
+ AVRational time_base_in;
103
+
104
+ /**
105
+ * The timebase used for the timestamps of the output packets. Set by the
106
+ * filter in av_bsf_init().
107
+ */
108
+ AVRational time_base_out;
109
+ } AVBSFContext;
110
+
111
+ typedef struct AVBitStreamFilter {
112
+ const char *name;
113
+
114
+ /**
115
+ * A list of codec ids supported by the filter, terminated by
116
+ * AV_CODEC_ID_NONE.
117
+ * May be NULL, in that case the bitstream filter works with any codec id.
118
+ */
119
+ const enum AVCodecID *codec_ids;
120
+
121
+ /**
122
+ * A class for the private data, used to declare bitstream filter private
123
+ * AVOptions. This field is NULL for bitstream filters that do not declare
124
+ * any options.
125
+ *
126
+ * If this field is non-NULL, the first member of the filter private data
127
+ * must be a pointer to AVClass, which will be set by libavcodec generic
128
+ * code to this class.
129
+ */
130
+ const AVClass *priv_class;
131
+ } AVBitStreamFilter;
132
+
133
+ /**
134
+ * @return a bitstream filter with the specified name or NULL if no such
135
+ * bitstream filter exists.
136
+ */
137
+ const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
138
+
139
+ /**
140
+ * Iterate over all registered bitstream filters.
141
+ *
142
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
143
+ * point to NULL to start the iteration.
144
+ *
145
+ * @return the next registered bitstream filter or NULL when the iteration is
146
+ * finished
147
+ */
148
+ const AVBitStreamFilter *av_bsf_iterate(void **opaque);
149
+
150
+ /**
151
+ * Allocate a context for a given bitstream filter. The caller must fill in the
152
+ * context parameters as described in the documentation and then call
153
+ * av_bsf_init() before sending any data to the filter.
154
+ *
155
+ * @param filter the filter for which to allocate an instance.
156
+ * @param[out] ctx a pointer into which the pointer to the newly-allocated context
157
+ * will be written. It must be freed with av_bsf_free() after the
158
+ * filtering is done.
159
+ *
160
+ * @return 0 on success, a negative AVERROR code on failure
161
+ */
162
+ int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
163
+
164
+ /**
165
+ * Prepare the filter for use, after all the parameters and options have been
166
+ * set.
167
+ *
168
+ * @param ctx a AVBSFContext previously allocated with av_bsf_alloc()
169
+ */
170
+ int av_bsf_init(AVBSFContext *ctx);
171
+
172
+ /**
173
+ * Submit a packet for filtering.
174
+ *
175
+ * After sending each packet, the filter must be completely drained by calling
176
+ * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
177
+ * AVERROR_EOF.
178
+ *
179
+ * @param ctx an initialized AVBSFContext
180
+ * @param pkt the packet to filter. The bitstream filter will take ownership of
181
+ * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
182
+ * If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero),
183
+ * it signals the end of the stream (i.e. no more non-empty packets will be sent;
184
+ * sending more empty packets does nothing) and will cause the filter to output
185
+ * any packets it may have buffered internally.
186
+ *
187
+ * @return
188
+ * - 0 on success.
189
+ * - AVERROR(EAGAIN) if packets need to be retrieved from the filter (using
190
+ * av_bsf_receive_packet()) before new input can be consumed.
191
+ * - Another negative AVERROR value if an error occurs.
192
+ */
193
+ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
194
+
195
+ /**
196
+ * Retrieve a filtered packet.
197
+ *
198
+ * @param ctx an initialized AVBSFContext
199
+ * @param[out] pkt this struct will be filled with the contents of the filtered
200
+ * packet. It is owned by the caller and must be freed using
201
+ * av_packet_unref() when it is no longer needed.
202
+ * This parameter should be "clean" (i.e. freshly allocated
203
+ * with av_packet_alloc() or unreffed with av_packet_unref())
204
+ * when this function is called. If this function returns
205
+ * successfully, the contents of pkt will be completely
206
+ * overwritten by the returned data. On failure, pkt is not
207
+ * touched.
208
+ *
209
+ * @return
210
+ * - 0 on success.
211
+ * - AVERROR(EAGAIN) if more packets need to be sent to the filter (using
212
+ * av_bsf_send_packet()) to get more output.
213
+ * - AVERROR_EOF if there will be no further output from the filter.
214
+ * - Another negative AVERROR value if an error occurs.
215
+ *
216
+ * @note one input packet may result in several output packets, so after sending
217
+ * a packet with av_bsf_send_packet(), this function needs to be called
218
+ * repeatedly until it stops returning 0. It is also possible for a filter to
219
+ * output fewer packets than were sent to it, so this function may return
220
+ * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
221
+ */
222
+ int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
223
+
224
+ /**
225
+ * Reset the internal bitstream filter state. Should be called e.g. when seeking.
226
+ */
227
+ void av_bsf_flush(AVBSFContext *ctx);
228
+
229
+ /**
230
+ * Free a bitstream filter context and everything associated with it; write NULL
231
+ * into the supplied pointer.
232
+ */
233
+ void av_bsf_free(AVBSFContext **ctx);
234
+
235
+ /**
236
+ * Get the AVClass for AVBSFContext. It can be used in combination with
237
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
238
+ *
239
+ * @see av_opt_find().
240
+ */
241
+ const AVClass *av_bsf_get_class(void);
242
+
243
+ /**
244
+ * Structure for chain/list of bitstream filters.
245
+ * Empty list can be allocated by av_bsf_list_alloc().
246
+ */
247
+ typedef struct AVBSFList AVBSFList;
248
+
249
+ /**
250
+ * Allocate empty list of bitstream filters.
251
+ * The list must be later freed by av_bsf_list_free()
252
+ * or finalized by av_bsf_list_finalize().
253
+ *
254
+ * @return Pointer to @ref AVBSFList on success, NULL in case of failure
255
+ */
256
+ AVBSFList *av_bsf_list_alloc(void);
257
+
258
+ /**
259
+ * Free list of bitstream filters.
260
+ *
261
+ * @param lst Pointer to pointer returned by av_bsf_list_alloc()
262
+ */
263
+ void av_bsf_list_free(AVBSFList **lst);
264
+
265
+ /**
266
+ * Append bitstream filter to the list of bitstream filters.
267
+ *
268
+ * @param lst List to append to
269
+ * @param bsf Filter context to be appended
270
+ *
271
+ * @return >=0 on success, negative AVERROR in case of failure
272
+ */
273
+ int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
274
+
275
+ /**
276
+ * Construct new bitstream filter context given it's name and options
277
+ * and append it to the list of bitstream filters.
278
+ *
279
+ * @param lst List to append to
280
+ * @param bsf_name Name of the bitstream filter
281
+ * @param options Options for the bitstream filter, can be set to NULL
282
+ *
283
+ * @return >=0 on success, negative AVERROR in case of failure
284
+ */
285
+ int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
286
+ /**
287
+ * Finalize list of bitstream filters.
288
+ *
289
+ * This function will transform @ref AVBSFList to single @ref AVBSFContext,
290
+ * so the whole chain of bitstream filters can be treated as single filter
291
+ * freshly allocated by av_bsf_alloc().
292
+ * If the call is successful, @ref AVBSFList structure is freed and lst
293
+ * will be set to NULL. In case of failure, caller is responsible for
294
+ * freeing the structure by av_bsf_list_free()
295
+ *
296
+ * @param lst Filter list structure to be transformed
297
+ * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
298
+ * representing the chain of bitstream filters
299
+ *
300
+ * @return >=0 on success, negative AVERROR in case of failure
301
+ */
302
+ int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
303
+
304
+ /**
305
+ * Parse string describing list of bitstream filters and create single
306
+ * @ref AVBSFContext describing the whole chain of bitstream filters.
307
+ * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
308
+ * allocated by av_bsf_alloc().
309
+ *
310
+ * @param str String describing chain of bitstream filters in format
311
+ * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
312
+ * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
313
+ * representing the chain of bitstream filters
314
+ *
315
+ * @return >=0 on success, negative AVERROR in case of failure
316
+ */
317
+ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
318
+
319
+ /**
320
+ * Get null/pass-through bitstream filter.
321
+ *
322
+ * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
323
+ *
324
+ * @return
325
+ */
326
+ int av_bsf_get_null_filter(AVBSFContext **bsf);
327
+
328
+ /**
329
+ * @}
330
+ */
331
+
332
+ #endif // AVCODEC_BSF_H
ffmpeg/include/libavcodec/codec.h ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * AVCodec public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_CODEC_H
22
+ #define AVCODEC_CODEC_H
23
+
24
+ #include <stdint.h>
25
+
26
+ #include "libavutil/avutil.h"
27
+ #include "libavutil/hwcontext.h"
28
+ #include "libavutil/log.h"
29
+ #include "libavutil/pixfmt.h"
30
+ #include "libavutil/rational.h"
31
+ #include "libavutil/samplefmt.h"
32
+
33
+ #include "libavcodec/codec_id.h"
34
+ #include "libavcodec/version_major.h"
35
+
36
+ /**
37
+ * @addtogroup lavc_core
38
+ * @{
39
+ */
40
+
41
+ /**
42
+ * Decoder can use draw_horiz_band callback.
43
+ */
44
+ #define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
45
+ /**
46
+ * Codec uses get_buffer() or get_encode_buffer() for allocating buffers and
47
+ * supports custom allocators.
48
+ * If not set, it might not use get_buffer() or get_encode_buffer() at all, or
49
+ * use operations that assume the buffer was allocated by
50
+ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
51
+ */
52
+ #define AV_CODEC_CAP_DR1 (1 << 1)
53
+ /**
54
+ * Encoder or decoder requires flushing with NULL input at the end in order to
55
+ * give the complete and correct output.
56
+ *
57
+ * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
58
+ * with NULL data. The user can still send NULL data to the public encode
59
+ * or decode function, but libavcodec will not pass it along to the codec
60
+ * unless this flag is set.
61
+ *
62
+ * Decoders:
63
+ * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
64
+ * avpkt->size=0 at the end to get the delayed data until the decoder no longer
65
+ * returns frames.
66
+ *
67
+ * Encoders:
68
+ * The encoder needs to be fed with NULL data at the end of encoding until the
69
+ * encoder no longer returns data.
70
+ *
71
+ * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
72
+ * flag also means that the encoder must set the pts and duration for
73
+ * each output packet. If this flag is not set, the pts and duration will
74
+ * be determined by libavcodec from the input frame.
75
+ */
76
+ #define AV_CODEC_CAP_DELAY (1 << 5)
77
+ /**
78
+ * Codec can be fed a final frame with a smaller size.
79
+ * This can be used to prevent truncation of the last audio samples.
80
+ */
81
+ #define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
82
+
83
+ #if FF_API_SUBFRAMES
84
+ /**
85
+ * Codec can output multiple frames per AVPacket
86
+ * Normally demuxers return one frame at a time, demuxers which do not do
87
+ * are connected to a parser to split what they return into proper frames.
88
+ * This flag is reserved to the very rare category of codecs which have a
89
+ * bitstream that cannot be split into frames without timeconsuming
90
+ * operations like full decoding. Demuxers carrying such bitstreams thus
91
+ * may return multiple frames in a packet. This has many disadvantages like
92
+ * prohibiting stream copy in many cases thus it should only be considered
93
+ * as a last resort.
94
+ */
95
+ #define AV_CODEC_CAP_SUBFRAMES (1 << 8)
96
+ #endif
97
+
98
+ /**
99
+ * Codec is experimental and is thus avoided in favor of non experimental
100
+ * encoders
101
+ */
102
+ #define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
103
+ /**
104
+ * Codec should fill in channel configuration and samplerate instead of container
105
+ */
106
+ #define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
107
+ /**
108
+ * Codec supports frame-level multithreading.
109
+ */
110
+ #define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
111
+ /**
112
+ * Codec supports slice-based (or partition-based) multithreading.
113
+ */
114
+ #define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
115
+ /**
116
+ * Codec supports changed parameters at any point.
117
+ */
118
+ #define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
119
+ /**
120
+ * Codec supports multithreading through a method other than slice- or
121
+ * frame-level multithreading. Typically this marks wrappers around
122
+ * multithreading-capable external libraries.
123
+ */
124
+ #define AV_CODEC_CAP_OTHER_THREADS (1 << 15)
125
+ /**
126
+ * Audio encoder supports receiving a different number of samples in each call.
127
+ */
128
+ #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
129
+ /**
130
+ * Decoder is not a preferred choice for probing.
131
+ * This indicates that the decoder is not a good choice for probing.
132
+ * It could for example be an expensive to spin up hardware decoder,
133
+ * or it could simply not provide a lot of useful information about
134
+ * the stream.
135
+ * A decoder marked with this flag should only be used as last resort
136
+ * choice for probing.
137
+ */
138
+ #define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
139
+
140
+ /**
141
+ * Codec is backed by a hardware implementation. Typically used to
142
+ * identify a non-hwaccel hardware decoder. For information about hwaccels, use
143
+ * avcodec_get_hw_config() instead.
144
+ */
145
+ #define AV_CODEC_CAP_HARDWARE (1 << 18)
146
+
147
+ /**
148
+ * Codec is potentially backed by a hardware implementation, but not
149
+ * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
150
+ * implementation provides some sort of internal fallback.
151
+ */
152
+ #define AV_CODEC_CAP_HYBRID (1 << 19)
153
+
154
+ /**
155
+ * This encoder can reorder user opaque values from input AVFrames and return
156
+ * them with corresponding output packets.
157
+ * @see AV_CODEC_FLAG_COPY_OPAQUE
158
+ */
159
+ #define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
160
+
161
+ /**
162
+ * This encoder can be flushed using avcodec_flush_buffers(). If this flag is
163
+ * not set, the encoder must be closed and reopened to ensure that no frames
164
+ * remain pending.
165
+ */
166
+ #define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21)
167
+
168
+ /**
169
+ * The encoder is able to output reconstructed frame data, i.e. raw frames that
170
+ * would be produced by decoding the encoded bitstream.
171
+ *
172
+ * Reconstructed frame output is enabled by the AV_CODEC_FLAG_RECON_FRAME flag.
173
+ */
174
+ #define AV_CODEC_CAP_ENCODER_RECON_FRAME (1 << 22)
175
+
176
+ /**
177
+ * AVProfile.
178
+ */
179
+ typedef struct AVProfile {
180
+ int profile;
181
+ const char *name; ///< short name for the profile
182
+ } AVProfile;
183
+
184
+ /**
185
+ * AVCodec.
186
+ */
187
+ typedef struct AVCodec {
188
+ /**
189
+ * Name of the codec implementation.
190
+ * The name is globally unique among encoders and among decoders (but an
191
+ * encoder and a decoder can share the same name).
192
+ * This is the primary way to find a codec from the user perspective.
193
+ */
194
+ const char *name;
195
+ /**
196
+ * Descriptive name for the codec, meant to be more human readable than name.
197
+ * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
198
+ */
199
+ const char *long_name;
200
+ enum AVMediaType type;
201
+ enum AVCodecID id;
202
+ /**
203
+ * Codec capabilities.
204
+ * see AV_CODEC_CAP_*
205
+ */
206
+ int capabilities;
207
+ uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
208
+
209
+ /**
210
+ * Deprecated codec capabilities.
211
+ */
212
+ attribute_deprecated
213
+ const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config()
214
+ attribute_deprecated
215
+ const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config()
216
+ attribute_deprecated
217
+ const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config()
218
+ attribute_deprecated
219
+ const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config()
220
+
221
+ const AVClass *priv_class; ///< AVClass for the private context
222
+ const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
223
+
224
+ /**
225
+ * Group name of the codec implementation.
226
+ * This is a short symbolic name of the wrapper backing this codec. A
227
+ * wrapper uses some kind of external implementation for the codec, such
228
+ * as an external library, or a codec implementation provided by the OS or
229
+ * the hardware.
230
+ * If this field is NULL, this is a builtin, libavcodec native codec.
231
+ * If non-NULL, this will be the suffix in AVCodec.name in most cases
232
+ * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
233
+ */
234
+ const char *wrapper_name;
235
+
236
+ /**
237
+ * Array of supported channel layouts, terminated with a zeroed layout.
238
+ * @deprecated use avcodec_get_supported_config()
239
+ */
240
+ attribute_deprecated
241
+ const AVChannelLayout *ch_layouts;
242
+ } AVCodec;
243
+
244
+ /**
245
+ * Iterate over all registered codecs.
246
+ *
247
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
248
+ * point to NULL to start the iteration.
249
+ *
250
+ * @return the next registered codec or NULL when the iteration is
251
+ * finished
252
+ */
253
+ const AVCodec *av_codec_iterate(void **opaque);
254
+
255
+ /**
256
+ * Find a registered decoder with a matching codec ID.
257
+ *
258
+ * @param id AVCodecID of the requested decoder
259
+ * @return A decoder if one was found, NULL otherwise.
260
+ */
261
+ const AVCodec *avcodec_find_decoder(enum AVCodecID id);
262
+
263
+ /**
264
+ * Find a registered decoder with the specified name.
265
+ *
266
+ * @param name name of the requested decoder
267
+ * @return A decoder if one was found, NULL otherwise.
268
+ */
269
+ const AVCodec *avcodec_find_decoder_by_name(const char *name);
270
+
271
+ /**
272
+ * Find a registered encoder with a matching codec ID.
273
+ *
274
+ * @param id AVCodecID of the requested encoder
275
+ * @return An encoder if one was found, NULL otherwise.
276
+ */
277
+ const AVCodec *avcodec_find_encoder(enum AVCodecID id);
278
+
279
+ /**
280
+ * Find a registered encoder with the specified name.
281
+ *
282
+ * @param name name of the requested encoder
283
+ * @return An encoder if one was found, NULL otherwise.
284
+ */
285
+ const AVCodec *avcodec_find_encoder_by_name(const char *name);
286
+ /**
287
+ * @return a non-zero number if codec is an encoder, zero otherwise
288
+ */
289
+ int av_codec_is_encoder(const AVCodec *codec);
290
+
291
+ /**
292
+ * @return a non-zero number if codec is a decoder, zero otherwise
293
+ */
294
+ int av_codec_is_decoder(const AVCodec *codec);
295
+
296
+ /**
297
+ * Return a name for the specified profile, if available.
298
+ *
299
+ * @param codec the codec that is searched for the given profile
300
+ * @param profile the profile value for which a name is requested
301
+ * @return A name for the profile if found, NULL otherwise.
302
+ */
303
+ const char *av_get_profile_name(const AVCodec *codec, int profile);
304
+
305
+ enum {
306
+ /**
307
+ * The codec supports this format via the hw_device_ctx interface.
308
+ *
309
+ * When selecting this format, AVCodecContext.hw_device_ctx should
310
+ * have been set to a device of the specified type before calling
311
+ * avcodec_open2().
312
+ */
313
+ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
314
+ /**
315
+ * The codec supports this format via the hw_frames_ctx interface.
316
+ *
317
+ * When selecting this format for a decoder,
318
+ * AVCodecContext.hw_frames_ctx should be set to a suitable frames
319
+ * context inside the get_format() callback. The frames context
320
+ * must have been created on a device of the specified type.
321
+ *
322
+ * When selecting this format for an encoder,
323
+ * AVCodecContext.hw_frames_ctx should be set to the context which
324
+ * will be used for the input frames before calling avcodec_open2().
325
+ */
326
+ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
327
+ /**
328
+ * The codec supports this format by some internal method.
329
+ *
330
+ * This format can be selected without any additional configuration -
331
+ * no device or frames context is required.
332
+ */
333
+ AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
334
+ /**
335
+ * The codec supports this format by some ad-hoc method.
336
+ *
337
+ * Additional settings and/or function calls are required. See the
338
+ * codec-specific documentation for details. (Methods requiring
339
+ * this sort of configuration are deprecated and others should be
340
+ * used in preference.)
341
+ */
342
+ AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
343
+ };
344
+
345
+ typedef struct AVCodecHWConfig {
346
+ /**
347
+ * For decoders, a hardware pixel format which that decoder may be
348
+ * able to decode to if suitable hardware is available.
349
+ *
350
+ * For encoders, a pixel format which the encoder may be able to
351
+ * accept. If set to AV_PIX_FMT_NONE, this applies to all pixel
352
+ * formats supported by the codec.
353
+ */
354
+ enum AVPixelFormat pix_fmt;
355
+ /**
356
+ * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
357
+ * setup methods which can be used with this configuration.
358
+ */
359
+ int methods;
360
+ /**
361
+ * The device type associated with the configuration.
362
+ *
363
+ * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
364
+ * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
365
+ */
366
+ enum AVHWDeviceType device_type;
367
+ } AVCodecHWConfig;
368
+
369
+ /**
370
+ * Retrieve supported hardware configurations for a codec.
371
+ *
372
+ * Values of index from zero to some maximum return the indexed configuration
373
+ * descriptor; all other values return NULL. If the codec does not support
374
+ * any hardware configurations then it will always return NULL.
375
+ */
376
+ const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
377
+
378
+ /**
379
+ * @}
380
+ */
381
+
382
+ #endif /* AVCODEC_CODEC_H */
ffmpeg/include/libavcodec/codec_desc.h ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Codec descriptors public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_CODEC_DESC_H
22
+ #define AVCODEC_CODEC_DESC_H
23
+
24
+ #include "libavutil/avutil.h"
25
+
26
+ #include "codec_id.h"
27
+
28
+ /**
29
+ * @addtogroup lavc_core
30
+ * @{
31
+ */
32
+
33
+ /**
34
+ * This struct describes the properties of a single codec described by an
35
+ * AVCodecID.
36
+ * @see avcodec_descriptor_get()
37
+ */
38
+ typedef struct AVCodecDescriptor {
39
+ enum AVCodecID id;
40
+ enum AVMediaType type;
41
+ /**
42
+ * Name of the codec described by this descriptor. It is non-empty and
43
+ * unique for each codec descriptor. It should contain alphanumeric
44
+ * characters and '_' only.
45
+ */
46
+ const char *name;
47
+ /**
48
+ * A more descriptive name for this codec. May be NULL.
49
+ */
50
+ const char *long_name;
51
+ /**
52
+ * Codec properties, a combination of AV_CODEC_PROP_* flags.
53
+ */
54
+ int props;
55
+ /**
56
+ * MIME type(s) associated with the codec.
57
+ * May be NULL; if not, a NULL-terminated array of MIME types.
58
+ * The first item is always non-NULL and is the preferred MIME type.
59
+ */
60
+ const char *const *mime_types;
61
+ /**
62
+ * If non-NULL, an array of profiles recognized for this codec.
63
+ * Terminated with AV_PROFILE_UNKNOWN.
64
+ */
65
+ const struct AVProfile *profiles;
66
+ } AVCodecDescriptor;
67
+
68
+ /**
69
+ * Codec uses only intra compression.
70
+ * Video and audio codecs only.
71
+ */
72
+ #define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
73
+ /**
74
+ * Codec supports lossy compression. Audio and video codecs only.
75
+ * @note a codec may support both lossy and lossless
76
+ * compression modes
77
+ */
78
+ #define AV_CODEC_PROP_LOSSY (1 << 1)
79
+ /**
80
+ * Codec supports lossless compression. Audio and video codecs only.
81
+ */
82
+ #define AV_CODEC_PROP_LOSSLESS (1 << 2)
83
+ /**
84
+ * Codec supports frame reordering. That is, the coded order (the order in which
85
+ * the encoded packets are output by the encoders / stored / input to the
86
+ * decoders) may be different from the presentation order of the corresponding
87
+ * frames.
88
+ *
89
+ * For codecs that do not have this property set, PTS and DTS should always be
90
+ * equal.
91
+ */
92
+ #define AV_CODEC_PROP_REORDER (1 << 3)
93
+
94
+ /**
95
+ * Video codec supports separate coding of fields in interlaced frames.
96
+ */
97
+ #define AV_CODEC_PROP_FIELDS (1 << 4)
98
+
99
+ /**
100
+ * Subtitle codec is bitmap based
101
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
102
+ */
103
+ #define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
104
+ /**
105
+ * Subtitle codec is text based.
106
+ * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
107
+ */
108
+ #define AV_CODEC_PROP_TEXT_SUB (1 << 17)
109
+
110
+ /**
111
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
112
+ */
113
+ const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
114
+
115
+ /**
116
+ * Iterate over all codec descriptors known to libavcodec.
117
+ *
118
+ * @param prev previous descriptor. NULL to get the first descriptor.
119
+ *
120
+ * @return next descriptor or NULL after the last descriptor
121
+ */
122
+ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
123
+
124
+ /**
125
+ * @return codec descriptor with the given name or NULL if no such descriptor
126
+ * exists.
127
+ */
128
+ const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
129
+
130
+ /**
131
+ * @}
132
+ */
133
+
134
+ #endif // AVCODEC_CODEC_DESC_H
ffmpeg/include/libavcodec/codec_id.h ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Codec IDs
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_CODEC_ID_H
22
+ #define AVCODEC_CODEC_ID_H
23
+
24
+ #include "libavutil/avutil.h"
25
+ #include "libavutil/samplefmt.h"
26
+
27
+ #include "version_major.h"
28
+
29
+ /**
30
+ * @addtogroup lavc_core
31
+ * @{
32
+ */
33
+
34
+ /**
35
+ * Identify the syntax and semantics of the bitstream.
36
+ * The principle is roughly:
37
+ * Two decoders with the same ID can decode the same streams.
38
+ * Two encoders with the same ID can encode compatible streams.
39
+ * There may be slight deviations from the principle due to implementation
40
+ * details.
41
+ *
42
+ * If you add a codec ID to this list, add it so that
43
+ * 1. no value of an existing codec ID changes (that would break ABI),
44
+ * 2. it is as close as possible to similar codecs
45
+ *
46
+ * After adding new codec IDs, do not forget to add an entry to the codec
47
+ * descriptor list and bump libavcodec minor version.
48
+ */
49
+ enum AVCodecID {
50
+ AV_CODEC_ID_NONE,
51
+
52
+ /* video codecs */
53
+ AV_CODEC_ID_MPEG1VIDEO,
54
+ AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
55
+ AV_CODEC_ID_H261,
56
+ AV_CODEC_ID_H263,
57
+ AV_CODEC_ID_RV10,
58
+ AV_CODEC_ID_RV20,
59
+ AV_CODEC_ID_MJPEG,
60
+ AV_CODEC_ID_MJPEGB,
61
+ AV_CODEC_ID_LJPEG,
62
+ AV_CODEC_ID_SP5X,
63
+ AV_CODEC_ID_JPEGLS,
64
+ AV_CODEC_ID_MPEG4,
65
+ AV_CODEC_ID_RAWVIDEO,
66
+ AV_CODEC_ID_MSMPEG4V1,
67
+ AV_CODEC_ID_MSMPEG4V2,
68
+ AV_CODEC_ID_MSMPEG4V3,
69
+ AV_CODEC_ID_WMV1,
70
+ AV_CODEC_ID_WMV2,
71
+ AV_CODEC_ID_H263P,
72
+ AV_CODEC_ID_H263I,
73
+ AV_CODEC_ID_FLV1,
74
+ AV_CODEC_ID_SVQ1,
75
+ AV_CODEC_ID_SVQ3,
76
+ AV_CODEC_ID_DVVIDEO,
77
+ AV_CODEC_ID_HUFFYUV,
78
+ AV_CODEC_ID_CYUV,
79
+ AV_CODEC_ID_H264,
80
+ AV_CODEC_ID_INDEO3,
81
+ AV_CODEC_ID_VP3,
82
+ AV_CODEC_ID_THEORA,
83
+ AV_CODEC_ID_ASV1,
84
+ AV_CODEC_ID_ASV2,
85
+ AV_CODEC_ID_FFV1,
86
+ AV_CODEC_ID_4XM,
87
+ AV_CODEC_ID_VCR1,
88
+ AV_CODEC_ID_CLJR,
89
+ AV_CODEC_ID_MDEC,
90
+ AV_CODEC_ID_ROQ,
91
+ AV_CODEC_ID_INTERPLAY_VIDEO,
92
+ AV_CODEC_ID_XAN_WC3,
93
+ AV_CODEC_ID_XAN_WC4,
94
+ AV_CODEC_ID_RPZA,
95
+ AV_CODEC_ID_CINEPAK,
96
+ AV_CODEC_ID_WS_VQA,
97
+ AV_CODEC_ID_MSRLE,
98
+ AV_CODEC_ID_MSVIDEO1,
99
+ AV_CODEC_ID_IDCIN,
100
+ AV_CODEC_ID_8BPS,
101
+ AV_CODEC_ID_SMC,
102
+ AV_CODEC_ID_FLIC,
103
+ AV_CODEC_ID_TRUEMOTION1,
104
+ AV_CODEC_ID_VMDVIDEO,
105
+ AV_CODEC_ID_MSZH,
106
+ AV_CODEC_ID_ZLIB,
107
+ AV_CODEC_ID_QTRLE,
108
+ AV_CODEC_ID_TSCC,
109
+ AV_CODEC_ID_ULTI,
110
+ AV_CODEC_ID_QDRAW,
111
+ AV_CODEC_ID_VIXL,
112
+ AV_CODEC_ID_QPEG,
113
+ AV_CODEC_ID_PNG,
114
+ AV_CODEC_ID_PPM,
115
+ AV_CODEC_ID_PBM,
116
+ AV_CODEC_ID_PGM,
117
+ AV_CODEC_ID_PGMYUV,
118
+ AV_CODEC_ID_PAM,
119
+ AV_CODEC_ID_FFVHUFF,
120
+ AV_CODEC_ID_RV30,
121
+ AV_CODEC_ID_RV40,
122
+ AV_CODEC_ID_VC1,
123
+ AV_CODEC_ID_WMV3,
124
+ AV_CODEC_ID_LOCO,
125
+ AV_CODEC_ID_WNV1,
126
+ AV_CODEC_ID_AASC,
127
+ AV_CODEC_ID_INDEO2,
128
+ AV_CODEC_ID_FRAPS,
129
+ AV_CODEC_ID_TRUEMOTION2,
130
+ AV_CODEC_ID_BMP,
131
+ AV_CODEC_ID_CSCD,
132
+ AV_CODEC_ID_MMVIDEO,
133
+ AV_CODEC_ID_ZMBV,
134
+ AV_CODEC_ID_AVS,
135
+ AV_CODEC_ID_SMACKVIDEO,
136
+ AV_CODEC_ID_NUV,
137
+ AV_CODEC_ID_KMVC,
138
+ AV_CODEC_ID_FLASHSV,
139
+ AV_CODEC_ID_CAVS,
140
+ AV_CODEC_ID_JPEG2000,
141
+ AV_CODEC_ID_VMNC,
142
+ AV_CODEC_ID_VP5,
143
+ AV_CODEC_ID_VP6,
144
+ AV_CODEC_ID_VP6F,
145
+ AV_CODEC_ID_TARGA,
146
+ AV_CODEC_ID_DSICINVIDEO,
147
+ AV_CODEC_ID_TIERTEXSEQVIDEO,
148
+ AV_CODEC_ID_TIFF,
149
+ AV_CODEC_ID_GIF,
150
+ AV_CODEC_ID_DXA,
151
+ AV_CODEC_ID_DNXHD,
152
+ AV_CODEC_ID_THP,
153
+ AV_CODEC_ID_SGI,
154
+ AV_CODEC_ID_C93,
155
+ AV_CODEC_ID_BETHSOFTVID,
156
+ AV_CODEC_ID_PTX,
157
+ AV_CODEC_ID_TXD,
158
+ AV_CODEC_ID_VP6A,
159
+ AV_CODEC_ID_AMV,
160
+ AV_CODEC_ID_VB,
161
+ AV_CODEC_ID_PCX,
162
+ AV_CODEC_ID_SUNRAST,
163
+ AV_CODEC_ID_INDEO4,
164
+ AV_CODEC_ID_INDEO5,
165
+ AV_CODEC_ID_MIMIC,
166
+ AV_CODEC_ID_RL2,
167
+ AV_CODEC_ID_ESCAPE124,
168
+ AV_CODEC_ID_DIRAC,
169
+ AV_CODEC_ID_BFI,
170
+ AV_CODEC_ID_CMV,
171
+ AV_CODEC_ID_MOTIONPIXELS,
172
+ AV_CODEC_ID_TGV,
173
+ AV_CODEC_ID_TGQ,
174
+ AV_CODEC_ID_TQI,
175
+ AV_CODEC_ID_AURA,
176
+ AV_CODEC_ID_AURA2,
177
+ AV_CODEC_ID_V210X,
178
+ AV_CODEC_ID_TMV,
179
+ AV_CODEC_ID_V210,
180
+ AV_CODEC_ID_DPX,
181
+ AV_CODEC_ID_MAD,
182
+ AV_CODEC_ID_FRWU,
183
+ AV_CODEC_ID_FLASHSV2,
184
+ AV_CODEC_ID_CDGRAPHICS,
185
+ AV_CODEC_ID_R210,
186
+ AV_CODEC_ID_ANM,
187
+ AV_CODEC_ID_BINKVIDEO,
188
+ AV_CODEC_ID_IFF_ILBM,
189
+ #define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
190
+ AV_CODEC_ID_KGV1,
191
+ AV_CODEC_ID_YOP,
192
+ AV_CODEC_ID_VP8,
193
+ AV_CODEC_ID_PICTOR,
194
+ AV_CODEC_ID_ANSI,
195
+ AV_CODEC_ID_A64_MULTI,
196
+ AV_CODEC_ID_A64_MULTI5,
197
+ AV_CODEC_ID_R10K,
198
+ AV_CODEC_ID_MXPEG,
199
+ AV_CODEC_ID_LAGARITH,
200
+ AV_CODEC_ID_PRORES,
201
+ AV_CODEC_ID_JV,
202
+ AV_CODEC_ID_DFA,
203
+ AV_CODEC_ID_WMV3IMAGE,
204
+ AV_CODEC_ID_VC1IMAGE,
205
+ AV_CODEC_ID_UTVIDEO,
206
+ AV_CODEC_ID_BMV_VIDEO,
207
+ AV_CODEC_ID_VBLE,
208
+ AV_CODEC_ID_DXTORY,
209
+ #if FF_API_V408_CODECID
210
+ AV_CODEC_ID_V410,
211
+ #endif
212
+ AV_CODEC_ID_XWD,
213
+ AV_CODEC_ID_CDXL,
214
+ AV_CODEC_ID_XBM,
215
+ AV_CODEC_ID_ZEROCODEC,
216
+ AV_CODEC_ID_MSS1,
217
+ AV_CODEC_ID_MSA1,
218
+ AV_CODEC_ID_TSCC2,
219
+ AV_CODEC_ID_MTS2,
220
+ AV_CODEC_ID_CLLC,
221
+ AV_CODEC_ID_MSS2,
222
+ AV_CODEC_ID_VP9,
223
+ AV_CODEC_ID_AIC,
224
+ AV_CODEC_ID_ESCAPE130,
225
+ AV_CODEC_ID_G2M,
226
+ AV_CODEC_ID_WEBP,
227
+ AV_CODEC_ID_HNM4_VIDEO,
228
+ AV_CODEC_ID_HEVC,
229
+ #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
230
+ AV_CODEC_ID_FIC,
231
+ AV_CODEC_ID_ALIAS_PIX,
232
+ AV_CODEC_ID_BRENDER_PIX,
233
+ AV_CODEC_ID_PAF_VIDEO,
234
+ AV_CODEC_ID_EXR,
235
+ AV_CODEC_ID_VP7,
236
+ AV_CODEC_ID_SANM,
237
+ AV_CODEC_ID_SGIRLE,
238
+ AV_CODEC_ID_MVC1,
239
+ AV_CODEC_ID_MVC2,
240
+ AV_CODEC_ID_HQX,
241
+ AV_CODEC_ID_TDSC,
242
+ AV_CODEC_ID_HQ_HQA,
243
+ AV_CODEC_ID_HAP,
244
+ AV_CODEC_ID_DDS,
245
+ AV_CODEC_ID_DXV,
246
+ AV_CODEC_ID_SCREENPRESSO,
247
+ AV_CODEC_ID_RSCC,
248
+ AV_CODEC_ID_AVS2,
249
+ AV_CODEC_ID_PGX,
250
+ AV_CODEC_ID_AVS3,
251
+ AV_CODEC_ID_MSP2,
252
+ AV_CODEC_ID_VVC,
253
+ #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC
254
+ AV_CODEC_ID_Y41P,
255
+ AV_CODEC_ID_AVRP,
256
+ AV_CODEC_ID_012V,
257
+ AV_CODEC_ID_AVUI,
258
+ AV_CODEC_ID_TARGA_Y216,
259
+ #if FF_API_V408_CODECID
260
+ AV_CODEC_ID_V308,
261
+ AV_CODEC_ID_V408,
262
+ #endif
263
+ AV_CODEC_ID_YUV4,
264
+ AV_CODEC_ID_AVRN,
265
+ AV_CODEC_ID_CPIA,
266
+ AV_CODEC_ID_XFACE,
267
+ AV_CODEC_ID_SNOW,
268
+ AV_CODEC_ID_SMVJPEG,
269
+ AV_CODEC_ID_APNG,
270
+ AV_CODEC_ID_DAALA,
271
+ AV_CODEC_ID_CFHD,
272
+ AV_CODEC_ID_TRUEMOTION2RT,
273
+ AV_CODEC_ID_M101,
274
+ AV_CODEC_ID_MAGICYUV,
275
+ AV_CODEC_ID_SHEERVIDEO,
276
+ AV_CODEC_ID_YLC,
277
+ AV_CODEC_ID_PSD,
278
+ AV_CODEC_ID_PIXLET,
279
+ AV_CODEC_ID_SPEEDHQ,
280
+ AV_CODEC_ID_FMVC,
281
+ AV_CODEC_ID_SCPR,
282
+ AV_CODEC_ID_CLEARVIDEO,
283
+ AV_CODEC_ID_XPM,
284
+ AV_CODEC_ID_AV1,
285
+ AV_CODEC_ID_BITPACKED,
286
+ AV_CODEC_ID_MSCC,
287
+ AV_CODEC_ID_SRGC,
288
+ AV_CODEC_ID_SVG,
289
+ AV_CODEC_ID_GDV,
290
+ AV_CODEC_ID_FITS,
291
+ AV_CODEC_ID_IMM4,
292
+ AV_CODEC_ID_PROSUMER,
293
+ AV_CODEC_ID_MWSC,
294
+ AV_CODEC_ID_WCMV,
295
+ AV_CODEC_ID_RASC,
296
+ AV_CODEC_ID_HYMT,
297
+ AV_CODEC_ID_ARBC,
298
+ AV_CODEC_ID_AGM,
299
+ AV_CODEC_ID_LSCR,
300
+ AV_CODEC_ID_VP4,
301
+ AV_CODEC_ID_IMM5,
302
+ AV_CODEC_ID_MVDV,
303
+ AV_CODEC_ID_MVHA,
304
+ AV_CODEC_ID_CDTOONS,
305
+ AV_CODEC_ID_MV30,
306
+ AV_CODEC_ID_NOTCHLC,
307
+ AV_CODEC_ID_PFM,
308
+ AV_CODEC_ID_MOBICLIP,
309
+ AV_CODEC_ID_PHOTOCD,
310
+ AV_CODEC_ID_IPU,
311
+ AV_CODEC_ID_ARGO,
312
+ AV_CODEC_ID_CRI,
313
+ AV_CODEC_ID_SIMBIOSIS_IMX,
314
+ AV_CODEC_ID_SGA_VIDEO,
315
+ AV_CODEC_ID_GEM,
316
+ AV_CODEC_ID_VBN,
317
+ AV_CODEC_ID_JPEGXL,
318
+ AV_CODEC_ID_QOI,
319
+ AV_CODEC_ID_PHM,
320
+ AV_CODEC_ID_RADIANCE_HDR,
321
+ AV_CODEC_ID_WBMP,
322
+ AV_CODEC_ID_MEDIA100,
323
+ AV_CODEC_ID_VQC,
324
+ AV_CODEC_ID_PDV,
325
+ AV_CODEC_ID_EVC,
326
+ AV_CODEC_ID_RTV1,
327
+ AV_CODEC_ID_VMIX,
328
+ AV_CODEC_ID_LEAD,
329
+ AV_CODEC_ID_DNXUC,
330
+ AV_CODEC_ID_RV60,
331
+ AV_CODEC_ID_JPEGXL_ANIM,
332
+
333
+ /* various PCM "codecs" */
334
+ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
335
+ AV_CODEC_ID_PCM_S16LE = 0x10000,
336
+ AV_CODEC_ID_PCM_S16BE,
337
+ AV_CODEC_ID_PCM_U16LE,
338
+ AV_CODEC_ID_PCM_U16BE,
339
+ AV_CODEC_ID_PCM_S8,
340
+ AV_CODEC_ID_PCM_U8,
341
+ AV_CODEC_ID_PCM_MULAW,
342
+ AV_CODEC_ID_PCM_ALAW,
343
+ AV_CODEC_ID_PCM_S32LE,
344
+ AV_CODEC_ID_PCM_S32BE,
345
+ AV_CODEC_ID_PCM_U32LE,
346
+ AV_CODEC_ID_PCM_U32BE,
347
+ AV_CODEC_ID_PCM_S24LE,
348
+ AV_CODEC_ID_PCM_S24BE,
349
+ AV_CODEC_ID_PCM_U24LE,
350
+ AV_CODEC_ID_PCM_U24BE,
351
+ AV_CODEC_ID_PCM_S24DAUD,
352
+ AV_CODEC_ID_PCM_ZORK,
353
+ AV_CODEC_ID_PCM_S16LE_PLANAR,
354
+ AV_CODEC_ID_PCM_DVD,
355
+ AV_CODEC_ID_PCM_F32BE,
356
+ AV_CODEC_ID_PCM_F32LE,
357
+ AV_CODEC_ID_PCM_F64BE,
358
+ AV_CODEC_ID_PCM_F64LE,
359
+ AV_CODEC_ID_PCM_BLURAY,
360
+ AV_CODEC_ID_PCM_LXF,
361
+ AV_CODEC_ID_S302M,
362
+ AV_CODEC_ID_PCM_S8_PLANAR,
363
+ AV_CODEC_ID_PCM_S24LE_PLANAR,
364
+ AV_CODEC_ID_PCM_S32LE_PLANAR,
365
+ AV_CODEC_ID_PCM_S16BE_PLANAR,
366
+ AV_CODEC_ID_PCM_S64LE,
367
+ AV_CODEC_ID_PCM_S64BE,
368
+ AV_CODEC_ID_PCM_F16LE,
369
+ AV_CODEC_ID_PCM_F24LE,
370
+ AV_CODEC_ID_PCM_VIDC,
371
+ AV_CODEC_ID_PCM_SGA,
372
+
373
+ /* various ADPCM codecs */
374
+ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
375
+ AV_CODEC_ID_ADPCM_IMA_WAV,
376
+ AV_CODEC_ID_ADPCM_IMA_DK3,
377
+ AV_CODEC_ID_ADPCM_IMA_DK4,
378
+ AV_CODEC_ID_ADPCM_IMA_WS,
379
+ AV_CODEC_ID_ADPCM_IMA_SMJPEG,
380
+ AV_CODEC_ID_ADPCM_MS,
381
+ AV_CODEC_ID_ADPCM_4XM,
382
+ AV_CODEC_ID_ADPCM_XA,
383
+ AV_CODEC_ID_ADPCM_ADX,
384
+ AV_CODEC_ID_ADPCM_EA,
385
+ AV_CODEC_ID_ADPCM_G726,
386
+ AV_CODEC_ID_ADPCM_CT,
387
+ AV_CODEC_ID_ADPCM_SWF,
388
+ AV_CODEC_ID_ADPCM_YAMAHA,
389
+ AV_CODEC_ID_ADPCM_SBPRO_4,
390
+ AV_CODEC_ID_ADPCM_SBPRO_3,
391
+ AV_CODEC_ID_ADPCM_SBPRO_2,
392
+ AV_CODEC_ID_ADPCM_THP,
393
+ AV_CODEC_ID_ADPCM_IMA_AMV,
394
+ AV_CODEC_ID_ADPCM_EA_R1,
395
+ AV_CODEC_ID_ADPCM_EA_R3,
396
+ AV_CODEC_ID_ADPCM_EA_R2,
397
+ AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
398
+ AV_CODEC_ID_ADPCM_IMA_EA_EACS,
399
+ AV_CODEC_ID_ADPCM_EA_XAS,
400
+ AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
401
+ AV_CODEC_ID_ADPCM_IMA_ISS,
402
+ AV_CODEC_ID_ADPCM_G722,
403
+ AV_CODEC_ID_ADPCM_IMA_APC,
404
+ AV_CODEC_ID_ADPCM_VIMA,
405
+ AV_CODEC_ID_ADPCM_AFC,
406
+ AV_CODEC_ID_ADPCM_IMA_OKI,
407
+ AV_CODEC_ID_ADPCM_DTK,
408
+ AV_CODEC_ID_ADPCM_IMA_RAD,
409
+ AV_CODEC_ID_ADPCM_G726LE,
410
+ AV_CODEC_ID_ADPCM_THP_LE,
411
+ AV_CODEC_ID_ADPCM_PSX,
412
+ AV_CODEC_ID_ADPCM_AICA,
413
+ AV_CODEC_ID_ADPCM_IMA_DAT4,
414
+ AV_CODEC_ID_ADPCM_MTAF,
415
+ AV_CODEC_ID_ADPCM_AGM,
416
+ AV_CODEC_ID_ADPCM_ARGO,
417
+ AV_CODEC_ID_ADPCM_IMA_SSI,
418
+ AV_CODEC_ID_ADPCM_ZORK,
419
+ AV_CODEC_ID_ADPCM_IMA_APM,
420
+ AV_CODEC_ID_ADPCM_IMA_ALP,
421
+ AV_CODEC_ID_ADPCM_IMA_MTF,
422
+ AV_CODEC_ID_ADPCM_IMA_CUNNING,
423
+ AV_CODEC_ID_ADPCM_IMA_MOFLEX,
424
+ AV_CODEC_ID_ADPCM_IMA_ACORN,
425
+ AV_CODEC_ID_ADPCM_XMD,
426
+ AV_CODEC_ID_ADPCM_IMA_XBOX,
427
+
428
+ /* AMR */
429
+ AV_CODEC_ID_AMR_NB = 0x12000,
430
+ AV_CODEC_ID_AMR_WB,
431
+
432
+ /* RealAudio codecs*/
433
+ AV_CODEC_ID_RA_144 = 0x13000,
434
+ AV_CODEC_ID_RA_288,
435
+
436
+ /* various DPCM codecs */
437
+ AV_CODEC_ID_ROQ_DPCM = 0x14000,
438
+ AV_CODEC_ID_INTERPLAY_DPCM,
439
+ AV_CODEC_ID_XAN_DPCM,
440
+ AV_CODEC_ID_SOL_DPCM,
441
+ AV_CODEC_ID_SDX2_DPCM,
442
+ AV_CODEC_ID_GREMLIN_DPCM,
443
+ AV_CODEC_ID_DERF_DPCM,
444
+ AV_CODEC_ID_WADY_DPCM,
445
+ AV_CODEC_ID_CBD2_DPCM,
446
+
447
+ /* audio codecs */
448
+ AV_CODEC_ID_MP2 = 0x15000,
449
+ AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
450
+ AV_CODEC_ID_AAC,
451
+ AV_CODEC_ID_AC3,
452
+ AV_CODEC_ID_DTS,
453
+ AV_CODEC_ID_VORBIS,
454
+ AV_CODEC_ID_DVAUDIO,
455
+ AV_CODEC_ID_WMAV1,
456
+ AV_CODEC_ID_WMAV2,
457
+ AV_CODEC_ID_MACE3,
458
+ AV_CODEC_ID_MACE6,
459
+ AV_CODEC_ID_VMDAUDIO,
460
+ AV_CODEC_ID_FLAC,
461
+ AV_CODEC_ID_MP3ADU,
462
+ AV_CODEC_ID_MP3ON4,
463
+ AV_CODEC_ID_SHORTEN,
464
+ AV_CODEC_ID_ALAC,
465
+ AV_CODEC_ID_WESTWOOD_SND1,
466
+ AV_CODEC_ID_GSM, ///< as in Berlin toast format
467
+ AV_CODEC_ID_QDM2,
468
+ AV_CODEC_ID_COOK,
469
+ AV_CODEC_ID_TRUESPEECH,
470
+ AV_CODEC_ID_TTA,
471
+ AV_CODEC_ID_SMACKAUDIO,
472
+ AV_CODEC_ID_QCELP,
473
+ AV_CODEC_ID_WAVPACK,
474
+ AV_CODEC_ID_DSICINAUDIO,
475
+ AV_CODEC_ID_IMC,
476
+ AV_CODEC_ID_MUSEPACK7,
477
+ AV_CODEC_ID_MLP,
478
+ AV_CODEC_ID_GSM_MS, /* as found in WAV */
479
+ AV_CODEC_ID_ATRAC3,
480
+ AV_CODEC_ID_APE,
481
+ AV_CODEC_ID_NELLYMOSER,
482
+ AV_CODEC_ID_MUSEPACK8,
483
+ AV_CODEC_ID_SPEEX,
484
+ AV_CODEC_ID_WMAVOICE,
485
+ AV_CODEC_ID_WMAPRO,
486
+ AV_CODEC_ID_WMALOSSLESS,
487
+ AV_CODEC_ID_ATRAC3P,
488
+ AV_CODEC_ID_EAC3,
489
+ AV_CODEC_ID_SIPR,
490
+ AV_CODEC_ID_MP1,
491
+ AV_CODEC_ID_TWINVQ,
492
+ AV_CODEC_ID_TRUEHD,
493
+ AV_CODEC_ID_MP4ALS,
494
+ AV_CODEC_ID_ATRAC1,
495
+ AV_CODEC_ID_BINKAUDIO_RDFT,
496
+ AV_CODEC_ID_BINKAUDIO_DCT,
497
+ AV_CODEC_ID_AAC_LATM,
498
+ AV_CODEC_ID_QDMC,
499
+ AV_CODEC_ID_CELT,
500
+ AV_CODEC_ID_G723_1,
501
+ AV_CODEC_ID_G729,
502
+ AV_CODEC_ID_8SVX_EXP,
503
+ AV_CODEC_ID_8SVX_FIB,
504
+ AV_CODEC_ID_BMV_AUDIO,
505
+ AV_CODEC_ID_RALF,
506
+ AV_CODEC_ID_IAC,
507
+ AV_CODEC_ID_ILBC,
508
+ AV_CODEC_ID_OPUS,
509
+ AV_CODEC_ID_COMFORT_NOISE,
510
+ AV_CODEC_ID_TAK,
511
+ AV_CODEC_ID_METASOUND,
512
+ AV_CODEC_ID_PAF_AUDIO,
513
+ AV_CODEC_ID_ON2AVC,
514
+ AV_CODEC_ID_DSS_SP,
515
+ AV_CODEC_ID_CODEC2,
516
+ AV_CODEC_ID_FFWAVESYNTH,
517
+ AV_CODEC_ID_SONIC,
518
+ AV_CODEC_ID_SONIC_LS,
519
+ AV_CODEC_ID_EVRC,
520
+ AV_CODEC_ID_SMV,
521
+ AV_CODEC_ID_DSD_LSBF,
522
+ AV_CODEC_ID_DSD_MSBF,
523
+ AV_CODEC_ID_DSD_LSBF_PLANAR,
524
+ AV_CODEC_ID_DSD_MSBF_PLANAR,
525
+ AV_CODEC_ID_4GV,
526
+ AV_CODEC_ID_INTERPLAY_ACM,
527
+ AV_CODEC_ID_XMA1,
528
+ AV_CODEC_ID_XMA2,
529
+ AV_CODEC_ID_DST,
530
+ AV_CODEC_ID_ATRAC3AL,
531
+ AV_CODEC_ID_ATRAC3PAL,
532
+ AV_CODEC_ID_DOLBY_E,
533
+ AV_CODEC_ID_APTX,
534
+ AV_CODEC_ID_APTX_HD,
535
+ AV_CODEC_ID_SBC,
536
+ AV_CODEC_ID_ATRAC9,
537
+ AV_CODEC_ID_HCOM,
538
+ AV_CODEC_ID_ACELP_KELVIN,
539
+ AV_CODEC_ID_MPEGH_3D_AUDIO,
540
+ AV_CODEC_ID_SIREN,
541
+ AV_CODEC_ID_HCA,
542
+ AV_CODEC_ID_FASTAUDIO,
543
+ AV_CODEC_ID_MSNSIREN,
544
+ AV_CODEC_ID_DFPWM,
545
+ AV_CODEC_ID_BONK,
546
+ AV_CODEC_ID_MISC4,
547
+ AV_CODEC_ID_APAC,
548
+ AV_CODEC_ID_FTR,
549
+ AV_CODEC_ID_WAVARC,
550
+ AV_CODEC_ID_RKA,
551
+ AV_CODEC_ID_AC4,
552
+ AV_CODEC_ID_OSQ,
553
+ AV_CODEC_ID_QOA,
554
+ AV_CODEC_ID_LC3,
555
+
556
+ /* subtitle codecs */
557
+ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
558
+ AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
559
+ AV_CODEC_ID_DVB_SUBTITLE,
560
+ AV_CODEC_ID_TEXT, ///< raw UTF-8 text
561
+ AV_CODEC_ID_XSUB,
562
+ AV_CODEC_ID_SSA,
563
+ AV_CODEC_ID_MOV_TEXT,
564
+ AV_CODEC_ID_HDMV_PGS_SUBTITLE,
565
+ AV_CODEC_ID_DVB_TELETEXT,
566
+ AV_CODEC_ID_SRT,
567
+ AV_CODEC_ID_MICRODVD,
568
+ AV_CODEC_ID_EIA_608,
569
+ AV_CODEC_ID_JACOSUB,
570
+ AV_CODEC_ID_SAMI,
571
+ AV_CODEC_ID_REALTEXT,
572
+ AV_CODEC_ID_STL,
573
+ AV_CODEC_ID_SUBVIEWER1,
574
+ AV_CODEC_ID_SUBVIEWER,
575
+ AV_CODEC_ID_SUBRIP,
576
+ AV_CODEC_ID_WEBVTT,
577
+ AV_CODEC_ID_MPL2,
578
+ AV_CODEC_ID_VPLAYER,
579
+ AV_CODEC_ID_PJS,
580
+ AV_CODEC_ID_ASS,
581
+ AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
582
+ AV_CODEC_ID_TTML,
583
+ AV_CODEC_ID_ARIB_CAPTION,
584
+
585
+ /* other specific kind of codecs (generally used for attachments) */
586
+ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
587
+ AV_CODEC_ID_TTF = 0x18000,
588
+
589
+ AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
590
+ AV_CODEC_ID_EPG,
591
+ AV_CODEC_ID_BINTEXT,
592
+ AV_CODEC_ID_XBIN,
593
+ AV_CODEC_ID_IDF,
594
+ AV_CODEC_ID_OTF,
595
+ AV_CODEC_ID_SMPTE_KLV,
596
+ AV_CODEC_ID_DVD_NAV,
597
+ AV_CODEC_ID_TIMED_ID3,
598
+ AV_CODEC_ID_BIN_DATA,
599
+ AV_CODEC_ID_SMPTE_2038,
600
+ AV_CODEC_ID_LCEVC,
601
+
602
+
603
+ AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
604
+
605
+ AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
606
+ * stream (only used by libavformat) */
607
+ AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
608
+ * stream (only used by libavformat) */
609
+ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
610
+ AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
611
+ /**
612
+ * Dummy null video codec, useful mainly for development and debugging.
613
+ * Null encoder/decoder discard all input and never return any output.
614
+ */
615
+ AV_CODEC_ID_VNULL,
616
+ /**
617
+ * Dummy null audio codec, useful mainly for development and debugging.
618
+ * Null encoder/decoder discard all input and never return any output.
619
+ */
620
+ AV_CODEC_ID_ANULL,
621
+ };
622
+
623
+ /**
624
+ * Get the type of the given codec.
625
+ */
626
+ enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
627
+
628
+ /**
629
+ * Get the name of a codec.
630
+ * @return a static string identifying the codec; never NULL
631
+ */
632
+ const char *avcodec_get_name(enum AVCodecID id);
633
+
634
+ /**
635
+ * Return codec bits per sample.
636
+ *
637
+ * @param[in] codec_id the codec
638
+ * @return Number of bits per sample or zero if unknown for the given codec.
639
+ */
640
+ int av_get_bits_per_sample(enum AVCodecID codec_id);
641
+
642
+ /**
643
+ * Return codec bits per sample.
644
+ * Only return non-zero if the bits per sample is exactly correct, not an
645
+ * approximation.
646
+ *
647
+ * @param[in] codec_id the codec
648
+ * @return Number of bits per sample or zero if unknown for the given codec.
649
+ */
650
+ int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
651
+
652
+ /**
653
+ * Return a name for the specified profile, if available.
654
+ *
655
+ * @param codec_id the ID of the codec to which the requested profile belongs
656
+ * @param profile the profile value for which a name is requested
657
+ * @return A name for the profile if found, NULL otherwise.
658
+ *
659
+ * @note unlike av_get_profile_name(), which searches a list of profiles
660
+ * supported by a specific decoder or encoder implementation, this
661
+ * function searches the list of profiles from the AVCodecDescriptor
662
+ */
663
+ const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
664
+
665
+ /**
666
+ * Return the PCM codec associated with a sample format.
667
+ * @param be endianness, 0 for little, 1 for big,
668
+ * -1 (or anything else) for native
669
+ * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
670
+ */
671
+ enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
672
+
673
+ /**
674
+ * @}
675
+ */
676
+
677
+ #endif // AVCODEC_CODEC_ID_H
ffmpeg/include/libavcodec/codec_par.h ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Codec parameters public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_CODEC_PAR_H
22
+ #define AVCODEC_CODEC_PAR_H
23
+
24
+ #include <stdint.h>
25
+
26
+ #include "libavutil/avutil.h"
27
+ #include "libavutil/channel_layout.h"
28
+ #include "libavutil/rational.h"
29
+ #include "libavutil/pixfmt.h"
30
+
31
+ #include "codec_id.h"
32
+ #include "defs.h"
33
+ #include "packet.h"
34
+
35
+ /**
36
+ * @addtogroup lavc_core
37
+ * @{
38
+ */
39
+
40
+ /**
41
+ * This struct describes the properties of an encoded stream.
42
+ *
43
+ * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
44
+ * be allocated with avcodec_parameters_alloc() and freed with
45
+ * avcodec_parameters_free().
46
+ */
47
+ typedef struct AVCodecParameters {
48
+ /**
49
+ * General type of the encoded data.
50
+ */
51
+ enum AVMediaType codec_type;
52
+ /**
53
+ * Specific type of the encoded data (the codec used).
54
+ */
55
+ enum AVCodecID codec_id;
56
+ /**
57
+ * Additional information about the codec (corresponds to the AVI FOURCC).
58
+ */
59
+ uint32_t codec_tag;
60
+
61
+ /**
62
+ * Extra binary data needed for initializing the decoder, codec-dependent.
63
+ *
64
+ * Must be allocated with av_malloc() and will be freed by
65
+ * avcodec_parameters_free(). The allocated size of extradata must be at
66
+ * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
67
+ * bytes zeroed.
68
+ */
69
+ uint8_t *extradata;
70
+ /**
71
+ * Size of the extradata content in bytes.
72
+ */
73
+ int extradata_size;
74
+
75
+ /**
76
+ * Additional data associated with the entire stream.
77
+ *
78
+ * Should be allocated with av_packet_side_data_new() or
79
+ * av_packet_side_data_add(), and will be freed by avcodec_parameters_free().
80
+ */
81
+ AVPacketSideData *coded_side_data;
82
+
83
+ /**
84
+ * Amount of entries in @ref coded_side_data.
85
+ */
86
+ int nb_coded_side_data;
87
+
88
+ /**
89
+ * - video: the pixel format, the value corresponds to enum AVPixelFormat.
90
+ * - audio: the sample format, the value corresponds to enum AVSampleFormat.
91
+ */
92
+ int format;
93
+
94
+ /**
95
+ * The average bitrate of the encoded data (in bits per second).
96
+ */
97
+ int64_t bit_rate;
98
+
99
+ /**
100
+ * The number of bits per sample in the codedwords.
101
+ *
102
+ * This is basically the bitrate per sample. It is mandatory for a bunch of
103
+ * formats to actually decode them. It's the number of bits for one sample in
104
+ * the actual coded bitstream.
105
+ *
106
+ * This could be for example 4 for ADPCM
107
+ * For PCM formats this matches bits_per_raw_sample
108
+ * Can be 0
109
+ */
110
+ int bits_per_coded_sample;
111
+
112
+ /**
113
+ * This is the number of valid bits in each output sample. If the
114
+ * sample format has more bits, the least significant bits are additional
115
+ * padding bits, which are always 0. Use right shifts to reduce the sample
116
+ * to its actual size. For example, audio formats with 24 bit samples will
117
+ * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
118
+ * To get the original sample use "(int32_t)sample >> 8"."
119
+ *
120
+ * For ADPCM this might be 12 or 16 or similar
121
+ * Can be 0
122
+ */
123
+ int bits_per_raw_sample;
124
+
125
+ /**
126
+ * Codec-specific bitstream restrictions that the stream conforms to.
127
+ */
128
+ int profile;
129
+ int level;
130
+
131
+ /**
132
+ * Video only. The dimensions of the video frame in pixels.
133
+ */
134
+ int width;
135
+ int height;
136
+
137
+ /**
138
+ * Video only. The aspect ratio (width / height) which a single pixel
139
+ * should have when displayed.
140
+ *
141
+ * When the aspect ratio is unknown / undefined, the numerator should be
142
+ * set to 0 (the denominator may have any value).
143
+ */
144
+ AVRational sample_aspect_ratio;
145
+
146
+ /**
147
+ * Video only. Number of frames per second, for streams with constant frame
148
+ * durations. Should be set to { 0, 1 } when some frames have differing
149
+ * durations or if the value is not known.
150
+ *
151
+ * @note This field correponds to values that are stored in codec-level
152
+ * headers and is typically overridden by container/transport-layer
153
+ * timestamps, when available. It should thus be used only as a last resort,
154
+ * when no higher-level timing information is available.
155
+ */
156
+ AVRational framerate;
157
+
158
+ /**
159
+ * Video only. The order of the fields in interlaced video.
160
+ */
161
+ enum AVFieldOrder field_order;
162
+
163
+ /**
164
+ * Video only. Additional colorspace characteristics.
165
+ */
166
+ enum AVColorRange color_range;
167
+ enum AVColorPrimaries color_primaries;
168
+ enum AVColorTransferCharacteristic color_trc;
169
+ enum AVColorSpace color_space;
170
+ enum AVChromaLocation chroma_location;
171
+
172
+ /**
173
+ * Video only. Number of delayed frames.
174
+ */
175
+ int video_delay;
176
+
177
+ /**
178
+ * Audio only. The channel layout and number of channels.
179
+ */
180
+ AVChannelLayout ch_layout;
181
+ /**
182
+ * Audio only. The number of audio samples per second.
183
+ */
184
+ int sample_rate;
185
+ /**
186
+ * Audio only. The number of bytes per coded audio frame, required by some
187
+ * formats.
188
+ *
189
+ * Corresponds to nBlockAlign in WAVEFORMATEX.
190
+ */
191
+ int block_align;
192
+ /**
193
+ * Audio only. Audio frame size, if known. Required by some formats to be static.
194
+ */
195
+ int frame_size;
196
+
197
+ /**
198
+ * Audio only. The amount of padding (in samples) inserted by the encoder at
199
+ * the beginning of the audio. I.e. this number of leading decoded samples
200
+ * must be discarded by the caller to get the original audio without leading
201
+ * padding.
202
+ */
203
+ int initial_padding;
204
+ /**
205
+ * Audio only. The amount of padding (in samples) appended by the encoder to
206
+ * the end of the audio. I.e. this number of decoded samples must be
207
+ * discarded by the caller from the end of the stream to get the original
208
+ * audio without any trailing padding.
209
+ */
210
+ int trailing_padding;
211
+ /**
212
+ * Audio only. Number of samples to skip after a discontinuity.
213
+ */
214
+ int seek_preroll;
215
+ } AVCodecParameters;
216
+
217
+ /**
218
+ * Allocate a new AVCodecParameters and set its fields to default values
219
+ * (unknown/invalid/0). The returned struct must be freed with
220
+ * avcodec_parameters_free().
221
+ */
222
+ AVCodecParameters *avcodec_parameters_alloc(void);
223
+
224
+ /**
225
+ * Free an AVCodecParameters instance and everything associated with it and
226
+ * write NULL to the supplied pointer.
227
+ */
228
+ void avcodec_parameters_free(AVCodecParameters **par);
229
+
230
+ /**
231
+ * Copy the contents of src to dst. Any allocated fields in dst are freed and
232
+ * replaced with newly allocated duplicates of the corresponding fields in src.
233
+ *
234
+ * @return >= 0 on success, a negative AVERROR code on failure.
235
+ */
236
+ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
237
+
238
+ /**
239
+ * This function is the same as av_get_audio_frame_duration(), except it works
240
+ * with AVCodecParameters instead of an AVCodecContext.
241
+ */
242
+ int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
243
+
244
+ /**
245
+ * @}
246
+ */
247
+
248
+ #endif // AVCODEC_CODEC_PAR_H
ffmpeg/include/libavcodec/d3d11va.h ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Direct3D11 HW acceleration
3
+ *
4
+ * copyright (c) 2009 Laurent Aimar
5
+ * copyright (c) 2015 Steve Lhomme
6
+ *
7
+ * This file is part of FFmpeg.
8
+ *
9
+ * FFmpeg is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * FFmpeg is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with FFmpeg; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
+ */
23
+
24
+ #ifndef AVCODEC_D3D11VA_H
25
+ #define AVCODEC_D3D11VA_H
26
+
27
+ /**
28
+ * @file
29
+ * @ingroup lavc_codec_hwaccel_d3d11va
30
+ * Public libavcodec D3D11VA header.
31
+ */
32
+
33
+ #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
34
+ #undef _WIN32_WINNT
35
+ #define _WIN32_WINNT 0x0602
36
+ #endif
37
+
38
+ #include <stdint.h>
39
+ #include <d3d11.h>
40
+
41
+ /**
42
+ * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11
43
+ * @ingroup lavc_codec_hwaccel
44
+ *
45
+ * @{
46
+ */
47
+
48
+ /**
49
+ * This structure is used to provides the necessary configurations and data
50
+ * to the Direct3D11 FFmpeg HWAccel implementation.
51
+ *
52
+ * The application must make it available as AVCodecContext.hwaccel_context.
53
+ *
54
+ * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext.
55
+ */
56
+ typedef struct AVD3D11VAContext {
57
+ /**
58
+ * D3D11 decoder object
59
+ */
60
+ ID3D11VideoDecoder *decoder;
61
+
62
+ /**
63
+ * D3D11 VideoContext
64
+ */
65
+ ID3D11VideoContext *video_context;
66
+
67
+ /**
68
+ * D3D11 configuration used to create the decoder
69
+ */
70
+ D3D11_VIDEO_DECODER_CONFIG *cfg;
71
+
72
+ /**
73
+ * The number of surface in the surface array
74
+ */
75
+ unsigned surface_count;
76
+
77
+ /**
78
+ * The array of Direct3D surfaces used to create the decoder
79
+ */
80
+ ID3D11VideoDecoderOutputView **surface;
81
+
82
+ /**
83
+ * A bit field configuring the workarounds needed for using the decoder
84
+ */
85
+ uint64_t workaround;
86
+
87
+ /**
88
+ * Private to the FFmpeg AVHWAccel implementation
89
+ */
90
+ unsigned report_id;
91
+
92
+ /**
93
+ * Mutex to access video_context
94
+ */
95
+ HANDLE context_mutex;
96
+ } AVD3D11VAContext;
97
+
98
+ /**
99
+ * Allocate an AVD3D11VAContext.
100
+ *
101
+ * @return Newly-allocated AVD3D11VAContext or NULL on failure.
102
+ */
103
+ AVD3D11VAContext *av_d3d11va_alloc_context(void);
104
+
105
+ /**
106
+ * @}
107
+ */
108
+
109
+ #endif /* AVCODEC_D3D11VA_H */
ffmpeg/include/libavcodec/defs.h ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ #ifndef AVCODEC_DEFS_H
21
+ #define AVCODEC_DEFS_H
22
+
23
+ /**
24
+ * @file
25
+ * @ingroup libavc
26
+ * Misc types and constants that do not belong anywhere else.
27
+ */
28
+
29
+ #include <stdint.h>
30
+ #include <stdlib.h>
31
+
32
+ /**
33
+ * @ingroup lavc_decoding
34
+ * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
35
+ * This is mainly needed because some optimized bitstream readers read
36
+ * 32 or 64 bit at once and could read over the end.<br>
37
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged
38
+ * MPEG bitstreams could cause overread and segfault.
39
+ */
40
+ #define AV_INPUT_BUFFER_PADDING_SIZE 64
41
+
42
+ /**
43
+ * Verify checksums embedded in the bitstream (could be of either encoded or
44
+ * decoded data, depending on the format) and print an error message on mismatch.
45
+ * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
46
+ * decoder/demuxer returning an error.
47
+ */
48
+ #define AV_EF_CRCCHECK (1<<0)
49
+ #define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
50
+ #define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length
51
+ #define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection
52
+
53
+ #define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue
54
+ #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
55
+ #define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors
56
+ #define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder/muxer should not do as an error
57
+
58
+ #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
59
+ #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
60
+ #define FF_COMPLIANCE_NORMAL 0
61
+ #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
62
+ #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
63
+
64
+
65
+ #define AV_PROFILE_UNKNOWN -99
66
+ #define AV_PROFILE_RESERVED -100
67
+
68
+ #define AV_PROFILE_AAC_MAIN 0
69
+ #define AV_PROFILE_AAC_LOW 1
70
+ #define AV_PROFILE_AAC_SSR 2
71
+ #define AV_PROFILE_AAC_LTP 3
72
+ #define AV_PROFILE_AAC_HE 4
73
+ #define AV_PROFILE_AAC_HE_V2 28
74
+ #define AV_PROFILE_AAC_LD 22
75
+ #define AV_PROFILE_AAC_ELD 38
76
+ #define AV_PROFILE_AAC_USAC 41
77
+ #define AV_PROFILE_MPEG2_AAC_LOW 128
78
+ #define AV_PROFILE_MPEG2_AAC_HE 131
79
+
80
+ #define AV_PROFILE_DNXHD 0
81
+ #define AV_PROFILE_DNXHR_LB 1
82
+ #define AV_PROFILE_DNXHR_SQ 2
83
+ #define AV_PROFILE_DNXHR_HQ 3
84
+ #define AV_PROFILE_DNXHR_HQX 4
85
+ #define AV_PROFILE_DNXHR_444 5
86
+
87
+ #define AV_PROFILE_DTS 20
88
+ #define AV_PROFILE_DTS_ES 30
89
+ #define AV_PROFILE_DTS_96_24 40
90
+ #define AV_PROFILE_DTS_HD_HRA 50
91
+ #define AV_PROFILE_DTS_HD_MA 60
92
+ #define AV_PROFILE_DTS_EXPRESS 70
93
+ #define AV_PROFILE_DTS_HD_MA_X 61
94
+ #define AV_PROFILE_DTS_HD_MA_X_IMAX 62
95
+
96
+ #define AV_PROFILE_EAC3_DDP_ATMOS 30
97
+
98
+ #define AV_PROFILE_TRUEHD_ATMOS 30
99
+
100
+ #define AV_PROFILE_MPEG2_422 0
101
+ #define AV_PROFILE_MPEG2_HIGH 1
102
+ #define AV_PROFILE_MPEG2_SS 2
103
+ #define AV_PROFILE_MPEG2_SNR_SCALABLE 3
104
+ #define AV_PROFILE_MPEG2_MAIN 4
105
+ #define AV_PROFILE_MPEG2_SIMPLE 5
106
+
107
+ #define AV_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
108
+ #define AV_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
109
+
110
+ #define AV_PROFILE_H264_BASELINE 66
111
+ #define AV_PROFILE_H264_CONSTRAINED_BASELINE (66|AV_PROFILE_H264_CONSTRAINED)
112
+ #define AV_PROFILE_H264_MAIN 77
113
+ #define AV_PROFILE_H264_EXTENDED 88
114
+ #define AV_PROFILE_H264_HIGH 100
115
+ #define AV_PROFILE_H264_HIGH_10 110
116
+ #define AV_PROFILE_H264_HIGH_10_INTRA (110|AV_PROFILE_H264_INTRA)
117
+ #define AV_PROFILE_H264_MULTIVIEW_HIGH 118
118
+ #define AV_PROFILE_H264_HIGH_422 122
119
+ #define AV_PROFILE_H264_HIGH_422_INTRA (122|AV_PROFILE_H264_INTRA)
120
+ #define AV_PROFILE_H264_STEREO_HIGH 128
121
+ #define AV_PROFILE_H264_HIGH_444 144
122
+ #define AV_PROFILE_H264_HIGH_444_PREDICTIVE 244
123
+ #define AV_PROFILE_H264_HIGH_444_INTRA (244|AV_PROFILE_H264_INTRA)
124
+ #define AV_PROFILE_H264_CAVLC_444 44
125
+
126
+ #define AV_PROFILE_VC1_SIMPLE 0
127
+ #define AV_PROFILE_VC1_MAIN 1
128
+ #define AV_PROFILE_VC1_COMPLEX 2
129
+ #define AV_PROFILE_VC1_ADVANCED 3
130
+
131
+ #define AV_PROFILE_MPEG4_SIMPLE 0
132
+ #define AV_PROFILE_MPEG4_SIMPLE_SCALABLE 1
133
+ #define AV_PROFILE_MPEG4_CORE 2
134
+ #define AV_PROFILE_MPEG4_MAIN 3
135
+ #define AV_PROFILE_MPEG4_N_BIT 4
136
+ #define AV_PROFILE_MPEG4_SCALABLE_TEXTURE 5
137
+ #define AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
138
+ #define AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
139
+ #define AV_PROFILE_MPEG4_HYBRID 8
140
+ #define AV_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
141
+ #define AV_PROFILE_MPEG4_CORE_SCALABLE 10
142
+ #define AV_PROFILE_MPEG4_ADVANCED_CODING 11
143
+ #define AV_PROFILE_MPEG4_ADVANCED_CORE 12
144
+ #define AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
145
+ #define AV_PROFILE_MPEG4_SIMPLE_STUDIO 14
146
+ #define AV_PROFILE_MPEG4_ADVANCED_SIMPLE 15
147
+
148
+ #define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
149
+ #define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
150
+ #define AV_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
151
+ #define AV_PROFILE_JPEG2000_DCINEMA_2K 3
152
+ #define AV_PROFILE_JPEG2000_DCINEMA_4K 4
153
+
154
+ #define AV_PROFILE_VP9_0 0
155
+ #define AV_PROFILE_VP9_1 1
156
+ #define AV_PROFILE_VP9_2 2
157
+ #define AV_PROFILE_VP9_3 3
158
+
159
+ #define AV_PROFILE_HEVC_MAIN 1
160
+ #define AV_PROFILE_HEVC_MAIN_10 2
161
+ #define AV_PROFILE_HEVC_MAIN_STILL_PICTURE 3
162
+ #define AV_PROFILE_HEVC_REXT 4
163
+ #define AV_PROFILE_HEVC_MULTIVIEW_MAIN 6
164
+ #define AV_PROFILE_HEVC_SCC 9
165
+
166
+ #define AV_PROFILE_VVC_MAIN_10 1
167
+ #define AV_PROFILE_VVC_MAIN_10_444 33
168
+
169
+ #define AV_PROFILE_AV1_MAIN 0
170
+ #define AV_PROFILE_AV1_HIGH 1
171
+ #define AV_PROFILE_AV1_PROFESSIONAL 2
172
+
173
+ #define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
174
+ #define AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
175
+ #define AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
176
+ #define AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
177
+ #define AV_PROFILE_MJPEG_JPEG_LS 0xf7
178
+
179
+ #define AV_PROFILE_SBC_MSBC 1
180
+
181
+ #define AV_PROFILE_PRORES_PROXY 0
182
+ #define AV_PROFILE_PRORES_LT 1
183
+ #define AV_PROFILE_PRORES_STANDARD 2
184
+ #define AV_PROFILE_PRORES_HQ 3
185
+ #define AV_PROFILE_PRORES_4444 4
186
+ #define AV_PROFILE_PRORES_XQ 5
187
+
188
+ #define AV_PROFILE_ARIB_PROFILE_A 0
189
+ #define AV_PROFILE_ARIB_PROFILE_C 1
190
+
191
+ #define AV_PROFILE_KLVA_SYNC 0
192
+ #define AV_PROFILE_KLVA_ASYNC 1
193
+
194
+ #define AV_PROFILE_EVC_BASELINE 0
195
+ #define AV_PROFILE_EVC_MAIN 1
196
+
197
+
198
+ #define AV_LEVEL_UNKNOWN -99
199
+
200
+ enum AVFieldOrder {
201
+ AV_FIELD_UNKNOWN,
202
+ AV_FIELD_PROGRESSIVE,
203
+ AV_FIELD_TT, ///< Top coded_first, top displayed first
204
+ AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
205
+ AV_FIELD_TB, ///< Top coded first, bottom displayed first
206
+ AV_FIELD_BT, ///< Bottom coded first, top displayed first
207
+ };
208
+
209
+ /**
210
+ * @ingroup lavc_decoding
211
+ */
212
+ enum AVDiscard{
213
+ /* We leave some space between them for extensions (drop some
214
+ * keyframes for intra-only or drop just some bidir frames). */
215
+ AVDISCARD_NONE =-16, ///< discard nothing
216
+ AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
217
+ AVDISCARD_NONREF = 8, ///< discard all non reference
218
+ AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
219
+ AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
220
+ AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
221
+ AVDISCARD_ALL = 48, ///< discard all
222
+ };
223
+
224
+ enum AVAudioServiceType {
225
+ AV_AUDIO_SERVICE_TYPE_MAIN = 0,
226
+ AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
227
+ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
228
+ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
229
+ AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
230
+ AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
231
+ AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
232
+ AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
233
+ AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
234
+ AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
235
+ };
236
+
237
+ /**
238
+ * Pan Scan area.
239
+ * This specifies the area which should be displayed.
240
+ * Note there may be multiple such areas for one frame.
241
+ */
242
+ typedef struct AVPanScan {
243
+ /**
244
+ * id
245
+ * - encoding: Set by user.
246
+ * - decoding: Set by libavcodec.
247
+ */
248
+ int id;
249
+
250
+ /**
251
+ * width and height in 1/16 pel
252
+ * - encoding: Set by user.
253
+ * - decoding: Set by libavcodec.
254
+ */
255
+ int width;
256
+ int height;
257
+
258
+ /**
259
+ * position of the top left corner in 1/16 pel for up to 3 fields/frames
260
+ * - encoding: Set by user.
261
+ * - decoding: Set by libavcodec.
262
+ */
263
+ int16_t position[3][2];
264
+ } AVPanScan;
265
+
266
+ /**
267
+ * This structure describes the bitrate properties of an encoded bitstream. It
268
+ * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
269
+ * parameters for H.264/HEVC.
270
+ */
271
+ typedef struct AVCPBProperties {
272
+ /**
273
+ * Maximum bitrate of the stream, in bits per second.
274
+ * Zero if unknown or unspecified.
275
+ */
276
+ int64_t max_bitrate;
277
+ /**
278
+ * Minimum bitrate of the stream, in bits per second.
279
+ * Zero if unknown or unspecified.
280
+ */
281
+ int64_t min_bitrate;
282
+ /**
283
+ * Average bitrate of the stream, in bits per second.
284
+ * Zero if unknown or unspecified.
285
+ */
286
+ int64_t avg_bitrate;
287
+
288
+ /**
289
+ * The size of the buffer to which the ratecontrol is applied, in bits.
290
+ * Zero if unknown or unspecified.
291
+ */
292
+ int64_t buffer_size;
293
+
294
+ /**
295
+ * The delay between the time the packet this structure is associated with
296
+ * is received and the time when it should be decoded, in periods of a 27MHz
297
+ * clock.
298
+ *
299
+ * UINT64_MAX when unknown or unspecified.
300
+ */
301
+ uint64_t vbv_delay;
302
+ } AVCPBProperties;
303
+
304
+ /**
305
+ * Allocate a CPB properties structure and initialize its fields to default
306
+ * values.
307
+ *
308
+ * @param size if non-NULL, the size of the allocated struct will be written
309
+ * here. This is useful for embedding it in side data.
310
+ *
311
+ * @return the newly allocated struct or NULL on failure
312
+ */
313
+ AVCPBProperties *av_cpb_properties_alloc(size_t *size);
314
+
315
+ /**
316
+ * This structure supplies correlation between a packet timestamp and a wall clock
317
+ * production time. The definition follows the Producer Reference Time ('prft')
318
+ * as defined in ISO/IEC 14496-12
319
+ */
320
+ typedef struct AVProducerReferenceTime {
321
+ /**
322
+ * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
323
+ */
324
+ int64_t wallclock;
325
+ int flags;
326
+ } AVProducerReferenceTime;
327
+
328
+ /**
329
+ * Encode extradata length to a buffer. Used by xiph codecs.
330
+ *
331
+ * @param s buffer to write to; must be at least (v/255+1) bytes long
332
+ * @param v size of extradata in bytes
333
+ * @return number of bytes written to the buffer.
334
+ */
335
+ unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
336
+
337
+ #endif // AVCODEC_DEFS_H
ffmpeg/include/libavcodec/dirac.h ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (C) 2007 Marco Gerards <marco@gnu.org>
3
+ * Copyright (C) 2009 David Conrad
4
+ * Copyright (C) 2011 Jordi Ortiz
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_DIRAC_H
24
+ #define AVCODEC_DIRAC_H
25
+
26
+ /**
27
+ * @file
28
+ * Interface to Dirac Decoder/Encoder
29
+ * @author Marco Gerards <marco@gnu.org>
30
+ * @author David Conrad
31
+ * @author Jordi Ortiz
32
+ */
33
+
34
+ #include <stddef.h>
35
+ #include <stdint.h>
36
+
37
+ #include "libavutil/pixfmt.h"
38
+ #include "libavutil/rational.h"
39
+
40
+ /**
41
+ * The spec limits the number of wavelet decompositions to 4 for both
42
+ * level 1 (VC-2) and 128 (long-gop default).
43
+ * 5 decompositions is the maximum before >16-bit buffers are needed.
44
+ * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting
45
+ * the others to 4 decompositions (or 3 for the fidelity filter).
46
+ *
47
+ * We use this instead of MAX_DECOMPOSITIONS to save some memory.
48
+ */
49
+ #define MAX_DWT_LEVELS 5
50
+
51
+ /**
52
+ * Parse code values:
53
+ *
54
+ * Dirac Specification ->
55
+ * 9.6.1 Table 9.1
56
+ *
57
+ * VC-2 Specification ->
58
+ * 10.4.1 Table 10.1
59
+ */
60
+
61
+ enum DiracParseCodes {
62
+ DIRAC_PCODE_SEQ_HEADER = 0x00,
63
+ DIRAC_PCODE_END_SEQ = 0x10,
64
+ DIRAC_PCODE_AUX = 0x20,
65
+ DIRAC_PCODE_PAD = 0x30,
66
+ DIRAC_PCODE_PICTURE_CODED = 0x08,
67
+ DIRAC_PCODE_PICTURE_RAW = 0x48,
68
+ DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,
69
+ DIRAC_PCODE_PICTURE_HQ = 0xE8,
70
+ DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A,
71
+ DIRAC_PCODE_INTER_NOREF_CO2 = 0x09,
72
+ DIRAC_PCODE_INTER_REF_CO1 = 0x0D,
73
+ DIRAC_PCODE_INTER_REF_CO2 = 0x0E,
74
+ DIRAC_PCODE_INTRA_REF_CO = 0x0C,
75
+ DIRAC_PCODE_INTRA_REF_RAW = 0x4C,
76
+ DIRAC_PCODE_INTRA_REF_PICT = 0xCC,
77
+ DIRAC_PCODE_MAGIC = 0x42424344,
78
+ };
79
+
80
+ typedef struct DiracVersionInfo {
81
+ int major;
82
+ int minor;
83
+ } DiracVersionInfo;
84
+
85
+ typedef struct AVDiracSeqHeader {
86
+ unsigned width;
87
+ unsigned height;
88
+ uint8_t chroma_format; ///< 0: 444 1: 422 2: 420
89
+
90
+ uint8_t interlaced;
91
+ uint8_t top_field_first;
92
+
93
+ uint8_t frame_rate_index; ///< index into dirac_frame_rate[]
94
+ uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[]
95
+
96
+ uint16_t clean_width;
97
+ uint16_t clean_height;
98
+ uint16_t clean_left_offset;
99
+ uint16_t clean_right_offset;
100
+
101
+ uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[]
102
+ uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]
103
+
104
+ int profile;
105
+ int level;
106
+
107
+ AVRational framerate;
108
+ AVRational sample_aspect_ratio;
109
+
110
+ enum AVPixelFormat pix_fmt;
111
+ enum AVColorRange color_range;
112
+ enum AVColorPrimaries color_primaries;
113
+ enum AVColorTransferCharacteristic color_trc;
114
+ enum AVColorSpace colorspace;
115
+
116
+ DiracVersionInfo version;
117
+ int bit_depth;
118
+ } AVDiracSeqHeader;
119
+
120
+ /**
121
+ * Parse a Dirac sequence header.
122
+ *
123
+ * @param dsh this function will allocate and fill an AVDiracSeqHeader struct
124
+ * and write it into this pointer. The caller must free it with
125
+ * av_free().
126
+ * @param buf the data buffer
127
+ * @param buf_size the size of the data buffer in bytes
128
+ * @param log_ctx if non-NULL, this function will log errors here
129
+ * @return 0 on success, a negative AVERROR code on failure
130
+ */
131
+ int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh,
132
+ const uint8_t *buf, size_t buf_size,
133
+ void *log_ctx);
134
+
135
+ #endif /* AVCODEC_DIRAC_H */
ffmpeg/include/libavcodec/dv_profile.h ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_DV_PROFILE_H
20
+ #define AVCODEC_DV_PROFILE_H
21
+
22
+ #include <stdint.h>
23
+
24
+ #include "libavutil/pixfmt.h"
25
+ #include "libavutil/rational.h"
26
+
27
+ /* minimum number of bytes to read from a DV stream in order to
28
+ * determine the profile */
29
+ #define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */
30
+
31
+
32
+ /*
33
+ * AVDVProfile is used to express the differences between various
34
+ * DV flavors. For now it's primarily used for differentiating
35
+ * 525/60 and 625/50, but the plans are to use it for various
36
+ * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
37
+ */
38
+ typedef struct AVDVProfile {
39
+ int dsf; /* value of the dsf in the DV header */
40
+ int video_stype; /* stype for VAUX source pack */
41
+ int frame_size; /* total size of one frame in bytes */
42
+ int difseg_size; /* number of DIF segments per DIF channel */
43
+ int n_difchan; /* number of DIF channels per frame */
44
+ AVRational time_base; /* 1/framerate */
45
+ int ltc_divisor; /* FPS from the LTS standpoint */
46
+ int height; /* picture height in pixels */
47
+ int width; /* picture width in pixels */
48
+ AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
49
+ enum AVPixelFormat pix_fmt; /* picture pixel format */
50
+ int bpm; /* blocks per macroblock */
51
+ const uint8_t *block_sizes; /* AC block sizes, in bits */
52
+ int audio_stride; /* size of audio_shuffle table */
53
+ int audio_min_samples[3]; /* min amount of audio samples */
54
+ /* for 48kHz, 44.1kHz and 32kHz */
55
+ int audio_samples_dist[5]; /* how many samples are supposed to be */
56
+ /* in each frame in a 5 frames window */
57
+ const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
58
+ } AVDVProfile;
59
+
60
+ /**
61
+ * Get a DV profile for the provided compressed frame.
62
+ *
63
+ * @param sys the profile used for the previous frame, may be NULL
64
+ * @param frame the compressed data buffer
65
+ * @param buf_size size of the buffer in bytes
66
+ * @return the DV profile for the supplied data or NULL on failure
67
+ */
68
+ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
69
+ const uint8_t *frame, unsigned buf_size);
70
+
71
+ /**
72
+ * Get a DV profile for the provided stream parameters.
73
+ */
74
+ const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
75
+
76
+ /**
77
+ * Get a DV profile for the provided stream parameters.
78
+ * The frame rate is used as a best-effort parameter.
79
+ */
80
+ const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate);
81
+
82
+ #endif /* AVCODEC_DV_PROFILE_H */
ffmpeg/include/libavcodec/dxva2.h ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * DXVA2 HW acceleration
3
+ *
4
+ * copyright (c) 2009 Laurent Aimar
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_DXVA2_H
24
+ #define AVCODEC_DXVA2_H
25
+
26
+ /**
27
+ * @file
28
+ * @ingroup lavc_codec_hwaccel_dxva2
29
+ * Public libavcodec DXVA2 header.
30
+ */
31
+
32
+ #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
33
+ #undef _WIN32_WINNT
34
+ #define _WIN32_WINNT 0x0602
35
+ #endif
36
+
37
+ #include <stdint.h>
38
+ #include <d3d9.h>
39
+ #include <dxva2api.h>
40
+
41
+ /**
42
+ * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
43
+ * @ingroup lavc_codec_hwaccel
44
+ *
45
+ * @{
46
+ */
47
+
48
+ /**
49
+ * This structure is used to provides the necessary configurations and data
50
+ * to the DXVA2 FFmpeg HWAccel implementation.
51
+ *
52
+ * The application must make it available as AVCodecContext.hwaccel_context.
53
+ */
54
+ struct dxva_context {
55
+ /**
56
+ * DXVA2 decoder object
57
+ */
58
+ IDirectXVideoDecoder *decoder;
59
+
60
+ /**
61
+ * DXVA2 configuration used to create the decoder
62
+ */
63
+ const DXVA2_ConfigPictureDecode *cfg;
64
+
65
+ /**
66
+ * The number of surface in the surface array
67
+ */
68
+ unsigned surface_count;
69
+
70
+ /**
71
+ * The array of Direct3D surfaces used to create the decoder
72
+ */
73
+ LPDIRECT3DSURFACE9 *surface;
74
+
75
+ /**
76
+ * A bit field configuring the workarounds needed for using the decoder
77
+ */
78
+ uint64_t workaround;
79
+
80
+ /**
81
+ * Private to the FFmpeg AVHWAccel implementation
82
+ */
83
+ unsigned report_id;
84
+ };
85
+
86
+ /**
87
+ * @}
88
+ */
89
+
90
+ #endif /* AVCODEC_DXVA2_H */
ffmpeg/include/libavcodec/jni.h ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * JNI public API functions
3
+ *
4
+ * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_JNI_H
24
+ #define AVCODEC_JNI_H
25
+
26
+ /*
27
+ * Manually set a Java virtual machine which will be used to retrieve the JNI
28
+ * environment. Once a Java VM is set it cannot be changed afterwards, meaning
29
+ * you can call multiple times av_jni_set_java_vm with the same Java VM pointer
30
+ * however it will error out if you try to set a different Java VM.
31
+ *
32
+ * @param vm Java virtual machine
33
+ * @param log_ctx context used for logging, can be NULL
34
+ * @return 0 on success, < 0 otherwise
35
+ */
36
+ int av_jni_set_java_vm(void *vm, void *log_ctx);
37
+
38
+ /*
39
+ * Get the Java virtual machine which has been set with av_jni_set_java_vm.
40
+ *
41
+ * @param vm Java virtual machine
42
+ * @return a pointer to the Java virtual machine
43
+ */
44
+ void *av_jni_get_java_vm(void *log_ctx);
45
+
46
+ /*
47
+ * Set the Android application context which will be used to retrieve the Android
48
+ * content resolver to handle content uris.
49
+ *
50
+ * This function is only available on Android.
51
+ *
52
+ * @param app_ctx global JNI reference to the Android application context
53
+ * @return 0 on success, < 0 otherwise
54
+ */
55
+ int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
56
+
57
+ /*
58
+ * Get the Android application context that has been set with
59
+ * av_jni_set_android_app_ctx.
60
+ *
61
+ * This function is only available on Android.
62
+ *
63
+ * @return a pointer the the Android application context
64
+ */
65
+ void *av_jni_get_android_app_ctx(void);
66
+
67
+ #endif /* AVCODEC_JNI_H */
ffmpeg/include/libavcodec/mediacodec.h ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Android MediaCodec public API
3
+ *
4
+ * Copyright (c) 2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_MEDIACODEC_H
24
+ #define AVCODEC_MEDIACODEC_H
25
+
26
+ #include "libavcodec/avcodec.h"
27
+
28
+ /**
29
+ * This structure holds a reference to a android/view/Surface object that will
30
+ * be used as output by the decoder.
31
+ *
32
+ */
33
+ typedef struct AVMediaCodecContext {
34
+
35
+ /**
36
+ * android/view/Surface object reference.
37
+ */
38
+ void *surface;
39
+
40
+ } AVMediaCodecContext;
41
+
42
+ /**
43
+ * Allocate and initialize a MediaCodec context.
44
+ *
45
+ * When decoding with MediaCodec is finished, the caller must free the
46
+ * MediaCodec context with av_mediacodec_default_free.
47
+ *
48
+ * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
49
+ */
50
+ AVMediaCodecContext *av_mediacodec_alloc_context(void);
51
+
52
+ /**
53
+ * Convenience function that sets up the MediaCodec context.
54
+ *
55
+ * @param avctx codec context
56
+ * @param ctx MediaCodec context to initialize
57
+ * @param surface reference to an android/view/Surface
58
+ * @return 0 on success, < 0 otherwise
59
+ */
60
+ int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface);
61
+
62
+ /**
63
+ * This function must be called to free the MediaCodec context initialized with
64
+ * av_mediacodec_default_init().
65
+ *
66
+ * @param avctx codec context
67
+ */
68
+ void av_mediacodec_default_free(AVCodecContext *avctx);
69
+
70
+ /**
71
+ * Opaque structure representing a MediaCodec buffer to render.
72
+ */
73
+ typedef struct MediaCodecBuffer AVMediaCodecBuffer;
74
+
75
+ /**
76
+ * Release a MediaCodec buffer and render it to the surface that is associated
77
+ * with the decoder. This function should only be called once on a given
78
+ * buffer, once released the underlying buffer returns to the codec, thus
79
+ * subsequent calls to this function will have no effect.
80
+ *
81
+ * @param buffer the buffer to render
82
+ * @param render 1 to release and render the buffer to the surface or 0 to
83
+ * discard the buffer
84
+ * @return 0 on success, < 0 otherwise
85
+ */
86
+ int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
87
+
88
+ /**
89
+ * Release a MediaCodec buffer and render it at the given time to the surface
90
+ * that is associated with the decoder. The timestamp must be within one second
91
+ * of the current `java/lang/System#nanoTime()` (which is implemented using
92
+ * `CLOCK_MONOTONIC` on Android). See the Android MediaCodec documentation
93
+ * of [`android/media/MediaCodec#releaseOutputBuffer(int,long)`][0] for more details.
94
+ *
95
+ * @param buffer the buffer to render
96
+ * @param time timestamp in nanoseconds of when to render the buffer
97
+ * @return 0 on success, < 0 otherwise
98
+ *
99
+ * [0]: https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,%20long)
100
+ */
101
+ int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time);
102
+
103
+ #endif /* AVCODEC_MEDIACODEC_H */
ffmpeg/include/libavcodec/packet.h ADDED
@@ -0,0 +1,894 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * AVPacket public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_PACKET_H
22
+ #define AVCODEC_PACKET_H
23
+
24
+ #include <stddef.h>
25
+ #include <stdint.h>
26
+
27
+ #include "libavutil/attributes.h"
28
+ #include "libavutil/buffer.h"
29
+ #include "libavutil/dict.h"
30
+ #include "libavutil/rational.h"
31
+ #include "libavutil/version.h"
32
+
33
+ #include "libavcodec/version_major.h"
34
+
35
+ /**
36
+ * @defgroup lavc_packet_side_data AVPacketSideData
37
+ *
38
+ * Types and functions for working with AVPacketSideData.
39
+ * @{
40
+ */
41
+ enum AVPacketSideDataType {
42
+ /**
43
+ * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
44
+ * bytes worth of palette. This side data signals that a new palette is
45
+ * present.
46
+ */
47
+ AV_PKT_DATA_PALETTE,
48
+
49
+ /**
50
+ * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
51
+ * that the extradata buffer was changed and the receiving side should
52
+ * act upon it appropriately. The new extradata is embedded in the side
53
+ * data buffer and should be immediately used for processing the current
54
+ * frame or packet.
55
+ */
56
+ AV_PKT_DATA_NEW_EXTRADATA,
57
+
58
+ /**
59
+ * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
60
+ * @code
61
+ * u32le param_flags
62
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
63
+ * s32le sample_rate
64
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
65
+ * s32le width
66
+ * s32le height
67
+ * @endcode
68
+ */
69
+ AV_PKT_DATA_PARAM_CHANGE,
70
+
71
+ /**
72
+ * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
73
+ * structures with info about macroblocks relevant to splitting the
74
+ * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
75
+ * That is, it does not necessarily contain info about all macroblocks,
76
+ * as long as the distance between macroblocks in the info is smaller
77
+ * than the target payload size.
78
+ * Each MB info structure is 12 bytes, and is laid out as follows:
79
+ * @code
80
+ * u32le bit offset from the start of the packet
81
+ * u8 current quantizer at the start of the macroblock
82
+ * u8 GOB number
83
+ * u16le macroblock address within the GOB
84
+ * u8 horizontal MV predictor
85
+ * u8 vertical MV predictor
86
+ * u8 horizontal MV predictor for block number 3
87
+ * u8 vertical MV predictor for block number 3
88
+ * @endcode
89
+ */
90
+ AV_PKT_DATA_H263_MB_INFO,
91
+
92
+ /**
93
+ * This side data should be associated with an audio stream and contains
94
+ * ReplayGain information in form of the AVReplayGain struct.
95
+ */
96
+ AV_PKT_DATA_REPLAYGAIN,
97
+
98
+ /**
99
+ * This side data contains a 3x3 transformation matrix describing an affine
100
+ * transformation that needs to be applied to the decoded video frames for
101
+ * correct presentation.
102
+ *
103
+ * See libavutil/display.h for a detailed description of the data.
104
+ */
105
+ AV_PKT_DATA_DISPLAYMATRIX,
106
+
107
+ /**
108
+ * This side data should be associated with a video stream and contains
109
+ * Stereoscopic 3D information in form of the AVStereo3D struct.
110
+ */
111
+ AV_PKT_DATA_STEREO3D,
112
+
113
+ /**
114
+ * This side data should be associated with an audio stream and corresponds
115
+ * to enum AVAudioServiceType.
116
+ */
117
+ AV_PKT_DATA_AUDIO_SERVICE_TYPE,
118
+
119
+ /**
120
+ * This side data contains quality related information from the encoder.
121
+ * @code
122
+ * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
123
+ * u8 picture type
124
+ * u8 error count
125
+ * u16 reserved
126
+ * u64le[error count] sum of squared differences between encoder in and output
127
+ * @endcode
128
+ */
129
+ AV_PKT_DATA_QUALITY_STATS,
130
+
131
+ /**
132
+ * This side data contains an integer value representing the stream index
133
+ * of a "fallback" track. A fallback track indicates an alternate
134
+ * track to use when the current track can not be decoded for some reason.
135
+ * e.g. no decoder available for codec.
136
+ */
137
+ AV_PKT_DATA_FALLBACK_TRACK,
138
+
139
+ /**
140
+ * This side data corresponds to the AVCPBProperties struct.
141
+ */
142
+ AV_PKT_DATA_CPB_PROPERTIES,
143
+
144
+ /**
145
+ * Recommmends skipping the specified number of samples
146
+ * @code
147
+ * u32le number of samples to skip from start of this packet
148
+ * u32le number of samples to skip from end of this packet
149
+ * u8 reason for start skip
150
+ * u8 reason for end skip (0=padding silence, 1=convergence)
151
+ * @endcode
152
+ */
153
+ AV_PKT_DATA_SKIP_SAMPLES,
154
+
155
+ /**
156
+ * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
157
+ * the packet may contain "dual mono" audio specific to Japanese DTV
158
+ * and if it is true, recommends only the selected channel to be used.
159
+ * @code
160
+ * u8 selected channels (0=main/left, 1=sub/right, 2=both)
161
+ * @endcode
162
+ */
163
+ AV_PKT_DATA_JP_DUALMONO,
164
+
165
+ /**
166
+ * A list of zero terminated key/value strings. There is no end marker for
167
+ * the list, so it is required to rely on the side data size to stop.
168
+ */
169
+ AV_PKT_DATA_STRINGS_METADATA,
170
+
171
+ /**
172
+ * Subtitle event position
173
+ * @code
174
+ * u32le x1
175
+ * u32le y1
176
+ * u32le x2
177
+ * u32le y2
178
+ * @endcode
179
+ */
180
+ AV_PKT_DATA_SUBTITLE_POSITION,
181
+
182
+ /**
183
+ * Data found in BlockAdditional element of matroska container. There is
184
+ * no end marker for the data, so it is required to rely on the side data
185
+ * size to recognize the end. 8 byte id (as found in BlockAddId) followed
186
+ * by data.
187
+ */
188
+ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
189
+
190
+ /**
191
+ * The optional first identifier line of a WebVTT cue.
192
+ */
193
+ AV_PKT_DATA_WEBVTT_IDENTIFIER,
194
+
195
+ /**
196
+ * The optional settings (rendering instructions) that immediately
197
+ * follow the timestamp specifier of a WebVTT cue.
198
+ */
199
+ AV_PKT_DATA_WEBVTT_SETTINGS,
200
+
201
+ /**
202
+ * A list of zero terminated key/value strings. There is no end marker for
203
+ * the list, so it is required to rely on the side data size to stop. This
204
+ * side data includes updated metadata which appeared in the stream.
205
+ */
206
+ AV_PKT_DATA_METADATA_UPDATE,
207
+
208
+ /**
209
+ * MPEGTS stream ID as uint8_t, this is required to pass the stream ID
210
+ * information from the demuxer to the corresponding muxer.
211
+ */
212
+ AV_PKT_DATA_MPEGTS_STREAM_ID,
213
+
214
+ /**
215
+ * Mastering display metadata (based on SMPTE-2086:2014). This metadata
216
+ * should be associated with a video stream and contains data in the form
217
+ * of the AVMasteringDisplayMetadata struct.
218
+ */
219
+ AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
220
+
221
+ /**
222
+ * This side data should be associated with a video stream and corresponds
223
+ * to the AVSphericalMapping structure.
224
+ */
225
+ AV_PKT_DATA_SPHERICAL,
226
+
227
+ /**
228
+ * Content light level (based on CTA-861.3). This metadata should be
229
+ * associated with a video stream and contains data in the form of the
230
+ * AVContentLightMetadata struct.
231
+ */
232
+ AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
233
+
234
+ /**
235
+ * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
236
+ * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
237
+ * The number of bytes of CC data is AVPacketSideData.size.
238
+ */
239
+ AV_PKT_DATA_A53_CC,
240
+
241
+ /**
242
+ * This side data is encryption initialization data.
243
+ * The format is not part of ABI, use av_encryption_init_info_* methods to
244
+ * access.
245
+ */
246
+ AV_PKT_DATA_ENCRYPTION_INIT_INFO,
247
+
248
+ /**
249
+ * This side data contains encryption info for how to decrypt the packet.
250
+ * The format is not part of ABI, use av_encryption_info_* methods to access.
251
+ */
252
+ AV_PKT_DATA_ENCRYPTION_INFO,
253
+
254
+ /**
255
+ * Active Format Description data consisting of a single byte as specified
256
+ * in ETSI TS 101 154 using AVActiveFormatDescription enum.
257
+ */
258
+ AV_PKT_DATA_AFD,
259
+
260
+ /**
261
+ * Producer Reference Time data corresponding to the AVProducerReferenceTime struct,
262
+ * usually exported by some encoders (on demand through the prft flag set in the
263
+ * AVCodecContext export_side_data field).
264
+ */
265
+ AV_PKT_DATA_PRFT,
266
+
267
+ /**
268
+ * ICC profile data consisting of an opaque octet buffer following the
269
+ * format described by ISO 15076-1.
270
+ */
271
+ AV_PKT_DATA_ICC_PROFILE,
272
+
273
+ /**
274
+ * DOVI configuration
275
+ * ref:
276
+ * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2
277
+ * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3
278
+ * Tags are stored in struct AVDOVIDecoderConfigurationRecord.
279
+ */
280
+ AV_PKT_DATA_DOVI_CONF,
281
+
282
+ /**
283
+ * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
284
+ * where the first uint32_t describes how many (1-3) of the other timecodes are used.
285
+ * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
286
+ * function in libavutil/timecode.h.
287
+ */
288
+ AV_PKT_DATA_S12M_TIMECODE,
289
+
290
+ /**
291
+ * HDR10+ dynamic metadata associated with a video frame. The metadata is in
292
+ * the form of the AVDynamicHDRPlus struct and contains
293
+ * information for color volume transform - application 4 of
294
+ * SMPTE 2094-40:2016 standard.
295
+ */
296
+ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
297
+
298
+ /**
299
+ * IAMF Mix Gain Parameter Data associated with the audio frame. This metadata
300
+ * is in the form of the AVIAMFParamDefinition struct and contains information
301
+ * defined in sections 3.6.1 and 3.8.1 of the Immersive Audio Model and
302
+ * Formats standard.
303
+ */
304
+ AV_PKT_DATA_IAMF_MIX_GAIN_PARAM,
305
+
306
+ /**
307
+ * IAMF Demixing Info Parameter Data associated with the audio frame. This
308
+ * metadata is in the form of the AVIAMFParamDefinition struct and contains
309
+ * information defined in sections 3.6.1 and 3.8.2 of the Immersive Audio Model
310
+ * and Formats standard.
311
+ */
312
+ AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM,
313
+
314
+ /**
315
+ * IAMF Recon Gain Info Parameter Data associated with the audio frame. This
316
+ * metadata is in the form of the AVIAMFParamDefinition struct and contains
317
+ * information defined in sections 3.6.1 and 3.8.3 of the Immersive Audio Model
318
+ * and Formats standard.
319
+ */
320
+ AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM,
321
+
322
+ /**
323
+ * Ambient viewing environment metadata, as defined by H.274. This metadata
324
+ * should be associated with a video stream and contains data in the form
325
+ * of the AVAmbientViewingEnvironment struct.
326
+ */
327
+ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
328
+
329
+ /**
330
+ * The number of pixels to discard from the top/bottom/left/right border of the
331
+ * decoded frame to obtain the sub-rectangle intended for presentation.
332
+ *
333
+ * @code
334
+ * u32le crop_top
335
+ * u32le crop_bottom
336
+ * u32le crop_left
337
+ * u32le crop_right
338
+ * @endcode
339
+ */
340
+ AV_PKT_DATA_FRAME_CROPPING,
341
+
342
+ /**
343
+ * Raw LCEVC payload data, as a uint8_t array, with NAL emulation
344
+ * bytes intact.
345
+ */
346
+ AV_PKT_DATA_LCEVC,
347
+
348
+ /**
349
+ * The number of side data types.
350
+ * This is not part of the public API/ABI in the sense that it may
351
+ * change when new side data types are added.
352
+ * This must stay the last enum value.
353
+ * If its value becomes huge, some code using it
354
+ * needs to be updated as it assumes it to be smaller than other limits.
355
+ */
356
+ AV_PKT_DATA_NB
357
+ };
358
+
359
+ #if FF_API_QUALITY_FACTOR
360
+ #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
361
+ #endif
362
+
363
+ /**
364
+ * This structure stores auxiliary information for decoding, presenting, or
365
+ * otherwise processing the coded stream. It is typically exported by demuxers
366
+ * and encoders and can be fed to decoders and muxers either in a per packet
367
+ * basis, or as global side data (applying to the entire coded stream).
368
+ *
369
+ * Global side data is handled as follows:
370
+ * - During demuxing, it may be exported through
371
+ * @ref AVCodecParameters.coded_side_data "AVStream's codec parameters", which can
372
+ * then be passed as input to decoders through the
373
+ * @ref AVCodecContext.coded_side_data "decoder context's side data", for
374
+ * initialization.
375
+ * - For muxing, it can be fed through @ref AVCodecParameters.coded_side_data
376
+ * "AVStream's codec parameters", typically the output of encoders through
377
+ * the @ref AVCodecContext.coded_side_data "encoder context's side data", for
378
+ * initialization.
379
+ *
380
+ * Packet specific side data is handled as follows:
381
+ * - During demuxing, it may be exported through @ref AVPacket.side_data
382
+ * "AVPacket's side data", which can then be passed as input to decoders.
383
+ * - For muxing, it can be fed through @ref AVPacket.side_data "AVPacket's
384
+ * side data", typically the output of encoders.
385
+ *
386
+ * Different modules may accept or export different types of side data
387
+ * depending on media type and codec. Refer to @ref AVPacketSideDataType for a
388
+ * list of defined types and where they may be found or used.
389
+ */
390
+ typedef struct AVPacketSideData {
391
+ uint8_t *data;
392
+ size_t size;
393
+ enum AVPacketSideDataType type;
394
+ } AVPacketSideData;
395
+
396
+ /**
397
+ * Allocate a new packet side data.
398
+ *
399
+ * @param sd pointer to an array of side data to which the side data should
400
+ * be added. *sd may be NULL, in which case the array will be
401
+ * initialized.
402
+ * @param nb_sd pointer to an integer containing the number of entries in
403
+ * the array. The integer value will be increased by 1 on success.
404
+ * @param type side data type
405
+ * @param size desired side data size
406
+ * @param flags currently unused. Must be zero
407
+ *
408
+ * @return pointer to freshly allocated side data on success, or NULL otherwise.
409
+ */
410
+ AVPacketSideData *av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd,
411
+ enum AVPacketSideDataType type,
412
+ size_t size, int flags);
413
+
414
+ /**
415
+ * Wrap existing data as packet side data.
416
+ *
417
+ * @param sd pointer to an array of side data to which the side data should
418
+ * be added. *sd may be NULL, in which case the array will be
419
+ * initialized
420
+ * @param nb_sd pointer to an integer containing the number of entries in
421
+ * the array. The integer value will be increased by 1 on success.
422
+ * @param type side data type
423
+ * @param data a data array. It must be allocated with the av_malloc() family
424
+ * of functions. The ownership of the data is transferred to the
425
+ * side data array on success
426
+ * @param size size of the data array
427
+ * @param flags currently unused. Must be zero
428
+ *
429
+ * @return pointer to freshly allocated side data on success, or NULL otherwise
430
+ * On failure, the side data array is unchanged and the data remains
431
+ * owned by the caller.
432
+ */
433
+ AVPacketSideData *av_packet_side_data_add(AVPacketSideData **sd, int *nb_sd,
434
+ enum AVPacketSideDataType type,
435
+ void *data, size_t size, int flags);
436
+
437
+ /**
438
+ * Get side information from a side data array.
439
+ *
440
+ * @param sd the array from which the side data should be fetched
441
+ * @param nb_sd value containing the number of entries in the array.
442
+ * @param type desired side information type
443
+ *
444
+ * @return pointer to side data if present or NULL otherwise
445
+ */
446
+ const AVPacketSideData *av_packet_side_data_get(const AVPacketSideData *sd,
447
+ int nb_sd,
448
+ enum AVPacketSideDataType type);
449
+
450
+ /**
451
+ * Remove side data of the given type from a side data array.
452
+ *
453
+ * @param sd the array from which the side data should be removed
454
+ * @param nb_sd pointer to an integer containing the number of entries in
455
+ * the array. Will be reduced by the amount of entries removed
456
+ * upon return
457
+ * @param type side information type
458
+ */
459
+ void av_packet_side_data_remove(AVPacketSideData *sd, int *nb_sd,
460
+ enum AVPacketSideDataType type);
461
+
462
+ /**
463
+ * Convenience function to free all the side data stored in an array, and
464
+ * the array itself.
465
+ *
466
+ * @param sd pointer to array of side data to free. Will be set to NULL
467
+ * upon return.
468
+ * @param nb_sd pointer to an integer containing the number of entries in
469
+ * the array. Will be set to 0 upon return.
470
+ */
471
+ void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd);
472
+
473
+ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
474
+
475
+ /**
476
+ * @}
477
+ */
478
+
479
+ /**
480
+ * @defgroup lavc_packet AVPacket
481
+ *
482
+ * Types and functions for working with AVPacket.
483
+ * @{
484
+ */
485
+
486
+ /**
487
+ * This structure stores compressed data. It is typically exported by demuxers
488
+ * and then passed as input to decoders, or received as output from encoders and
489
+ * then passed to muxers.
490
+ *
491
+ * For video, it should typically contain one compressed frame. For audio it may
492
+ * contain several compressed frames. Encoders are allowed to output empty
493
+ * packets, with no compressed data, containing only side data
494
+ * (e.g. to update some stream parameters at the end of encoding).
495
+ *
496
+ * The semantics of data ownership depends on the buf field.
497
+ * If it is set, the packet data is dynamically allocated and is
498
+ * valid indefinitely until a call to av_packet_unref() reduces the
499
+ * reference count to 0.
500
+ *
501
+ * If the buf field is not set av_packet_ref() would make a copy instead
502
+ * of increasing the reference count.
503
+ *
504
+ * The side data is always allocated with av_malloc(), copied by
505
+ * av_packet_ref() and freed by av_packet_unref().
506
+ *
507
+ * sizeof(AVPacket) being a part of the public ABI is deprecated. once
508
+ * av_init_packet() is removed, new packets will only be able to be allocated
509
+ * with av_packet_alloc(), and new fields may be added to the end of the struct
510
+ * with a minor bump.
511
+ *
512
+ * @see av_packet_alloc
513
+ * @see av_packet_ref
514
+ * @see av_packet_unref
515
+ */
516
+ typedef struct AVPacket {
517
+ /**
518
+ * A reference to the reference-counted buffer where the packet data is
519
+ * stored.
520
+ * May be NULL, then the packet data is not reference-counted.
521
+ */
522
+ AVBufferRef *buf;
523
+ /**
524
+ * Presentation timestamp in AVStream->time_base units; the time at which
525
+ * the decompressed packet will be presented to the user.
526
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
527
+ * pts MUST be larger or equal to dts as presentation cannot happen before
528
+ * decompression, unless one wants to view hex dumps. Some formats misuse
529
+ * the terms dts and pts/cts to mean something different. Such timestamps
530
+ * must be converted to true pts/dts before they are stored in AVPacket.
531
+ */
532
+ int64_t pts;
533
+ /**
534
+ * Decompression timestamp in AVStream->time_base units; the time at which
535
+ * the packet is decompressed.
536
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
537
+ */
538
+ int64_t dts;
539
+ uint8_t *data;
540
+ int size;
541
+ int stream_index;
542
+ /**
543
+ * A combination of AV_PKT_FLAG values
544
+ */
545
+ int flags;
546
+ /**
547
+ * Additional packet data that can be provided by the container.
548
+ * Packet can contain several types of side information.
549
+ */
550
+ AVPacketSideData *side_data;
551
+ int side_data_elems;
552
+
553
+ /**
554
+ * Duration of this packet in AVStream->time_base units, 0 if unknown.
555
+ * Equals next_pts - this_pts in presentation order.
556
+ */
557
+ int64_t duration;
558
+
559
+ int64_t pos; ///< byte position in stream, -1 if unknown
560
+
561
+ /**
562
+ * for some private data of the user
563
+ */
564
+ void *opaque;
565
+
566
+ /**
567
+ * AVBufferRef for free use by the API user. FFmpeg will never check the
568
+ * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
569
+ * the packet is unreferenced. av_packet_copy_props() calls create a new
570
+ * reference with av_buffer_ref() for the target packet's opaque_ref field.
571
+ *
572
+ * This is unrelated to the opaque field, although it serves a similar
573
+ * purpose.
574
+ */
575
+ AVBufferRef *opaque_ref;
576
+
577
+ /**
578
+ * Time base of the packet's timestamps.
579
+ * In the future, this field may be set on packets output by encoders or
580
+ * demuxers, but its value will be by default ignored on input to decoders
581
+ * or muxers.
582
+ */
583
+ AVRational time_base;
584
+ } AVPacket;
585
+
586
+ #if FF_API_INIT_PACKET
587
+ attribute_deprecated
588
+ typedef struct AVPacketList {
589
+ AVPacket pkt;
590
+ struct AVPacketList *next;
591
+ } AVPacketList;
592
+ #endif
593
+
594
+ #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
595
+ #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
596
+ /**
597
+ * Flag is used to discard packets which are required to maintain valid
598
+ * decoder state but are not required for output and should be dropped
599
+ * after decoding.
600
+ **/
601
+ #define AV_PKT_FLAG_DISCARD 0x0004
602
+ /**
603
+ * The packet comes from a trusted source.
604
+ *
605
+ * Otherwise-unsafe constructs such as arbitrary pointers to data
606
+ * outside the packet may be followed.
607
+ */
608
+ #define AV_PKT_FLAG_TRUSTED 0x0008
609
+ /**
610
+ * Flag is used to indicate packets that contain frames that can
611
+ * be discarded by the decoder. I.e. Non-reference frames.
612
+ */
613
+ #define AV_PKT_FLAG_DISPOSABLE 0x0010
614
+
615
+ enum AVSideDataParamChangeFlags {
616
+ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
617
+ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
618
+ };
619
+
620
+ /**
621
+ * Allocate an AVPacket and set its fields to default values. The resulting
622
+ * struct must be freed using av_packet_free().
623
+ *
624
+ * @return An AVPacket filled with default values or NULL on failure.
625
+ *
626
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
627
+ * must be allocated through other means such as av_new_packet.
628
+ *
629
+ * @see av_new_packet
630
+ */
631
+ AVPacket *av_packet_alloc(void);
632
+
633
+ /**
634
+ * Create a new packet that references the same data as src.
635
+ *
636
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
637
+ *
638
+ * @return newly created AVPacket on success, NULL on error.
639
+ *
640
+ * @see av_packet_alloc
641
+ * @see av_packet_ref
642
+ */
643
+ AVPacket *av_packet_clone(const AVPacket *src);
644
+
645
+ /**
646
+ * Free the packet, if the packet is reference counted, it will be
647
+ * unreferenced first.
648
+ *
649
+ * @param pkt packet to be freed. The pointer will be set to NULL.
650
+ * @note passing NULL is a no-op.
651
+ */
652
+ void av_packet_free(AVPacket **pkt);
653
+
654
+ #if FF_API_INIT_PACKET
655
+ /**
656
+ * Initialize optional fields of a packet with default values.
657
+ *
658
+ * Note, this does not touch the data and size members, which have to be
659
+ * initialized separately.
660
+ *
661
+ * @param pkt packet
662
+ *
663
+ * @see av_packet_alloc
664
+ * @see av_packet_unref
665
+ *
666
+ * @deprecated This function is deprecated. Once it's removed,
667
+ sizeof(AVPacket) will not be a part of the ABI anymore.
668
+ */
669
+ attribute_deprecated
670
+ void av_init_packet(AVPacket *pkt);
671
+ #endif
672
+
673
+ /**
674
+ * Allocate the payload of a packet and initialize its fields with
675
+ * default values.
676
+ *
677
+ * @param pkt packet
678
+ * @param size wanted payload size
679
+ * @return 0 if OK, AVERROR_xxx otherwise
680
+ */
681
+ int av_new_packet(AVPacket *pkt, int size);
682
+
683
+ /**
684
+ * Reduce packet size, correctly zeroing padding
685
+ *
686
+ * @param pkt packet
687
+ * @param size new size
688
+ */
689
+ void av_shrink_packet(AVPacket *pkt, int size);
690
+
691
+ /**
692
+ * Increase packet size, correctly zeroing padding
693
+ *
694
+ * @param pkt packet
695
+ * @param grow_by number of bytes by which to increase the size of the packet
696
+ */
697
+ int av_grow_packet(AVPacket *pkt, int grow_by);
698
+
699
+ /**
700
+ * Initialize a reference-counted packet from av_malloc()ed data.
701
+ *
702
+ * @param pkt packet to be initialized. This function will set the data, size,
703
+ * and buf fields, all others are left untouched.
704
+ * @param data Data allocated by av_malloc() to be used as packet data. If this
705
+ * function returns successfully, the data is owned by the underlying AVBuffer.
706
+ * The caller may not access the data through other means.
707
+ * @param size size of data in bytes, without the padding. I.e. the full buffer
708
+ * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
709
+ *
710
+ * @return 0 on success, a negative AVERROR on error
711
+ */
712
+ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
713
+
714
+ /**
715
+ * Allocate new information of a packet.
716
+ *
717
+ * @param pkt packet
718
+ * @param type side information type
719
+ * @param size side information size
720
+ * @return pointer to fresh allocated data or NULL otherwise
721
+ */
722
+ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
723
+ size_t size);
724
+
725
+ /**
726
+ * Wrap an existing array as a packet side data.
727
+ *
728
+ * @param pkt packet
729
+ * @param type side information type
730
+ * @param data the side data array. It must be allocated with the av_malloc()
731
+ * family of functions. The ownership of the data is transferred to
732
+ * pkt.
733
+ * @param size side information size
734
+ * @return a non-negative number on success, a negative AVERROR code on
735
+ * failure. On failure, the packet is unchanged and the data remains
736
+ * owned by the caller.
737
+ */
738
+ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
739
+ uint8_t *data, size_t size);
740
+
741
+ /**
742
+ * Shrink the already allocated side data buffer
743
+ *
744
+ * @param pkt packet
745
+ * @param type side information type
746
+ * @param size new side information size
747
+ * @return 0 on success, < 0 on failure
748
+ */
749
+ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
750
+ size_t size);
751
+
752
+ /**
753
+ * Get side information from packet.
754
+ *
755
+ * @param pkt packet
756
+ * @param type desired side information type
757
+ * @param size If supplied, *size will be set to the size of the side data
758
+ * or to zero if the desired side data is not present.
759
+ * @return pointer to data if present or NULL otherwise
760
+ */
761
+ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
762
+ size_t *size);
763
+
764
+ /**
765
+ * Pack a dictionary for use in side_data.
766
+ *
767
+ * @param dict The dictionary to pack.
768
+ * @param size pointer to store the size of the returned data
769
+ * @return pointer to data if successful, NULL otherwise
770
+ */
771
+ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
772
+ /**
773
+ * Unpack a dictionary from side_data.
774
+ *
775
+ * @param data data from side_data
776
+ * @param size size of the data
777
+ * @param dict the metadata storage dictionary
778
+ * @return 0 on success, < 0 on failure
779
+ */
780
+ int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
781
+ AVDictionary **dict);
782
+
783
+ /**
784
+ * Convenience function to free all the side data stored.
785
+ * All the other fields stay untouched.
786
+ *
787
+ * @param pkt packet
788
+ */
789
+ void av_packet_free_side_data(AVPacket *pkt);
790
+
791
+ /**
792
+ * Setup a new reference to the data described by a given packet
793
+ *
794
+ * If src is reference-counted, setup dst as a new reference to the
795
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
796
+ * data from src into it.
797
+ *
798
+ * All the other fields are copied from src.
799
+ *
800
+ * @see av_packet_unref
801
+ *
802
+ * @param dst Destination packet. Will be completely overwritten.
803
+ * @param src Source packet
804
+ *
805
+ * @return 0 on success, a negative AVERROR on error. On error, dst
806
+ * will be blank (as if returned by av_packet_alloc()).
807
+ */
808
+ int av_packet_ref(AVPacket *dst, const AVPacket *src);
809
+
810
+ /**
811
+ * Wipe the packet.
812
+ *
813
+ * Unreference the buffer referenced by the packet and reset the
814
+ * remaining packet fields to their default values.
815
+ *
816
+ * @param pkt The packet to be unreferenced.
817
+ */
818
+ void av_packet_unref(AVPacket *pkt);
819
+
820
+ /**
821
+ * Move every field in src to dst and reset src.
822
+ *
823
+ * @see av_packet_unref
824
+ *
825
+ * @param src Source packet, will be reset
826
+ * @param dst Destination packet
827
+ */
828
+ void av_packet_move_ref(AVPacket *dst, AVPacket *src);
829
+
830
+ /**
831
+ * Copy only "properties" fields from src to dst.
832
+ *
833
+ * Properties for the purpose of this function are all the fields
834
+ * beside those related to the packet data (buf, data, size)
835
+ *
836
+ * @param dst Destination packet
837
+ * @param src Source packet
838
+ *
839
+ * @return 0 on success AVERROR on failure.
840
+ */
841
+ int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
842
+
843
+ /**
844
+ * Ensure the data described by a given packet is reference counted.
845
+ *
846
+ * @note This function does not ensure that the reference will be writable.
847
+ * Use av_packet_make_writable instead for that purpose.
848
+ *
849
+ * @see av_packet_ref
850
+ * @see av_packet_make_writable
851
+ *
852
+ * @param pkt packet whose data should be made reference counted.
853
+ *
854
+ * @return 0 on success, a negative AVERROR on error. On failure, the
855
+ * packet is unchanged.
856
+ */
857
+ int av_packet_make_refcounted(AVPacket *pkt);
858
+
859
+ /**
860
+ * Create a writable reference for the data described by a given packet,
861
+ * avoiding data copy if possible.
862
+ *
863
+ * @param pkt Packet whose data should be made writable.
864
+ *
865
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
866
+ * packet is unchanged.
867
+ */
868
+ int av_packet_make_writable(AVPacket *pkt);
869
+
870
+ /**
871
+ * Convert valid timing fields (timestamps / durations) in a packet from one
872
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
873
+ * ignored.
874
+ *
875
+ * @param pkt packet on which the conversion will be performed
876
+ * @param tb_src source timebase, in which the timing fields in pkt are
877
+ * expressed
878
+ * @param tb_dst destination timebase, to which the timing fields will be
879
+ * converted
880
+ */
881
+ void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
882
+
883
+ /**
884
+ * Allocate an AVContainerFifo instance for AVPacket.
885
+ *
886
+ * @param flags currently unused
887
+ */
888
+ struct AVContainerFifo *av_container_fifo_alloc_avpacket(unsigned flags);
889
+
890
+ /**
891
+ * @}
892
+ */
893
+
894
+ #endif // AVCODEC_PACKET_H
ffmpeg/include/libavcodec/qsv.h ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Intel MediaSDK QSV public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_QSV_H
22
+ #define AVCODEC_QSV_H
23
+
24
+ #include <mfxvideo.h>
25
+
26
+ #include "libavutil/buffer.h"
27
+
28
+ /**
29
+ * This struct is used for communicating QSV parameters between libavcodec and
30
+ * the caller. It is managed by the caller and must be assigned to
31
+ * AVCodecContext.hwaccel_context.
32
+ * - decoding: hwaccel_context must be set on return from the get_format()
33
+ * callback
34
+ * - encoding: hwaccel_context must be set before avcodec_open2()
35
+ */
36
+ typedef struct AVQSVContext {
37
+ /**
38
+ * If non-NULL, the session to use for encoding or decoding.
39
+ * Otherwise, libavcodec will try to create an internal session.
40
+ */
41
+ mfxSession session;
42
+
43
+ /**
44
+ * The IO pattern to use.
45
+ */
46
+ int iopattern;
47
+
48
+ /**
49
+ * Extra buffers to pass to encoder or decoder initialization.
50
+ */
51
+ mfxExtBuffer **ext_buffers;
52
+ int nb_ext_buffers;
53
+
54
+ /**
55
+ * Encoding only. If this field is set to non-zero by the caller, libavcodec
56
+ * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to
57
+ * the encoder initialization. This only makes sense if iopattern is also
58
+ * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY.
59
+ *
60
+ * The number of allocated opaque surfaces will be the sum of the number
61
+ * required by the encoder and the user-provided value nb_opaque_surfaces.
62
+ * The array of the opaque surfaces will be exported to the caller through
63
+ * the opaque_surfaces field.
64
+ *
65
+ * The caller must set this field to zero for oneVPL (MFX_VERSION >= 2.0)
66
+ */
67
+ int opaque_alloc;
68
+
69
+ /**
70
+ * Encoding only, and only if opaque_alloc is set to non-zero. Before
71
+ * calling avcodec_open2(), the caller should set this field to the number
72
+ * of extra opaque surfaces to allocate beyond what is required by the
73
+ * encoder.
74
+ *
75
+ * On return from avcodec_open2(), this field will be set by libavcodec to
76
+ * the total number of allocated opaque surfaces.
77
+ */
78
+ int nb_opaque_surfaces;
79
+
80
+ /**
81
+ * Encoding only, and only if opaque_alloc is set to non-zero. On return
82
+ * from avcodec_open2(), this field will be used by libavcodec to export the
83
+ * array of the allocated opaque surfaces to the caller, so they can be
84
+ * passed to other parts of the pipeline.
85
+ *
86
+ * The buffer reference exported here is owned and managed by libavcodec,
87
+ * the callers should make their own reference with av_buffer_ref() and free
88
+ * it with av_buffer_unref() when it is no longer needed.
89
+ *
90
+ * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1.
91
+ */
92
+ AVBufferRef *opaque_surfaces;
93
+
94
+ /**
95
+ * Encoding only, and only if opaque_alloc is set to non-zero. On return
96
+ * from avcodec_open2(), this field will be set to the surface type used in
97
+ * the opaque allocation request.
98
+ */
99
+ int opaque_alloc_type;
100
+ } AVQSVContext;
101
+
102
+ /**
103
+ * Allocate a new context.
104
+ *
105
+ * It must be freed by the caller with av_free().
106
+ */
107
+ AVQSVContext *av_qsv_alloc_context(void);
108
+
109
+ #endif /* AVCODEC_QSV_H */
ffmpeg/include/libavcodec/vdpau.h ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * The Video Decode and Presentation API for UNIX (VDPAU) is used for
3
+ * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
4
+ *
5
+ * Copyright (C) 2008 NVIDIA
6
+ *
7
+ * This file is part of FFmpeg.
8
+ *
9
+ * FFmpeg is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * FFmpeg is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with FFmpeg; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
+ */
23
+
24
+ #ifndef AVCODEC_VDPAU_H
25
+ #define AVCODEC_VDPAU_H
26
+
27
+ /**
28
+ * @file
29
+ * @ingroup lavc_codec_hwaccel_vdpau
30
+ * Public libavcodec VDPAU header.
31
+ */
32
+
33
+
34
+ /**
35
+ * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
36
+ * @ingroup lavc_codec_hwaccel
37
+ *
38
+ * VDPAU hardware acceleration has two modules
39
+ * - VDPAU decoding
40
+ * - VDPAU presentation
41
+ *
42
+ * The VDPAU decoding module parses all headers using FFmpeg
43
+ * parsing mechanisms and uses VDPAU for the actual decoding.
44
+ *
45
+ * As per the current implementation, the actual decoding
46
+ * and rendering (API calls) are done as part of the VDPAU
47
+ * presentation (vo_vdpau.c) module.
48
+ *
49
+ * @{
50
+ */
51
+
52
+ #include <vdpau/vdpau.h>
53
+
54
+ #include "libavutil/avconfig.h"
55
+ #include "libavutil/attributes.h"
56
+
57
+ #include "avcodec.h"
58
+
59
+ struct AVCodecContext;
60
+ struct AVFrame;
61
+
62
+ typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
63
+ const VdpPictureInfo *, uint32_t,
64
+ const VdpBitstreamBuffer *);
65
+
66
+ /**
67
+ * This structure is used to share data between the libavcodec library and
68
+ * the client video application.
69
+ * This structure will be allocated and stored in AVCodecContext.hwaccel_context
70
+ * by av_vdpau_bind_context(). Members can be set by the user once
71
+ * during initialization or through each AVCodecContext.get_buffer()
72
+ * function call. In any case, they must be valid prior to calling
73
+ * decoding functions.
74
+ *
75
+ * The size of this structure is not a part of the public ABI and must not
76
+ * be used outside of libavcodec.
77
+ */
78
+ typedef struct AVVDPAUContext {
79
+ /**
80
+ * VDPAU decoder handle
81
+ *
82
+ * Set by user.
83
+ */
84
+ VdpDecoder decoder;
85
+
86
+ /**
87
+ * VDPAU decoder render callback
88
+ *
89
+ * Set by the user.
90
+ */
91
+ VdpDecoderRender *render;
92
+
93
+ AVVDPAU_Render2 render2;
94
+ } AVVDPAUContext;
95
+
96
+ #if FF_API_VDPAU_ALLOC_GET_SET
97
+ /**
98
+ * @brief allocation function for AVVDPAUContext
99
+ *
100
+ * Allows extending the struct without breaking API/ABI
101
+ * @deprecated use av_vdpau_bind_context() instead
102
+ */
103
+ attribute_deprecated
104
+ AVVDPAUContext *av_alloc_vdpaucontext(void);
105
+
106
+ /**
107
+ * @deprecated render2 is public and can be accessed directly
108
+ */
109
+ attribute_deprecated
110
+ AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
111
+ /**
112
+ * @deprecated render2 is public and can be accessed directly
113
+ */
114
+ attribute_deprecated
115
+ void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
116
+ #endif
117
+
118
+ /**
119
+ * Associate a VDPAU device with a codec context for hardware acceleration.
120
+ * This function is meant to be called from the get_format() codec callback,
121
+ * or earlier. It can also be called after avcodec_flush_buffers() to change
122
+ * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
123
+ * display preemption).
124
+ *
125
+ * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
126
+ * successfully.
127
+ *
128
+ * @param avctx decoding context whose get_format() callback is invoked
129
+ * @param device VDPAU device handle to use for hardware acceleration
130
+ * @param get_proc_address VDPAU device driver
131
+ * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
132
+ *
133
+ * @return 0 on success, an AVERROR code on failure.
134
+ */
135
+ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
136
+ VdpGetProcAddress *get_proc_address, unsigned flags);
137
+
138
+ /**
139
+ * Gets the parameters to create an adequate VDPAU video surface for the codec
140
+ * context using VDPAU hardware decoding acceleration.
141
+ *
142
+ * @note Behavior is undefined if the context was not successfully bound to a
143
+ * VDPAU device using av_vdpau_bind_context().
144
+ *
145
+ * @param avctx the codec context being used for decoding the stream
146
+ * @param type storage space for the VDPAU video surface chroma type
147
+ * (or NULL to ignore)
148
+ * @param width storage space for the VDPAU video surface pixel width
149
+ * (or NULL to ignore)
150
+ * @param height storage space for the VDPAU video surface pixel height
151
+ * (or NULL to ignore)
152
+ *
153
+ * @return 0 on success, a negative AVERROR code on failure.
154
+ */
155
+ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
156
+ uint32_t *width, uint32_t *height);
157
+
158
+ #if FF_API_VDPAU_ALLOC_GET_SET
159
+ /**
160
+ * Allocate an AVVDPAUContext.
161
+ *
162
+ * @return Newly-allocated AVVDPAUContext or NULL on failure.
163
+ * @deprecated use av_vdpau_bind_context() instead
164
+ */
165
+ attribute_deprecated
166
+ AVVDPAUContext *av_vdpau_alloc_context(void);
167
+ #endif
168
+
169
+ /** @} */
170
+
171
+ #endif /* AVCODEC_VDPAU_H */
ffmpeg/include/libavcodec/version.h ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_VERSION_H
20
+ #define AVCODEC_VERSION_H
21
+
22
+ /**
23
+ * @file
24
+ * @ingroup libavc
25
+ * Libavcodec version macros.
26
+ */
27
+
28
+ #include "libavutil/version.h"
29
+
30
+ #include "version_major.h"
31
+
32
+ #define LIBAVCODEC_VERSION_MINOR 31
33
+ #define LIBAVCODEC_VERSION_MICRO 100
34
+
35
+ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
36
+ LIBAVCODEC_VERSION_MINOR, \
37
+ LIBAVCODEC_VERSION_MICRO)
38
+ #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
39
+ LIBAVCODEC_VERSION_MINOR, \
40
+ LIBAVCODEC_VERSION_MICRO)
41
+ #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
42
+
43
+ #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
44
+
45
+ #endif /* AVCODEC_VERSION_H */
ffmpeg/include/libavcodec/version_major.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVCODEC_VERSION_MAJOR_H
20
+ #define AVCODEC_VERSION_MAJOR_H
21
+
22
+ /**
23
+ * @file
24
+ * @ingroup libavc
25
+ * Libavcodec version macros.
26
+ */
27
+
28
+ #define LIBAVCODEC_VERSION_MAJOR 61
29
+
30
+ /**
31
+ * FF_API_* defines may be placed below to indicate public API that will be
32
+ * dropped at a future version bump. The defines themselves are not part of
33
+ * the public API and may change, break or disappear at any time.
34
+ *
35
+ * @note, when bumping the major version it is recommended to manually
36
+ * disable each FF_API_* in its own commit instead of disabling them all
37
+ * at once through the bump. This improves the git bisect-ability of the change.
38
+ */
39
+
40
+ #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 62)
41
+ #define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 62)
42
+ #define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 62)
43
+ #define FF_API_DROPCHANGED (LIBAVCODEC_VERSION_MAJOR < 62)
44
+
45
+ #define FF_API_AVFFT (LIBAVCODEC_VERSION_MAJOR < 62)
46
+ #define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62)
47
+ #define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62)
48
+ #define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)
49
+ #define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
50
+ #define FF_API_QUALITY_FACTOR (LIBAVCODEC_VERSION_MAJOR < 62)
51
+ #define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 62)
52
+ #define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
53
+
54
+ // reminder to remove the OMX encoder on next major bump
55
+ #define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 62)
56
+ // reminder to remove Sonic Lossy/Lossless encoders on next major bump
57
+ #define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 62)
58
+ // reminder to remove Sonic decoder on next-next major bump
59
+ #define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63)
60
+
61
+ #endif /* AVCODEC_VERSION_MAJOR_H */
ffmpeg/include/libavcodec/videotoolbox.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Videotoolbox hardware acceleration
3
+ *
4
+ * copyright (c) 2012 Sebastien Zwickert
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_VIDEOTOOLBOX_H
24
+ #define AVCODEC_VIDEOTOOLBOX_H
25
+
26
+ /**
27
+ * @file
28
+ * @ingroup lavc_codec_hwaccel_videotoolbox
29
+ * Public libavcodec Videotoolbox header.
30
+ */
31
+
32
+ /**
33
+ * @defgroup lavc_codec_hwaccel_videotoolbox VideoToolbox Decoder
34
+ * @ingroup lavc_codec_hwaccel
35
+ *
36
+ * Hardware accelerated decoding using VideoToolbox on Apple Platforms
37
+ *
38
+ * @{
39
+ */
40
+
41
+ #include <stdint.h>
42
+
43
+ #define Picture QuickdrawPicture
44
+ #include <VideoToolbox/VideoToolbox.h>
45
+ #undef Picture
46
+
47
+ #include "libavcodec/avcodec.h"
48
+
49
+ #include "libavutil/attributes.h"
50
+
51
+ /**
52
+ * This struct holds all the information that needs to be passed
53
+ * between the caller and libavcodec for initializing Videotoolbox decoding.
54
+ * Its size is not a part of the public ABI, it must be allocated with
55
+ * av_videotoolbox_alloc_context() and freed with av_free().
56
+ */
57
+ typedef struct AVVideotoolboxContext {
58
+ /**
59
+ * Videotoolbox decompression session object.
60
+ */
61
+ VTDecompressionSessionRef session;
62
+
63
+ /**
64
+ * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
65
+ * set by the caller. If this is set to 0, then no specific format is
66
+ * requested from the decoder, and its native format is output.
67
+ */
68
+ OSType cv_pix_fmt_type;
69
+
70
+ /**
71
+ * CoreMedia Format Description that Videotoolbox will use to create the decompression session.
72
+ */
73
+ CMVideoFormatDescriptionRef cm_fmt_desc;
74
+
75
+ /**
76
+ * CoreMedia codec type that Videotoolbox will use to create the decompression session.
77
+ */
78
+ int cm_codec_type;
79
+ } AVVideotoolboxContext;
80
+
81
+ /**
82
+ * @}
83
+ */
84
+
85
+ #endif /* AVCODEC_VIDEOTOOLBOX_H */
ffmpeg/include/libavcodec/vorbis_parser.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ /**
20
+ * @file
21
+ * A public API for Vorbis parsing
22
+ *
23
+ * Determines the duration for each packet.
24
+ */
25
+
26
+ #ifndef AVCODEC_VORBIS_PARSER_H
27
+ #define AVCODEC_VORBIS_PARSER_H
28
+
29
+ #include <stdint.h>
30
+
31
+ typedef struct AVVorbisParseContext AVVorbisParseContext;
32
+
33
+ /**
34
+ * Allocate and initialize the Vorbis parser using headers in the extradata.
35
+ */
36
+ AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata,
37
+ int extradata_size);
38
+
39
+ /**
40
+ * Free the parser and everything associated with it.
41
+ */
42
+ void av_vorbis_parse_free(AVVorbisParseContext **s);
43
+
44
+ #define VORBIS_FLAG_HEADER 0x00000001
45
+ #define VORBIS_FLAG_COMMENT 0x00000002
46
+ #define VORBIS_FLAG_SETUP 0x00000004
47
+
48
+ /**
49
+ * Get the duration for a Vorbis packet.
50
+ *
51
+ * If @p flags is @c NULL,
52
+ * special frames are considered invalid.
53
+ *
54
+ * @param s Vorbis parser context
55
+ * @param buf buffer containing a Vorbis frame
56
+ * @param buf_size size of the buffer
57
+ * @param flags flags for special frames
58
+ */
59
+ int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf,
60
+ int buf_size, int *flags);
61
+
62
+ /**
63
+ * Get the duration for a Vorbis packet.
64
+ *
65
+ * @param s Vorbis parser context
66
+ * @param buf buffer containing a Vorbis frame
67
+ * @param buf_size size of the buffer
68
+ */
69
+ int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf,
70
+ int buf_size);
71
+
72
+ void av_vorbis_parse_reset(AVVorbisParseContext *s);
73
+
74
+ #endif /* AVCODEC_VORBIS_PARSER_H */
ffmpeg/include/libavdevice/avdevice.h ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVDEVICE_AVDEVICE_H
20
+ #define AVDEVICE_AVDEVICE_H
21
+
22
+ #include "version_major.h"
23
+ #ifndef HAVE_AV_CONFIG_H
24
+ /* When included as part of the ffmpeg build, only include the major version
25
+ * to avoid unnecessary rebuilds. When included externally, keep including
26
+ * the full version information. */
27
+ #include "version.h"
28
+ #endif
29
+
30
+ /**
31
+ * @file
32
+ * @ingroup lavd
33
+ * Main libavdevice API header
34
+ */
35
+
36
+ /**
37
+ * @defgroup lavd libavdevice
38
+ * Special devices muxing/demuxing library.
39
+ *
40
+ * Libavdevice is a complementary library to @ref libavf "libavformat". It
41
+ * provides various "special" platform-specific muxers and demuxers, e.g. for
42
+ * grabbing devices, audio capture and playback etc. As a consequence, the
43
+ * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own
44
+ * I/O functions). The filename passed to avformat_open_input() often does not
45
+ * refer to an actually existing file, but has some special device-specific
46
+ * meaning - e.g. for xcbgrab it is the display name.
47
+ *
48
+ * To use libavdevice, simply call avdevice_register_all() to register all
49
+ * compiled muxers and demuxers. They all use standard libavformat API.
50
+ *
51
+ * @{
52
+ */
53
+
54
+ #include "libavutil/log.h"
55
+ #include "libavutil/opt.h"
56
+ #include "libavutil/dict.h"
57
+ #include "libavformat/avformat.h"
58
+
59
+ /**
60
+ * Return the LIBAVDEVICE_VERSION_INT constant.
61
+ */
62
+ unsigned avdevice_version(void);
63
+
64
+ /**
65
+ * Return the libavdevice build-time configuration.
66
+ */
67
+ const char *avdevice_configuration(void);
68
+
69
+ /**
70
+ * Return the libavdevice license.
71
+ */
72
+ const char *avdevice_license(void);
73
+
74
+ /**
75
+ * Initialize libavdevice and register all the input and output devices.
76
+ */
77
+ void avdevice_register_all(void);
78
+
79
+ /**
80
+ * Audio input devices iterator.
81
+ *
82
+ * If d is NULL, returns the first registered input audio/video device,
83
+ * if d is non-NULL, returns the next registered input audio/video device after d
84
+ * or NULL if d is the last one.
85
+ */
86
+ const AVInputFormat *av_input_audio_device_next(const AVInputFormat *d);
87
+
88
+ /**
89
+ * Video input devices iterator.
90
+ *
91
+ * If d is NULL, returns the first registered input audio/video device,
92
+ * if d is non-NULL, returns the next registered input audio/video device after d
93
+ * or NULL if d is the last one.
94
+ */
95
+ const AVInputFormat *av_input_video_device_next(const AVInputFormat *d);
96
+
97
+ /**
98
+ * Audio output devices iterator.
99
+ *
100
+ * If d is NULL, returns the first registered output audio/video device,
101
+ * if d is non-NULL, returns the next registered output audio/video device after d
102
+ * or NULL if d is the last one.
103
+ */
104
+ const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d);
105
+
106
+ /**
107
+ * Video output devices iterator.
108
+ *
109
+ * If d is NULL, returns the first registered output audio/video device,
110
+ * if d is non-NULL, returns the next registered output audio/video device after d
111
+ * or NULL if d is the last one.
112
+ */
113
+ const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d);
114
+
115
+ typedef struct AVDeviceRect {
116
+ int x; /**< x coordinate of top left corner */
117
+ int y; /**< y coordinate of top left corner */
118
+ int width; /**< width */
119
+ int height; /**< height */
120
+ } AVDeviceRect;
121
+
122
+ /**
123
+ * Message types used by avdevice_app_to_dev_control_message().
124
+ */
125
+ enum AVAppToDevMessageType {
126
+ /**
127
+ * Dummy message.
128
+ */
129
+ AV_APP_TO_DEV_NONE = MKBETAG('N','O','N','E'),
130
+
131
+ /**
132
+ * Window size change message.
133
+ *
134
+ * Message is sent to the device every time the application changes the size
135
+ * of the window device renders to.
136
+ * Message should also be sent right after window is created.
137
+ *
138
+ * data: AVDeviceRect: new window size.
139
+ */
140
+ AV_APP_TO_DEV_WINDOW_SIZE = MKBETAG('G','E','O','M'),
141
+
142
+ /**
143
+ * Repaint request message.
144
+ *
145
+ * Message is sent to the device when window has to be repainted.
146
+ *
147
+ * data: AVDeviceRect: area required to be repainted.
148
+ * NULL: whole area is required to be repainted.
149
+ */
150
+ AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A'),
151
+
152
+ /**
153
+ * Request pause/play.
154
+ *
155
+ * Application requests pause/unpause playback.
156
+ * Mostly usable with devices that have internal buffer.
157
+ * By default devices are not paused.
158
+ *
159
+ * data: NULL
160
+ */
161
+ AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '),
162
+ AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'),
163
+ AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T'),
164
+
165
+ /**
166
+ * Volume control message.
167
+ *
168
+ * Set volume level. It may be device-dependent if volume
169
+ * is changed per stream or system wide. Per stream volume
170
+ * change is expected when possible.
171
+ *
172
+ * data: double: new volume with range of 0.0 - 1.0.
173
+ */
174
+ AV_APP_TO_DEV_SET_VOLUME = MKBETAG('S', 'V', 'O', 'L'),
175
+
176
+ /**
177
+ * Mute control messages.
178
+ *
179
+ * Change mute state. It may be device-dependent if mute status
180
+ * is changed per stream or system wide. Per stream mute status
181
+ * change is expected when possible.
182
+ *
183
+ * data: NULL.
184
+ */
185
+ AV_APP_TO_DEV_MUTE = MKBETAG(' ', 'M', 'U', 'T'),
186
+ AV_APP_TO_DEV_UNMUTE = MKBETAG('U', 'M', 'U', 'T'),
187
+ AV_APP_TO_DEV_TOGGLE_MUTE = MKBETAG('T', 'M', 'U', 'T'),
188
+
189
+ /**
190
+ * Get volume/mute messages.
191
+ *
192
+ * Force the device to send AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED or
193
+ * AV_DEV_TO_APP_MUTE_STATE_CHANGED command respectively.
194
+ *
195
+ * data: NULL.
196
+ */
197
+ AV_APP_TO_DEV_GET_VOLUME = MKBETAG('G', 'V', 'O', 'L'),
198
+ AV_APP_TO_DEV_GET_MUTE = MKBETAG('G', 'M', 'U', 'T'),
199
+ };
200
+
201
+ /**
202
+ * Message types used by avdevice_dev_to_app_control_message().
203
+ */
204
+ enum AVDevToAppMessageType {
205
+ /**
206
+ * Dummy message.
207
+ */
208
+ AV_DEV_TO_APP_NONE = MKBETAG('N','O','N','E'),
209
+
210
+ /**
211
+ * Create window buffer message.
212
+ *
213
+ * Device requests to create a window buffer. Exact meaning is device-
214
+ * and application-dependent. Message is sent before rendering first
215
+ * frame and all one-shot initializations should be done here.
216
+ * Application is allowed to ignore preferred window buffer size.
217
+ *
218
+ * @note: Application is obligated to inform about window buffer size
219
+ * with AV_APP_TO_DEV_WINDOW_SIZE message.
220
+ *
221
+ * data: AVDeviceRect: preferred size of the window buffer.
222
+ * NULL: no preferred size of the window buffer.
223
+ */
224
+ AV_DEV_TO_APP_CREATE_WINDOW_BUFFER = MKBETAG('B','C','R','E'),
225
+
226
+ /**
227
+ * Prepare window buffer message.
228
+ *
229
+ * Device requests to prepare a window buffer for rendering.
230
+ * Exact meaning is device- and application-dependent.
231
+ * Message is sent before rendering of each frame.
232
+ *
233
+ * data: NULL.
234
+ */
235
+ AV_DEV_TO_APP_PREPARE_WINDOW_BUFFER = MKBETAG('B','P','R','E'),
236
+
237
+ /**
238
+ * Display window buffer message.
239
+ *
240
+ * Device requests to display a window buffer.
241
+ * Message is sent when new frame is ready to be displayed.
242
+ * Usually buffers need to be swapped in handler of this message.
243
+ *
244
+ * data: NULL.
245
+ */
246
+ AV_DEV_TO_APP_DISPLAY_WINDOW_BUFFER = MKBETAG('B','D','I','S'),
247
+
248
+ /**
249
+ * Destroy window buffer message.
250
+ *
251
+ * Device requests to destroy a window buffer.
252
+ * Message is sent when device is about to be destroyed and window
253
+ * buffer is not required anymore.
254
+ *
255
+ * data: NULL.
256
+ */
257
+ AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B','D','E','S'),
258
+
259
+ /**
260
+ * Buffer fullness status messages.
261
+ *
262
+ * Device signals buffer overflow/underflow.
263
+ *
264
+ * data: NULL.
265
+ */
266
+ AV_DEV_TO_APP_BUFFER_OVERFLOW = MKBETAG('B','O','F','L'),
267
+ AV_DEV_TO_APP_BUFFER_UNDERFLOW = MKBETAG('B','U','F','L'),
268
+
269
+ /**
270
+ * Buffer readable/writable.
271
+ *
272
+ * Device informs that buffer is readable/writable.
273
+ * When possible, device informs how many bytes can be read/write.
274
+ *
275
+ * @warning Device may not inform when number of bytes than can be read/write changes.
276
+ *
277
+ * data: int64_t: amount of bytes available to read/write.
278
+ * NULL: amount of bytes available to read/write is not known.
279
+ */
280
+ AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B','R','D',' '),
281
+ AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B','W','R',' '),
282
+
283
+ /**
284
+ * Mute state change message.
285
+ *
286
+ * Device informs that mute state has changed.
287
+ *
288
+ * data: int: 0 for not muted state, non-zero for muted state.
289
+ */
290
+ AV_DEV_TO_APP_MUTE_STATE_CHANGED = MKBETAG('C','M','U','T'),
291
+
292
+ /**
293
+ * Volume level change message.
294
+ *
295
+ * Device informs that volume level has changed.
296
+ *
297
+ * data: double: new volume with range of 0.0 - 1.0.
298
+ */
299
+ AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED = MKBETAG('C','V','O','L'),
300
+ };
301
+
302
+ /**
303
+ * Send control message from application to device.
304
+ *
305
+ * @param s device context.
306
+ * @param type message type.
307
+ * @param data message data. Exact type depends on message type.
308
+ * @param data_size size of message data.
309
+ * @return >= 0 on success, negative on error.
310
+ * AVERROR(ENOSYS) when device doesn't implement handler of the message.
311
+ */
312
+ int avdevice_app_to_dev_control_message(struct AVFormatContext *s,
313
+ enum AVAppToDevMessageType type,
314
+ void *data, size_t data_size);
315
+
316
+ /**
317
+ * Send control message from device to application.
318
+ *
319
+ * @param s device context.
320
+ * @param type message type.
321
+ * @param data message data. Can be NULL.
322
+ * @param data_size size of message data.
323
+ * @return >= 0 on success, negative on error.
324
+ * AVERROR(ENOSYS) when application doesn't implement handler of the message.
325
+ */
326
+ int avdevice_dev_to_app_control_message(struct AVFormatContext *s,
327
+ enum AVDevToAppMessageType type,
328
+ void *data, size_t data_size);
329
+
330
+ /**
331
+ * Structure describes basic parameters of the device.
332
+ */
333
+ typedef struct AVDeviceInfo {
334
+ char *device_name; /**< device name, format depends on device */
335
+ char *device_description; /**< human friendly name */
336
+ enum AVMediaType *media_types; /**< array indicating what media types(s), if any, a device can provide. If null, cannot provide any */
337
+ int nb_media_types; /**< length of media_types array, 0 if device cannot provide any media types */
338
+ } AVDeviceInfo;
339
+
340
+ /**
341
+ * List of devices.
342
+ */
343
+ typedef struct AVDeviceInfoList {
344
+ AVDeviceInfo **devices; /**< list of autodetected devices */
345
+ int nb_devices; /**< number of autodetected devices */
346
+ int default_device; /**< index of default device or -1 if no default */
347
+ } AVDeviceInfoList;
348
+
349
+ /**
350
+ * List devices.
351
+ *
352
+ * Returns available device names and their parameters.
353
+ *
354
+ * @note: Some devices may accept system-dependent device names that cannot be
355
+ * autodetected. The list returned by this function cannot be assumed to
356
+ * be always completed.
357
+ *
358
+ * @param s device context.
359
+ * @param[out] device_list list of autodetected devices.
360
+ * @return count of autodetected devices, negative on error.
361
+ */
362
+ int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list);
363
+
364
+ /**
365
+ * Convenient function to free result of avdevice_list_devices().
366
+ *
367
+ * @param device_list device list to be freed.
368
+ */
369
+ void avdevice_free_list_devices(AVDeviceInfoList **device_list);
370
+
371
+ /**
372
+ * List devices.
373
+ *
374
+ * Returns available device names and their parameters.
375
+ * These are convinient wrappers for avdevice_list_devices().
376
+ * Device context is allocated and deallocated internally.
377
+ *
378
+ * @param device device format. May be NULL if device name is set.
379
+ * @param device_name device name. May be NULL if device format is set.
380
+ * @param device_options An AVDictionary filled with device-private options. May be NULL.
381
+ * The same options must be passed later to avformat_write_header() for output
382
+ * devices or avformat_open_input() for input devices, or at any other place
383
+ * that affects device-private options.
384
+ * @param[out] device_list list of autodetected devices
385
+ * @return count of autodetected devices, negative on error.
386
+ * @note device argument takes precedence over device_name when both are set.
387
+ */
388
+ int avdevice_list_input_sources(const AVInputFormat *device, const char *device_name,
389
+ AVDictionary *device_options, AVDeviceInfoList **device_list);
390
+ int avdevice_list_output_sinks(const AVOutputFormat *device, const char *device_name,
391
+ AVDictionary *device_options, AVDeviceInfoList **device_list);
392
+
393
+ /**
394
+ * @}
395
+ */
396
+
397
+ #endif /* AVDEVICE_AVDEVICE_H */
ffmpeg/include/libavdevice/version.h ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVDEVICE_VERSION_H
20
+ #define AVDEVICE_VERSION_H
21
+
22
+ /**
23
+ * @file
24
+ * @ingroup lavd
25
+ * Libavdevice version macros
26
+ */
27
+
28
+ #include "libavutil/version.h"
29
+
30
+ #include "version_major.h"
31
+
32
+ #define LIBAVDEVICE_VERSION_MINOR 4
33
+ #define LIBAVDEVICE_VERSION_MICRO 100
34
+
35
+ #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
36
+ LIBAVDEVICE_VERSION_MINOR, \
37
+ LIBAVDEVICE_VERSION_MICRO)
38
+ #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
39
+ LIBAVDEVICE_VERSION_MINOR, \
40
+ LIBAVDEVICE_VERSION_MICRO)
41
+ #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
42
+
43
+ #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION)
44
+
45
+ #endif /* AVDEVICE_VERSION_H */
ffmpeg/include/libavdevice/version_major.h ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVDEVICE_VERSION_MAJOR_H
20
+ #define AVDEVICE_VERSION_MAJOR_H
21
+
22
+ /**
23
+ * @file
24
+ * @ingroup lavd
25
+ * Libavdevice version macros
26
+ */
27
+
28
+ #define LIBAVDEVICE_VERSION_MAJOR 61
29
+
30
+ /**
31
+ * FF_API_* defines may be placed below to indicate public API that will be
32
+ * dropped at a future version bump. The defines themselves are not part of
33
+ * the public API and may change, break or disappear at any time.
34
+ */
35
+
36
+ // reminder to remove the bktr device on next major bump
37
+ #define FF_API_BKTR_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
38
+ // reminder to remove the opengl device on next major bump
39
+ #define FF_API_OPENGL_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
40
+ // reminder to remove the sdl2 device on next major bump
41
+ #define FF_API_SDL2_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
42
+
43
+ #endif /* AVDEVICE_VERSION_MAJOR_H */
ffmpeg/include/libavfilter/avfilter.h ADDED
@@ -0,0 +1,1406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * filter layer
3
+ * Copyright (c) 2007 Bobby Bingham
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVFILTER_AVFILTER_H
23
+ #define AVFILTER_AVFILTER_H
24
+
25
+ /**
26
+ * @file
27
+ * @ingroup lavfi
28
+ * Main libavfilter public API header
29
+ */
30
+
31
+ /**
32
+ * @defgroup lavfi libavfilter
33
+ * Graph-based frame editing library.
34
+ *
35
+ * @{
36
+ */
37
+
38
+ #include <stddef.h>
39
+
40
+ #include "libavutil/attributes.h"
41
+ #include "libavutil/avutil.h"
42
+ #include "libavutil/buffer.h"
43
+ #include "libavutil/dict.h"
44
+ #include "libavutil/frame.h"
45
+ #include "libavutil/log.h"
46
+ #include "libavutil/samplefmt.h"
47
+ #include "libavutil/pixfmt.h"
48
+ #include "libavutil/rational.h"
49
+
50
+ #include "libavfilter/version_major.h"
51
+ #ifndef HAVE_AV_CONFIG_H
52
+ /* When included as part of the ffmpeg build, only include the major version
53
+ * to avoid unnecessary rebuilds. When included externally, keep including
54
+ * the full version information. */
55
+ #include "libavfilter/version.h"
56
+ #endif
57
+
58
+ /**
59
+ * Return the LIBAVFILTER_VERSION_INT constant.
60
+ */
61
+ unsigned avfilter_version(void);
62
+
63
+ /**
64
+ * Return the libavfilter build-time configuration.
65
+ */
66
+ const char *avfilter_configuration(void);
67
+
68
+ /**
69
+ * Return the libavfilter license.
70
+ */
71
+ const char *avfilter_license(void);
72
+
73
+ typedef struct AVFilterContext AVFilterContext;
74
+ typedef struct AVFilterLink AVFilterLink;
75
+ typedef struct AVFilterPad AVFilterPad;
76
+ typedef struct AVFilterFormats AVFilterFormats;
77
+ typedef struct AVFilterChannelLayouts AVFilterChannelLayouts;
78
+
79
+ /**
80
+ * Get the name of an AVFilterPad.
81
+ *
82
+ * @param pads an array of AVFilterPads
83
+ * @param pad_idx index of the pad in the array; it is the caller's
84
+ * responsibility to ensure the index is valid
85
+ *
86
+ * @return name of the pad_idx'th pad in pads
87
+ */
88
+ const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx);
89
+
90
+ /**
91
+ * Get the type of an AVFilterPad.
92
+ *
93
+ * @param pads an array of AVFilterPads
94
+ * @param pad_idx index of the pad in the array; it is the caller's
95
+ * responsibility to ensure the index is valid
96
+ *
97
+ * @return type of the pad_idx'th pad in pads
98
+ */
99
+ enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx);
100
+
101
+ /**
102
+ * Lists of formats / etc. supported by an end of a link.
103
+ *
104
+ * This structure is directly part of AVFilterLink, in two copies:
105
+ * one for the source filter, one for the destination filter.
106
+
107
+ * These lists are used for negotiating the format to actually be used,
108
+ * which will be loaded into the format and channel_layout members of
109
+ * AVFilterLink, when chosen.
110
+ */
111
+ typedef struct AVFilterFormatsConfig {
112
+
113
+ /**
114
+ * List of supported formats (pixel or sample).
115
+ */
116
+ AVFilterFormats *formats;
117
+
118
+ /**
119
+ * Lists of supported sample rates, only for audio.
120
+ */
121
+ AVFilterFormats *samplerates;
122
+
123
+ /**
124
+ * Lists of supported channel layouts, only for audio.
125
+ */
126
+ AVFilterChannelLayouts *channel_layouts;
127
+
128
+ /**
129
+ * Lists of supported YUV color metadata, only for YUV video.
130
+ */
131
+ AVFilterFormats *color_spaces; ///< AVColorSpace
132
+ AVFilterFormats *color_ranges; ///< AVColorRange
133
+
134
+ } AVFilterFormatsConfig;
135
+
136
+ /**
137
+ * The number of the filter inputs is not determined just by AVFilter.inputs.
138
+ * The filter might add additional inputs during initialization depending on the
139
+ * options supplied to it.
140
+ */
141
+ #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
142
+ /**
143
+ * The number of the filter outputs is not determined just by AVFilter.outputs.
144
+ * The filter might add additional outputs during initialization depending on
145
+ * the options supplied to it.
146
+ */
147
+ #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
148
+ /**
149
+ * The filter supports multithreading by splitting frames into multiple parts
150
+ * and processing them concurrently.
151
+ */
152
+ #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
153
+ /**
154
+ * The filter is a "metadata" filter - it does not modify the frame data in any
155
+ * way. It may only affect the metadata (i.e. those fields copied by
156
+ * av_frame_copy_props()).
157
+ *
158
+ * More precisely, this means:
159
+ * - video: the data of any frame output by the filter must be exactly equal to
160
+ * some frame that is received on one of its inputs. Furthermore, all frames
161
+ * produced on a given output must correspond to frames received on the same
162
+ * input and their order must be unchanged. Note that the filter may still
163
+ * drop or duplicate the frames.
164
+ * - audio: the data produced by the filter on any of its outputs (viewed e.g.
165
+ * as an array of interleaved samples) must be exactly equal to the data
166
+ * received by the filter on one of its inputs.
167
+ */
168
+ #define AVFILTER_FLAG_METADATA_ONLY (1 << 3)
169
+
170
+ /**
171
+ * The filter can create hardware frames using AVFilterContext.hw_device_ctx.
172
+ */
173
+ #define AVFILTER_FLAG_HWDEVICE (1 << 4)
174
+ /**
175
+ * Some filters support a generic "enable" expression option that can be used
176
+ * to enable or disable a filter in the timeline. Filters supporting this
177
+ * option have this flag set. When the enable expression is false, the default
178
+ * no-op filter_frame() function is called in place of the filter_frame()
179
+ * callback defined on each input pad, thus the frame is passed unchanged to
180
+ * the next filters.
181
+ */
182
+ #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
183
+ /**
184
+ * Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will
185
+ * have its filter_frame() callback(s) called as usual even when the enable
186
+ * expression is false. The filter will disable filtering within the
187
+ * filter_frame() callback(s) itself, for example executing code depending on
188
+ * the AVFilterContext->is_disabled value.
189
+ */
190
+ #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
191
+ /**
192
+ * Handy mask to test whether the filter supports or no the timeline feature
193
+ * (internally or generically).
194
+ */
195
+ #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
196
+
197
+ /**
198
+ * Filter definition. This defines the pads a filter contains, and all the
199
+ * callback functions used to interact with the filter.
200
+ */
201
+ typedef struct AVFilter {
202
+ /**
203
+ * Filter name. Must be non-NULL and unique among filters.
204
+ */
205
+ const char *name;
206
+
207
+ /**
208
+ * A description of the filter. May be NULL.
209
+ *
210
+ * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
211
+ */
212
+ const char *description;
213
+
214
+ /**
215
+ * List of static inputs.
216
+ *
217
+ * NULL if there are no (static) inputs. Instances of filters with
218
+ * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in
219
+ * this list.
220
+ */
221
+ const AVFilterPad *inputs;
222
+
223
+ /**
224
+ * List of static outputs.
225
+ *
226
+ * NULL if there are no (static) outputs. Instances of filters with
227
+ * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in
228
+ * this list.
229
+ */
230
+ const AVFilterPad *outputs;
231
+
232
+ /**
233
+ * A class for the private data, used to declare filter private AVOptions.
234
+ * This field is NULL for filters that do not declare any options.
235
+ *
236
+ * If this field is non-NULL, the first member of the filter private data
237
+ * must be a pointer to AVClass, which will be set by libavfilter generic
238
+ * code to this class.
239
+ */
240
+ const AVClass *priv_class;
241
+
242
+ /**
243
+ * A combination of AVFILTER_FLAG_*
244
+ */
245
+ int flags;
246
+
247
+ /*****************************************************************
248
+ * All fields below this line are not part of the public API. They
249
+ * may not be used outside of libavfilter and can be changed and
250
+ * removed at will.
251
+ * New public fields should be added right above.
252
+ *****************************************************************
253
+ */
254
+
255
+ /**
256
+ * The number of entries in the list of inputs.
257
+ */
258
+ uint8_t nb_inputs;
259
+
260
+ /**
261
+ * The number of entries in the list of outputs.
262
+ */
263
+ uint8_t nb_outputs;
264
+
265
+ /**
266
+ * This field determines the state of the formats union.
267
+ * It is an enum FilterFormatsState value.
268
+ */
269
+ uint8_t formats_state;
270
+
271
+ /**
272
+ * Filter pre-initialization function
273
+ *
274
+ * This callback will be called immediately after the filter context is
275
+ * allocated, to allow allocating and initing sub-objects.
276
+ *
277
+ * If this callback is not NULL, the uninit callback will be called on
278
+ * allocation failure.
279
+ *
280
+ * @return 0 on success,
281
+ * AVERROR code on failure (but the code will be
282
+ * dropped and treated as ENOMEM by the calling code)
283
+ */
284
+ int (*preinit)(AVFilterContext *ctx);
285
+
286
+ /**
287
+ * Filter initialization function.
288
+ *
289
+ * This callback will be called only once during the filter lifetime, after
290
+ * all the options have been set, but before links between filters are
291
+ * established and format negotiation is done.
292
+ *
293
+ * Basic filter initialization should be done here. Filters with dynamic
294
+ * inputs and/or outputs should create those inputs/outputs here based on
295
+ * provided options. No more changes to this filter's inputs/outputs can be
296
+ * done after this callback.
297
+ *
298
+ * This callback must not assume that the filter links exist or frame
299
+ * parameters are known.
300
+ *
301
+ * @ref AVFilter.uninit "uninit" is guaranteed to be called even if
302
+ * initialization fails, so this callback does not have to clean up on
303
+ * failure.
304
+ *
305
+ * @return 0 on success, a negative AVERROR on failure
306
+ */
307
+ int (*init)(AVFilterContext *ctx);
308
+
309
+ /**
310
+ * Filter uninitialization function.
311
+ *
312
+ * Called only once right before the filter is freed. Should deallocate any
313
+ * memory held by the filter, release any buffer references, etc. It does
314
+ * not need to deallocate the AVFilterContext.priv memory itself.
315
+ *
316
+ * This callback may be called even if @ref AVFilter.init "init" was not
317
+ * called or failed, so it must be prepared to handle such a situation.
318
+ */
319
+ void (*uninit)(AVFilterContext *ctx);
320
+
321
+ /**
322
+ * The state of the following union is determined by formats_state.
323
+ * See the documentation of enum FilterFormatsState in internal.h.
324
+ */
325
+ union {
326
+ /**
327
+ * Query formats supported by the filter on its inputs and outputs.
328
+ *
329
+ * This callback is called after the filter is initialized (so the inputs
330
+ * and outputs are fixed), shortly before the format negotiation. This
331
+ * callback may be called more than once.
332
+ *
333
+ * This callback must set ::AVFilterLink's
334
+ * @ref AVFilterFormatsConfig.formats "outcfg.formats"
335
+ * on every input link and
336
+ * @ref AVFilterFormatsConfig.formats "incfg.formats"
337
+ * on every output link to a list of pixel/sample formats that the filter
338
+ * supports on that link.
339
+ * For video links, this filter may also set
340
+ * @ref AVFilterFormatsConfig.color_spaces "incfg.color_spaces"
341
+ * /
342
+ * @ref AVFilterFormatsConfig.color_spaces "outcfg.color_spaces"
343
+ * and @ref AVFilterFormatsConfig.color_ranges "incfg.color_ranges"
344
+ * /
345
+ * @ref AVFilterFormatsConfig.color_ranges "outcfg.color_ranges"
346
+ * analogously.
347
+ * For audio links, this filter must also set
348
+ * @ref AVFilterFormatsConfig.samplerates "incfg.samplerates"
349
+ * /
350
+ * @ref AVFilterFormatsConfig.samplerates "outcfg.samplerates"
351
+ * and @ref AVFilterFormatsConfig.channel_layouts "incfg.channel_layouts"
352
+ * /
353
+ * @ref AVFilterFormatsConfig.channel_layouts "outcfg.channel_layouts"
354
+ * analogously.
355
+ *
356
+ * This callback must never be NULL if the union is in this state.
357
+ *
358
+ * @return zero on success, a negative value corresponding to an
359
+ * AVERROR code otherwise
360
+ */
361
+ int (*query_func)(AVFilterContext *);
362
+
363
+ /**
364
+ * Same as query_func(), except this function writes the results into
365
+ * provided arrays.
366
+ *
367
+ * @param cfg_in array of input format configurations with as many
368
+ * members as the filters has inputs (NULL when there are
369
+ * no inputs);
370
+ * @param cfg_out array of output format configurations with as many
371
+ * members as the filters has outputs (NULL when there
372
+ * are no outputs);
373
+ */
374
+ int (*query_func2)(const AVFilterContext *,
375
+ struct AVFilterFormatsConfig **cfg_in,
376
+ struct AVFilterFormatsConfig **cfg_out);
377
+ /**
378
+ * A pointer to an array of admissible pixel formats delimited
379
+ * by AV_PIX_FMT_NONE. The generic code will use this list
380
+ * to indicate that this filter supports each of these pixel formats,
381
+ * provided that all inputs and outputs use the same pixel format.
382
+ *
383
+ * In addition to that the generic code will mark all inputs
384
+ * and all outputs as supporting all color spaces and ranges, as
385
+ * long as all inputs and outputs use the same color space/range.
386
+ *
387
+ * This list must never be NULL if the union is in this state.
388
+ * The type of all inputs and outputs of filters using this must
389
+ * be AVMEDIA_TYPE_VIDEO.
390
+ */
391
+ const enum AVPixelFormat *pixels_list;
392
+ /**
393
+ * Analogous to pixels, but delimited by AV_SAMPLE_FMT_NONE
394
+ * and restricted to filters that only have AVMEDIA_TYPE_AUDIO
395
+ * inputs and outputs.
396
+ *
397
+ * In addition to that the generic code will mark all inputs
398
+ * and all outputs as supporting all sample rates and every
399
+ * channel count and channel layout, as long as all inputs
400
+ * and outputs use the same sample rate and channel count/layout.
401
+ */
402
+ const enum AVSampleFormat *samples_list;
403
+ /**
404
+ * Equivalent to { pix_fmt, AV_PIX_FMT_NONE } as pixels_list.
405
+ */
406
+ enum AVPixelFormat pix_fmt;
407
+ /**
408
+ * Equivalent to { sample_fmt, AV_SAMPLE_FMT_NONE } as samples_list.
409
+ */
410
+ enum AVSampleFormat sample_fmt;
411
+ } formats;
412
+
413
+ int priv_size; ///< size of private data to allocate for the filter
414
+
415
+ int flags_internal; ///< Additional flags for avfilter internal use only.
416
+
417
+ /**
418
+ * Make the filter instance process a command.
419
+ *
420
+ * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only
421
+ * @param arg the argument for the command
422
+ * @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported.
423
+ * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be
424
+ * time consuming then a filter should treat it like an unsupported command
425
+ *
426
+ * @returns >=0 on success otherwise an error code.
427
+ * AVERROR(ENOSYS) on unsupported commands
428
+ */
429
+ int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
430
+
431
+ /**
432
+ * Filter activation function.
433
+ *
434
+ * Called when any processing is needed from the filter, instead of any
435
+ * filter_frame and request_frame on pads.
436
+ *
437
+ * The function must examine inlinks and outlinks and perform a single
438
+ * step of processing. If there is nothing to do, the function must do
439
+ * nothing and not return an error. If more steps are or may be
440
+ * possible, it must use ff_filter_set_ready() to schedule another
441
+ * activation.
442
+ */
443
+ int (*activate)(AVFilterContext *ctx);
444
+ } AVFilter;
445
+
446
+ /**
447
+ * Get the number of elements in an AVFilter's inputs or outputs array.
448
+ */
449
+ unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output);
450
+
451
+ /**
452
+ * Process multiple parts of the frame concurrently.
453
+ */
454
+ #define AVFILTER_THREAD_SLICE (1 << 0)
455
+
456
+ /** An instance of a filter */
457
+ struct AVFilterContext {
458
+ const AVClass *av_class; ///< needed for av_log() and filters common options
459
+
460
+ const AVFilter *filter; ///< the AVFilter of which this is an instance
461
+
462
+ char *name; ///< name of this filter instance
463
+
464
+ AVFilterPad *input_pads; ///< array of input pads
465
+ AVFilterLink **inputs; ///< array of pointers to input links
466
+ unsigned nb_inputs; ///< number of input pads
467
+
468
+ AVFilterPad *output_pads; ///< array of output pads
469
+ AVFilterLink **outputs; ///< array of pointers to output links
470
+ unsigned nb_outputs; ///< number of output pads
471
+
472
+ void *priv; ///< private data for use by the filter
473
+
474
+ struct AVFilterGraph *graph; ///< filtergraph this filter belongs to
475
+
476
+ /**
477
+ * Type of multithreading being allowed/used. A combination of
478
+ * AVFILTER_THREAD_* flags.
479
+ *
480
+ * May be set by the caller before initializing the filter to forbid some
481
+ * or all kinds of multithreading for this filter. The default is allowing
482
+ * everything.
483
+ *
484
+ * When the filter is initialized, this field is combined using bit AND with
485
+ * AVFilterGraph.thread_type to get the final mask used for determining
486
+ * allowed threading types. I.e. a threading type needs to be set in both
487
+ * to be allowed.
488
+ *
489
+ * After the filter is initialized, libavfilter sets this field to the
490
+ * threading type that is actually used (0 for no multithreading).
491
+ */
492
+ int thread_type;
493
+
494
+ /**
495
+ * Max number of threads allowed in this filter instance.
496
+ * If <= 0, its value is ignored.
497
+ * Overrides global number of threads set per filter graph.
498
+ */
499
+ int nb_threads;
500
+
501
+ #if FF_API_CONTEXT_PUBLIC
502
+ /**
503
+ * @deprecated unused
504
+ */
505
+ attribute_deprecated
506
+ struct AVFilterCommand *command_queue;
507
+ #endif
508
+
509
+ char *enable_str; ///< enable expression string
510
+ #if FF_API_CONTEXT_PUBLIC
511
+ /**
512
+ * @deprecated unused
513
+ */
514
+ attribute_deprecated
515
+ void *enable;
516
+ /**
517
+ * @deprecated unused
518
+ */
519
+ double *var_values;
520
+ #endif
521
+ /**
522
+ * MUST NOT be accessed from outside avfilter.
523
+ *
524
+ * the enabled state from the last expression evaluation
525
+ */
526
+ int is_disabled;
527
+
528
+ /**
529
+ * For filters which will create hardware frames, sets the device the
530
+ * filter should create them in. All other filters will ignore this field:
531
+ * in particular, a filter which consumes or processes hardware frames will
532
+ * instead use the hw_frames_ctx field in AVFilterLink to carry the
533
+ * hardware context information.
534
+ *
535
+ * May be set by the caller on filters flagged with AVFILTER_FLAG_HWDEVICE
536
+ * before initializing the filter with avfilter_init_str() or
537
+ * avfilter_init_dict().
538
+ */
539
+ AVBufferRef *hw_device_ctx;
540
+
541
+ #if FF_API_CONTEXT_PUBLIC
542
+ /**
543
+ * @deprecated this field should never have been accessed by callers
544
+ */
545
+ attribute_deprecated
546
+ unsigned ready;
547
+ #endif
548
+
549
+ /**
550
+ * Sets the number of extra hardware frames which the filter will
551
+ * allocate on its output links for use in following filters or by
552
+ * the caller.
553
+ *
554
+ * Some hardware filters require all frames that they will use for
555
+ * output to be defined in advance before filtering starts. For such
556
+ * filters, any hardware frame pools used for output must therefore be
557
+ * of fixed size. The extra frames set here are on top of any number
558
+ * that the filter needs internally in order to operate normally.
559
+ *
560
+ * This field must be set before the graph containing this filter is
561
+ * configured.
562
+ */
563
+ int extra_hw_frames;
564
+ };
565
+
566
+ /**
567
+ * A link between two filters. This contains pointers to the source and
568
+ * destination filters between which this link exists, and the indexes of
569
+ * the pads involved. In addition, this link also contains the parameters
570
+ * which have been negotiated and agreed upon between the filter, such as
571
+ * image dimensions, format, etc.
572
+ *
573
+ * Applications must not normally access the link structure directly.
574
+ * Use the buffersrc and buffersink API instead.
575
+ * In the future, access to the header may be reserved for filters
576
+ * implementation.
577
+ */
578
+ struct AVFilterLink {
579
+ AVFilterContext *src; ///< source filter
580
+ AVFilterPad *srcpad; ///< output pad on the source filter
581
+
582
+ AVFilterContext *dst; ///< dest filter
583
+ AVFilterPad *dstpad; ///< input pad on the dest filter
584
+
585
+ enum AVMediaType type; ///< filter media type
586
+
587
+ int format; ///< agreed upon media format
588
+
589
+ /* These parameters apply only to video */
590
+ int w; ///< agreed upon image width
591
+ int h; ///< agreed upon image height
592
+ AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
593
+ /**
594
+ * For non-YUV links, these are respectively set to fallback values (as
595
+ * appropriate for that colorspace).
596
+ *
597
+ * Note: This includes grayscale formats, as these are currently treated
598
+ * as forced full range always.
599
+ */
600
+ enum AVColorSpace colorspace; ///< agreed upon YUV color space
601
+ enum AVColorRange color_range; ///< agreed upon YUV color range
602
+
603
+ /* These parameters apply only to audio */
604
+ int sample_rate; ///< samples per second
605
+ AVChannelLayout ch_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h)
606
+
607
+ /**
608
+ * Define the time base used by the PTS of the frames/samples
609
+ * which will pass through this link.
610
+ * During the configuration stage, each filter is supposed to
611
+ * change only the output timebase, while the timebase of the
612
+ * input link is assumed to be an unchangeable property.
613
+ */
614
+ AVRational time_base;
615
+
616
+ /*****************************************************************
617
+ * All fields below this line are not part of the public API. They
618
+ * may not be used outside of libavfilter and can be changed and
619
+ * removed at will.
620
+ * New public fields should be added right above.
621
+ *****************************************************************
622
+ */
623
+
624
+ /**
625
+ * Lists of supported formats / etc. supported by the input filter.
626
+ */
627
+ AVFilterFormatsConfig incfg;
628
+
629
+ /**
630
+ * Lists of supported formats / etc. supported by the output filter.
631
+ */
632
+ AVFilterFormatsConfig outcfg;
633
+ };
634
+
635
+ /**
636
+ * Link two filters together.
637
+ *
638
+ * @param src the source filter
639
+ * @param srcpad index of the output pad on the source filter
640
+ * @param dst the destination filter
641
+ * @param dstpad index of the input pad on the destination filter
642
+ * @return zero on success
643
+ */
644
+ int avfilter_link(AVFilterContext *src, unsigned srcpad,
645
+ AVFilterContext *dst, unsigned dstpad);
646
+
647
+ #if FF_API_LINK_PUBLIC
648
+ /**
649
+ * @deprecated this function should never be called by users
650
+ */
651
+ attribute_deprecated
652
+ void avfilter_link_free(AVFilterLink **link);
653
+
654
+ /**
655
+ * @deprecated this function should never be called by users
656
+ */
657
+ attribute_deprecated
658
+ int avfilter_config_links(AVFilterContext *filter);
659
+ #endif
660
+
661
+ #define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically
662
+ #define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw)
663
+
664
+ /**
665
+ * Make the filter instance process a command.
666
+ * It is recommended to use avfilter_graph_send_command().
667
+ */
668
+ int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
669
+
670
+ /**
671
+ * Iterate over all registered filters.
672
+ *
673
+ * @param opaque a pointer where libavfilter will store the iteration state. Must
674
+ * point to NULL to start the iteration.
675
+ *
676
+ * @return the next registered filter or NULL when the iteration is
677
+ * finished
678
+ */
679
+ const AVFilter *av_filter_iterate(void **opaque);
680
+
681
+ /**
682
+ * Get a filter definition matching the given name.
683
+ *
684
+ * @param name the filter name to find
685
+ * @return the filter definition, if any matching one is registered.
686
+ * NULL if none found.
687
+ */
688
+ const AVFilter *avfilter_get_by_name(const char *name);
689
+
690
+
691
+ /**
692
+ * Initialize a filter with the supplied parameters.
693
+ *
694
+ * @param ctx uninitialized filter context to initialize
695
+ * @param args Options to initialize the filter with. This must be a
696
+ * ':'-separated list of options in the 'key=value' form.
697
+ * May be NULL if the options have been set directly using the
698
+ * AVOptions API or there are no options that need to be set.
699
+ * @return 0 on success, a negative AVERROR on failure
700
+ */
701
+ int avfilter_init_str(AVFilterContext *ctx, const char *args);
702
+
703
+ /**
704
+ * Initialize a filter with the supplied dictionary of options.
705
+ *
706
+ * @param ctx uninitialized filter context to initialize
707
+ * @param options An AVDictionary filled with options for this filter. On
708
+ * return this parameter will be destroyed and replaced with
709
+ * a dict containing options that were not found. This dictionary
710
+ * must be freed by the caller.
711
+ * May be NULL, then this function is equivalent to
712
+ * avfilter_init_str() with the second parameter set to NULL.
713
+ * @return 0 on success, a negative AVERROR on failure
714
+ *
715
+ * @note This function and avfilter_init_str() do essentially the same thing,
716
+ * the difference is in manner in which the options are passed. It is up to the
717
+ * calling code to choose whichever is more preferable. The two functions also
718
+ * behave differently when some of the provided options are not declared as
719
+ * supported by the filter. In such a case, avfilter_init_str() will fail, but
720
+ * this function will leave those extra options in the options AVDictionary and
721
+ * continue as usual.
722
+ */
723
+ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options);
724
+
725
+ /**
726
+ * Free a filter context. This will also remove the filter from its
727
+ * filtergraph's list of filters.
728
+ *
729
+ * @param filter the filter to free
730
+ */
731
+ void avfilter_free(AVFilterContext *filter);
732
+
733
+ /**
734
+ * Insert a filter in the middle of an existing link.
735
+ *
736
+ * @param link the link into which the filter should be inserted
737
+ * @param filt the filter to be inserted
738
+ * @param filt_srcpad_idx the input pad on the filter to connect
739
+ * @param filt_dstpad_idx the output pad on the filter to connect
740
+ * @return zero on success
741
+ */
742
+ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
743
+ unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
744
+
745
+ /**
746
+ * @return AVClass for AVFilterContext.
747
+ *
748
+ * @see av_opt_find().
749
+ */
750
+ const AVClass *avfilter_get_class(void);
751
+
752
+ /**
753
+ * A function pointer passed to the @ref AVFilterGraph.execute callback to be
754
+ * executed multiple times, possibly in parallel.
755
+ *
756
+ * @param ctx the filter context the job belongs to
757
+ * @param arg an opaque parameter passed through from @ref
758
+ * AVFilterGraph.execute
759
+ * @param jobnr the index of the job being executed
760
+ * @param nb_jobs the total number of jobs
761
+ *
762
+ * @return 0 on success, a negative AVERROR on error
763
+ */
764
+ typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
765
+
766
+ /**
767
+ * A function executing multiple jobs, possibly in parallel.
768
+ *
769
+ * @param ctx the filter context to which the jobs belong
770
+ * @param func the function to be called multiple times
771
+ * @param arg the argument to be passed to func
772
+ * @param ret a nb_jobs-sized array to be filled with return values from each
773
+ * invocation of func
774
+ * @param nb_jobs the number of jobs to execute
775
+ *
776
+ * @return 0 on success, a negative AVERROR on error
777
+ */
778
+ typedef int (avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func,
779
+ void *arg, int *ret, int nb_jobs);
780
+
781
+ typedef struct AVFilterGraph {
782
+ const AVClass *av_class;
783
+ AVFilterContext **filters;
784
+ unsigned nb_filters;
785
+
786
+ char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
787
+
788
+ /**
789
+ * Type of multithreading allowed for filters in this graph. A combination
790
+ * of AVFILTER_THREAD_* flags.
791
+ *
792
+ * May be set by the caller at any point, the setting will apply to all
793
+ * filters initialized after that. The default is allowing everything.
794
+ *
795
+ * When a filter in this graph is initialized, this field is combined using
796
+ * bit AND with AVFilterContext.thread_type to get the final mask used for
797
+ * determining allowed threading types. I.e. a threading type needs to be
798
+ * set in both to be allowed.
799
+ */
800
+ int thread_type;
801
+
802
+ /**
803
+ * Maximum number of threads used by filters in this graph. May be set by
804
+ * the caller before adding any filters to the filtergraph. Zero (the
805
+ * default) means that the number of threads is determined automatically.
806
+ */
807
+ int nb_threads;
808
+
809
+ /**
810
+ * Opaque user data. May be set by the caller to an arbitrary value, e.g. to
811
+ * be used from callbacks like @ref AVFilterGraph.execute.
812
+ * Libavfilter will not touch this field in any way.
813
+ */
814
+ void *opaque;
815
+
816
+ /**
817
+ * This callback may be set by the caller immediately after allocating the
818
+ * graph and before adding any filters to it, to provide a custom
819
+ * multithreading implementation.
820
+ *
821
+ * If set, filters with slice threading capability will call this callback
822
+ * to execute multiple jobs in parallel.
823
+ *
824
+ * If this field is left unset, libavfilter will use its internal
825
+ * implementation, which may or may not be multithreaded depending on the
826
+ * platform and build options.
827
+ */
828
+ avfilter_execute_func *execute;
829
+
830
+ char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
831
+ } AVFilterGraph;
832
+
833
+ /**
834
+ * Allocate a filter graph.
835
+ *
836
+ * @return the allocated filter graph on success or NULL.
837
+ */
838
+ AVFilterGraph *avfilter_graph_alloc(void);
839
+
840
+ /**
841
+ * Create a new filter instance in a filter graph.
842
+ *
843
+ * @param graph graph in which the new filter will be used
844
+ * @param filter the filter to create an instance of
845
+ * @param name Name to give to the new instance (will be copied to
846
+ * AVFilterContext.name). This may be used by the caller to identify
847
+ * different filters, libavfilter itself assigns no semantics to
848
+ * this parameter. May be NULL.
849
+ *
850
+ * @return the context of the newly created filter instance (note that it is
851
+ * also retrievable directly through AVFilterGraph.filters or with
852
+ * avfilter_graph_get_filter()) on success or NULL on failure.
853
+ */
854
+ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph,
855
+ const AVFilter *filter,
856
+ const char *name);
857
+
858
+ /**
859
+ * Get a filter instance identified by instance name from graph.
860
+ *
861
+ * @param graph filter graph to search through.
862
+ * @param name filter instance name (should be unique in the graph).
863
+ * @return the pointer to the found filter instance or NULL if it
864
+ * cannot be found.
865
+ */
866
+ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *name);
867
+
868
+ /**
869
+ * A convenience wrapper that allocates and initializes a filter in a single
870
+ * step. The filter instance is created from the filter filt and inited with the
871
+ * parameter args. opaque is currently ignored.
872
+ *
873
+ * In case of success put in *filt_ctx the pointer to the created
874
+ * filter instance, otherwise set *filt_ctx to NULL.
875
+ *
876
+ * @param name the instance name to give to the created filter instance
877
+ * @param graph_ctx the filter graph
878
+ * @return a negative AVERROR error code in case of failure, a non
879
+ * negative value otherwise
880
+ *
881
+ * @warning Since the filter is initialized after this function successfully
882
+ * returns, you MUST NOT set any further options on it. If you need to
883
+ * do that, call ::avfilter_graph_alloc_filter(), followed by setting
884
+ * the options, followed by ::avfilter_init_dict() instead of this
885
+ * function.
886
+ */
887
+ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt,
888
+ const char *name, const char *args, void *opaque,
889
+ AVFilterGraph *graph_ctx);
890
+
891
+ /**
892
+ * Enable or disable automatic format conversion inside the graph.
893
+ *
894
+ * Note that format conversion can still happen inside explicitly inserted
895
+ * scale and aresample filters.
896
+ *
897
+ * @param flags any of the AVFILTER_AUTO_CONVERT_* constants
898
+ */
899
+ void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags);
900
+
901
+ enum {
902
+ AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */
903
+ AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
904
+ };
905
+
906
+ /**
907
+ * Check validity and configure all the links and formats in the graph.
908
+ *
909
+ * @param graphctx the filter graph
910
+ * @param log_ctx context used for logging
911
+ * @return >= 0 in case of success, a negative AVERROR code otherwise
912
+ */
913
+ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);
914
+
915
+ /**
916
+ * Free a graph, destroy its links, and set *graph to NULL.
917
+ * If *graph is NULL, do nothing.
918
+ */
919
+ void avfilter_graph_free(AVFilterGraph **graph);
920
+
921
+ /**
922
+ * A linked-list of the inputs/outputs of the filter chain.
923
+ *
924
+ * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(),
925
+ * where it is used to communicate open (unlinked) inputs and outputs from and
926
+ * to the caller.
927
+ * This struct specifies, per each not connected pad contained in the graph, the
928
+ * filter context and the pad index required for establishing a link.
929
+ */
930
+ typedef struct AVFilterInOut {
931
+ /** unique name for this input/output in the list */
932
+ char *name;
933
+
934
+ /** filter context associated to this input/output */
935
+ AVFilterContext *filter_ctx;
936
+
937
+ /** index of the filt_ctx pad to use for linking */
938
+ int pad_idx;
939
+
940
+ /** next input/input in the list, NULL if this is the last */
941
+ struct AVFilterInOut *next;
942
+ } AVFilterInOut;
943
+
944
+ /**
945
+ * Allocate a single AVFilterInOut entry.
946
+ * Must be freed with avfilter_inout_free().
947
+ * @return allocated AVFilterInOut on success, NULL on failure.
948
+ */
949
+ AVFilterInOut *avfilter_inout_alloc(void);
950
+
951
+ /**
952
+ * Free the supplied list of AVFilterInOut and set *inout to NULL.
953
+ * If *inout is NULL, do nothing.
954
+ */
955
+ void avfilter_inout_free(AVFilterInOut **inout);
956
+
957
+ /**
958
+ * Add a graph described by a string to a graph.
959
+ *
960
+ * @note The caller must provide the lists of inputs and outputs,
961
+ * which therefore must be known before calling the function.
962
+ *
963
+ * @note The inputs parameter describes inputs of the already existing
964
+ * part of the graph; i.e. from the point of view of the newly created
965
+ * part, they are outputs. Similarly the outputs parameter describes
966
+ * outputs of the already existing filters, which are provided as
967
+ * inputs to the parsed filters.
968
+ *
969
+ * @param graph the filter graph where to link the parsed graph context
970
+ * @param filters string to be parsed
971
+ * @param inputs linked list to the inputs of the graph
972
+ * @param outputs linked list to the outputs of the graph
973
+ * @return zero on success, a negative AVERROR code on error
974
+ */
975
+ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
976
+ AVFilterInOut *inputs, AVFilterInOut *outputs,
977
+ void *log_ctx);
978
+
979
+ /**
980
+ * Add a graph described by a string to a graph.
981
+ *
982
+ * In the graph filters description, if the input label of the first
983
+ * filter is not specified, "in" is assumed; if the output label of
984
+ * the last filter is not specified, "out" is assumed.
985
+ *
986
+ * @param graph the filter graph where to link the parsed graph context
987
+ * @param filters string to be parsed
988
+ * @param inputs pointer to a linked list to the inputs of the graph, may be NULL.
989
+ * If non-NULL, *inputs is updated to contain the list of open inputs
990
+ * after the parsing, should be freed with avfilter_inout_free().
991
+ * @param outputs pointer to a linked list to the outputs of the graph, may be NULL.
992
+ * If non-NULL, *outputs is updated to contain the list of open outputs
993
+ * after the parsing, should be freed with avfilter_inout_free().
994
+ * @return non negative on success, a negative AVERROR code on error
995
+ */
996
+ int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters,
997
+ AVFilterInOut **inputs, AVFilterInOut **outputs,
998
+ void *log_ctx);
999
+
1000
+ /**
1001
+ * Add a graph described by a string to a graph.
1002
+ *
1003
+ * @param[in] graph the filter graph where to link the parsed graph context
1004
+ * @param[in] filters string to be parsed
1005
+ * @param[out] inputs a linked list of all free (unlinked) inputs of the
1006
+ * parsed graph will be returned here. It is to be freed
1007
+ * by the caller using avfilter_inout_free().
1008
+ * @param[out] outputs a linked list of all free (unlinked) outputs of the
1009
+ * parsed graph will be returned here. It is to be freed by the
1010
+ * caller using avfilter_inout_free().
1011
+ * @return zero on success, a negative AVERROR code on error
1012
+ *
1013
+ * @note This function returns the inputs and outputs that are left
1014
+ * unlinked after parsing the graph and the caller then deals with
1015
+ * them.
1016
+ * @note This function makes no reference whatsoever to already
1017
+ * existing parts of the graph and the inputs parameter will on return
1018
+ * contain inputs of the newly parsed part of the graph. Analogously
1019
+ * the outputs parameter will contain outputs of the newly created
1020
+ * filters.
1021
+ */
1022
+ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
1023
+ AVFilterInOut **inputs,
1024
+ AVFilterInOut **outputs);
1025
+
1026
+ /**
1027
+ * Parameters of a filter's input or output pad.
1028
+ *
1029
+ * Created as a child of AVFilterParams by avfilter_graph_segment_parse().
1030
+ * Freed in avfilter_graph_segment_free().
1031
+ */
1032
+ typedef struct AVFilterPadParams {
1033
+ /**
1034
+ * An av_malloc()'ed string containing the pad label.
1035
+ *
1036
+ * May be av_free()'d and set to NULL by the caller, in which case this pad
1037
+ * will be treated as unlabeled for linking.
1038
+ * May also be replaced by another av_malloc()'ed string.
1039
+ */
1040
+ char *label;
1041
+ } AVFilterPadParams;
1042
+
1043
+ /**
1044
+ * Parameters describing a filter to be created in a filtergraph.
1045
+ *
1046
+ * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
1047
+ * Freed in avfilter_graph_segment_free().
1048
+ */
1049
+ typedef struct AVFilterParams {
1050
+ /**
1051
+ * The filter context.
1052
+ *
1053
+ * Created by avfilter_graph_segment_create_filters() based on
1054
+ * AVFilterParams.filter_name and instance_name.
1055
+ *
1056
+ * Callers may also create the filter context manually, then they should
1057
+ * av_free() filter_name and set it to NULL. Such AVFilterParams instances
1058
+ * are then skipped by avfilter_graph_segment_create_filters().
1059
+ */
1060
+ AVFilterContext *filter;
1061
+
1062
+ /**
1063
+ * Name of the AVFilter to be used.
1064
+ *
1065
+ * An av_malloc()'ed string, set by avfilter_graph_segment_parse(). Will be
1066
+ * passed to avfilter_get_by_name() by
1067
+ * avfilter_graph_segment_create_filters().
1068
+ *
1069
+ * Callers may av_free() this string and replace it with another one or
1070
+ * NULL. If the caller creates the filter instance manually, this string
1071
+ * MUST be set to NULL.
1072
+ *
1073
+ * When both AVFilterParams.filter an AVFilterParams.filter_name are NULL,
1074
+ * this AVFilterParams instance is skipped by avfilter_graph_segment_*()
1075
+ * functions.
1076
+ */
1077
+ char *filter_name;
1078
+ /**
1079
+ * Name to be used for this filter instance.
1080
+ *
1081
+ * An av_malloc()'ed string, may be set by avfilter_graph_segment_parse() or
1082
+ * left NULL. The caller may av_free() this string and replace with another
1083
+ * one or NULL.
1084
+ *
1085
+ * Will be used by avfilter_graph_segment_create_filters() - passed as the
1086
+ * third argument to avfilter_graph_alloc_filter(), then freed and set to
1087
+ * NULL.
1088
+ */
1089
+ char *instance_name;
1090
+
1091
+ /**
1092
+ * Options to be apllied to the filter.
1093
+ *
1094
+ * Filled by avfilter_graph_segment_parse(). Afterwards may be freely
1095
+ * modified by the caller.
1096
+ *
1097
+ * Will be applied to the filter by avfilter_graph_segment_apply_opts()
1098
+ * with an equivalent of av_opt_set_dict2(filter, &opts, AV_OPT_SEARCH_CHILDREN),
1099
+ * i.e. any unapplied options will be left in this dictionary.
1100
+ */
1101
+ AVDictionary *opts;
1102
+
1103
+ AVFilterPadParams **inputs;
1104
+ unsigned nb_inputs;
1105
+
1106
+ AVFilterPadParams **outputs;
1107
+ unsigned nb_outputs;
1108
+ } AVFilterParams;
1109
+
1110
+ /**
1111
+ * A filterchain is a list of filter specifications.
1112
+ *
1113
+ * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
1114
+ * Freed in avfilter_graph_segment_free().
1115
+ */
1116
+ typedef struct AVFilterChain {
1117
+ AVFilterParams **filters;
1118
+ size_t nb_filters;
1119
+ } AVFilterChain;
1120
+
1121
+ /**
1122
+ * A parsed representation of a filtergraph segment.
1123
+ *
1124
+ * A filtergraph segment is conceptually a list of filterchains, with some
1125
+ * supplementary information (e.g. format conversion flags).
1126
+ *
1127
+ * Created by avfilter_graph_segment_parse(). Must be freed with
1128
+ * avfilter_graph_segment_free().
1129
+ */
1130
+ typedef struct AVFilterGraphSegment {
1131
+ /**
1132
+ * The filtergraph this segment is associated with.
1133
+ * Set by avfilter_graph_segment_parse().
1134
+ */
1135
+ AVFilterGraph *graph;
1136
+
1137
+ /**
1138
+ * A list of filter chain contained in this segment.
1139
+ * Set in avfilter_graph_segment_parse().
1140
+ */
1141
+ AVFilterChain **chains;
1142
+ size_t nb_chains;
1143
+
1144
+ /**
1145
+ * A string containing a colon-separated list of key=value options applied
1146
+ * to all scale filters in this segment.
1147
+ *
1148
+ * May be set by avfilter_graph_segment_parse().
1149
+ * The caller may free this string with av_free() and replace it with a
1150
+ * different av_malloc()'ed string.
1151
+ */
1152
+ char *scale_sws_opts;
1153
+ } AVFilterGraphSegment;
1154
+
1155
+ /**
1156
+ * Parse a textual filtergraph description into an intermediate form.
1157
+ *
1158
+ * This intermediate representation is intended to be modified by the caller as
1159
+ * described in the documentation of AVFilterGraphSegment and its children, and
1160
+ * then applied to the graph either manually or with other
1161
+ * avfilter_graph_segment_*() functions. See the documentation for
1162
+ * avfilter_graph_segment_apply() for the canonical way to apply
1163
+ * AVFilterGraphSegment.
1164
+ *
1165
+ * @param graph Filter graph the parsed segment is associated with. Will only be
1166
+ * used for logging and similar auxiliary purposes. The graph will
1167
+ * not be actually modified by this function - the parsing results
1168
+ * are instead stored in seg for further processing.
1169
+ * @param graph_str a string describing the filtergraph segment
1170
+ * @param flags reserved for future use, caller must set to 0 for now
1171
+ * @param seg A pointer to the newly-created AVFilterGraphSegment is written
1172
+ * here on success. The graph segment is owned by the caller and must
1173
+ * be freed with avfilter_graph_segment_free() before graph itself is
1174
+ * freed.
1175
+ *
1176
+ * @retval "non-negative number" success
1177
+ * @retval "negative error code" failure
1178
+ */
1179
+ int avfilter_graph_segment_parse(AVFilterGraph *graph, const char *graph_str,
1180
+ int flags, AVFilterGraphSegment **seg);
1181
+
1182
+ /**
1183
+ * Create filters specified in a graph segment.
1184
+ *
1185
+ * Walk through the creation-pending AVFilterParams in the segment and create
1186
+ * new filter instances for them.
1187
+ * Creation-pending params are those where AVFilterParams.filter_name is
1188
+ * non-NULL (and hence AVFilterParams.filter is NULL). All other AVFilterParams
1189
+ * instances are ignored.
1190
+ *
1191
+ * For any filter created by this function, the corresponding
1192
+ * AVFilterParams.filter is set to the newly-created filter context,
1193
+ * AVFilterParams.filter_name and AVFilterParams.instance_name are freed and set
1194
+ * to NULL.
1195
+ *
1196
+ * @param seg the filtergraph segment to process
1197
+ * @param flags reserved for future use, caller must set to 0 for now
1198
+ *
1199
+ * @retval "non-negative number" Success, all creation-pending filters were
1200
+ * successfully created
1201
+ * @retval AVERROR_FILTER_NOT_FOUND some filter's name did not correspond to a
1202
+ * known filter
1203
+ * @retval "another negative error code" other failures
1204
+ *
1205
+ * @note Calling this function multiple times is safe, as it is idempotent.
1206
+ */
1207
+ int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags);
1208
+
1209
+ /**
1210
+ * Apply parsed options to filter instances in a graph segment.
1211
+ *
1212
+ * Walk through all filter instances in the graph segment that have option
1213
+ * dictionaries associated with them and apply those options with
1214
+ * av_opt_set_dict2(..., AV_OPT_SEARCH_CHILDREN). AVFilterParams.opts is
1215
+ * replaced by the dictionary output by av_opt_set_dict2(), which should be
1216
+ * empty (NULL) if all options were successfully applied.
1217
+ *
1218
+ * If any options could not be found, this function will continue processing all
1219
+ * other filters and finally return AVERROR_OPTION_NOT_FOUND (unless another
1220
+ * error happens). The calling program may then deal with unapplied options as
1221
+ * it wishes.
1222
+ *
1223
+ * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1224
+ * present in the segment will cause this function to fail. AVFilterParams with
1225
+ * no associated filter context are simply skipped.
1226
+ *
1227
+ * @param seg the filtergraph segment to process
1228
+ * @param flags reserved for future use, caller must set to 0 for now
1229
+ *
1230
+ * @retval "non-negative number" Success, all options were successfully applied.
1231
+ * @retval AVERROR_OPTION_NOT_FOUND some options were not found in a filter
1232
+ * @retval "another negative error code" other failures
1233
+ *
1234
+ * @note Calling this function multiple times is safe, as it is idempotent.
1235
+ */
1236
+ int avfilter_graph_segment_apply_opts(AVFilterGraphSegment *seg, int flags);
1237
+
1238
+ /**
1239
+ * Initialize all filter instances in a graph segment.
1240
+ *
1241
+ * Walk through all filter instances in the graph segment and call
1242
+ * avfilter_init_dict(..., NULL) on those that have not been initialized yet.
1243
+ *
1244
+ * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1245
+ * present in the segment will cause this function to fail. AVFilterParams with
1246
+ * no associated filter context or whose filter context is already initialized,
1247
+ * are simply skipped.
1248
+ *
1249
+ * @param seg the filtergraph segment to process
1250
+ * @param flags reserved for future use, caller must set to 0 for now
1251
+ *
1252
+ * @retval "non-negative number" Success, all filter instances were successfully
1253
+ * initialized
1254
+ * @retval "negative error code" failure
1255
+ *
1256
+ * @note Calling this function multiple times is safe, as it is idempotent.
1257
+ */
1258
+ int avfilter_graph_segment_init(AVFilterGraphSegment *seg, int flags);
1259
+
1260
+ /**
1261
+ * Link filters in a graph segment.
1262
+ *
1263
+ * Walk through all filter instances in the graph segment and try to link all
1264
+ * unlinked input and output pads. Any creation-pending filters (see
1265
+ * avfilter_graph_segment_create_filters()) present in the segment will cause
1266
+ * this function to fail. Disabled filters and already linked pads are skipped.
1267
+ *
1268
+ * Every filter output pad that has a corresponding AVFilterPadParams with a
1269
+ * non-NULL label is
1270
+ * - linked to the input with the matching label, if one exists;
1271
+ * - exported in the outputs linked list otherwise, with the label preserved.
1272
+ * Unlabeled outputs are
1273
+ * - linked to the first unlinked unlabeled input in the next non-disabled
1274
+ * filter in the chain, if one exists
1275
+ * - exported in the ouputs linked list otherwise, with NULL label
1276
+ *
1277
+ * Similarly, unlinked input pads are exported in the inputs linked list.
1278
+ *
1279
+ * @param seg the filtergraph segment to process
1280
+ * @param flags reserved for future use, caller must set to 0 for now
1281
+ * @param[out] inputs a linked list of all free (unlinked) inputs of the
1282
+ * filters in this graph segment will be returned here. It
1283
+ * is to be freed by the caller using avfilter_inout_free().
1284
+ * @param[out] outputs a linked list of all free (unlinked) outputs of the
1285
+ * filters in this graph segment will be returned here. It
1286
+ * is to be freed by the caller using avfilter_inout_free().
1287
+ *
1288
+ * @retval "non-negative number" success
1289
+ * @retval "negative error code" failure
1290
+ *
1291
+ * @note Calling this function multiple times is safe, as it is idempotent.
1292
+ */
1293
+ int avfilter_graph_segment_link(AVFilterGraphSegment *seg, int flags,
1294
+ AVFilterInOut **inputs,
1295
+ AVFilterInOut **outputs);
1296
+
1297
+ /**
1298
+ * Apply all filter/link descriptions from a graph segment to the associated filtergraph.
1299
+ *
1300
+ * This functions is currently equivalent to calling the following in sequence:
1301
+ * - avfilter_graph_segment_create_filters();
1302
+ * - avfilter_graph_segment_apply_opts();
1303
+ * - avfilter_graph_segment_init();
1304
+ * - avfilter_graph_segment_link();
1305
+ * failing if any of them fails. This list may be extended in the future.
1306
+ *
1307
+ * Since the above functions are idempotent, the caller may call some of them
1308
+ * manually, then do some custom processing on the filtergraph, then call this
1309
+ * function to do the rest.
1310
+ *
1311
+ * @param seg the filtergraph segment to process
1312
+ * @param flags reserved for future use, caller must set to 0 for now
1313
+ * @param[out] inputs passed to avfilter_graph_segment_link()
1314
+ * @param[out] outputs passed to avfilter_graph_segment_link()
1315
+ *
1316
+ * @retval "non-negative number" success
1317
+ * @retval "negative error code" failure
1318
+ *
1319
+ * @note Calling this function multiple times is safe, as it is idempotent.
1320
+ */
1321
+ int avfilter_graph_segment_apply(AVFilterGraphSegment *seg, int flags,
1322
+ AVFilterInOut **inputs,
1323
+ AVFilterInOut **outputs);
1324
+
1325
+ /**
1326
+ * Free the provided AVFilterGraphSegment and everything associated with it.
1327
+ *
1328
+ * @param seg double pointer to the AVFilterGraphSegment to be freed. NULL will
1329
+ * be written to this pointer on exit from this function.
1330
+ *
1331
+ * @note
1332
+ * The filter contexts (AVFilterParams.filter) are owned by AVFilterGraph rather
1333
+ * than AVFilterGraphSegment, so they are not freed.
1334
+ */
1335
+ void avfilter_graph_segment_free(AVFilterGraphSegment **seg);
1336
+
1337
+ /**
1338
+ * Send a command to one or more filter instances.
1339
+ *
1340
+ * @param graph the filter graph
1341
+ * @param target the filter(s) to which the command should be sent
1342
+ * "all" sends to all filters
1343
+ * otherwise it can be a filter or filter instance name
1344
+ * which will send the command to all matching filters.
1345
+ * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only
1346
+ * @param arg the argument for the command
1347
+ * @param res a buffer with size res_size where the filter(s) can return a response.
1348
+ *
1349
+ * @returns >=0 on success otherwise an error code.
1350
+ * AVERROR(ENOSYS) on unsupported commands
1351
+ */
1352
+ int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags);
1353
+
1354
+ /**
1355
+ * Queue a command for one or more filter instances.
1356
+ *
1357
+ * @param graph the filter graph
1358
+ * @param target the filter(s) to which the command should be sent
1359
+ * "all" sends to all filters
1360
+ * otherwise it can be a filter or filter instance name
1361
+ * which will send the command to all matching filters.
1362
+ * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only
1363
+ * @param arg the argument for the command
1364
+ * @param ts time at which the command should be sent to the filter
1365
+ *
1366
+ * @note As this executes commands after this function returns, no return code
1367
+ * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported.
1368
+ */
1369
+ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
1370
+
1371
+
1372
+ /**
1373
+ * Dump a graph into a human-readable string representation.
1374
+ *
1375
+ * @param graph the graph to dump
1376
+ * @param options formatting options; currently ignored
1377
+ * @return a string, or NULL in case of memory allocation failure;
1378
+ * the string must be freed using av_free
1379
+ */
1380
+ char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
1381
+
1382
+ /**
1383
+ * Request a frame on the oldest sink link.
1384
+ *
1385
+ * If the request returns AVERROR_EOF, try the next.
1386
+ *
1387
+ * Note that this function is not meant to be the sole scheduling mechanism
1388
+ * of a filtergraph, only a convenience function to help drain a filtergraph
1389
+ * in a balanced way under normal circumstances.
1390
+ *
1391
+ * Also note that AVERROR_EOF does not mean that frames did not arrive on
1392
+ * some of the sinks during the process.
1393
+ * When there are multiple sink links, in case the requested link
1394
+ * returns an EOF, this may cause a filter to flush pending frames
1395
+ * which are sent to another sink link, although unrequested.
1396
+ *
1397
+ * @return the return value of ff_request_frame(),
1398
+ * or AVERROR_EOF if all links returned AVERROR_EOF
1399
+ */
1400
+ int avfilter_graph_request_oldest(AVFilterGraph *graph);
1401
+
1402
+ /**
1403
+ * @}
1404
+ */
1405
+
1406
+ #endif /* AVFILTER_AVFILTER_H */
ffmpeg/include/libavfilter/buffersink.h ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVFILTER_BUFFERSINK_H
20
+ #define AVFILTER_BUFFERSINK_H
21
+
22
+ /**
23
+ * @file
24
+ * @ingroup lavfi_buffersink
25
+ * memory buffer sink API for audio and video
26
+ */
27
+
28
+ #include "avfilter.h"
29
+
30
+ /**
31
+ * @defgroup lavfi_buffersink Buffer sink API
32
+ * @ingroup lavfi
33
+ * @{
34
+ *
35
+ * The buffersink and abuffersink filters are there to connect filter graphs
36
+ * to applications. They have a single input, connected to the graph, and no
37
+ * output. Frames must be extracted using av_buffersink_get_frame() or
38
+ * av_buffersink_get_samples().
39
+ *
40
+ * The format negotiated by the graph during configuration can be obtained
41
+ * using the accessor functions:
42
+ * - av_buffersink_get_time_base(),
43
+ * - av_buffersink_get_format(),
44
+ * - av_buffersink_get_frame_rate(),
45
+ * - av_buffersink_get_w(),
46
+ * - av_buffersink_get_h(),
47
+ * - av_buffersink_get_sample_aspect_ratio(),
48
+ * - av_buffersink_get_channels(),
49
+ * - av_buffersink_get_ch_layout(),
50
+ * - av_buffersink_get_sample_rate().
51
+ *
52
+ * The layout returned by av_buffersink_get_ch_layout() must de uninitialized
53
+ * by the caller.
54
+ *
55
+ * The format can be constrained by setting options, using av_opt_set() and
56
+ * related functions with the AV_OPT_SEARCH_CHILDREN flag.
57
+ * - pixel_formats (array of pixel formats),
58
+ * - colorspaces (array of int),
59
+ * - colorranges (array of int),
60
+ * - sample_formats (array of sample formats),
61
+ * - samplerates (array of int),
62
+ * - channel_layouts (array of channel layouts)
63
+ * If an option is not set, all corresponding formats are accepted.
64
+ */
65
+
66
+ /**
67
+ * Get a frame with filtered data from sink and put it in frame.
68
+ *
69
+ * @param ctx pointer to a buffersink or abuffersink filter context.
70
+ * @param frame pointer to an allocated frame that will be filled with data.
71
+ * The data must be freed using av_frame_unref() / av_frame_free()
72
+ * @param flags a combination of AV_BUFFERSINK_FLAG_* flags
73
+ *
74
+ * @return >= 0 in for success, a negative AVERROR code for failure.
75
+ */
76
+ int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags);
77
+
78
+ /**
79
+ * Tell av_buffersink_get_buffer_ref() to read video/samples buffer
80
+ * reference, but not remove it from the buffer. This is useful if you
81
+ * need only to read a video/samples buffer, without to fetch it.
82
+ */
83
+ #define AV_BUFFERSINK_FLAG_PEEK 1
84
+
85
+ /**
86
+ * Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
87
+ * If a frame is already buffered, it is read (and removed from the buffer),
88
+ * but if no frame is present, return AVERROR(EAGAIN).
89
+ */
90
+ #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
91
+
92
+ /**
93
+ * Set the frame size for an audio buffer sink.
94
+ *
95
+ * All calls to av_buffersink_get_buffer_ref will return a buffer with
96
+ * exactly the specified number of samples, or AVERROR(EAGAIN) if there is
97
+ * not enough. The last buffer at EOF will be padded with 0.
98
+ */
99
+ void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size);
100
+
101
+ /**
102
+ * @defgroup lavfi_buffersink_accessors Buffer sink accessors
103
+ * Get the properties of the stream
104
+ * @{
105
+ */
106
+
107
+ enum AVMediaType av_buffersink_get_type (const AVFilterContext *ctx);
108
+ AVRational av_buffersink_get_time_base (const AVFilterContext *ctx);
109
+ int av_buffersink_get_format (const AVFilterContext *ctx);
110
+
111
+ AVRational av_buffersink_get_frame_rate (const AVFilterContext *ctx);
112
+ int av_buffersink_get_w (const AVFilterContext *ctx);
113
+ int av_buffersink_get_h (const AVFilterContext *ctx);
114
+ AVRational av_buffersink_get_sample_aspect_ratio (const AVFilterContext *ctx);
115
+ enum AVColorSpace av_buffersink_get_colorspace (const AVFilterContext *ctx);
116
+ enum AVColorRange av_buffersink_get_color_range (const AVFilterContext *ctx);
117
+
118
+ int av_buffersink_get_channels (const AVFilterContext *ctx);
119
+ int av_buffersink_get_ch_layout (const AVFilterContext *ctx,
120
+ AVChannelLayout *ch_layout);
121
+ int av_buffersink_get_sample_rate (const AVFilterContext *ctx);
122
+
123
+ AVBufferRef * av_buffersink_get_hw_frames_ctx (const AVFilterContext *ctx);
124
+
125
+ /** @} */
126
+
127
+ /**
128
+ * Get a frame with filtered data from sink and put it in frame.
129
+ *
130
+ * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
131
+ * @param frame pointer to an allocated frame that will be filled with data.
132
+ * The data must be freed using av_frame_unref() / av_frame_free()
133
+ *
134
+ * @return
135
+ * - >= 0 if a frame was successfully returned.
136
+ * - AVERROR(EAGAIN) if no frames are available at this point; more
137
+ * input frames must be added to the filtergraph to get more output.
138
+ * - AVERROR_EOF if there will be no more output frames on this sink.
139
+ * - A different negative AVERROR code in other failure cases.
140
+ */
141
+ int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
142
+
143
+ /**
144
+ * Same as av_buffersink_get_frame(), but with the ability to specify the number
145
+ * of samples read. This function is less efficient than
146
+ * av_buffersink_get_frame(), because it copies the data around.
147
+ *
148
+ * @param ctx pointer to a context of the abuffersink AVFilter.
149
+ * @param frame pointer to an allocated frame that will be filled with data.
150
+ * The data must be freed using av_frame_unref() / av_frame_free()
151
+ * frame will contain exactly nb_samples audio samples, except at
152
+ * the end of stream, when it can contain less than nb_samples.
153
+ *
154
+ * @return The return codes have the same meaning as for
155
+ * av_buffersink_get_frame().
156
+ *
157
+ * @warning do not mix this function with av_buffersink_get_frame(). Use only one or
158
+ * the other with a single sink, not both.
159
+ */
160
+ int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
161
+
162
+ /**
163
+ * @}
164
+ */
165
+
166
+ #endif /* AVFILTER_BUFFERSINK_H */