diff --git a/Program/avcodec-52.dll b/Program/avcodec-52.dll deleted file mode 100644 index 7ed2e7ef85..0000000000 Binary files a/Program/avcodec-52.dll and /dev/null differ diff --git a/Program/avcodec-53.dll b/Program/avcodec-53.dll new file mode 100644 index 0000000000..f762b3df0a Binary files /dev/null and b/Program/avcodec-53.dll differ diff --git a/Program/avdevice-52.dll b/Program/avdevice-52.dll deleted file mode 100644 index ae66642729..0000000000 Binary files a/Program/avdevice-52.dll and /dev/null differ diff --git a/Program/avformat-52.dll b/Program/avformat-52.dll deleted file mode 100644 index e936a796ca..0000000000 Binary files a/Program/avformat-52.dll and /dev/null differ diff --git a/Program/avformat-53.dll b/Program/avformat-53.dll new file mode 100644 index 0000000000..21267dd12c Binary files /dev/null and b/Program/avformat-53.dll differ diff --git a/Program/avutil-50.dll b/Program/avutil-50.dll deleted file mode 100644 index 1940d72201..0000000000 Binary files a/Program/avutil-50.dll and /dev/null differ diff --git a/Program/avutil-51.dll b/Program/avutil-51.dll new file mode 100644 index 0000000000..ef175d8c5c Binary files /dev/null and b/Program/avutil-51.dll differ diff --git a/Program/ffmpeg_lastgood/avcodec-51.dll b/Program/ffmpeg_lastgood/avcodec-51.dll deleted file mode 100644 index 5870cd8172..0000000000 Binary files a/Program/ffmpeg_lastgood/avcodec-51.dll and /dev/null differ diff --git a/Program/ffmpeg_lastgood/avformat-51.dll b/Program/ffmpeg_lastgood/avformat-51.dll deleted file mode 100644 index cb97ae8ee4..0000000000 Binary files a/Program/ffmpeg_lastgood/avformat-51.dll and /dev/null differ diff --git a/Program/ffmpeg_lastgood/avutil-49.dll b/Program/ffmpeg_lastgood/avutil-49.dll deleted file mode 100644 index edcb57911e..0000000000 Binary files a/Program/ffmpeg_lastgood/avutil-49.dll and /dev/null differ diff --git a/Program/swscale-0.dll b/Program/swscale-0.dll deleted file mode 100644 index b316c1287a..0000000000 Binary files a/Program/swscale-0.dll and /dev/null differ diff --git a/Program/swscale-2.dll b/Program/swscale-2.dll new file mode 100644 index 0000000000..f060f9f248 Binary files /dev/null and b/Program/swscale-2.dll differ diff --git a/autoconf/m4/video.m4 b/autoconf/m4/video.m4 index f4f15544cb..6aceb10d20 100644 --- a/autoconf/m4/video.m4 +++ b/autoconf/m4/video.m4 @@ -1,42 +1,31 @@ AC_DEFUN([SM_VIDEO], [ + +AC_REQUIRE([SM_STATIC]) + AC_ARG_WITH(ffmpeg, AS_HELP_STRING([--without-ffmpeg],[Disable ffmpeg support]), with_ffmpeg=$withval, with_ffmpeg=yes) +AC_ARG_WITH(static-ffmpeg, AS_HELP_STRING([--with-static-ffmpeg],[Statically link ffmpeg libraries]), with_static_ffmpeg=$withval, with_static_ffmpeg=no) -old_LIBS="$LIBS" -old_CFLAGS="$CFLAGS" -old_CXXFLAGS="$CXXFLAGS" - -if test "$with_ffmpeg" != "no"; then - if test "$with_ffmpeg" != "yes"; then - if test $(echo $with_ffmpeg|cut -c 1) != /; then - with_ffmpeg=$(/bin/pwd)/$with_ffmpeg - fi - CFLAGS="-I$with_ffmpeg/include $CFLAGS" - CXXFLAGS="-I$with_ffmpeg/include $CXXFLAGS" - LIBS="$with_ffmpeg/lib/libavutil.a $LIBS" - AC_CHECK_FUNC([av_free], have_libavutil=yes, have_libavutil=no) - LIBS="$with_ffmpeg/lib/libavcodec.a $LIBS" - AC_CHECK_FUNC([avcodec_init], have_libavcodec=yes, have_libavcodec=no) - LIBS="$with_ffmpeg/lib/libavformat.a $LIBS" - AC_CHECK_FUNC([guess_format], have_libavformat=yes, have_libavformat=no) - LIBS="$with_ffmpeg/lib/libswscale.a $LIBS" - AC_CHECK_FUNC([sws_scale], have_libswscale=yes, have_libswscale=no) - else - AC_SEARCH_LIBS(av_free, [avutil], have_libavutil=yes, have_libavutil=no) - AC_SEARCH_LIBS(avcodec_init, [avcodec], have_libavcodec=yes, have_libavcodec=no) - AC_SEARCH_LIBS(guess_format, [avformat], have_libavformat=yes, have_libavformat=no) - AC_SEARCH_LIBS(sws_scale, [swscale], have_libswscale=yes, have_libswscale=no) - fi +if test "$with_static_ffmpeg" = "yes"; then + LIB_PRE=$START_STATIC + LIB_POST=$END_STATIC fi have_ffmpeg=no -if test "$have_libavutil" = "yes" -a "$have_libavformat" = "yes" -a "$have_libavcodec" = "yes" -a "$have_libswscale" = "yes"; then - have_ffmpeg=yes - AC_DEFINE(HAVE_FFMPEG, 1, [FFMPEG support available]) -else - LIBS="$old_LIBS" - CFLAGS="$old_CFLAGS" - CXXFLAGS="$old_CXXFLAGS" +if test "$with_ffmpeg" = "yes"; then + AC_CHECK_LIB(avutil, av_free, have_libavutil=yes, have_libavutil=no) + AC_CHECK_LIB(avformat, av_guess_format, have_libavformat=yes, have_libavformat=no) + AC_CHECK_LIB(avcodec, avcodec_init, have_libavcodec=yes, have_libavcodec=no) + AC_CHECK_LIB(swscale, sws_scale, have_libswscale=yes, have_libswscale=no) + if test "$have_libavutil" = "yes" -a "$have_libavformat" = "yes" -a "$have_libavcodec" = "yes" -a "$have_libswscale" = "yes"; then + have_ffmpeg=yes + LIBS="$LIBS $LIB_PRE -lavutil -lavcodec -lavformat -lswscale $LIB_POST" + AC_DEFINE(HAVE_FFMPEG, 1, [FFMPEG support available]) + fi fi + +LIB_PRE= +LIB_POST= + AM_CONDITIONAL(HAVE_FFMPEG, test "$have_ffmpeg" = "yes") diff --git a/extern/ffmpeg/README.txt b/extern/ffmpeg/README.txt new file mode 100644 index 0000000000..e22241c131 --- /dev/null +++ b/extern/ffmpeg/README.txt @@ -0,0 +1,80 @@ +This is a FFmpeg Win32 shared build by Kyle Schwarz. + +Zeranoe's FFmpeg Builds Home Page: http://ffmpeg.zeranoe.com/builds/ + +Built on Jan 27 2012 18:37:07 + +FFmpeg version git-01fcbdf + libavutil 51. 34.101 / 51. 34.101 + libavcodec 53. 60.100 / 53. 60.100 + libavformat 53. 31.100 / 53. 31.100 + libavdevice 53. 4.100 / 53. 4.100 + libavfilter 2. 60.100 / 2. 60.100 + libswscale 2. 1.100 / 2. 1.100 + libswresample 0. 6.100 / 0. 6.100 + libpostproc 52. 0.100 / 52. 0.100 + +FFmpeg configured with: + --disable-static + --enable-shared + --enable-gpl + --enable-version3 + --disable-w32threads + --enable-runtime-cpudetect + --enable-avisynth + --enable-bzlib + --enable-frei0r + --enable-libopencore-amrnb + --enable-libopencore-amrwb + --enable-libfreetype + --enable-libgsm + --enable-libmp3lame + --enable-libopenjpeg + --enable-librtmp + --enable-libschroedinger + --enable-libspeex + --enable-libtheora + --enable-libvo-aacenc + --enable-libvo-amrwbenc + --enable-libvorbis + --enable-libvpx + --enable-libx264 + --enable-libxavs + --enable-libxvid + --enable-zlib + +The source code for this FFmpeg build can be found at: + http://ffmpeg.zeranoe.com/builds/source/ffmpeg/ + +This version of FFmpeg was built on: + Ubuntu Desktop 10.04: http://www.ubuntu.com/desktop + +The cross-compile toolchain used to compile this FFmpeg was: + MinGW-w64: http://mingw-w64.sourceforge.net/ + winpthreads (part of MinGW-w64) + +The GCC version used to compile this FFmpeg was: + GCC 4.6.2: http://gcc.gnu.org/ + +The external libaries compiled into this FFmpeg are: + bzip2 1.0.6 http://www.bzip.org + Frei0r 1.3 http://frei0r.dyne.org/ + opencore-amr 0.1.2 http://sourceforge.net/projects/opencore-amr/ + FreeType 2.4.6 http://www.freetype.org/ + gsm 1.0.13 http://libgsm.sourcearchive.com/ + LAME 3.98.4 http://lame.sourceforge.net/ + OpenJPEG 1.4 http://www.openjpeg.org/ + RTMP git-60218d0a http://rtmpdump.mplayerhq.hu/ + Schroedinger 1.0.10 http://diracvideo.org/ + Speex 1.2rc1 http://www.speex.org/ + Theora 1.1.1 http://www.theora.org/ + vo-aacenc 0.1.1 http://sourceforge.net/projects/opencore-amr/ + vo-amrwbenc 0.1.1 http://sourceforge.net/projects/opencore-amr/ + Vorbis 1.3.2 http://www.vorbis.com/ + libvpx v0.9.7-p1 http://www.webmproject.org/code/ + x264 git-bcd41db http://www.videolan.org/developers/x264.html + XAVS r55 http://xavs.sourceforge.net/ + Xvid 1.3.2 http://www.xvid.org/ + zlib 1.2.5 http://zlib.net/ + +License for each library can be found in the licenses folder. diff --git a/extern/ffmpeg/doc/developer.html b/extern/ffmpeg/doc/developer.html new file mode 100644 index 0000000000..4af08f8cdc --- /dev/null +++ b/extern/ffmpeg/doc/developer.html @@ -0,0 +1,656 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

Developer Documentation

+ + +

Table of Contents

+ + + +

1. Developers Guide

+ + +

1.1 API

+ + + +

1.2 Integrating libavcodec or libavformat in your program

+ +

You can integrate all the source code of the libraries to link them +statically to avoid any version problem. All you need is to provide a +’config.mak’ and a ’config.h’ in the parent directory. See the defines +generated by ./configure to understand what is needed. +

+

You can use libavcodec or libavformat in your commercial program, but +any patch you make must be published. The best way to proceed is +to send your patches to the FFmpeg mailing list. +

+ +

1.3 Contributing

+ +

There are 3 ways by which code gets into ffmpeg. +

+ +

Whichever way, changes should be reviewed by the maintainer of the code +before they are committed. And they should follow the Coding Rules. +The developer making the commit and the author are responsible for their changes +and should try to fix issues their commit causes. +

+

+

+

1.4 Coding Rules

+ + +

1.4.1 Code formatting conventions

+ +

There are the following guidelines regarding the indentation in files: +

+

The presentation is one inspired by ’indent -i4 -kr -nut’. +

+

The main priority in FFmpeg is simplicity and small code size in order to +minimize the bug count. +

+ +

1.4.2 Comments

+

Use the JavaDoc/Doxygen format (see examples below) so that code documentation +can be generated automatically. All nontrivial functions should have a comment +above them explaining what the function does, even if it is just one sentence. +All structures and their member variables should be documented, too. +

+

Avoid Qt-style and similar Doxygen syntax with ! in it, i.e. replace +//! with /// and similar. Also @ syntax should be employed +for markup commands, i.e. use @param and not \param. +

+
 
/**
+ * @file
+ * MPEG codec.
+ * @author ...
+ */
+
+/**
+ * Summary sentence.
+ * more text ...
+ * ...
+ */
+typedef struct Foobar{
+    int var1; /**< var1 description */
+    int var2; ///< var2 description
+    /** var3 description */
+    int var3;
+} Foobar;
+
+/**
+ * Summary sentence.
+ * more text ...
+ * ...
+ * @param my_parameter description of my_parameter
+ * @return return value description
+ */
+int myfunc(int my_parameter)
+...
+
+ + +

1.4.3 C language features

+ +

FFmpeg is programmed in the ISO C90 language with a few additional +features from ISO C99, namely: +

+ +

These features are supported by all compilers we care about, so we will not +accept patches to remove their use unless they absolutely do not impair +clarity and performance. +

+

All code must compile with recent versions of GCC and a number of other +currently supported compilers. To ensure compatibility, please do not use +additional C99 features or GCC extensions. Especially watch out for: +

+ + +

1.4.4 Naming conventions

+

All names are using underscores (_), not CamelCase. For example, ‘avfilter_get_video_buffer’ is +a valid function name and ‘AVFilterGetVideo’ is not. The exception from this are type names, like +for example structs and enums; they should always be in the CamelCase +

+ +

There are following conventions for naming variables and functions: +

+ + +

1.4.5 Miscellanous conventions

+ + + +

1.4.6 Editor configuration

+

In order to configure Vim to follow FFmpeg formatting conventions, paste +the following snippet into your ‘.vimrc’: +

 
" indentation rules for FFmpeg: 4 spaces, no tabs
+set expandtab
+set shiftwidth=4
+set softtabstop=4
+" allow tabs in Makefiles
+autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=8
+" Trailing whitespace and tabs are forbidden, so highlight them.
+highlight ForbiddenWhitespace ctermbg=red guibg=red
+match ForbiddenWhitespace /\s\+$\|\t/
+" Do not highlight spaces at the end of line while typing on that line.
+autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@<!$/
+
+ +

For Emacs, add these roughly equivalent lines to your ‘.emacs.d/init.el’: +

 
(setq c-default-style "k&r")
+(setq-default c-basic-offset 4)
+(setq-default indent-tabs-mode nil)
+(setq-default show-trailing-whitespace t)
+
+ + +

1.5 Development Policy

+ +
    +
  1. + Contributions should be licensed under the LGPL 2.1, including an + "or any later version" clause, or the MIT license. GPL 2 including + an "or any later version" clause is also acceptable, but LGPL is + preferred. +
  2. + You must not commit code which breaks FFmpeg! (Meaning unfinished but + enabled code which breaks compilation or compiles but does not work or + breaks the regression tests) + You can commit unfinished stuff (for testing etc), but it must be disabled + (#ifdef etc) by default so it does not interfere with other developers’ + work. +
  3. + You do not have to over-test things. If it works for you, and you think it + should work for others, then commit. If your code has problems + (portability, triggers compiler bugs, unusual environment etc) they will be + reported and eventually fixed. +
  4. + Do not commit unrelated changes together, split them into self-contained + pieces. Also do not forget that if part B depends on part A, but A does not + depend on B, then A can and should be committed first and separate from B. + Keeping changes well split into self-contained parts makes reviewing and + understanding them on the commit log mailing list easier. This also helps + in case of debugging later on. + Also if you have doubts about splitting or not splitting, do not hesitate to + ask/discuss it on the developer mailing list. +
  5. + Do not change behavior of the programs (renaming options etc) or public + API or ABI without first discussing it on the ffmpeg-devel mailing list. + Do not remove functionality from the code. Just improve! + +

    Note: Redundant code can be removed. +

  6. + Do not commit changes to the build system (Makefiles, configure script) + which change behavior, defaults etc, without asking first. The same + applies to compiler warning fixes, trivial looking fixes and to code + maintained by other developers. We usually have a reason for doing things + the way we do. Send your changes as patches to the ffmpeg-devel mailing + list, and if the code maintainers say OK, you may commit. This does not + apply to files you wrote and/or maintain. +
  7. + We refuse source indentation and other cosmetic changes if they are mixed + with functional changes, such commits will be rejected and removed. Every + developer has his own indentation style, you should not change it. Of course + if you (re)write something, you can use your own style, even though we would + prefer if the indentation throughout FFmpeg was consistent (Many projects + force a given indentation style - we do not.). If you really need to make + indentation changes (try to avoid this), separate them strictly from real + changes. + +

    NOTE: If you had to put if(){ .. } over a large (> 5 lines) chunk of code, + then either do NOT change the indentation of the inner part within (do not + move it to the right)! or do so in a separate commit +

  8. + Always fill out the commit log message. Describe in a few lines what you + changed and why. You can refer to mailing list postings if you fix a + particular bug. Comments such as "fixed!" or "Changed it." are unacceptable. + Recommended format: + area changed: Short 1 line description + +

    details describing what and why and giving references. +

  9. + Make sure the author of the commit is set correctly. (see git commit –author) + If you apply a patch, send an + answer to ffmpeg-devel (or wherever you got the patch from) saying that + you applied the patch. +
  10. + When applying patches that have been discussed (at length) on the mailing + list, reference the thread in the log message. +
  11. + Do NOT commit to code actively maintained by others without permission. + Send a patch to ffmpeg-devel instead. If no one answers within a reasonable + timeframe (12h for build failures and security fixes, 3 days small changes, + 1 week for big patches) then commit your patch if you think it is OK. + Also note, the maintainer can simply ask for more time to review! +
  12. + Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits + are sent there and reviewed by all the other developers. Bugs and possible + improvements or general questions regarding commits are discussed there. We + expect you to react if problems with your code are uncovered. +
  13. + Update the documentation if you change behavior or add features. If you are + unsure how best to do this, send a patch to ffmpeg-devel, the documentation + maintainer(s) will review and commit your stuff. +
  14. + Try to keep important discussions and requests (also) on the public + developer mailing list, so that all developers can benefit from them. +
  15. + Never write to unallocated memory, never write over the end of arrays, + always check values read from some untrusted source before using them + as array index or other risky things. +
  16. + Remember to check if you need to bump versions for the specific libav* + parts (libavutil, libavcodec, libavformat) you are changing. You need + to change the version integer. + Incrementing the first component means no backward compatibility to + previous versions (e.g. removal of a function from the public API). + Incrementing the second component means backward compatible change + (e.g. addition of a function to the public API or extension of an + existing data structure). + Incrementing the third component means a noteworthy binary compatible + change (e.g. encoder bug fix that matters for the decoder). +
  17. + Compiler warnings indicate potential bugs or code with bad style. If a type of + warning always points to correct and clean code, that warning should + be disabled, not the code changed. + Thus the remaining warnings can either be bugs or correct code. + If it is a bug, the bug has to be fixed. If it is not, the code should + be changed to not generate a warning unless that causes a slowdown + or obfuscates the code. +
  18. + If you add a new file, give it a proper license header. Do not copy and + paste it from a random place, use an existing file as template. +
+ +

We think our rules are not too hard. If you have comments, contact us. +

+

Note, these rules are mostly borrowed from the MPlayer project. +

+

+

+

1.6 Submitting patches

+ +

First, read the Coding Rules above if you did not yet, in particular +the rules regarding patch submission. +

+

When you submit your patch, please use git format-patch or +git send-email. We cannot read other diffs :-) +

+

Also please do not submit a patch which contains several unrelated changes. +Split it into separate, self-contained pieces. This does not mean splitting +file by file. Instead, make the patch as small as possible while still +keeping it as a logical unit that contains an individual change, even +if it spans multiple files. This makes reviewing your patches much easier +for us and greatly increases your chances of getting your patch applied. +

+

Use the patcheck tool of FFmpeg to check your patch. +The tool is located in the tools directory. +

+

Run the Regression tests before submitting a patch in order to verify +it does not cause unexpected problems. +

+

Patches should be posted as base64 encoded attachments (or any other +encoding which ensures that the patch will not be trashed during +transmission) to the ffmpeg-devel mailing list, see +http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel +

+

It also helps quite a bit if you tell us what the patch does (for example +’replaces lrint by lrintf’), and why (for example ’*BSD isn’t C99 compliant +and has no lrint()’) +

+

Also please if you send several patches, send each patch as a separate mail, +do not attach several unrelated patches to the same mail. +

+

Your patch will be reviewed on the mailing list. You will likely be asked +to make some changes and are expected to send in an improved version that +incorporates the requests from the review. This process may go through +several iterations. Once your patch is deemed good enough, some developer +will pick it up and commit it to the official FFmpeg tree. +

+

Give us a few days to react. But if some time passes without reaction, +send a reminder by email. Your patch should eventually be dealt with. +

+ + +

1.7 New codecs or formats checklist

+ +
    +
  1. + Did you use av_cold for codec initialization and close functions? +
  2. + Did you add a long_name under NULL_IF_CONFIG_SMALL to the AVCodec or + AVInputFormat/AVOutputFormat struct? +
  3. + Did you bump the minor version number (and reset the micro version + number) in ‘libavcodec/version.h’ or ‘libavformat/version.h’? +
  4. + Did you register it in ‘allcodecs.c’ or ‘allformats.c’? +
  5. + Did you add the CodecID to ‘avcodec.h’? +
  6. + If it has a fourCC, did you add it to ‘libavformat/riff.c’, + even if it is only a decoder? +
  7. + Did you add a rule to compile the appropriate files in the Makefile? + Remember to do this even if you’re just adding a format to a file that is + already being compiled by some other rule, like a raw demuxer. +
  8. + Did you add an entry to the table of supported formats or codecs in + ‘doc/general.texi’? +
  9. + Did you add an entry in the Changelog? +
  10. + If it depends on a parser or a library, did you add that dependency in + configure? +
  11. + Did you git add the appropriate files before committing? +
  12. + Did you make sure it compiles standalone, i.e. with + configure --disable-everything --enable-decoder=foo + (or --enable-demuxer or whatever your component is)? +
+ + + +

1.8 patch submission checklist

+ +
    +
  1. + Does make fate pass with the patch applied? +
  2. + Was the patch generated with git format-patch or send-email? +
  3. + Did you sign off your patch? (git commit -s) + See http://kerneltrap.org/files/Jeremy/DCO.txt for the meaning + of sign off. +
  4. + Did you provide a clear git commit log message? +
  5. + Is the patch against latest FFmpeg git master branch? +
  6. + Are you subscribed to ffmpeg-devel? + (the list is subscribers only due to spam) +
  7. + Have you checked that the changes are minimal, so that the same cannot be + achieved with a smaller patch and/or simpler final code? +
  8. + If the change is to speed critical code, did you benchmark it? +
  9. + If you did any benchmarks, did you provide them in the mail? +
  10. + Have you checked that the patch does not introduce buffer overflows or + other security issues? +
  11. + Did you test your decoder or demuxer against damaged data? If no, see + tools/trasher and the noise bitstream filter. Your decoder or demuxer + should not crash or end in a (near) infinite loop when fed damaged data. +
  12. + Does the patch not mix functional and cosmetic changes? +
  13. + Did you add tabs or trailing whitespace to the code? Both are forbidden. +
  14. + Is the patch attached to the email you send? +
  15. + Is the mime type of the patch correct? It should be text/x-diff or + text/x-patch or at least text/plain and not application/octet-stream. +
  16. + If the patch fixes a bug, did you provide a verbose analysis of the bug? +
  17. + If the patch fixes a bug, did you provide enough information, including + a sample, so the bug can be reproduced and the fix can be verified? + Note please do not attach samples >100k to mails but rather provide a + URL, you can upload to ftp://upload.ffmpeg.org +
  18. + Did you provide a verbose summary about what the patch does change? +
  19. + Did you provide a verbose explanation why it changes things like it does? +
  20. + Did you provide a verbose summary of the user visible advantages and + disadvantages if the patch is applied? +
  21. + Did you provide an example so we can verify the new feature added by the + patch easily? +
  22. + If you added a new file, did you insert a license header? It should be + taken from FFmpeg, not randomly copied and pasted from somewhere else. +
  23. + You should maintain alphabetical order in alphabetically ordered lists as + long as doing so does not break API/ABI compatibility. +
  24. + Lines with similar content should be aligned vertically when doing so + improves readability. +
  25. + Consider to add a regression test for your code. +
  26. + If you added YASM code please check that things still work with –disable-yasm +
+ + +

1.9 Patch review process

+ +

All patches posted to ffmpeg-devel will be reviewed, unless they contain a +clear note that the patch is not for the git master branch. +Reviews and comments will be posted as replies to the patch on the +mailing list. The patch submitter then has to take care of every comment, +that can be by resubmitting a changed patch or by discussion. Resubmitted +patches will themselves be reviewed like any other patch. If at some point +a patch passes review with no comments then it is approved, that can for +simple and small patches happen immediately while large patches will generally +have to be changed and reviewed many times before they are approved. +After a patch is approved it will be committed to the repository. +

+

We will review all submitted patches, but sometimes we are quite busy so +especially for large patches this can take several weeks. +

+

If you feel that the review process is too slow and you are willing to try to +take over maintainership of the area of code you change then just clone +git master and maintain the area of code there. We will merge each area from +where its best maintained. +

+

When resubmitting patches, please do not make any significant changes +not related to the comments received during review. Such patches will +be rejected. Instead, submit significant changes or new features as +separate patches. +

+

+

+

1.10 Regression tests

+ +

Before submitting a patch (or committing to the repository), you should at least +test that you did not break anything. +

+

Running ’make fate’ accomplishes this, please see fate.html for details. +

+

[Of course, some patches may change the results of the regression tests. In +this case, the reference results of the regression tests shall be modified +accordingly]. +

+
+

+ + +
diff --git a/extern/ffmpeg/doc/faq.html b/extern/ffmpeg/doc/faq.html new file mode 100644 index 0000000000..a08fc4ac14 --- /dev/null +++ b/extern/ffmpeg/doc/faq.html @@ -0,0 +1,614 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

FFmpeg FAQ

+ + +

Table of Contents

+
+ + +
+ + +

1. General Questions

+ + +

1.1 Why doesn’t FFmpeg support feature [xyz]?

+ +

Because no one has taken on that task yet. FFmpeg development is +driven by the tasks that are important to the individual developers. +If there is a feature that is important to you, the best way to get +it implemented is to undertake the task yourself or sponsor a developer. +

+ +

1.2 FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it?

+ +

No. Windows DLLs are not portable, bloated and often slow. +Moreover FFmpeg strives to support all codecs natively. +A DLL loader is not conducive to that goal. +

+ +

1.3 I cannot read this file although this format seems to be supported by ffmpeg.

+ +

Even if ffmpeg can read the container format, it may not support all its +codecs. Please consult the supported codec list in the ffmpeg +documentation. +

+ +

1.4 Which codecs are supported by Windows?

+ +

Windows does not support standard formats like MPEG very well, unless you +install some additional codecs. +

+

The following list of video codecs should work on most Windows systems: +

+
msmpeg4v2
+

.avi/.asf +

+
msmpeg4
+

.asf only +

+
wmv1
+

.asf only +

+
wmv2
+

.asf only +

+
mpeg4
+

Only if you have some MPEG-4 codec like ffdshow or Xvid installed. +

+
mpeg1video
+

.mpg only +

+
+

Note, ASF files often have .wmv or .wma extensions in Windows. It should also +be mentioned that Microsoft claims a patent on the ASF format, and may sue +or threaten users who create ASF files with non-Microsoft software. It is +strongly advised to avoid ASF where possible. +

+

The following list of audio codecs should work on most Windows systems: +

+
adpcm_ima_wav
+
adpcm_ms
+
pcm_s16le
+

always +

+
libmp3lame
+

If some MP3 codec like LAME is installed. +

+
+ + + +

2. Compilation

+ + +

2.1 error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

+ +

This is a bug in gcc. Do not report it to us. Instead, please report it to +the gcc developers. Note that we will not add workarounds for gcc bugs. +

+

Also note that (some of) the gcc developers believe this is not a bug or +not a bug they should fix: +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203. +Then again, some of them do not know the difference between an undecidable +problem and an NP-hard problem... +

+ +

3. Usage

+ + +

3.1 ffmpeg does not work; what is wrong?

+ +

Try a make distclean in the ffmpeg source directory before the build. +If this does not help see +(http://ffmpeg.org/bugreports.html). +

+ +

3.2 How do I encode single pictures into movies?

+ +

First, rename your pictures to follow a numerical sequence. +For example, img1.jpg, img2.jpg, img3.jpg,... +Then you may run: +

+
 
  ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
+
+ +

Notice that ‘%d’ is replaced by the image number. +

+

img%03d.jpg’ means the sequence ‘img001.jpg’, ‘img002.jpg’, etc... +

+

If you have large number of pictures to rename, you can use the +following command to ease the burden. The command, using the bourne +shell syntax, symbolically links all files in the current directory +that match *jpg to the ‘/tmp’ directory in the sequence of +‘img001.jpg’, ‘img002.jpg’ and so on. +

+
 
  x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
+
+ +

If you want to sequence them by oldest modified first, substitute +$(ls -r -t *jpg) in place of *jpg. +

+

Then run: +

+
 
  ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
+
+ +

The same logic is used for any image format that ffmpeg reads. +

+ +

3.3 How do I encode movie to single pictures?

+ +

Use: +

+
 
  ffmpeg -i movie.mpg movie%d.jpg
+
+ +

The ‘movie.mpg’ used as input will be converted to +‘movie1.jpg’, ‘movie2.jpg’, etc... +

+

Instead of relying on file format self-recognition, you may also use +

+
-c:v ppm
+
-c:v png
+
-c:v mjpeg
+
+

to force the encoding. +

+

Applying that to the previous example: +

 
  ffmpeg -i movie.mpg -f image2 -c:v mjpeg menu%d.jpg
+
+ +

Beware that there is no "jpeg" codec. Use "mjpeg" instead. +

+ +

3.4 Why do I see a slight quality degradation with multithreaded MPEG* encoding?

+ +

For multithreaded MPEG* encoding, the encoded slices must be independent, +otherwise thread n would practically have to wait for n-1 to finish, so it’s +quite logical that there is a small reduction of quality. This is not a bug. +

+ +

3.5 How can I read from the standard input or write to the standard output?

+ +

Use ‘-’ as file name. +

+ +

3.6 -f jpeg doesn’t work.

+ +

Try ’-f image2 test%d.jpg’. +

+ +

3.7 Why can I not change the frame rate?

+ +

Some codecs, like MPEG-1/2, only allow a small number of fixed frame rates. +Choose a different codec with the -c:v command line option. +

+ +

3.8 How do I encode Xvid or DivX video with ffmpeg?

+ +

Both Xvid and DivX (version 4+) are implementations of the ISO MPEG-4 +standard (note that there are many other coding formats that use this +same standard). Thus, use ’-c:v mpeg4’ to encode in these formats. The +default fourcc stored in an MPEG-4-coded file will be ’FMP4’. If you want +a different fourcc, use the ’-vtag’ option. E.g., ’-vtag xvid’ will +force the fourcc ’xvid’ to be stored as the video fourcc rather than the +default. +

+ +

3.9 Which are good parameters for encoding high quality MPEG-4?

+ +

’-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2’, +things to try: ’-bf 2’, ’-flags qprd’, ’-flags mv0’, ’-flags skiprd’. +

+ +

3.10 Which are good parameters for encoding high quality MPEG-1/MPEG-2?

+ +

’-mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100 -pass 1/2’ +but beware the ’-g 100’ might cause problems with some decoders. +Things to try: ’-bf 2’, ’-flags qprd’, ’-flags mv0’, ’-flags skiprd. +

+ +

3.11 Interlaced video looks very bad when encoded with ffmpeg, what is wrong?

+ +

You should use ’-flags +ilme+ildct’ and maybe ’-flags +alt’ for interlaced +material, and try ’-top 0/1’ if the result looks really messed-up. +

+ +

3.12 How can I read DirectShow files?

+ +

If you have built FFmpeg with ./configure --enable-avisynth +(only possible on MinGW/Cygwin platforms), +then you may use any file that DirectShow can read as input. +

+

Just create an "input.avs" text file with this single line ... +

 
  DirectShowSource("C:\path to your file\yourfile.asf")
+
+

... and then feed that text file to ffmpeg: +

 
  ffmpeg -i input.avs
+
+ +

For ANY other help on Avisynth, please visit the +Avisynth homepage. +

+ +

3.13 How can I join video files?

+ +

A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by +merely concatenating them. +

+

Hence you may concatenate your multimedia files by first transcoding them to +these privileged formats, then using the humble cat command (or the +equally humble copy under Windows), and finally transcoding back to your +format of choice. +

+
 
ffmpeg -i input1.avi -same_quant intermediate1.mpg
+ffmpeg -i input2.avi -same_quant intermediate2.mpg
+cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
+ffmpeg -i intermediate_all.mpg -same_quant output.avi
+
+ +

Notice that you should either use -same_quant or set a reasonably high +bitrate for your intermediate and output files, if you want to preserve +video quality. +

+

Also notice that you may avoid the huge intermediate files by taking advantage +of named pipes, should your platform support it: +

+
 
mkfifo intermediate1.mpg
+mkfifo intermediate2.mpg
+ffmpeg -i input1.avi -same_quant -y intermediate1.mpg < /dev/null &
+ffmpeg -i input2.avi -same_quant -y intermediate2.mpg < /dev/null &
+cat intermediate1.mpg intermediate2.mpg |\
+ffmpeg -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi
+
+ +

Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also +allow concatenation, and the transcoding step is almost lossless. +When using multiple yuv4mpegpipe(s), the first line needs to be discarded +from all but the first stream. This can be accomplished by piping through +tail as seen below. Note that when piping through tail you +must use command grouping, { ;}, to background properly. +

+

For example, let’s say we want to join two FLV files into an output.flv file: +

+
 
mkfifo temp1.a
+mkfifo temp1.v
+mkfifo temp2.a
+mkfifo temp2.v
+mkfifo all.a
+mkfifo all.v
+ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
+ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
+ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
+{ ffmpeg -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; } &
+cat temp1.a temp2.a > all.a &
+cat temp1.v temp2.v > all.v &
+ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
+       -f yuv4mpegpipe -i all.v \
+       -same_quant -y output.flv
+rm temp[12].[av] all.[av]
+
+ + +

3.14 -profile option fails when encoding H.264 video with AAC audio

+ +

ffmpeg prints an error like +

+
 
Undefined constant or missing '(' in 'baseline'
+Unable to parse option value "baseline"
+Error setting option profile to value baseline.
+
+ +

Short answer: write ‘-profile:v’ instead of ‘-profile’. +

+

Long answer: this happens because the ‘-profile’ option can apply to both +video and audio. Specifically the AAC encoder also defines some profiles, none +of which are named baseline. +

+

The solution is to apply the ‘-profile’ option to the video stream only +by using Stream specifiers. +Appending :v to it will do exactly that. +

+ +

3.15 Using ‘-f lavfi’, audio becomes mono for no apparent reason.

+ +

Use ‘-dumpgraph -’ to find out exactly where the channel layout is +lost. +

+

Most likely, it is through auto-inserted aconvert. Try to understand +why the converting filter was needed at that place. +

+

Just before the output is a likely place, as ‘-f lavfi’ currently +only support packed S16. +

+

Then insert the correct aconvert explicitly in the filter graph, +specifying the exact format. +

+
 
aconvert=s16:stereo:packed
+
+ + +

4. Development

+ + +

4.1 Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?

+ +

Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively, +examine the source code for one of the many open source projects that +already incorporate FFmpeg at (projects.html). +

+ +

4.2 Can you support my C compiler XXX?

+ +

It depends. If your compiler is C99-compliant, then patches to support +it are likely to be welcome if they do not pollute the source code +with #ifdefs related to the compiler. +

+ +

4.3 Is Microsoft Visual C++ supported?

+ +

No. Microsoft Visual C++ is not compliant to the C99 standard and does +not - among other things - support the inline assembly used in FFmpeg. +If you wish to use MSVC++ for your +project then you can link the MSVC++ code with libav* as long as +you compile the latter with a working C compiler. For more information, see +the Microsoft Visual C++ compatibility section in the FFmpeg +documentation. +

+

There have been efforts to make FFmpeg compatible with MSVC++ in the +past. However, they have all been rejected as too intrusive, especially +since MinGW does the job adequately. None of the core developers +work with MSVC++ and thus this item is low priority. Should you find +the silver bullet that solves this problem, feel free to shoot it at us. +

+

We strongly recommend you to move over from MSVC++ to MinGW tools. +

+ +

4.4 Can I use FFmpeg or libavcodec under Windows?

+ +

Yes, but the Cygwin or MinGW tools must be used to compile FFmpeg. +Read the Windows section in the FFmpeg documentation to find more +information. +

+

To get help and instructions for building FFmpeg under Windows, check out +the FFmpeg Windows Help Forum at +http://ffmpeg.arrozcru.org/. +

+ +

4.5 Can you add automake, libtool or autoconf support?

+ +

No. These tools are too bloated and they complicate the build. +

+ +

4.6 Why not rewrite FFmpeg in object-oriented C++?

+ +

FFmpeg is already organized in a highly modular manner and does not need to +be rewritten in a formal object language. Further, many of the developers +favor straight C; it works for them. For more arguments on this matter, +read "Programming Religion". +

+ +

4.7 Why are the ffmpeg programs devoid of debugging symbols?

+ +

The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug +information. Those binaries are stripped to create ffmpeg, ffplay, etc. If +you need the debug information, use the *_g versions. +

+ +

4.8 I do not like the LGPL, can I contribute code under the GPL instead?

+ +

Yes, as long as the code is optional and can easily and cleanly be placed +under #if CONFIG_GPL without breaking anything. So, for example, a new codec +or filter would be OK under GPL while a bug fix to LGPL code would not. +

+ +

4.9 I’m using FFmpeg from within my C++ application but the linker complains about missing symbols which seem to be available.

+ +

FFmpeg is a pure C project, so to use the libraries within your C++ application +you need to explicitly state that you are using a C library. You can do this by +encompassing your FFmpeg includes using extern "C". +

+

See http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3 +

+ +

4.10 I’m using libavutil from within my C++ application but the compiler complains about ’UINT64_C’ was not declared in this scope

+ +

FFmpeg is a pure C project using C99 math features, in order to enable C++ +to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS +

+ +

4.11 I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?

+ +

You have to implement a URLProtocol, see ‘libavformat/file.c’ in +FFmpeg and ‘libmpdemux/demux_lavf.c’ in MPlayer sources. +

+ +

4.12 Where can I find libav* headers for Pascal/Delphi?

+ +

see http://www.iversenit.dk/dev/ffmpeg-headers/ +

+ +

4.13 Where is the documentation about ffv1, msmpeg4, asv1, 4xm?

+ +

see http://www.ffmpeg.org/~michael/ +

+ +

4.14 How do I feed H.263-RTP (and other codecs in RTP) to libavcodec?

+ +

Even if peculiar since it is network oriented, RTP is a container like any +other. You have to demux RTP before feeding the payload to libavcodec. +In this specific case please look at RFC 4629 to see how it should be done. +

+ +

4.15 AVStream.r_frame_rate is wrong, it is much larger than the frame rate.

+ +

r_frame_rate is NOT the average frame rate, it is the smallest frame rate +that can accurately represent all timestamps. So no, it is not +wrong if it is larger than the average! +For example, if you have mixed 25 and 30 fps content, then r_frame_rate +will be 150. +

+ +

4.16 Why is make fate not running all tests?

+ +

Make sure you have the fate-suite samples and the SAMPLES Make variable +or FATE_SAMPLES environment variable or the --samples +configure option is set to the right path. +

+ +

4.17 Why is make fate not finding the samples?

+ +

Do you happen to have a ~ character in the samples path to indicate a +home directory? The value is used in ways where the shell cannot expand it, +causing FATE to not find files. Just replace ~ by the full path. +

+
+

+ + +
diff --git a/extern/ffmpeg/doc/fate.html b/extern/ffmpeg/doc/fate.html new file mode 100644 index 0000000000..9f77c5744f --- /dev/null +++ b/extern/ffmpeg/doc/fate.html @@ -0,0 +1,309 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ + +

FATE Automated Testing Environment

+ + +

Table of Contents

+ + + +

1. Introduction

+ +

FATE is an extended regression suite on the client-side and a means +for results aggregation and presentation on the server-side. +

+

The first part of this document explains how you can use FATE from +your FFmpeg source directory to test your ffmpeg binary. The second +part describes how you can run FATE to submit the results to FFmpeg’s +FATE server. +

+

In any way you can have a look at the publicly viewable FATE results +by visiting this website: +

+

http://fate.ffmpeg.org/ +

+

This is especially recommended for all people contributing source +code to FFmpeg, as it can be seen if some test on some platform broke +with there recent contribution. This usually happens on the platforms +the developers could not test on. +

+

The second part of this document describes how you can run FATE to +submit your results to FFmpeg’s FATE server. If you want to submit your +results be sure to check that your combination of CPU, OS and compiler +is not already listed on the above mentioned website. +

+

In the third part you can find a comprehensive listing of FATE makefile +targets and variables. +

+ + +

2. Using FATE from your FFmpeg source directory

+ +

If you want to run FATE on your machine you need to have the samples +in place. You can get the samples via the build target fate-rsync. +Use this command from the top-level source directory: +

+
 
make fate-rsync SAMPLES=fate-suite/
+make fate       SAMPLES=fate-suite/
+
+ +

The above commands set the samples location by passing a makefile +variable via command line. It is also possible to set the samples +location at source configuration time by invoking configure with +‘–samples=<path to the samples directory>’. Afterwards you can +invoke the makefile targets without setting the SAMPLES makefile +variable. This is illustrated by the following commands: +

+
 
./configure --samples=fate-suite/
+make fate-rsync
+make fate
+
+ +

Yet another way to tell FATE about the location of the sample +directory is by making sure the environment variable FATE_SAMPLES +contains the path to your samples directory. This can be achieved +by e.g. putting that variable in your shell profile or by setting +it in your interactive session. +

+
 
FATE_SAMPLES=fate-suite/ make fate
+
+ +
+

Do not put a ’~’ character in the samples path to indicate a home +directory. Because of shell nuances, this will cause FATE to fail. +

+ + +

3. Submitting the results to the FFmpeg result aggregation server

+ +

To submit your results to the server you should run fate through the +shell script tests/fate.sh from the FFmpeg sources. This script needs +to be invoked with a configuration file as its first argument. +

+
 
tests/fate.sh /path/to/fate_config
+
+ +

A configuration file template with comments describing the individual +configuration variables can be found at ‘tests/fate_config.sh.template’. +

+

The mentioned configuration template is also available here: +

slot=                                    # some unique identifier
+repo=git://source.ffmpeg.org/ffmpeg.git  # the source repository
+samples=                                 # path to samples directory
+workdir=                                 # directory in which to do all the work
+#fate_recv="ssh -T fate@fate.ffmpeg.org" # command to submit report
+comment=                                 # optional description
+
+# the following are optional and map to configure options
+arch=
+cpu=
+cross_prefix=
+cc=
+target_os=
+sysroot=
+target_exec=
+target_path=
+extra_cflags=
+extra_ldflags=
+extra_libs=
+extra_conf=     # extra configure options not covered above
+
+#make=          # name of GNU make if not 'make'
+makeopts=       # extra options passed to 'make'
+#tar=           # command to create a tar archive from its arguments on stdout,
+                # defaults to 'tar c'
+

+

Create a configuration that suits your needs, based on the configuration +template. The ‘slot’ configuration variable can be any string that is not +yet used, but it is suggested that you name it adhering to the following +pattern <arch>-<os>-<compiler>-<compiler version>. The configuration file +itself will be sourced in a shell script, therefore all shell features may +be used. This enables you to setup the environment as you need it for your +build. +

+

For your first test runs the ‘fate_recv’ variable should be empty or +commented out. This will run everything as normal except that it will omit +the submission of the results to the server. The following files should be +present in $workdir as specified in the configuration file: +

+ + +

When you have everything working properly you can create an SSH key and +send its public part to the FATE server administrator. +

+

Configure your SSH client to use public key authentication with that key +when connecting to the FATE server. Also do not forget to check the identity +of the server and to accept its host key. This can usually be achieved by +running your SSH client manually and killing it after you accepted the key. +The FATE server’s fingerprint is: +

+

b1:31:c8:79:3f:04:1d:f8:f2:23:26:5a:fd:55:fa:92 +

+

The only thing left is to automate the execution of the fate.sh script and +the synchronisation of the samples directory. +

+ + +

4. FATE makefile targets and variables

+ + +

4.1 Makefile targets

+ +
+
fate-rsync
+

Download/synchronize sample files to the configured samples directory. +

+
+
fate-list
+

Will list all fate/regression test targets. +

+
+
fate
+

Run the FATE test suite (requires the fate-suite dataset). +

+
+ + +

4.2 Makefile variables

+ +
+
V
+

Verbosity level, can be set to 0, 1 or 2. +

    +
  • 0: show just the test arguments +
  • 1: show just the command used in the test +
  • 2: show everything +
+ +
+
SAMPLES
+

Specify or override the path to the FATE samples at make time, it has a + meaning only while running the regression tests. +

+
+
THREADS
+

Specify how many threads to use while running regression tests, it is + quite useful to detect thread-related regressions. +

+
+ +

Example: +

 
make V=1 SAMPLES=/var/fate/samples THREADS=2 fate
+
+
+

+ + +
diff --git a/extern/ffmpeg/doc/ffmpeg.html b/extern/ffmpeg/doc/ffmpeg.html new file mode 100644 index 0000000000..4ea053f8b4 --- /dev/null +++ b/extern/ffmpeg/doc/ffmpeg.html @@ -0,0 +1,8403 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

ffmpeg Documentation

+ + +

Table of Contents

+
+ + +
+ + +

1. Synopsis

+ +

The generic syntax is: +

+
 
ffmpeg [global options] [[infile options][‘-iinfile]]... {[outfile options] outfile}...
+
+ + +

2. Description

+ +

ffmpeg is a very fast video and audio converter that can also grab from +a live audio/video source. It can also convert between arbitrary sample +rates and resize video on the fly with a high quality polyphase filter. +

+

ffmpeg reads from an arbitrary number of input "files" (which can be regular +files, pipes, network streams, grabbing devices, etc.), specified by the +-i option, and writes to an arbitrary number of output "files", which are +specified by a plain output filename. Anything found on the command line which +cannot be interpreted as an option is considered to be an output filename. +

+

Each input or output file can in principle contain any number of streams of +different types (video/audio/subtitle/attachment/data). Allowed number and/or +types of streams can be limited by the container format. Selecting, which +streams from which inputs go into output, is done either automatically or with +the -map option (see the Stream selection chapter). +

+

To refer to input files in options, you must use their indices (0-based). E.g. +the first input file is 0, the second is 1 etc. Similarly, streams +within a file are referred to by their indices. E.g. 2:3 refers to the +fourth stream in the third input file. See also the Stream specifiers chapter. +

+

As a general rule, options are applied to the next specified +file. Therefore, order is important, and you can have the same +option on the command line multiple times. Each occurrence is +then applied to the next input or output file. +Exceptions from this rule are the global options (e.g. verbosity level), +which should be specified first. +

+

Do not mix input and output files – first specify all input files, then all +output files. Also do not mix options which belong to different files. All +options apply ONLY to the next input or output file and are reset between files. +

+ + +

The format option may be needed for raw input files. +

+ + +

3. Stream selection

+ +

By default ffmpeg includes only one stream of each type (video, audio, subtitle) +present in the input files and adds them to each output file. It picks the +"best" of each based upon the following criteria; for video it is the stream +with the highest resolution, for audio the stream with the most channels, for +subtitle it’s the first subtitle stream. In the case where several streams of +the same type rate equally, the lowest numbered stream is chosen. +

+

You can disable some of those defaults by using -vn/-an/-sn options. For +full manual control, use the -map option, which disables the defaults just +described. +

+ + +

4. Options

+ +

All the numerical options, if not specified otherwise, accept in input +a string representing a number, which may contain one of the +International System number postfixes, for example ’K’, ’M’, ’G’. +If ’i’ is appended after the postfix, powers of 2 are used instead of +powers of 10. The ’B’ postfix multiplies the value for 8, and can be +appended after another postfix or used alone. This allows using for +example ’KB’, ’MiB’, ’G’ and ’B’ as postfix. +

+

Options which do not take arguments are boolean options, and set the +corresponding value to true. They can be set to false by prefixing +with "no" the option name, for example using "-nofoo" in the +command line will set to false the boolean option with name "foo". +

+

+

+

4.1 Stream specifiers

+

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers +are used to precisely specify which stream(s) does a given option belong to. +

+

A stream specifier is a string generally appended to the option name and +separated from it by a colon. E.g. -codec:a:1 ac3 option contains +a:1 stream specifer, which matches the second audio stream. Therefore it +would select the ac3 codec for the second audio stream. +

+

A stream specifier can match several stream, the option is then applied to all +of them. E.g. the stream specifier in -b:a 128k matches all audio +streams. +

+

An empty stream specifier matches all streams, for example -codec copy +or -codec: copy would copy all the streams without reencoding. +

+

Possible forms of stream specifiers are: +

+
stream_index
+

Matches the stream with this index. E.g. -threads:1 4 would set the +thread count for the second stream to 4. +

+
stream_type[:stream_index]
+

stream_type is one of: ’v’ for video, ’a’ for audio, ’s’ for subtitle, +’d’ for data and ’t’ for attachments. If stream_index is given, then +matches stream number stream_index of this type. Otherwise matches all +streams of this type. +

+
p:program_id[:stream_index]
+

If stream_index is given, then matches stream number stream_index in +program with id program_id. Otherwise matches all streams in this program. +

+
+ +

4.2 Generic options

+ +

These options are shared amongst the av* tools. +

+
+
-L
+

Show license. +

+
+
-h, -?, -help, --help
+

Show help. +

+
+
-version
+

Show version. +

+
+
-formats
+

Show available formats. +

+

The fields preceding the format names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
+ +
+
-codecs
+

Show available codecs. +

+

The fields preceding the codec names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
V/A/S
+

Video/audio/subtitle codec +

+
S
+

Codec supports slices +

+
D
+

Codec supports direct rendering +

+
T
+

Codec can handle input truncated at random locations instead of only at frame boundaries +

+
+ +
+
-bsfs
+

Show available bitstream filters. +

+
+
-protocols
+

Show available protocols. +

+
+
-filters
+

Show available libavfilter filters. +

+
+
-pix_fmts
+

Show available pixel formats. +

+
+
-sample_fmts
+

Show available sample formats. +

+
+
-loglevel loglevel | -v loglevel
+

Set the logging level used by the library. +loglevel is a number or a string containing one of the following values: +

+
quiet
+
panic
+
fatal
+
error
+
warning
+
info
+
verbose
+
debug
+
+ +

By default the program logs to stderr, if coloring is supported by the +terminal, colors are used to mark errors and warnings. Log coloring +can be disabled setting the environment variable +AV_LOG_FORCE_NOCOLOR or NO_COLOR, or can be forced setting +the environment variable AV_LOG_FORCE_COLOR. +The use of the environment variable NO_COLOR is deprecated and +will be dropped in a following FFmpeg version. +

+
+
-report
+

Dump full command line and console output to a file named +program-YYYYMMDD-HHMMSS.log in the current +directory. +This file can be useful for bug reports. +It also implies -loglevel verbose. +

+

Note: setting the environment variable FFREPORT to any value has the +same effect. +

+
+
+ + +

4.3 AVOptions

+ +

These options are provided directly by the libavformat, libavdevice and +libavcodec libraries. To see the list of available AVOptions, use the +‘-help’ option. They are separated into two categories: +

+
generic
+

These options can be set for any container, codec or device. Generic options +are listed under AVFormatContext options for containers/devices and under +AVCodecContext options for codecs. +

+
private
+

These options are specific to the given container, device or codec. Private +options are listed under their corresponding containers/devices/codecs. +

+
+ +

For example to write an ID3v2.3 header instead of a default ID3v2.4 to +an MP3 file, use the ‘id3v2_version’ private option of the MP3 +muxer: +

 
ffmpeg -i input.flac -id3v2_version 3 out.mp3
+
+ +

All codec AVOptions are obviously per-stream, so the chapter on stream +specifiers applies to them +

+

Note ‘-nooption’ syntax cannot be used for boolean AVOptions, +use ‘-option 0’/‘-option 1’. +

+

Note2 old undocumented way of specifying per-stream AVOptions by prepending +v/a/s to the options name is now obsolete and will be removed soon. +

+ +

4.4 Main options

+ +
+
-f fmt (input/output)
+

Force input or output file format. The format is normally auto detected for input +files and guessed from file extension for output files, so this option is not +needed in most cases. +

+
+
-i filename (input)
+

input file name +

+
+
-y (global)
+

Overwrite output files without asking. +

+
+
-n (global)
+

Do not overwrite output files but exit if file exists. +

+
+
-c[:stream_specifier] codec (input/output,per-stream)
+
-codec[:stream_specifier] codec (input/output,per-stream)
+

Select an encoder (when used before an output file) or a decoder (when used +before an input file) for one or more streams. codec is the name of a +decoder/encoder or a special value copy (output only) to indicate that +the stream is not to be re-encoded. +

+

For example +

 
ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
+
+

encodes all video streams with libx264 and copies all audio streams. +

+

For each stream, the last matching c option is applied, so +

 
ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
+
+

will copy all the streams except the second video, which will be encoded with +libx264, and the 138th audio, which will be encoded with libvorbis. +

+
+
-t duration (output)
+

Stop writing the output after its duration reaches duration. +duration may be a number in seconds, or in hh:mm:ss[.xxx] form. +

+
+
-fs limit_size (output)
+

Set the file size limit. +

+
+
-ss position (input/output)
+

When used as an input option (before -i), seeks in this input file to +position. When used as an output option (before an output filename), +decodes but discards input until the timestamps reach position. This is +slower, but more accurate. +

+

position may be either in seconds or in hh:mm:ss[.xxx] form. +

+
+
-itsoffset offset (input)
+

Set the input time offset in seconds. +[-]hh:mm:ss[.xxx] syntax is also supported. +The offset is added to the timestamps of the input files. +Specifying a positive offset means that the corresponding +streams are delayed by offset seconds. +

+
+
-timestamp time (output)
+

Set the recording timestamp in the container. +The syntax for time is: +

 
now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
+
+

If the value is "now" it takes the current time. +Time is local time unless ’Z’ or ’z’ is appended, in which case it is +interpreted as UTC. +If the year-month-day part is not specified it takes the current +year-month-day. +

+
+
-metadata[:metadata_specifier] key=value (output,per-metadata)
+

Set a metadata key/value pair. +

+

An optional metadata_specifier may be given to set metadata +on streams or chapters. See -map_metadata documentation for +details. +

+

This option overrides metadata set with -map_metadata. It is +also possible to delete metadata by using an empty value. +

+

For example, for setting the title in the output file: +

 
ffmpeg -i in.avi -metadata title="my title" out.flv
+
+ +

To set the language of the first audio stream: +

 
ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
+
+ +
+
-target type (output)
+

Specify target file type (vcd, svcd, dvd, dv, +dv50). type may be prefixed with pal-, ntsc- or +film- to use the corresponding standard. All the format options +(bitrate, codecs, buffer sizes) are then set automatically. You can just type: +

+
 
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
+
+ +

Nevertheless you can specify additional options as long as you know +they do not conflict with the standard, as in: +

+
 
ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
+
+ +
+
-dframes number (output)
+

Set the number of data frames to record. This is an alias for -frames:d. +

+
+
-frames[:stream_specifier] framecount (output,per-stream)
+

Stop writing to the stream after framecount frames. +

+
+
-q[:stream_specifier] q (output,per-stream)
+
-qscale[:stream_specifier] q (output,per-stream)
+

Use fixed quality scale (VBR). The meaning of q is +codec-dependent. +

+
+
-filter[:stream_specifier] filter_graph (output,per-stream)
+

filter_graph is a description of the filter graph to apply to +the stream. Use -filters to show all the available filters +(including also sources and sinks). +

+
-pre[:stream_specifier] preset_name (output,per-stream)
+

Specify the preset for matching stream(s). +

+
+
-stats (global)
+

Print encoding progress/statistics. On by default. +

+
+
-attach filename (output)
+

Add an attachment to the output file. This is supported by a few formats +like Matroska for e.g. fonts used in rendering subtitles. Attachments +are implemented as a specific type of stream, so this option will add +a new stream to the file. It is then possible to use per-stream options +on this stream in the usual way. Attachment streams created with this +option will be created after all the other streams (i.e. those created +with -map or automatic mappings). +

+

Note that for Matroska you also have to set the mimetype metadata tag: +

 
ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv
+
+

(assuming that the attachment stream will be third in the output file). +

+
+
-dump_attachment[:stream_specifier] filename (input,per-stream)
+

Extract the matching attachment stream into a file named filename. If +filename is empty, then the value of the filename metadata tag +will be used. +

+

E.g. to extract the first attachment to a file named ’out.ttf’: +

 
ffmpeg -dump_attachment:t:0 out.ttf INPUT
+
+

To extract all attachments to files determined by the filename tag: +

 
ffmpeg -dump_attachment:t "" INPUT
+
+ +

Technical note – attachments are implemented as codec extradata, so this +option can actually be used to extract extradata from any stream, not just +attachments. +

+
+
+ + +

4.5 Video Options

+ +
+
-vframes number (output)
+

Set the number of video frames to record. This is an alias for -frames:v. +

+
-r[:stream_specifier] fps (input/output,per-stream)
+

Set frame rate (Hz value, fraction or abbreviation), (default = 25). +

+
-s[:stream_specifier] size (input/output,per-stream)
+

Set frame size. The format is ‘wxh’ (default - same as source). +The following abbreviations are recognized: +

+
sqcif
+

128x96 +

+
qcif
+

176x144 +

+
cif
+

352x288 +

+
4cif
+

704x576 +

+
16cif
+

1408x1152 +

+
qqvga
+

160x120 +

+
qvga
+

320x240 +

+
vga
+

640x480 +

+
svga
+

800x600 +

+
xga
+

1024x768 +

+
uxga
+

1600x1200 +

+
qxga
+

2048x1536 +

+
sxga
+

1280x1024 +

+
qsxga
+

2560x2048 +

+
hsxga
+

5120x4096 +

+
wvga
+

852x480 +

+
wxga
+

1366x768 +

+
wsxga
+

1600x1024 +

+
wuxga
+

1920x1200 +

+
woxga
+

2560x1600 +

+
wqsxga
+

3200x2048 +

+
wquxga
+

3840x2400 +

+
whsxga
+

6400x4096 +

+
whuxga
+

7680x4800 +

+
cga
+

320x200 +

+
ega
+

640x350 +

+
hd480
+

852x480 +

+
hd720
+

1280x720 +

+
hd1080
+

1920x1080 +

+
+ +
+
-aspect[:stream_specifier] aspect (output,per-stream)
+

Set the video display aspect ratio specified by aspect. +

+

aspect can be a floating point number string, or a string of the +form num:den, where num and den are the +numerator and denominator of the aspect ratio. For example "4:3", +"16:9", "1.3333", and "1.7777" are valid argument values. +

+
+
-croptop size
+
-cropbottom size
+
-cropleft size
+
-cropright size
+

All the crop options have been removed. Use -vf +crop=width:height:x:y instead. +

+
+
-padtop size
+
-padbottom size
+
-padleft size
+
-padright size
+
-padcolor hex_color
+

All the pad options have been removed. Use -vf +pad=width:height:x:y:color instead. +

+
+
-vn (output)
+

Disable video recording. +

+
-bt tolerance
+

Set video bitrate tolerance (in bits, default 4000k). +Has a minimum value of: (target_bitrate/target_framerate). +In 1-pass mode, bitrate tolerance specifies how far ratecontrol is +willing to deviate from the target average bitrate value. This is +not related to min/max bitrate. Lowering tolerance too much has +an adverse effect on quality. +

+
-maxrate bitrate
+

Set max video bitrate (in bit/s). +Requires -bufsize to be set. +

+
-minrate bitrate
+

Set min video bitrate (in bit/s). +Most useful in setting up a CBR encode: +

 
ffmpeg -i myfile.avi -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
+
+

It is of little use elsewise. +

+
-bufsize size
+

Set video buffer verifier buffer size (in bits). +

+
-vcodec codec (output)
+

Set the video codec. This is an alias for -codec:v. +

+
-same_quant
+

Use same quantizer as source (implies VBR). +

+

Note that this is NOT SAME QUALITY. Do not use this option unless you know you +need it. +

+
+
-pass n
+

Select the pass number (1 or 2). It is used to do two-pass +video encoding. The statistics of the video are recorded in the first +pass into a log file (see also the option -passlogfile), +and in the second pass that log file is used to generate the video +at the exact requested bitrate. +On pass 1, you may just deactivate audio and set output to null, +examples for Windows and Unix: +

 
ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
+ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
+
+ +
+
-passlogfile prefix (global)
+

Set two-pass log file name prefix to prefix, the default file name +prefix is “ffmpeg2pass”. The complete file name will be +‘PREFIX-N.log’, where N is a number specific to the output +stream +

+
+
-vlang code
+

Set the ISO 639 language code (3 letters) of the current video stream. +

+
+
-vf filter_graph (output)
+

filter_graph is a description of the filter graph to apply to +the input video. +Use the option "-filters" to show all the available filters (including +also sources and sinks). This is an alias for -filter:v. +

+
+
+ + +

4.6 Advanced Video Options

+ +
+
-pix_fmt[:stream_specifier] format (input/output,per-stream)
+

Set pixel format. Use -pix_fmts to show all the supported +pixel formats. +

+
-sws_flags flags (input/output)
+

Set SwScaler flags. +

+
-g gop_size
+

Set the group of pictures size. +

+
-intra
+

deprecated, use -g 1 +

+
-vdt n
+

Discard threshold. +

+
-qmin q
+

minimum video quantizer scale (VBR) +

+
-qmax q
+

maximum video quantizer scale (VBR) +

+
-qdiff q
+

maximum difference between the quantizer scales (VBR) +

+
-qblur blur
+

video quantizer scale blur (VBR) (range 0.0 - 1.0) +

+
-qcomp compression
+

video quantizer scale compression (VBR) (default 0.5). +Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0 +

+
+
-lmin lambda
+

minimum video lagrange factor (VBR) +

+
-lmax lambda
+

max video lagrange factor (VBR) +

+
-mblmin lambda
+

minimum macroblock quantizer scale (VBR) +

+
-mblmax lambda
+

maximum macroblock quantizer scale (VBR) +

+

These four options (lmin, lmax, mblmin, mblmax) use ’lambda’ units, +but you may use the QP2LAMBDA constant to easily convert from ’q’ units: +

 
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
+
+ +
+
-rc_init_cplx complexity
+

initial complexity for single pass encoding +

+
-b_qfactor factor
+

qp factor between P- and B-frames +

+
-i_qfactor factor
+

qp factor between P- and I-frames +

+
-b_qoffset offset
+

qp offset between P- and B-frames +

+
-i_qoffset offset
+

qp offset between P- and I-frames +

+
-rc_eq equation
+

Set rate control equation (see section "Expression Evaluation") +(default = tex^qComp). +

+

When computing the rate control equation expression, besides the +standard functions defined in the section "Expression Evaluation", the +following functions are available: +

+
bits2qp(bits)
+
qp2bits(qp)
+
+ +

and the following constants are available: +

+
iTex
+
pTex
+
tex
+
mv
+
fCode
+
iCount
+
mcVar
+
var
+
isI
+
isP
+
isB
+
avgQP
+
qComp
+
avgIITex
+
avgPITex
+
avgPPTex
+
avgBPTex
+
avgTex
+
+ +
+
-rc_override[:stream_specifier] override (output,per-stream)
+

Rate control override for specific intervals, formatted as "int,int,int" +list separated with slashes. Two first values are the beginning and +end frame numbers, last one is quantizer to use if positive, or quality +factor if negative. +

+
-me_method method
+

Set motion estimation method to method. +Available methods are (from lowest to best quality): +

+
zero
+

Try just the (0, 0) vector. +

+
phods
+
log
+
x1
+
hex
+
umh
+
epzs
+

(default method) +

+
full
+

exhaustive search (slow and marginally better than epzs) +

+
+ +
+
-dct_algo algo
+

Set DCT algorithm to algo. Available values are: +

+
0
+

FF_DCT_AUTO (default) +

+
1
+

FF_DCT_FASTINT +

+
2
+

FF_DCT_INT +

+
3
+

FF_DCT_MMX +

+
4
+

FF_DCT_MLIB +

+
5
+

FF_DCT_ALTIVEC +

+
+ +
+
-idct_algo algo
+

Set IDCT algorithm to algo. Available values are: +

+
0
+

FF_IDCT_AUTO (default) +

+
1
+

FF_IDCT_INT +

+
2
+

FF_IDCT_SIMPLE +

+
3
+

FF_IDCT_SIMPLEMMX +

+
4
+

FF_IDCT_LIBMPEG2MMX +

+
5
+

FF_IDCT_PS2 +

+
6
+

FF_IDCT_MLIB +

+
7
+

FF_IDCT_ARM +

+
8
+

FF_IDCT_ALTIVEC +

+
9
+

FF_IDCT_SH4 +

+
10
+

FF_IDCT_SIMPLEARM +

+
+ +
+
-er n
+

Set error resilience to n. +

+
1
+

FF_ER_CAREFUL (default) +

+
2
+

FF_ER_COMPLIANT +

+
3
+

FF_ER_AGGRESSIVE +

+
4
+

FF_ER_VERY_AGGRESSIVE +

+
+ +
+
-ec bit_mask
+

Set error concealment to bit_mask. bit_mask is a bit mask of +the following values: +

+
1
+

FF_EC_GUESS_MVS (default = enabled) +

+
2
+

FF_EC_DEBLOCK (default = enabled) +

+
+ +
+
-bf frames
+

Use ’frames’ B-frames (supported for MPEG-1, MPEG-2 and MPEG-4). +

+
-mbd mode
+

macroblock decision +

+
0
+

FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg). +

+
1
+

FF_MB_DECISION_BITS: Choose the one which needs the fewest bits. +

+
2
+

FF_MB_DECISION_RD: rate distortion +

+
+ +
+
-4mv
+

Use four motion vector by macroblock (MPEG-4 only). +

+
-part
+

Use data partitioning (MPEG-4 only). +

+
-bug param
+

Work around encoder bugs that are not auto-detected. +

+
-strict strictness
+

How strictly to follow the standards. +

+
-aic
+

Enable Advanced intra coding (h263+). +

+
-umv
+

Enable Unlimited Motion Vector (h263+) +

+
+
-deinterlace
+

Deinterlace pictures. +

+
-ilme
+

Force interlacing support in encoder (MPEG-2 and MPEG-4 only). +Use this option if your input file is interlaced and you want +to keep the interlaced format for minimum losses. +The alternative is to deinterlace the input stream with +‘-deinterlace’, but deinterlacing introduces losses. +

+
-psnr
+

Calculate PSNR of compressed frames. +

+
-vstats
+

Dump video coding statistics to ‘vstats_HHMMSS.log’. +

+
-vstats_file file
+

Dump video coding statistics to file. +

+
-top[:stream_specifier] n (output,per-stream)
+

top=1/bottom=0/auto=-1 field first +

+
-dc precision
+

Intra_dc_precision. +

+
-vtag fourcc/tag (output)
+

Force video tag/fourcc. This is an alias for -tag:v. +

+
-qphist (global)
+

Show QP histogram +

+
-vbsf bitstream_filter
+

Deprecated see -bsf +

+
-force_key_frames[:stream_specifier] time[,time...] (output,per-stream)
+

Force key frames at the specified timestamps, more precisely at the first +frames after each specified time. +This option can be useful to ensure that a seek point is present at a +chapter mark or any other designated place in the output file. +The timestamps must be specified in ascending order. +

+
+
-copyinkf[:stream_specifier] (output,per-stream)
+

When doing stream copy, copy also non-key frames found at the +beginning. +

+
+ + +

4.7 Audio Options

+ +
+
-aframes number (output)
+

Set the number of audio frames to record. This is an alias for -frames:a. +

+
-ar[:stream_specifier] freq (input/output,per-stream)
+

Set the audio sampling frequency. For output streams it is set by +default to the frequency of the corresponding input stream. For input +streams this option only makes sense for audio grabbing devices and raw +demuxers and is mapped to the corresponding demuxer options. +

+
-aq q (output)
+

Set the audio quality (codec-specific, VBR). This is an alias for -q:a. +

+
-ac[:stream_specifier] channels (input/output,per-stream)
+

Set the number of audio channels. For output streams it is set by +default to the number of input audio channels. For input streams +this option only makes sense for audio grabbing devices and raw demuxers +and is mapped to the corresponding demuxer options. +

+
-an (output)
+

Disable audio recording. +

+
-acodec codec (input/output)
+

Set the audio codec. This is an alias for -codec:a. +

+
-sample_fmt[:stream_specifier] sample_fmt (output,per-stream)
+

Set the audio sample format. Use -sample_fmts to get a list +of supported sample formats. +

+
+ + +

4.8 Advanced Audio options:

+ +
+
-atag fourcc/tag (output)
+

Force audio tag/fourcc. This is an alias for -tag:a. +

+
-audio_service_type type
+

Set the type of service that the audio stream contains. +

+
ma
+

Main Audio Service (default) +

+
ef
+

Effects +

+
vi
+

Visually Impaired +

+
hi
+

Hearing Impaired +

+
di
+

Dialogue +

+
co
+

Commentary +

+
em
+

Emergency +

+
vo
+

Voice Over +

+
ka
+

Karaoke +

+
+
+
-absf bitstream_filter
+

Deprecated, see -bsf +

+
+ + +

4.9 Subtitle options:

+ +
+
-slang code
+

Set the ISO 639 language code (3 letters) of the current subtitle stream. +

+
-scodec codec (input/output)
+

Set the subtitle codec. This is an alias for -codec:s. +

+
-sn (output)
+

Disable subtitle recording. +

+
-sbsf bitstream_filter
+

Deprecated, see -bsf +

+
+ + +

4.10 Audio/Video grab options

+ +
+
-isync (global)
+

Synchronize read on input. +

+
+ + +

4.11 Advanced options

+ +
+
-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] (output)
+
+

Designate one or more input streams as a source for the output file. Each input +stream is identified by the input file index input_file_id and +the input stream index input_stream_id within the input +file. Both indices start at 0. If specified, +sync_file_id:stream_specifier sets which input stream +is used as a presentation sync reference. +

+

The first -map option on the command line specifies the +source for output stream 0, the second -map option specifies +the source for output stream 1, etc. +

+

A - character before the stream identifier creates a "negative" mapping. +It disables matching streams from already created mappings. +

+

For example, to map ALL streams from the first input file to output +

 
ffmpeg -i INPUT -map 0 output
+
+ +

For example, if you have two audio streams in the first input file, +these streams are identified by "0:0" and "0:1". You can use +-map to select which streams to place in an output file. For +example: +

 
ffmpeg -i INPUT -map 0:1 out.wav
+
+

will map the input stream in ‘INPUT’ identified by "0:1" to +the (single) output stream in ‘out.wav’. +

+

For example, to select the stream with index 2 from input file +‘a.mov’ (specified by the identifier "0:2"), and stream with +index 6 from input ‘b.mov’ (specified by the identifier "1:6"), +and copy them to the output file ‘out.mov’: +

 
ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov
+
+ +

To select all video and the third audio stream from an input file: +

 
ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT
+
+ +

To map all the streams except the second audio, use negative mappings +

 
ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT
+
+ +

Note that using this option disables the default mappings for this output file. +

+
+
-map_channel [input_file_id.stream_specifier.channel_id|-1][:output_file_id.stream_specifier]
+

Map an audio channel from a given input to an output. If +output_file_id.stream_specifier are not set, the audio channel will +be mapped on all the audio streams. +

+

Using "-1" instead of +input_file_id.stream_specifier.channel_id will map a muted +channel. +

+

For example, assuming INPUT is a stereo audio file, you can switch the +two audio channels with the following command: +

 
ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
+
+ +

If you want to mute the first channel and keep the second: +

 
ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
+
+ +

The order of the "-map_channel" option specifies the order of the channels in +the output stream. The output channel layout is guessed from the number of +channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" +in combination of "-map_channel" makes the channel gain levels to be updated if +channel layouts don’t match (for instance two "-map_channel" options and "-ac +6"). +

+

You can also extract each channel of an INPUT to specific outputs; the +following command extract each channel of the audio stream (file 0, stream 0) +to the respective OUTPUT_CH0 and OUTPUT_CH1: +

 
ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
+
+ +

The following example split the channels of a stereo input into streams: +

+
 
ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
+
+ +

Note that currently each output stream can only contain channels from a single +input stream; you can’t for example use "-map_channel" to pick multiple input +audio channels contained in different streams (from the same or different files) +and merge them into a single output stream. It is therefore not currently +possible, for example, to turn two separate mono streams into a single stereo +stream. However spliting a stereo stream into two single channel mono streams +is possible. +

+
+
-map_metadata[:metadata_spec_out] infile[:metadata_spec_in] (output,per-metadata)
+

Set metadata information of the next output file from infile. Note that +those are file indices (zero-based), not filenames. +Optional metadata_spec_in/out parameters specify, which metadata to copy. +A metadata specifier can have the following forms: +

+
g
+

global metadata, i.e. metadata that applies to the whole file +

+
+
s[:stream_spec]
+

per-stream metadata. stream_spec is a stream specifier as described +in the Stream specifiers chapter. In an input metadata specifier, the first +matching stream is copied from. In an output metadata specifier, all matching +streams are copied to. +

+
+
c:chapter_index
+

per-chapter metadata. chapter_index is the zero-based chapter index. +

+
+
p:program_index
+

per-program metadata. program_index is the zero-based program index. +

+
+

If metadata specifier is omitted, it defaults to global. +

+

By default, global metadata is copied from the first input file, +per-stream and per-chapter metadata is copied along with streams/chapters. These +default mappings are disabled by creating any mapping of the relevant type. A negative +file index can be used to create a dummy mapping that just disables automatic copying. +

+

For example to copy metadata from the first stream of the input file to global metadata +of the output file: +

 
ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3
+
+ +

To do the reverse, i.e. copy global metadata to all audio streams: +

 
ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv
+
+

Note that simple 0 would work as well in this example, since global +metadata is assumed by default. +

+
+
-map_chapters input_file_index (output)
+

Copy chapters from input file with index input_file_index to the next +output file. If no chapter mapping is specified, then chapters are copied from +the first input file with at least one chapter. Use a negative file index to +disable any chapter copying. +

+
-debug category
+

Print specific debug info. +category is a number or a string containing one of the following values: +

+
bitstream
+
buffers
+

picture buffer allocations +

+
bugs
+
dct_coeff
+
er
+

error recognition +

+
mb_type
+

macroblock (MB) type +

+
mmco
+

memory management control operations (H.264) +

+
mv
+

motion vector +

+
pict
+

picture info +

+
pts
+
qp
+

per-block quantization parameter (QP) +

+
rc
+

rate control +

+
skip
+
startcode
+
thread_ops
+

threading operations +

+
vis_mb_type
+

visualize block types +

+
vis_qp
+

visualize quantization parameter (QP), lower QP are tinted greener +

+
+
+
-benchmark (global)
+

Show benchmarking information at the end of an encode. +Shows CPU time used and maximum memory consumption. +Maximum memory consumption is not supported on all systems, +it will usually display as 0 if not supported. +

+
-timelimit duration (global)
+

Exit after ffmpeg has been running for duration seconds. +

+
-dump (global)
+

Dump each input packet to stderr. +

+
-hex (global)
+

When dumping packets, also dump the payload. +

+
-ps size
+

Set RTP payload size in bytes. +

+
-re (input)
+

Read input at native frame rate. Mainly used to simulate a grab device. +

+
-loop_input
+

Loop over the input stream. Currently it works only for image +streams. This option is used for automatic FFserver testing. +This option is deprecated, use -loop 1. +

+
-loop_output number_of_times
+

Repeatedly loop output for formats that support looping such as animated GIF +(0 will loop the output infinitely). +This option is deprecated, use -loop. +

+
-threads count
+

Thread count. +

+
-vsync parameter
+

Video sync method. +

+
+
0, passthrough
+

Each frame is passed with its timestamp from the demuxer to the muxer. +

+
1, cfr
+

Frames will be duplicated and dropped to achieve exactly the requested +constant framerate. +

+
2, vfr
+

Frames are passed through with their timestamp or dropped so as to +prevent 2 frames from having the same timestamp. +

+
-1, auto
+

Chooses between 1 and 2 depending on muxer capabilities. This is the +default method. +

+
+ +

With -map you can select from which stream the timestamps should be +taken. You can leave either video or audio unchanged and sync the +remaining stream(s) to the unchanged one. +

+
+
-async samples_per_second
+

Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, +the parameter is the maximum samples per second by which the audio is changed. +-async 1 is a special case where only the start of the audio stream is corrected +without any later correction. +

+
-copyts
+

Copy timestamps from input to output. +

+
-copytb
+

Copy input stream time base from input to output when stream copying. +

+
-shortest
+

Finish encoding when the shortest input stream ends. +

+
-dts_delta_threshold
+

Timestamp discontinuity delta threshold. +

+
-muxdelay seconds (input)
+

Set the maximum demux-decode delay. +

+
-muxpreload seconds (input)
+

Set the initial demux-decode delay. +

+
-streamid output-stream-index:new-value (output)
+

Assign a new stream-id value to an output stream. This option should be +specified prior to the output filename to which it applies. +For the situation where multiple output files exist, a streamid +may be reassigned to a different value. +

+

For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for +an output mpegts file: +

 
ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
+
+ +
+
-bsf[:stream_specifier] bitstream_filters (output,per-stream)
+

Set bitstream filters for matching streams. bistream_filters is +a comma-separated list of bitstream filters. Use the -bsfs option +to get the list of bitstream filters. +

 
ffmpeg -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
+
+
 
ffmpeg -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
+
+ +
+
-tag[:stream_specifier] codec_tag (per-stream)
+

Force a tag/fourcc for matching streams. +

+
+
-timecode hh:mm:ssSEPff
+

Specify Timecode for writing. SEP is ’:’ for non drop timecode and ’;’ +(or ’.’) for drop. +

 
ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg
+
+
+
+ + +

4.12 Preset files

+

A preset file contains a sequence of option=value pairs, +one for each line, specifying a sequence of options which would be +awkward to specify on the command line. Lines starting with the hash +(’#’) character are ignored and are used to provide comments. Check +the ‘presets’ directory in the FFmpeg source tree for examples. +

+

Preset files are specified with the vpre, apre, +spre, and fpre options. The fpre option takes the +filename of the preset instead of a preset name as input and can be +used for any kind of codec. For the vpre, apre, and +spre options, the options specified in a preset file are +applied to the currently selected codec of the same type as the preset +option. +

+

The argument passed to the vpre, apre, and spre +preset options identifies the preset file to use according to the +following rules: +

+

First ffmpeg searches for a file named arg.ffpreset in the +directories ‘$FFMPEG_DATADIR’ (if set), and ‘$HOME/.ffmpeg’, and in +the datadir defined at configuration time (usually ‘PREFIX/share/ffmpeg’) +or in a ‘ffpresets’ folder along the executable on win32, +in that order. For example, if the argument is libx264-max, it will +search for the file ‘libx264-max.ffpreset’. +

+

If no such file is found, then ffmpeg will search for a file named +codec_name-arg.ffpreset in the above-mentioned +directories, where codec_name is the name of the codec to which +the preset file options will be applied. For example, if you select +the video codec with -vcodec libx264 and use -vpre max, +then it will search for the file ‘libx264-max.ffpreset’. +

+ +

5. Tips

+ + + + +

6. Examples

+ + +

6.1 Preset files

+ +

A preset file contains a sequence of option=value pairs, one for +each line, specifying a sequence of options which can be specified also on +the command line. Lines starting with the hash (’#’) character are ignored and +are used to provide comments. Empty lines are also ignored. Check the +‘presets’ directory in the FFmpeg source tree for examples. +

+

Preset files are specified with the pre option, this option takes a +preset name as input. FFmpeg searches for a file named preset_name.avpreset in +the directories ‘$AVCONV_DATADIR’ (if set), and ‘$HOME/.ffmpeg’, and in +the data directory defined at configuration time (usually ‘$PREFIX/share/ffmpeg’) +in that order. For example, if the argument is libx264-max, it will +search for the file ‘libx264-max.avpreset’. +

+ +

6.2 Video and Audio grabbing

+ +

If you specify the input format and device then ffmpeg can grab video +and audio directly. +

+
 
ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
+
+ +

Or with an ALSA audio source (mono input, card id 1) instead of OSS: +

 
ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg
+
+ +

Note that you must activate the right video source and channel before +launching ffmpeg with any TV viewer such as +xawtv by Gerd Knorr. You also +have to set the audio recording levels correctly with a +standard mixer. +

+ +

6.3 X11 grabbing

+ +

Grab the X11 display with ffmpeg via +

+
 
ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
+
+ +

0.0 is display.screen number of your X11 server, same as +the DISPLAY environment variable. +

+
 
ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
+
+ +

0.0 is display.screen number of your X11 server, same as the DISPLAY environment +variable. 10 is the x-offset and 20 the y-offset for the grabbing. +

+ +

6.4 Video and Audio file format conversion

+ +

Any supported file format and protocol can serve as input to ffmpeg: +

+

Examples: +

+ + +

7. Expression Evaluation

+ +

When evaluating an arithmetic expression, FFmpeg uses an internal +formula evaluator, implemented through the ‘libavutil/eval.h’ +interface. +

+

An expression may contain unary, binary operators, constants, and +functions. +

+

Two expressions expr1 and expr2 can be combined to form +another expression "expr1;expr2". +expr1 and expr2 are evaluated in turn, and the new +expression evaluates to the value of expr2. +

+

The following binary operators are available: +, -, +*, /, ^. +

+

The following unary operators are available: +, -. +

+

The following functions are available: +

+
sinh(x)
+
cosh(x)
+
tanh(x)
+
sin(x)
+
cos(x)
+
tan(x)
+
atan(x)
+
asin(x)
+
acos(x)
+
exp(x)
+
log(x)
+
abs(x)
+
squish(x)
+
gauss(x)
+
isnan(x)
+

Return 1.0 if x is NAN, 0.0 otherwise. +

+
+
mod(x, y)
+
max(x, y)
+
min(x, y)
+
eq(x, y)
+
gte(x, y)
+
gt(x, y)
+
lte(x, y)
+
lt(x, y)
+
st(var, expr)
+

Allow to store the value of the expression expr in an internal +variable. var specifies the number of the variable where to +store the value, and it is a value ranging from 0 to 9. The function +returns the value stored in the internal variable. +Note, Variables are currently not shared between expressions. +

+
+
ld(var)
+

Allow to load the value of the internal variable with number +var, which was previously stored with st(var, expr). +The function returns the loaded value. +

+
+
while(cond, expr)
+

Evaluate expression expr while the expression cond is +non-zero, and returns the value of the last expr evaluation, or +NAN if cond was always false. +

+
+
ceil(expr)
+

Round the value of expression expr upwards to the nearest +integer. For example, "ceil(1.5)" is "2.0". +

+
+
floor(expr)
+

Round the value of expression expr downwards to the nearest +integer. For example, "floor(-1.5)" is "-2.0". +

+
+
trunc(expr)
+

Round the value of expression expr towards zero to the nearest +integer. For example, "trunc(-1.5)" is "-1.0". +

+
+
sqrt(expr)
+

Compute the square root of expr. This is equivalent to +"(expr)^.5". +

+
+
not(expr)
+

Return 1.0 if expr is zero, 0.0 otherwise. +

+
+
pow(x, y)
+

Compute the power of x elevated y, it is equivalent to +"(x)^(y)". +

+
+
random(x)
+

Return a pseudo random value between 0.0 and 1.0. x is the index of the +internal variable which will be used to save the seed/state. +

+
+
hypot(x, y)
+

This function is similar to the C function with the same name; it returns +"sqrt(x*x + y*y)", the length of the hypotenuse of a +right triangle with sides of length x and y, or the distance of the +point (x, y) from the origin. +

+
+
gcd(x, y)
+

Return the greatest common divisor of x and y. If both x and +y are 0 or either or both are less than zero then behavior is undefined. +

+
+
if(x, y)
+

Evaluate x, and if the result is non-zero return the result of +the evaluation of y, return 0 otherwise. +

+
+
ifnot(x, y)
+

Evaluate x, and if the result is zero return the result of the +evaluation of y, return 0 otherwise. +

+
+ +

The following constants are available: +

+
PI
+

area of the unit disc, approximately 3.14 +

+
E
+

exp(1) (Euler’s number), approximately 2.718 +

+
PHI
+

golden ratio (1+sqrt(5))/2, approximately 1.618 +

+
+ +

Assuming that an expression is considered "true" if it has a non-zero +value, note that: +

+

* works like AND +

+

+ works like OR +

+

and the construct: +

 
if A then B else C
+
+

is equivalent to +

 
if(A,B) + ifnot(A,C)
+
+ +

In your C code, you can extend the list of unary and binary functions, +and define recognized constants, so that they are available for your +expressions. +

+

The evaluator also recognizes the International System number +postfixes. If ’i’ is appended after the postfix, powers of 2 are used +instead of powers of 10. The ’B’ postfix multiplies the value for 8, +and can be appended after another postfix or used alone. This allows +using for example ’KB’, ’MiB’, ’G’ and ’B’ as postfix. +

+

Follows the list of available International System postfixes, with +indication of the corresponding powers of 10 and of 2. +

+
y
+

-24 / -80 +

+
z
+

-21 / -70 +

+
a
+

-18 / -60 +

+
f
+

-15 / -50 +

+
p
+

-12 / -40 +

+
n
+

-9 / -30 +

+
u
+

-6 / -20 +

+
m
+

-3 / -10 +

+
c
+

-2 +

+
d
+

-1 +

+
h
+

2 +

+
k
+

3 / 10 +

+
K
+

3 / 10 +

+
M
+

6 / 20 +

+
G
+

9 / 30 +

+
T
+

12 / 40 +

+
P
+

15 / 40 +

+
E
+

18 / 50 +

+
Z
+

21 / 60 +

+
Y
+

24 / 70 +

+
+ + +

8. Decoders

+ +

Decoders are configured elements in FFmpeg which allow the decoding of +multimedia streams. +

+

When you configure your FFmpeg build, all the supported native decoders +are enabled by default. Decoders requiring an external library must be enabled +manually via the corresponding --enable-lib option. You can list all +available decoders using the configure option --list-decoders. +

+

You can disable all the decoders with the configure option +--disable-decoders and selectively enable / disable single decoders +with the options --enable-decoder=DECODER / +--disable-decoder=DECODER. +

+

The option -codecs of the ff* tools will display the list of +enabled decoders. +

+ + +

9. Video Decoders

+ +

A description of some of the currently available video decoders +follows. +

+ +

9.1 rawvideo

+ +

Raw video decoder. +

+

This decoder decodes rawvideo streams. +

+ +

9.1.1 Options

+ +
+
top top_field_first
+

Specify the assumed field type of the input video. +

+
-1
+

the video is assumed to be progressive (default) +

+
0
+

bottom-field-first is assumed +

+
1
+

top-field-first is assumed +

+
+ +
+
+ + + +

10. Audio Decoders

+ + +

10.1 ffwavesynth

+ +

Internal wave synthetizer. +

+

This decoder generates wave patterns according to predefined sequences. Its +use is purely internal and the format of the data it accepts is not publicly +documented. +

+ +

11. Encoders

+ +

Encoders are configured elements in FFmpeg which allow the encoding of +multimedia streams. +

+

When you configure your FFmpeg build, all the supported native encoders +are enabled by default. Encoders requiring an external library must be enabled +manually via the corresponding --enable-lib option. You can list all +available encoders using the configure option --list-encoders. +

+

You can disable all the encoders with the configure option +--disable-encoders and selectively enable / disable single encoders +with the options --enable-encoder=ENCODER / +--disable-encoder=ENCODER. +

+

The option -codecs of the ff* tools will display the list of +enabled encoders. +

+ + +

12. Audio Encoders

+ +

A description of some of the currently available audio encoders +follows. +

+ +

12.1 ac3 and ac3_fixed

+ +

AC-3 audio encoders. +

+

These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as +the undocumented RealAudio 3 (a.k.a. dnet). +

+

The ac3 encoder uses floating-point math, while the ac3_fixed +encoder only uses fixed-point integer math. This does not mean that one is +always faster, just that one or the other may be better suited to a +particular system. The floating-point encoder will generally produce better +quality audio for a given bitrate. The ac3_fixed encoder is not the +default codec for any of the output formats, so it must be specified explicitly +using the option -acodec ac3_fixed in order to use it. +

+ +

12.1.1 AC-3 Metadata

+ +

The AC-3 metadata options are used to set parameters that describe the audio, +but in most cases do not affect the audio encoding itself. Some of the options +do directly affect or influence the decoding and playback of the resulting +bitstream, while others are just for informational purposes. A few of the +options will add bits to the output stream that could otherwise be used for +audio data, and will thus affect the quality of the output. Those will be +indicated accordingly with a note in the option list below. +

+

These parameters are described in detail in several publicly-available +documents. +

+ + +

12.1.1.1 Metadata Control Options

+ +
+
-per_frame_metadata boolean
+

Allow Per-Frame Metadata. Specifies if the encoder should check for changing +metadata for each frame. +

+
0
+

The metadata values set at initialization will be used for every frame in the +stream. (default) +

+
1
+

Metadata values can be changed before encoding each frame. +

+
+ +
+
+ + +

12.1.1.2 Downmix Levels

+ +
+
-center_mixlev level
+

Center Mix Level. The amount of gain the decoder should apply to the center +channel when downmixing to stereo. This field will only be written to the +bitstream if a center channel is present. The value is specified as a scale +factor. There are 3 valid values: +

+
0.707
+

Apply -3dB gain +

+
0.595
+

Apply -4.5dB gain (default) +

+
0.500
+

Apply -6dB gain +

+
+ +
+
-surround_mixlev level
+

Surround Mix Level. The amount of gain the decoder should apply to the surround +channel(s) when downmixing to stereo. This field will only be written to the +bitstream if one or more surround channels are present. The value is specified +as a scale factor. There are 3 valid values: +

+
0.707
+

Apply -3dB gain +

+
0.500
+

Apply -6dB gain (default) +

+
0.000
+

Silence Surround Channel(s) +

+
+ +
+
+ + +

12.1.1.3 Audio Production Information

+

Audio Production Information is optional information describing the mixing +environment. Either none or both of the fields are written to the bitstream. +

+
+
-mixing_level number
+

Mixing Level. Specifies peak sound pressure level (SPL) in the production +environment when the mix was mastered. Valid values are 80 to 111, or -1 for +unknown or not indicated. The default value is -1, but that value cannot be +used if the Audio Production Information is written to the bitstream. Therefore, +if the room_type option is not the default value, the mixing_level +option must not be -1. +

+
+
-room_type type
+

Room Type. Describes the equalization used during the final mixing session at +the studio or on the dubbing stage. A large room is a dubbing stage with the +industry standard X-curve equalization; a small room has flat equalization. +This field will not be written to the bitstream if both the mixing_level +option and the room_type option have the default values. +

+
0
+
notindicated
+

Not Indicated (default) +

+
1
+
large
+

Large Room +

+
2
+
small
+

Small Room +

+
+ +
+
+ + +

12.1.1.4 Other Metadata Options

+ +
+
-copyright boolean
+

Copyright Indicator. Specifies whether a copyright exists for this audio. +

+
0
+
off
+

No Copyright Exists (default) +

+
1
+
on
+

Copyright Exists +

+
+ +
+
-dialnorm value
+

Dialogue Normalization. Indicates how far the average dialogue level of the +program is below digital 100% full scale (0 dBFS). This parameter determines a +level shift during audio reproduction that sets the average volume of the +dialogue to a preset level. The goal is to match volume level between program +sources. A value of -31dB will result in no volume level change, relative to +the source volume, during audio reproduction. Valid values are whole numbers in +the range -31 to -1, with -31 being the default. +

+
+
-dsur_mode mode
+

Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround +(Pro Logic). This field will only be written to the bitstream if the audio +stream is stereo. Using this option does NOT mean the encoder will actually +apply Dolby Surround processing. +

+
0
+
notindicated
+

Not Indicated (default) +

+
1
+
off
+

Not Dolby Surround Encoded +

+
2
+
on
+

Dolby Surround Encoded +

+
+ +
+
-original boolean
+

Original Bit Stream Indicator. Specifies whether this audio is from the +original source and not a copy. +

+
0
+
off
+

Not Original Source +

+
1
+
on
+

Original Source (default) +

+
+ +
+
+ + +

12.1.2 Extended Bitstream Information

+

The extended bitstream options are part of the Alternate Bit Stream Syntax as +specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts. +If any one parameter in a group is specified, all values in that group will be +written to the bitstream. Default values are used for those that are written +but have not been specified. If the mixing levels are written, the decoder +will use these values instead of the ones specified in the center_mixlev +and surround_mixlev options if it supports the Alternate Bit Stream +Syntax. +

+ +

12.1.2.1 Extended Bitstream Information - Part 1

+ +
+
-dmix_mode mode
+

Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt +(Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode. +

+
0
+
notindicated
+

Not Indicated (default) +

+
1
+
ltrt
+

Lt/Rt Downmix Preferred +

+
2
+
loro
+

Lo/Ro Downmix Preferred +

+
+ +
+
-ltrt_cmixlev level
+

Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the +center channel when downmixing to stereo in Lt/Rt mode. +

+
1.414
+

Apply +3dB gain +

+
1.189
+

Apply +1.5dB gain +

+
1.000
+

Apply 0dB gain +

+
0.841
+

Apply -1.5dB gain +

+
0.707
+

Apply -3.0dB gain +

+
0.595
+

Apply -4.5dB gain (default) +

+
0.500
+

Apply -6.0dB gain +

+
0.000
+

Silence Center Channel +

+
+ +
+
-ltrt_surmixlev level
+

Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the +surround channel(s) when downmixing to stereo in Lt/Rt mode. +

+
0.841
+

Apply -1.5dB gain +

+
0.707
+

Apply -3.0dB gain +

+
0.595
+

Apply -4.5dB gain +

+
0.500
+

Apply -6.0dB gain (default) +

+
0.000
+

Silence Surround Channel(s) +

+
+ +
+
-loro_cmixlev level
+

Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the +center channel when downmixing to stereo in Lo/Ro mode. +

+
1.414
+

Apply +3dB gain +

+
1.189
+

Apply +1.5dB gain +

+
1.000
+

Apply 0dB gain +

+
0.841
+

Apply -1.5dB gain +

+
0.707
+

Apply -3.0dB gain +

+
0.595
+

Apply -4.5dB gain (default) +

+
0.500
+

Apply -6.0dB gain +

+
0.000
+

Silence Center Channel +

+
+ +
+
-loro_surmixlev level
+

Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the +surround channel(s) when downmixing to stereo in Lo/Ro mode. +

+
0.841
+

Apply -1.5dB gain +

+
0.707
+

Apply -3.0dB gain +

+
0.595
+

Apply -4.5dB gain +

+
0.500
+

Apply -6.0dB gain (default) +

+
0.000
+

Silence Surround Channel(s) +

+
+ +
+
+ + +

12.1.2.2 Extended Bitstream Information - Part 2

+ +
+
-dsurex_mode mode
+

Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX +(7.1 matrixed to 5.1). Using this option does NOT mean the encoder will actually +apply Dolby Surround EX processing. +

+
0
+
notindicated
+

Not Indicated (default) +

+
1
+
on
+

Dolby Surround EX Off +

+
2
+
off
+

Dolby Surround EX On +

+
+ +
+
-dheadphone_mode mode
+

Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone +encoding (multi-channel matrixed to 2.0 for use with headphones). Using this +option does NOT mean the encoder will actually apply Dolby Headphone +processing. +

+
0
+
notindicated
+

Not Indicated (default) +

+
1
+
on
+

Dolby Headphone Off +

+
2
+
off
+

Dolby Headphone On +

+
+ +
+
-ad_conv_type type
+

A/D Converter Type. Indicates whether the audio has passed through HDCD A/D +conversion. +

+
0
+
standard
+

Standard A/D Converter (default) +

+
1
+
hdcd
+

HDCD A/D Converter +

+
+ +
+
+ + +

12.1.3 Other AC-3 Encoding Options

+ +
+
-stereo_rematrixing boolean
+

Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This +is an optional AC-3 feature that increases quality by selectively encoding +the left/right channels as mid/side. This option is enabled by default, and it +is highly recommended that it be left as enabled except for testing purposes. +

+
+
+ + +

12.1.4 Floating-Point-Only AC-3 Encoding Options

+ +

These options are only valid for the floating-point encoder and do not exist +for the fixed-point encoder due to the corresponding features not being +implemented in fixed-point. +

+
+
-channel_coupling boolean
+

Enables/Disables use of channel coupling, which is an optional AC-3 feature +that increases quality by combining high frequency information from multiple +channels into a single channel. The per-channel high frequency information is +sent with less accuracy in both the frequency and time domains. This allows +more bits to be used for lower frequencies while preserving enough information +to reconstruct the high frequencies. This option is enabled by default for the +floating-point encoder and should generally be left as enabled except for +testing purposes or to increase encoding speed. +

+
-1
+
auto
+

Selected by Encoder (default) +

+
0
+
off
+

Disable Channel Coupling +

+
1
+
on
+

Enable Channel Coupling +

+
+ +
+
-cpl_start_band number
+

Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a +value higher than the bandwidth is used, it will be reduced to 1 less than the +coupling end band. If auto is used, the start band will be determined by +the encoder based on the bit rate, sample rate, and channel layout. This option +has no effect if channel coupling is disabled. +

+
-1
+
auto
+

Selected by Encoder (default) +

+
+ +
+
+ + + +

13. Video Encoders

+ +

A description of some of the currently available video encoders +follows. +

+ +

13.1 libvpx

+ +

VP8 format supported through libvpx. +

+

Requires the presence of the libvpx headers and library during configuration. +You need to explicitly configure the build with --enable-libvpx. +

+ +

13.1.1 Options

+ +

Mapping from FFmpeg to libvpx options with conversion notes in parentheses. +

+
+
threads
+

g_threads +

+
+
profile
+

g_profile +

+
+
vb
+

rc_target_bitrate +

+
+
g
+

kf_max_dist +

+
+
keyint_min
+

kf_min_dist +

+
+
qmin
+

rc_min_quantizer +

+
+
qmax
+

rc_max_quantizer +

+
+
bufsize, vb
+

rc_buf_sz +(bufsize * 1000 / vb) +

+

rc_buf_optimal_sz +(bufsize * 1000 / vb * 5 / 6) +

+
+
rc_init_occupancy, vb
+

rc_buf_initial_sz +(rc_init_occupancy * 1000 / vb) +

+
+
rc_buffer_aggressivity
+

rc_undershoot_pct +

+
+
skip_threshold
+

rc_dropframe_thresh +

+
+
qcomp
+

rc_2pass_vbr_bias_pct +

+
+
maxrate, vb
+

rc_2pass_vbr_maxsection_pct +(maxrate * 100 / vb) +

+
+
minrate, vb
+

rc_2pass_vbr_minsection_pct +(minrate * 100 / vb) +

+
+
minrate, maxrate, vb
+

VPX_CBR +(minrate == maxrate == vb) +

+
+
crf
+

VPX_CQ, VP8E_SET_CQ_LEVEL +

+
+
quality
+
+
best
+

VPX_DL_BEST_QUALITY +

+
good
+

VPX_DL_GOOD_QUALITY +

+
realtime
+

VPX_DL_REALTIME +

+
+ +
+
speed
+

VP8E_SET_CPUUSED +

+
+
nr
+

VP8E_SET_NOISE_SENSITIVITY +

+
+
mb_threshold
+

VP8E_SET_STATIC_THRESHOLD +

+
+
slices
+

VP8E_SET_TOKEN_PARTITIONS +

+
+
Alternate reference frame related
+
+
vp8flags altref
+

VP8E_SET_ENABLEAUTOALTREF +

+
arnr_max_frames
+

VP8E_SET_ARNR_MAXFRAMES +

+
arnr_type
+

VP8E_SET_ARNR_TYPE +

+
arnr_strength
+

VP8E_SET_ARNR_STRENGTH +

+
rc_lookahead
+

g_lag_in_frames +

+
+ +
+
vp8flags error_resilient
+

g_error_resilient +

+
+
+ +

For more information about libvpx see: +http://www.webmproject.org/ +

+ +

13.2 libx264

+ +

H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 format supported through +libx264. +

+

Requires the presence of the libx264 headers and library during +configuration. You need to explicitly configure the build with +--enable-libx264. +

+ +

13.2.1 Options

+ +
+
preset preset_name
+

Set the encoding preset. +

+
+
tune tune_name
+

Tune the encoding params. +

+
+
fastfirstpass bool
+

Use fast settings when encoding first pass, default value is 1. +

+
+
profile profile_name
+

Set profile restrictions. +

+
+
level level
+

Specify level (as defined by Annex A). +Deprecated in favor of x264opts. +

+
+
passlogfile filename
+

Specify filename for 2 pass stats. +Deprecated in favor of x264opts (see stats libx264 option). +

+
+
wpredp wpred_type
+

Specify Weighted prediction for P-frames. +Deprecated in favor of x264opts (see weightp libx264 option). +

+
+
x264opts options
+

Allow to set any x264 option, see x264 –fullhelp for a list. +

+

options is a list of key=value couples separated by +":". +

+
+ +

For example to specify libx264 encoding options with ffmpeg: +

 
ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
+
+ +

For more information about libx264 and the supported options see: +http://www.videolan.org/developers/x264.html +

+ +

14. Demuxers

+ +

Demuxers are configured elements in FFmpeg which allow to read the +multimedia streams from a particular type of file. +

+

When you configure your FFmpeg build, all the supported demuxers +are enabled by default. You can list all available ones using the +configure option "–list-demuxers". +

+

You can disable all the demuxers using the configure option +"–disable-demuxers", and selectively enable a single demuxer with +the option "–enable-demuxer=DEMUXER", or disable it +with the option "–disable-demuxer=DEMUXER". +

+

The option "-formats" of the ff* tools will display the list of +enabled demuxers. +

+

The description of some of the currently available demuxers follows. +

+ +

14.1 image2

+ +

Image file demuxer. +

+

This demuxer reads from a list of image files specified by a pattern. +

+

The pattern may contain the string "%d" or "%0Nd", which +specifies the position of the characters representing a sequential +number in each filename matched by the pattern. If the form +"%d0Nd" is used, the string representing the number in each +filename is 0-padded and N is the total number of 0-padded +digits representing the number. The literal character ’%’ can be +specified in the pattern with the string "%%". +

+

If the pattern contains "%d" or "%0Nd", the first filename of +the file list specified by the pattern must contain a number +inclusively contained between 0 and 4, all the following numbers must +be sequential. This limitation may be hopefully fixed. +

+

The pattern may contain a suffix which is used to automatically +determine the format of the images contained in the files. +

+

For example the pattern "img-%03d.bmp" will match a sequence of +filenames of the form ‘img-001.bmp’, ‘img-002.bmp’, ..., +‘img-010.bmp’, etc.; the pattern "i%%m%%g-%d.jpg" will match a +sequence of filenames of the form ‘i%m%g-1.jpg’, +‘i%m%g-2.jpg’, ..., ‘i%m%g-10.jpg’, etc. +

+

The size, the pixel format, and the format of each image must be the +same for all the files in the sequence. +

+

The following example shows how to use ffmpeg for creating a +video from the images in the file sequence ‘img-001.jpeg’, +‘img-002.jpeg’, ..., assuming an input frame rate of 10 frames per +second: +

 
ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv
+
+ +

Note that the pattern must not necessarily contain "%d" or +"%0Nd", for example to convert a single image file +‘img.jpeg’ you can employ the command: +

 
ffmpeg -i img.jpeg img.png
+
+ + +

14.2 applehttp

+ +

Apple HTTP Live Streaming demuxer. +

+

This demuxer presents all AVStreams from all variant streams. +The id field is set to the bitrate variant index number. By setting +the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay), +the caller can decide which variant streams to actually receive. +The total bitrate of the variant that the stream belongs to is +available in a metadata key named "variant_bitrate". +

+ +

14.3 sbg

+ +

SBaGen script demuxer. +

+

This demuxer reads the script language used by SBaGen +http://uazu.net/sbagen/ to generate binaural beats sessions. A SBG +script looks like that: +

 
-SE
+a: 300-2.5/3 440+4.5/0
+b: 300-2.5/0 440+4.5/3
+off: -
+NOW      == a
++0:07:00 == b
++0:14:00 == a
++0:21:00 == b
++0:30:00    off
+
+ +

A SBG script can mix absolute and relative timestamps. If the script uses +either only absolute timestamps (including the script start time) or only +relative ones, then its layout is fixed, and the conversion is +straightforward. On the other hand, if the script mixes both kind of +timestamps, then the NOW reference for relative timestamps will be +taken from the current time of day at the time the script is read, and the +script layout will be frozen according to that reference. That means that if +the script is directly played, the actual times will match the absolute +timestamps up to the sound controller’s clock accuracy, but if the user +somehow pauses the playback or seeks, all times will be shifted accordingly. +

+ +

15. Muxers

+ +

Muxers are configured elements in FFmpeg which allow writing +multimedia streams to a particular type of file. +

+

When you configure your FFmpeg build, all the supported muxers +are enabled by default. You can list all available muxers using the +configure option --list-muxers. +

+

You can disable all the muxers with the configure option +--disable-muxers and selectively enable / disable single muxers +with the options --enable-muxer=MUXER / +--disable-muxer=MUXER. +

+

The option -formats of the ff* tools will display the list of +enabled muxers. +

+

A description of some of the currently available muxers follows. +

+

+

+

15.1 crc

+ +

CRC (Cyclic Redundancy Check) testing format. +

+

This muxer computes and prints the Adler-32 CRC of all the input audio +and video frames. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. +

+

The output of the muxer consists of a single line of the form: +CRC=0xCRC, where CRC is a hexadecimal number 0-padded to +8 digits containing the CRC for all the decoded input frames. +

+

For example to compute the CRC of the input, and store it in the file +‘out.crc’: +

 
ffmpeg -i INPUT -f crc out.crc
+
+ +

You can print the CRC to stdout with the command: +

 
ffmpeg -i INPUT -f crc -
+
+ +

You can select the output format of each frame with ffmpeg by +specifying the audio and video codec and format. For example to +compute the CRC of the input audio converted to PCM unsigned 8-bit +and the input video converted to MPEG-2 video, use the command: +

 
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
+
+ +

See also the framecrc muxer. +

+

+

+

15.2 framecrc

+ +

Per-frame CRC (Cyclic Redundancy Check) testing format. +

+

This muxer computes and prints the Adler-32 CRC for each decoded audio +and video frame. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. +

+

The output of the muxer consists of a line for each audio and video +frame of the form: stream_index, frame_dts, +frame_size, 0xCRC, where CRC is a hexadecimal +number 0-padded to 8 digits containing the CRC of the decoded frame. +

+

For example to compute the CRC of each decoded frame in the input, and +store it in the file ‘out.crc’: +

 
ffmpeg -i INPUT -f framecrc out.crc
+
+ +

You can print the CRC of each decoded frame to stdout with the command: +

 
ffmpeg -i INPUT -f framecrc -
+
+ +

You can select the output format of each frame with ffmpeg by +specifying the audio and video codec and format. For example, to +compute the CRC of each decoded input audio frame converted to PCM +unsigned 8-bit and of each decoded input video frame converted to +MPEG-2 video, use the command: +

 
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
+
+ +

See also the crc muxer. +

+

+

+

15.3 image2

+ +

Image file muxer. +

+

The image file muxer writes video frames to image files. +

+

The output filenames are specified by a pattern, which can be used to +produce sequentially numbered series of files. +The pattern may contain the string "%d" or "%0Nd", this string +specifies the position of the characters representing a numbering in +the filenames. If the form "%0Nd" is used, the string +representing the number in each filename is 0-padded to N +digits. The literal character ’%’ can be specified in the pattern with +the string "%%". +

+

If the pattern contains "%d" or "%0Nd", the first filename of +the file list specified will contain the number 1, all the following +numbers will be sequential. +

+

The pattern may contain a suffix which is used to automatically +determine the format of the image files to write. +

+

For example the pattern "img-%03d.bmp" will specify a sequence of +filenames of the form ‘img-001.bmp’, ‘img-002.bmp’, ..., +‘img-010.bmp’, etc. +The pattern "img%%-%d.jpg" will specify a sequence of filenames of the +form ‘img%-1.jpg’, ‘img%-2.jpg’, ..., ‘img%-10.jpg’, +etc. +

+

The following example shows how to use ffmpeg for creating a +sequence of files ‘img-001.jpeg’, ‘img-002.jpeg’, ..., +taking one image every second from the input video: +

 
ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
+
+ +

Note that with ffmpeg, if the format is not specified with the +-f option and the output filename specifies an image file +format, the image2 muxer is automatically selected, so the previous +command can be written as: +

 
ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
+
+ +

Note also that the pattern must not necessarily contain "%d" or +"%0Nd", for example to create a single image file +‘img.jpeg’ from the input video you can employ the command: +

 
ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
+
+ +

The image muxer supports the .Y.U.V image file format. This format is +special in that that each image frame consists of three files, for +each of the YUV420P components. To read or write this image file format, +specify the name of the ’.Y’ file. The muxer will automatically open the +’.U’ and ’.V’ files as required. +

+ +

15.4 mov

+ +

MOV / MP4 muxer +

+

The muxer options are: +

+
+
-moov_size bytes
+

Reserves space for the moov atom at the beginning of the file instead of placing the +moov atom at the end. If the space reserved is insufficient, muxing will fail. +

+
+ + +

15.5 mpegts

+ +

MPEG transport stream muxer. +

+

This muxer implements ISO 13818-1 and part of ETSI EN 300 468. +

+

The muxer options are: +

+
+
-mpegts_original_network_id number
+

Set the original_network_id (default 0x0001). This is unique identifier +of a network in DVB. Its main use is in the unique identification of a +service through the path Original_Network_ID, Transport_Stream_ID. +

+
-mpegts_transport_stream_id number
+

Set the transport_stream_id (default 0x0001). This identifies a +transponder in DVB. +

+
-mpegts_service_id number
+

Set the service_id (default 0x0001) also known as program in DVB. +

+
-mpegts_pmt_start_pid number
+

Set the first PID for PMT (default 0x1000, max 0x1f00). +

+
-mpegts_start_pid number
+

Set the first PID for data packets (default 0x0100, max 0x0f00). +

+
+ +

The recognized metadata settings in mpegts muxer are service_provider +and service_name. If they are not set the default for +service_provider is "FFmpeg" and the default for +service_name is "Service01". +

+
 
ffmpeg -i file.mpg -c copy \
+     -mpegts_original_network_id 0x1122 \
+     -mpegts_transport_stream_id 0x3344 \
+     -mpegts_service_id 0x5566 \
+     -mpegts_pmt_start_pid 0x1500 \
+     -mpegts_start_pid 0x150 \
+     -metadata service_provider="Some provider" \
+     -metadata service_name="Some Channel" \
+     -y out.ts
+
+ + +

15.6 null

+ +

Null muxer. +

+

This muxer does not generate any output file, it is mainly useful for +testing or benchmarking purposes. +

+

For example to benchmark decoding with ffmpeg you can use the +command: +

 
ffmpeg -benchmark -i INPUT -f null out.null
+
+ +

Note that the above command does not read or write the ‘out.null’ +file, but specifying the output file is required by the ffmpeg +syntax. +

+

Alternatively you can write the command as: +

 
ffmpeg -benchmark -i INPUT -f null -
+
+ + +

15.7 matroska

+ +

Matroska container muxer. +

+

This muxer implements the matroska and webm container specs. +

+

The recognized metadata settings in this muxer are: +

+
+
title=title name
+

Name provided to a single track +

+
+ +
+
language=language name
+

Specifies the language of the track in the Matroska languages form +

+
+ +
+
stereo_mode=mode
+

Stereo 3D video layout of two views in a single video track +

+
mono
+

video is not stereo +

+
left_right
+

Both views are arranged side by side, Left-eye view is on the left +

+
bottom_top
+

Both views are arranged in top-bottom orientation, Left-eye view is at bottom +

+
top_bottom
+

Both views are arranged in top-bottom orientation, Left-eye view is on top +

+
checkerboard_rl
+

Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first +

+
checkerboard_lr
+

Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first +

+
row_interleaved_rl
+

Each view is constituted by a row based interleaving, Right-eye view is first row +

+
row_interleaved_lr
+

Each view is constituted by a row based interleaving, Left-eye view is first row +

+
col_interleaved_rl
+

Both views are arranged in a column based interleaving manner, Right-eye view is first column +

+
col_interleaved_lr
+

Both views are arranged in a column based interleaving manner, Left-eye view is first column +

+
anaglyph_cyan_red
+

All frames are in anaglyph format viewable through red-cyan filters +

+
right_left
+

Both views are arranged side by side, Right-eye view is on the left +

+
anaglyph_green_magenta
+

All frames are in anaglyph format viewable through green-magenta filters +

+
block_lr
+

Both eyes laced in one Block, Left-eye view is first +

+
block_rl
+

Both eyes laced in one Block, Right-eye view is first +

+
+
+
+ +

For example a 3D WebM clip can be created using the following command line: +

 
ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
+
+ + +

15.8 segment

+ +

Basic stream segmenter. +

+

The segmenter muxer outputs streams to a number of separate files of nearly +fixed duration. Output filename pattern can be set in a fashion similar to +image2. +

+

Every segment starts with a video keyframe, if a video stream is present. +The segment muxer works best with a single constant frame rate video. +

+

Optionally it can generate a flat list of the created segments, one segment +per line. +

+
+
segment_format format
+

Override the inner container format, by default it is guessed by the filename +extension. +

+
segment_time t
+

Set segment duration to t seconds. +

+
segment_list name
+

Generate also a listfile named name. +

+
segment_list_size size
+

Overwrite the listfile once it reaches size entries. +

+
+ +
 
ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
+
+ + + +

16. Input Devices

+ +

Input devices are configured elements in FFmpeg which allow to access +the data coming from a multimedia device attached to your system. +

+

When you configure your FFmpeg build, all the supported input devices +are enabled by default. You can list all available ones using the +configure option "–list-indevs". +

+

You can disable all the input devices using the configure option +"–disable-indevs", and selectively enable an input device using the +option "–enable-indev=INDEV", or you can disable a particular +input device using the option "–disable-indev=INDEV". +

+

The option "-formats" of the ff* tools will display the list of +supported input devices (amongst the demuxers). +

+

A description of the currently available input devices follows. +

+ +

16.1 alsa

+ +

ALSA (Advanced Linux Sound Architecture) input device. +

+

To enable this input device during configuration you need libasound +installed on your system. +

+

This device allows capturing from an ALSA device. The name of the +device to capture has to be an ALSA card identifier. +

+

An ALSA identifier has the syntax: +

 
hw:CARD[,DEV[,SUBDEV]]
+
+ +

where the DEV and SUBDEV components are optional. +

+

The three arguments (in order: CARD,DEV,SUBDEV) +specify card number or identifier, device number and subdevice number +(-1 means any). +

+

To see the list of cards currently recognized by your system check the +files ‘/proc/asound/cards’ and ‘/proc/asound/devices’. +

+

For example to capture with ffmpeg from an ALSA device with +card id 0, you may run the command: +

 
ffmpeg -f alsa -i hw:0 alsaout.wav
+
+ +

For more information see: +http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html +

+ +

16.2 bktr

+ +

BSD video input device. +

+ +

16.3 dshow

+ +

Windows DirectShow input device. +

+

DirectShow support is enabled when FFmpeg is built with mingw-w64. +Currently only audio and video devices are supported. +

+

Multiple devices may be opened as separate inputs, but they may also be +opened on the same input, which should improve synchronism between them. +

+

The input name should be in the format: +

+
 
TYPE=NAME[:TYPE=NAME]
+
+ +

where TYPE can be either audio or video, +and NAME is the device’s name. +

+ +

16.3.1 Options

+ +

If no options are specified, the device’s defaults are used. +If the device does not support the requested options, it will +fail to open. +

+
+
video_size
+

Set the video size in the captured video. +

+
+
framerate
+

Set the framerate in the captured video. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. +

+
+
channels
+

Set the number of channels in the captured audio. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +

+
+
list_options
+

If set to ‘true’, print a list of selected device’s options +and exit. +

+
+
video_device_number
+

Set video device number for devices with same name (starts at 0, +defaults to 0). +

+
+
audio_device_number
+

Set audio device number for devices with same name (starts at 0, +defaults to 0). +

+
+
+ + +

16.3.2 Examples

+ + + + +

16.4 dv1394

+ +

Linux DV 1394 input device. +

+ +

16.5 fbdev

+ +

Linux framebuffer input device. +

+

The Linux framebuffer is a graphic hardware-independent abstraction +layer to show graphics on a computer monitor, typically on the +console. It is accessed through a file device node, usually +‘/dev/fb0’. +

+

For more detailed information read the file +Documentation/fb/framebuffer.txt included in the Linux source tree. +

+

To record from the framebuffer device ‘/dev/fb0’ with +ffmpeg: +

 
ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
+
+ +

You can take a single screenshot image with the command: +

 
ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
+
+ +

See also http://linux-fbdev.sourceforge.net/, and fbset(1). +

+ +

16.6 jack

+ +

JACK input device. +

+

To enable this input device during configuration you need libjack +installed on your system. +

+

A JACK input device creates one or more JACK writable clients, one for +each audio channel, with name client_name:input_N, where +client_name is the name provided by the application, and N +is a number which identifies the channel. +Each writable client will send the acquired data to the FFmpeg input +device. +

+

Once you have created one or more JACK readable clients, you need to +connect them to one or more JACK writable clients. +

+

To connect or disconnect JACK clients you can use the jack_connect +and jack_disconnect programs, or do it through a graphical interface, +for example with qjackctl. +

+

To list the JACK clients and their properties you can invoke the command +jack_lsp. +

+

Follows an example which shows how to capture a JACK readable client +with ffmpeg. +

 
# Create a JACK writable client with name "ffmpeg".
+$ ffmpeg -f jack -i ffmpeg -y out.wav
+
+# Start the sample jack_metro readable client.
+$ jack_metro -b 120 -d 0.2 -f 4000
+
+# List the current JACK clients.
+$ jack_lsp -c
+system:capture_1
+system:capture_2
+system:playback_1
+system:playback_2
+ffmpeg:input_1
+metro:120_bpm
+
+# Connect metro to the ffmpeg writable client.
+$ jack_connect metro:120_bpm ffmpeg:input_1
+
+ +

For more information read: +http://jackaudio.org/ +

+ +

16.7 lavfi

+ +

Libavfilter input virtual device. +

+

This input device reads data from the open output pads of a libavfilter +filtergraph. +

+

For each filtergraph open output, the input device will create a +corresponding stream which is mapped to the generated output. Currently +only video data is supported. The filtergraph is specified through the +option ‘graph’. +

+ +

16.7.1 Options

+ +
+
graph
+

Specify the filtergraph to use as input. Each video open output must be +labelled by a unique string of the form "outN", where N is a +number starting from 0 corresponding to the mapped input stream +generated by the device. +The first unlabelled output is automatically assigned to the "out0" +label, but all the others need to be specified explicitly. +

+

If not specified defaults to the filename specified for the input +device. +

+
+ + +

16.7.2 Examples

+ + + + +

16.8 libdc1394

+ +

IIDC1394 input device, based on libdc1394 and libraw1394. +

+ +

16.9 openal

+ +

The OpenAL input device provides audio capture on all systems with a +working OpenAL 1.1 implementation. +

+

To enable this input device during configuration, you need OpenAL +headers and libraries installed on your system, and need to configure +FFmpeg with --enable-openal. +

+

OpenAL headers and libraries should be provided as part of your OpenAL +implementation, or as an additional download (an SDK). Depending on your +installation you may need to specify additional flags via the +--extra-cflags and --extra-ldflags for allowing the build +system to locate the OpenAL headers and libraries. +

+

An incomplete list of OpenAL implementations follows: +

+
+
Creative
+

The official Windows implementation, providing hardware acceleration +with supported devices and software fallback. +See http://openal.org/. +

+
OpenAL Soft
+

Portable, open source (LGPL) software implementation. Includes +backends for the most common sound APIs on the Windows, Linux, +Solaris, and BSD operating systems. +See http://kcat.strangesoft.net/openal.html. +

+
Apple
+

OpenAL is part of Core Audio, the official Mac OS X Audio interface. +See http://developer.apple.com/technologies/mac/audio-and-video.html +

+
+ +

This device allows to capture from an audio input device handled +through OpenAL. +

+

You need to specify the name of the device to capture in the provided +filename. If the empty string is provided, the device will +automatically select the default device. You can get the list of the +supported devices by using the option list_devices. +

+ +

16.9.1 Options

+ +
+
channels
+

Set the number of channels in the captured audio. Only the values +‘1’ (monaural) and ‘2’ (stereo) are currently supported. +Defaults to ‘2’. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. Only the values +‘8’ and ‘16’ are currently supported. Defaults to +‘16’. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +Defaults to ‘44.1k’. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +Defaults to ‘false’. +

+
+
+ + +

16.9.2 Examples

+ +

Print the list of OpenAL supported devices and exit: +

 
$ ffmpeg -list_devices true -f openal -i dummy out.ogg
+
+ +

Capture from the OpenAL device ‘DR-BT101 via PulseAudio’: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
+
+ +

Capture from the default device (note the empty string ” as filename): +

 
$ ffmpeg -f openal -i '' out.ogg
+
+ +

Capture from two devices simultaneously, writing to two different files, +within the same ffmpeg command: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
+
+

Note: not all OpenAL implementations support multiple simultaneous capture - +try the latest OpenAL Soft if the above does not work. +

+ +

16.10 oss

+ +

Open Sound System input device. +

+

The filename to provide to the input device is the device node +representing the OSS input device, and is usually set to +‘/dev/dsp’. +

+

For example to grab from ‘/dev/dsp’ using ffmpeg use the +command: +

 
ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
+
+ +

For more information about OSS see: +http://manuals.opensound.com/usersguide/dsp.html +

+ +

16.11 pulse

+ +

pulseaudio input device. +

+

To enable this input device during configuration you need libpulse-simple +installed in your system. +

+

The filename to provide to the input device is a source device or the +string "default" +

+

To list the pulse source devices and their properties you can invoke +the command pactl list sources. +

+
 
ffmpeg -f pulse -i default /tmp/pulse.wav
+
+ + +

16.11.1 server AVOption

+ +

The syntax is: +

 
-server server name
+
+ +

Connects to a specific server. +

+ +

16.11.2 name AVOption

+ +

The syntax is: +

 
-name application name
+
+ +

Specify the application name pulse will use when showing active clients, +by default it is the LIBAVFORMAT_IDENT string +

+ +

16.11.3 stream_name AVOption

+ +

The syntax is: +

 
-stream_name stream name
+
+ +

Specify the stream name pulse will use when showing active streams, +by default it is "record" +

+ +

16.11.4 sample_rate AVOption

+ +

The syntax is: +

 
-sample_rate samplerate
+
+ +

Specify the samplerate in Hz, by default 48kHz is used. +

+ +

16.11.5 channels AVOption

+ +

The syntax is: +

 
-channels N
+
+ +

Specify the channels in use, by default 2 (stereo) is set. +

+ +

16.11.6 frame_size AVOption

+ +

The syntax is: +

 
-frame_size bytes
+
+ +

Specify the number of byte per frame, by default it is set to 1024. +

+ +

16.11.7 fragment_size AVOption

+ +

The syntax is: +

 
-fragment_size bytes
+
+ +

Specify the minimal buffering fragment in pulseaudio, it will affect the +audio latency. By default it is unset. +

+ +

16.12 sndio

+ +

sndio input device. +

+

To enable this input device during configuration you need libsndio +installed on your system. +

+

The filename to provide to the input device is the device node +representing the sndio input device, and is usually set to +‘/dev/audio0’. +

+

For example to grab from ‘/dev/audio0’ using ffmpeg use the +command: +

 
ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
+
+ + +

16.13 video4linux and video4linux2

+ +

Video4Linux and Video4Linux2 input video devices. +

+

The name of the device to grab is a file device node, usually Linux +systems tend to automatically create such nodes when the device +(e.g. an USB webcam) is plugged into the system, and has a name of the +kind ‘/dev/videoN’, where N is a number associated to +the device. +

+

Video4Linux and Video4Linux2 devices only support a limited set of +widthxheight sizes and framerates. You can check which are +supported for example with the command dov4l for Video4Linux +devices and using -list_formats all for Video4Linux2 devices. +

+

If the size for the device is set to 0x0, the input device will +try to auto-detect the size to use. +Only for the video4linux2 device, if the frame rate is set to 0/0 the +input device will use the frame rate value already set in the driver. +

+

Video4Linux support is deprecated since Linux 2.6.30, and will be +dropped in later versions. +

+

Note that if FFmpeg is build with v4l-utils support ("–enable-libv4l2" +option), it will always be used. +

+

Follow some usage examples of the video4linux devices with the ff* +tools. +

 
# Grab and show the input of a video4linux device, frame rate is set
+# to the default of 25/1.
+ffplay -s 320x240 -f video4linux /dev/video0
+
+# Grab and show the input of a video4linux2 device, auto-adjust size.
+ffplay -f video4linux2 /dev/video0
+
+# Grab and record the input of a video4linux2 device, auto-adjust size,
+# frame rate value defaults to 0/0 so it is read from the video4linux2
+# driver.
+ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
+
+ +

"v4l" and "v4l2" can be used as aliases for the respective "video4linux" and +"video4linux2". +

+ +

16.14 vfwcap

+ +

VfW (Video for Windows) capture input device. +

+

The filename passed as input is the capture driver number, ranging from +0 to 9. You may use "list" as filename to print a list of drivers. Any +other filename will be interpreted as device number 0. +

+ +

16.15 x11grab

+ +

X11 video input device. +

+

This device allows to capture a region of an X11 display. +

+

The filename passed as input has the syntax: +

 
[hostname]:display_number.screen_number[+x_offset,y_offset]
+
+ +

hostname:display_number.screen_number specifies the +X11 display name of the screen to grab from. hostname can be +omitted, and defaults to "localhost". The environment variable +DISPLAY contains the default display name. +

+

x_offset and y_offset specify the offsets of the grabbed +area with respect to the top-left border of the X11 screen. They +default to 0. +

+

Check the X11 documentation (e.g. man X) for more detailed information. +

+

Use the dpyinfo program for getting basic information about the +properties of your X11 display (e.g. grep for "name" or "dimensions"). +

+

For example to grab from ‘:0.0’ using ffmpeg: +

 
ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
+
+# Grab at position 10,20.
+ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
+
+ + +

16.15.1 follow_mouse AVOption

+ +

The syntax is: +

 
-follow_mouse centered|PIXELS
+
+ +

When it is specified with "centered", the grabbing region follows the mouse +pointer and keeps the pointer at the center of region; otherwise, the region +follows only when the mouse pointer reaches within PIXELS (greater than +zero) to the edge of region. +

+

For example: +

 
ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
+
+# Follows only when the mouse pointer reaches within 100 pixels to edge
+ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
+
+ + +

16.15.2 show_region AVOption

+ +

The syntax is: +

 
-show_region 1
+
+ +

If show_region AVOption is specified with 1, then the grabbing +region will be indicated on screen. With this option, it’s easy to know what is +being grabbed if only a portion of the screen is grabbed. +

+

For example: +

 
ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
+
+# With follow_mouse
+ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
+
+ + +

17. Output Devices

+ +

Output devices are configured elements in FFmpeg which allow to write +multimedia data to an output device attached to your system. +

+

When you configure your FFmpeg build, all the supported output devices +are enabled by default. You can list all available ones using the +configure option "–list-outdevs". +

+

You can disable all the output devices using the configure option +"–disable-outdevs", and selectively enable an output device using the +option "–enable-outdev=OUTDEV", or you can disable a particular +input device using the option "–disable-outdev=OUTDEV". +

+

The option "-formats" of the ff* tools will display the list of +enabled output devices (amongst the muxers). +

+

A description of the currently available output devices follows. +

+ +

17.1 alsa

+ +

ALSA (Advanced Linux Sound Architecture) output device. +

+ +

17.2 oss

+ +

OSS (Open Sound System) output device. +

+ +

17.3 sdl

+ +

SDL (Simple DirectMedia Layer) output device. +

+

This output devices allows to show a video stream in an SDL +window. Only one SDL window is allowed per application, so you can +have only one instance of this output device in an application. +

+

To enable this output device you need libsdl installed on your system +when configuring your build. +

+

For more information about SDL, check: +http://www.libsdl.org/ +

+ +

17.3.1 Options

+ +
+
window_title
+

Set the SDL window title, if not specified default to the filename +specified for the output device. +

+
+
icon_title
+

Set the name of the iconified SDL window, if not specified it is set +to the same value of window_title. +

+
+
window_size
+

Set the SDL window size, can be a string of the form +widthxheight or a video size abbreviation. +If not specified it defaults to the size of the input video. +

+
+ + +

17.3.2 Examples

+ +

The following command shows the ffmpeg output is an +SDL window, forcing its size to the qcif format: +

 
ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL output"
+
+ + +

17.4 sndio

+ +

sndio audio output device. +

+ +

18. Protocols

+ +

Protocols are configured elements in FFmpeg which allow to access +resources which require the use of a particular protocol. +

+

When you configure your FFmpeg build, all the supported protocols are +enabled by default. You can list all available ones using the +configure option "–list-protocols". +

+

You can disable all the protocols using the configure option +"–disable-protocols", and selectively enable a protocol using the +option "–enable-protocol=PROTOCOL", or you can disable a +particular protocol using the option +"–disable-protocol=PROTOCOL". +

+

The option "-protocols" of the ff* tools will display the list of +supported protocols. +

+

A description of the currently available protocols follows. +

+ +

18.1 applehttp

+ +

Read Apple HTTP Live Streaming compliant segmented stream as +a uniform one. The M3U8 playlists describing the segments can be +remote HTTP resources or local files, accessed using the standard +file protocol. +HTTP is default, specific protocol can be declared by specifying +"+proto" after the applehttp URI scheme name, where proto +is either "file" or "http". +

+
 
applehttp://host/path/to/remote/resource.m3u8
+applehttp+http://host/path/to/remote/resource.m3u8
+applehttp+file://path/to/local/resource.m3u8
+
+ + +

18.2 concat

+ +

Physical concatenation protocol. +

+

Allow to read and seek from many resource in sequence as if they were +a unique resource. +

+

A URL accepted by this protocol has the syntax: +

 
concat:URL1|URL2|...|URLN
+
+ +

where URL1, URL2, ..., URLN are the urls of the +resource to be concatenated, each one possibly specifying a distinct +protocol. +

+

For example to read a sequence of files ‘split1.mpeg’, +‘split2.mpeg’, ‘split3.mpeg’ with ffplay use the +command: +

 
ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
+
+ +

Note that you may need to escape the character "|" which is special for +many shells. +

+ +

18.3 file

+ +

File access protocol. +

+

Allow to read from or read to a file. +

+

For example to read from a file ‘input.mpeg’ with ffmpeg +use the command: +

 
ffmpeg -i file:input.mpeg output.mpeg
+
+ +

The ff* tools default to the file protocol, that is a resource +specified with the name "FILE.mpeg" is interpreted as the URL +"file:FILE.mpeg". +

+ +

18.4 gopher

+ +

Gopher protocol. +

+ +

18.5 http

+ +

HTTP (Hyper Text Transfer Protocol). +

+ +

18.6 mmst

+ +

MMS (Microsoft Media Server) protocol over TCP. +

+ +

18.7 mmsh

+ +

MMS (Microsoft Media Server) protocol over HTTP. +

+

The required syntax is: +

 
mmsh://server[:port][/app][/playpath]
+
+ + +

18.8 md5

+ +

MD5 output protocol. +

+

Computes the MD5 hash of the data to be written, and on close writes +this to the designated output or stdout if none is specified. It can +be used to test muxers without writing an actual file. +

+

Some examples follow. +

 
# Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
+ffmpeg -i input.flv -f avi -y md5:output.avi.md5
+
+# Write the MD5 hash of the encoded AVI file to stdout.
+ffmpeg -i input.flv -f avi -y md5:
+
+ +

Note that some formats (typically MOV) require the output protocol to +be seekable, so they will fail with the MD5 output protocol. +

+ +

18.9 pipe

+ +

UNIX pipe access protocol. +

+

Allow to read and write from UNIX pipes. +

+

The accepted syntax is: +

 
pipe:[number]
+
+ +

number is the number corresponding to the file descriptor of the +pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number +is not specified, by default the stdout file descriptor will be used +for writing, stdin for reading. +

+

For example to read from stdin with ffmpeg: +

 
cat test.wav | ffmpeg -i pipe:0
+# ...this is the same as...
+cat test.wav | ffmpeg -i pipe:
+
+ +

For writing to stdout with ffmpeg: +

 
ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
+# ...this is the same as...
+ffmpeg -i test.wav -f avi pipe: | cat > test.avi
+
+ +

Note that some formats (typically MOV), require the output protocol to +be seekable, so they will fail with the pipe output protocol. +

+ +

18.10 rtmp

+ +

Real-Time Messaging Protocol. +

+

The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia +content across a TCP/IP network. +

+

The required syntax is: +

 
rtmp://server[:port][/app][/playpath]
+
+ +

The accepted parameters are: +

+
server
+

The address of the RTMP server. +

+
+
port
+

The number of the TCP port to use (by default is 1935). +

+
+
app
+

It is the name of the application to access. It usually corresponds to +the path where the application is installed on the RTMP server +(e.g. ‘/ondemand/’, ‘/flash/live/’, etc.). +

+
+
playpath
+

It is the path or name of the resource to play with reference to the +application specified in app, may be prefixed by "mp4:". +

+
+
+ +

For example to read with ffplay a multimedia resource named +"sample" from the application "vod" from an RTMP server "myserver": +

 
ffplay rtmp://myserver/vod/sample
+
+ + +

18.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte

+ +

Real-Time Messaging Protocol and its variants supported through +librtmp. +

+

Requires the presence of the librtmp headers and library during +configuration. You need to explicitly configure the build with +"–enable-librtmp". If enabled this will replace the native RTMP +protocol. +

+

This protocol provides most client functions and a few server +functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), +encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled +variants of these encrypted types (RTMPTE, RTMPTS). +

+

The required syntax is: +

 
rtmp_proto://server[:port][/app][/playpath] options
+
+ +

where rtmp_proto is one of the strings "rtmp", "rtmpt", "rtmpe", +"rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and +server, port, app and playpath have the same +meaning as specified for the RTMP native protocol. +options contains a list of space-separated options of the form +key=val. +

+

See the librtmp manual page (man 3 librtmp) for more information. +

+

For example, to stream a file in real-time to an RTMP server using +ffmpeg: +

 
ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
+
+ +

To play the same stream using ffplay: +

 
ffplay "rtmp://myserver/live/mystream live=1"
+
+ + +

18.12 rtp

+ +

Real-Time Protocol. +

+ +

18.13 rtsp

+ +

RTSP is not technically a protocol handler in libavformat, it is a demuxer +and muxer. The demuxer supports both normal RTSP (with data transferred +over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with +data transferred over RDT). +

+

The muxer can be used to send a stream using RTSP ANNOUNCE to a server +supporting it (currently Darwin Streaming Server and Mischa Spiegelmock’s +RTSP server). +

+

The required syntax for a RTSP url is: +

 
rtsp://hostname[:port]/path
+
+ +

The following options (set on the ffmpeg/ffplay command +line, or set in code via AVOptions or in avformat_open_input), +are supported: +

+

Flags for rtsp_transport: +

+
+
udp
+

Use UDP as lower transport protocol. +

+
+
tcp
+

Use TCP (interleaving within the RTSP control channel) as lower +transport protocol. +

+
+
udp_multicast
+

Use UDP multicast as lower transport protocol. +

+
+
http
+

Use HTTP tunneling as lower transport protocol, which is useful for +passing proxies. +

+
+ +

Multiple lower transport protocols may be specified, in that case they are +tried one at a time (if the setup of one fails, the next one is tried). +For the muxer, only the tcp and udp options are supported. +

+

Flags for rtsp_flags: +

+
+
filter_src
+

Accept packets only from negotiated peer address and port. +

+
+ +

When receiving data over UDP, the demuxer tries to reorder received packets +(since they may arrive out of order, or packets may get lost totally). In +order for this to be enabled, a maximum delay must be specified in the +max_delay field of AVFormatContext. +

+

When watching multi-bitrate Real-RTSP streams with ffplay, the +streams to display can be chosen with -vst n and +-ast n for video and audio respectively, and can be switched +on the fly by pressing v and a. +

+

Example command lines: +

+

To watch a stream over UDP, with a max reordering delay of 0.5 seconds: +

+
 
ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
+
+ +

To watch a stream tunneled over HTTP: +

+
 
ffplay -rtsp_transport http rtsp://server/video.mp4
+
+ +

To send a stream in realtime to a RTSP server, for others to watch: +

+
 
ffmpeg -re -i input -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
+
+ + +

18.14 sap

+ +

Session Announcement Protocol (RFC 2974). This is not technically a +protocol handler in libavformat, it is a muxer and demuxer. +It is used for signalling of RTP streams, by announcing the SDP for the +streams regularly on a separate port. +

+ +

18.14.1 Muxer

+ +

The syntax for a SAP url given to the muxer is: +

 
sap://destination[:port][?options]
+
+ +

The RTP packets are sent to destination on port port, +or to port 5004 if no port is specified. +options is a &-separated list. The following options +are supported: +

+
+
announce_addr=address
+

Specify the destination IP address for sending the announcements to. +If omitted, the announcements are sent to the commonly used SAP +announcement multicast address 224.2.127.254 (sap.mcast.net), or +ff0e::2:7ffe if destination is an IPv6 address. +

+
+
announce_port=port
+

Specify the port to send the announcements on, defaults to +9875 if not specified. +

+
+
ttl=ttl
+

Specify the time to live value for the announcements and RTP packets, +defaults to 255. +

+
+
same_port=0|1
+

If set to 1, send all RTP streams on the same port pair. If zero (the +default), all streams are sent on unique ports, with each stream on a +port 2 numbers higher than the previous. +VLC/Live555 requires this to be set to 1, to be able to receive the stream. +The RTP stack in libavformat for receiving requires all streams to be sent +on unique ports. +

+
+ +

Example command lines follow. +

+

To broadcast a stream on the local subnet, for watching in VLC: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255?same_port=1
+
+ +

Similarly, for watching in ffplay: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255
+
+ +

And for watching in ffplay, over IPv6: +

+
 
ffmpeg -re -i input -f sap sap://[ff0e::1:2:3:4]
+
+ + +

18.14.2 Demuxer

+ +

The syntax for a SAP url given to the demuxer is: +

 
sap://[address][:port]
+
+ +

address is the multicast address to listen for announcements on, +if omitted, the default 224.2.127.254 (sap.mcast.net) is used. port +is the port that is listened on, 9875 if omitted. +

+

The demuxers listens for announcements on the given address and port. +Once an announcement is received, it tries to receive that particular stream. +

+

Example command lines follow. +

+

To play back the first stream announced on the normal SAP multicast address: +

+
 
ffplay sap://
+
+ +

To play back the first stream announced on one the default IPv6 SAP multicast address: +

+
 
ffplay sap://[ff0e::2:7ffe]
+
+ + +

18.15 tcp

+ +

Trasmission Control Protocol. +

+

The required syntax for a TCP url is: +

 
tcp://hostname:port[?options]
+
+ +
+
listen
+

Listen for an incoming connection +

+
 
ffmpeg -i input -f format tcp://hostname:port?listen
+ffplay tcp://hostname:port
+
+ +
+
+ + +

18.16 udp

+ +

User Datagram Protocol. +

+

The required syntax for a UDP url is: +

 
udp://hostname:port[?options]
+
+ +

options contains a list of &-seperated options of the form key=val. +Follow the list of supported options. +

+
+
buffer_size=size
+

set the UDP buffer size in bytes +

+
+
localport=port
+

override the local UDP port to bind with +

+
+
localaddr=addr
+

Choose the local IP address. This is useful e.g. if sending multicast +and the host has multiple interfaces, where the user can choose +which interface to send on by specifying the IP address of that interface. +

+
+
pkt_size=size
+

set the size in bytes of UDP packets +

+
+
reuse=1|0
+

explicitly allow or disallow reusing UDP sockets +

+
+
ttl=ttl
+

set the time to live value (for multicast only) +

+
+
connect=1|0
+

Initialize the UDP socket with connect(). In this case, the +destination address can’t be changed with ff_udp_set_remote_url later. +If the destination address isn’t known at the start, this option can +be specified in ff_udp_set_remote_url, too. +This allows finding out the source address for the packets with getsockname, +and makes writes return with AVERROR(ECONNREFUSED) if "destination +unreachable" is received. +For receiving, this gives the benefit of only receiving packets from +the specified peer address/port. +

+
+ +

Some usage examples of the udp protocol with ffmpeg follow. +

+

To stream over UDP to a remote endpoint: +

 
ffmpeg -i input -f format udp://hostname:port
+
+ +

To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer: +

 
ffmpeg -i input -f mpegts udp://hostname:port?pkt_size=188&buffer_size=65535
+
+ +

To receive over UDP from a remote endpoint: +

 
ffmpeg -i udp://[multicast-address]:port
+
+ + +

19. Bitstream Filters

+ +

When you configure your FFmpeg build, all the supported bitstream +filters are enabled by default. You can list all available ones using +the configure option --list-bsfs. +

+

You can disable all the bitstream filters using the configure option +--disable-bsfs, and selectively enable any bitstream filter using +the option --enable-bsf=BSF, or you can disable a particular +bitstream filter using the option --disable-bsf=BSF. +

+

The option -bsfs of the ff* tools will display the list of +all the supported bitstream filters included in your build. +

+

Below is a description of the currently available bitstream filters. +

+ +

19.1 aac_adtstoasc

+ + +

19.2 chomp

+ + +

19.3 dump_extradata

+ + +

19.4 h264_mp4toannexb

+ +

Convert an H.264 bitstream from length prefixed mode to start code +prefixed mode (as defined in the Annex B of the ITU-T H.264 +specification). +

+

This is required by some streaming formats, typically the MPEG-2 +transport stream format ("mpegts"). +

+

For example to remux an MP4 file containing an H.264 stream to mpegts +format with ffmpeg, you can use the command: +

+
 
ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
+
+ + +

19.5 imx_dump_header

+ + +

19.6 mjpeg2jpeg

+ +

Convert MJPEG/AVI1 packets to full JPEG/JFIF packets. +

+

MJPEG is a video codec wherein each video frame is essentially a +JPEG image. The individual frames can be extracted without loss, +e.g. by +

+
 
ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
+
+ +

Unfortunately, these chunks are incomplete JPEG images, because +they lack the DHT segment required for decoding. Quoting from +http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml: +

+

Avery Lee, writing in the rec.video.desktop newsgroup in 2001, +commented that "MJPEG, or at least the MJPEG in AVIs having the +MJPG fourcc, is restricted JPEG with a fixed – and *omitted* – +Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, +and it must use basic Huffman encoding, not arithmetic or +progressive. . . . You can indeed extract the MJPEG frames and +decode them with a regular JPEG decoder, but you have to prepend +the DHT segment to them, or else the decoder won’t have any idea +how to decompress the data. The exact table necessary is given in +the OpenDML spec." +

+

This bitstream filter patches the header of frames extracted from an MJPEG +stream (carrying the AVI1 header ID and lacking a DHT segment) to +produce fully qualified JPEG images. +

+
 
ffmpeg -i mjpeg-movie.avi -c:v copy -vbsf mjpeg2jpeg frame_%d.jpg
+exiftran -i -9 frame*.jpg
+ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
+
+ + +

19.7 mjpega_dump_header

+ + +

19.8 movsub

+ + +

19.9 mp3_header_compress

+ + +

19.10 mp3_header_decompress

+ + +

19.11 noise

+ + +

19.12 remove_extradata

+ + +

20. Filtergraph description

+ +

A filtergraph is a directed graph of connected filters. It can contain +cycles, and there can be multiple links between a pair of +filters. Each link has one input pad on one side connecting it to one +filter from which it takes its input, and one output pad on the other +side connecting it to the one filter accepting its output. +

+

Each filter in a filtergraph is an instance of a filter class +registered in the application, which defines the features and the +number of input and output pads of the filter. +

+

A filter with no input pads is called a "source", a filter with no +output pads is called a "sink". +

+ +

20.1 Filtergraph syntax

+ +

A filtergraph can be represented using a textual representation, which +is recognized by the -vf option of the ff* +tools, and by the avfilter_graph_parse() function defined in +‘libavfilter/avfiltergraph.h’. +

+

A filterchain consists of a sequence of connected filters, each one +connected to the previous one in the sequence. A filterchain is +represented by a list of ","-separated filter descriptions. +

+

A filtergraph consists of a sequence of filterchains. A sequence of +filterchains is represented by a list of ";"-separated filterchain +descriptions. +

+

A filter is represented by a string of the form: +[in_link_1]...[in_link_N]filter_name=arguments[out_link_1]...[out_link_M] +

+

filter_name is the name of the filter class of which the +described filter is an instance of, and has to be the name of one of +the filter classes registered in the program. +The name of the filter class is optionally followed by a string +"=arguments". +

+

arguments is a string which contains the parameters used to +initialize the filter instance, and are described in the filter +descriptions below. +

+

The list of arguments can be quoted using the character "’" as initial +and ending mark, and the character ’\’ for escaping the characters +within the quoted text; otherwise the argument string is considered +terminated when the next special character (belonging to the set +"[]=;,") is encountered. +

+

The name and arguments of the filter are optionally preceded and +followed by a list of link labels. +A link label allows to name a link and associate it to a filter output +or input pad. The preceding labels in_link_1 +... in_link_N, are associated to the filter input pads, +the following labels out_link_1 ... out_link_M, are +associated to the output pads. +

+

When two link labels with the same name are found in the +filtergraph, a link between the corresponding input and output pad is +created. +

+

If an output pad is not labelled, it is linked by default to the first +unlabelled input pad of the next filter in the filterchain. +For example in the filterchain: +

 
nullsrc, split[L1], [L2]overlay, nullsink
+
+

the split filter instance has two output pads, and the overlay filter +instance two input pads. The first output pad of split is labelled +"L1", the first input pad of overlay is labelled "L2", and the second +output pad of split is linked to the second input pad of overlay, +which are both unlabelled. +

+

In a complete filterchain all the unlabelled filter input and output +pads must be connected. A filtergraph is considered valid if all the +filter input and output pads of all the filterchains are connected. +

+

Follows a BNF description for the filtergraph syntax: +

 
NAME             ::= sequence of alphanumeric characters and '_'
+LINKLABEL        ::= "[" NAME "]"
+LINKLABELS       ::= LINKLABEL [LINKLABELS]
+FILTER_ARGUMENTS ::= sequence of chars (eventually quoted)
+FILTER           ::= [LINKNAMES] NAME ["=" ARGUMENTS] [LINKNAMES]
+FILTERCHAIN      ::= FILTER [,FILTERCHAIN]
+FILTERGRAPH      ::= FILTERCHAIN [;FILTERGRAPH]
+
+ + + +

21. Audio Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the audio filters included in your +build. +

+

Below is a description of the currently available audio filters. +

+ +

21.1 aconvert

+ +

Convert the input audio format to the specified formats. +

+

The filter accepts a string of the form: +"sample_format:channel_layout:packing_format". +

+

sample_format specifies the sample format, and can be a string or +the corresponding numeric value defined in ‘libavutil/samplefmt.h’. +

+

channel_layout specifies the channel layout, and can be a string +or the corresponding number value defined in ‘libavutil/audioconvert.h’. +

+

packing_format specifies the type of packing in output, can be one +of "planar" or "packed", or the corresponding numeric values "0" or "1". +

+

The special parameter "auto", signifies that the filter will +automatically select the output format depending on the output filter. +

+

Some examples follow. +

+ + + +

21.2 aformat

+ +

Convert the input audio to one of the specified formats. The framework will +negotiate the most appropriate format to minimize conversions. +

+

The filter accepts three lists of formats, separated by ":", in the form: +"sample_formats:channel_layouts:packing_formats". +

+

Elements in each list are separated by "," which has to be escaped in the +filtergraph specification. +

+

The special parameter "all", in place of a list of elements, signifies all +supported formats. +

+

Some examples follow: +

 
aformat=u8\\,s16:mono:packed
+
+aformat=s16:mono\\,stereo:all
+
+ + +

21.3 amerge

+ +

Merge two audio streams into a single multi-channel stream. +

+

This filter does not need any argument. +

+

If the channel layouts of the inputs are disjoint, and therefore compatible, +the channel layout of the output will be set accordingly and the channels +will be reordered as necessary. If the channel layouts of the inputs are not +disjoint, the output will have all the channels of the first input then all +the channels of the second input, in that order, and the channel layout of +the output will be the default value corresponding to the total number of +channels. +

+

For example, if the first input is in 2.1 (FL+FR+LF) and the second input +is FC+BL+BR, then the output will be in 5.1, with the channels in the +following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the +first input, b1 is the first channel of the second input). +

+

On the other hand, if both input are in stereo, the output channels will be +in the default order: a1, a2, b1, b2, and the channel layout will be +arbitrarily set to 4.0, which may or may not be the expected value. +

+

Both inputs must have the same sample rate, format and packing. +

+

If inputs do not have the same duration, the output will stop with the +shortest. +

+

Example: merge two mono files into a stereo stream: +

 
amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
+
+ + +

21.4 anull

+ +

Pass the audio source unchanged to the output. +

+ +

21.5 aresample

+ +

Resample the input audio to the specified sample rate. +

+

The filter accepts exactly one parameter, the output sample rate. If not +specified then the filter will automatically convert between its input +and output sample rates. +

+

For example, to resample the input audio to 44100Hz: +

 
aresample=44100
+
+ + +

21.6 ashowinfo

+ +

Show a line containing various information for each input audio frame. +The input audio is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad, and +is usually 1/sample_rate. +

+
+
pts_time
+

presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic audio) +

+
+
fmt
+

sample format name +

+
+
chlayout
+

channel layout description +

+
+
nb_samples
+

number of samples (per each channel) contained in the filtered frame +

+
+
rate
+

sample rate for the audio frame +

+
+
planar
+

if the packing format is planar, 0 if packed +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) for each input frame plane, +expressed in the form "[c0 c1 c2 c3 c4 c5 +c6 c7]" +

+
+ + +

21.7 asplit

+ +

Pass on the input audio to two outputs. Both outputs are identical to +the input audio. +

+

For example: +

 
[in] asplit[out0], showaudio[out1]
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

21.8 astreamsync

+ +

Forward two audio streams and control the order the buffers are forwarded. +

+

The argument to the filter is an expression deciding which stream should be +forwarded next: if the result is negative, the first stream is forwarded; if +the result is positive or zero, the second stream is forwarded. It can use +the following variables: +

+
+
b1 b2
+

number of buffers forwarded so far on each stream +

+
s1 s2
+

number of samples forwarded so far on each stream +

+
t1 t2
+

current timestamp of each stream +

+
+ +

The default value is t1-t2, which means to always forward the stream +that has a smaller timestamp. +

+

Example: stress-test amerge by randomly sending buffers on the wrong +input, while avoiding too much of a desynchronization: +

 
amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
+[a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
+[a2] [b2] amerge
+
+ + +

21.9 earwax

+ +

Make audio easier to listen to on headphones. +

+

This filter adds ‘cues’ to 44.1kHz stereo (i.e. audio CD format) audio +so that when listened to on headphones the stereo image is moved from +inside your head (standard for headphones) to outside and in front of +the listener (standard for speakers). +

+

Ported from SoX. +

+ +

21.10 pan

+ +

Mix channels with specific gain levels. The filter accepts the output +channel layout followed by a set of channels definitions. +

+

This filter is also designed to remap efficiently the channels of an audio +stream. +

+

The filter accepts parameters of the form: +"l:outdef:outdef:..." +

+
+
l
+

output channel layout or number of channels +

+
+
outdef
+

output channel specification, of the form: +"out_name=[gain*]in_name[+[gain*]in_name...]" +

+
+
out_name
+

output channel to define, either a channel name (FL, FR, etc.) or a channel +number (c0, c1, etc.) +

+
+
gain
+

multiplicative coefficient for the channel, 1 leaving the volume unchanged +

+
+
in_name
+

input channel to use, see out_name for details; it is not possible to mix +named and numbered input channels +

+
+ +

If the ‘=’ in a channel specification is replaced by ‘<’, then the gains for +that specification will be renormalized so that the total is 1, thus +avoiding clipping noise. +

+ +

21.10.1 Mixing examples

+ +

For example, if you want to down-mix from stereo to mono, but with a bigger +factor for the left channel: +

 
pan=1:c0=0.9*c0+0.1*c1
+
+ +

A customized down-mix to stereo that works automatically for 3-, 4-, 5- and +7-channels surround: +

 
pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
+
+ +

Note that ffmpeg integrates a default down-mix (and up-mix) system +that should be preferred (see "-ac" option) unless you have very specific +needs. +

+ +

21.10.2 Remapping examples

+ +

The channel remapping will be effective if, and only if: +

+ + +

If all these conditions are satisfied, the filter will notify the user ("Pure +channel mapping detected"), and use an optimized and lossless method to do the +remapping. +

+

For example, if you have a 5.1 source and want a stereo audio stream by +dropping the extra channels: +

 
pan="stereo: c0=FL : c1=FR"
+
+ +

Given the same source, you can also switch front left and front right channels +and keep the input channel layout: +

 
pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
+
+ +

If the input is a stereo audio stream, you can mute the front left channel (and +still keep the stereo channel layout) with: +

 
pan="stereo:c1=c1"
+
+ +

Still with a stereo audio stream input, you can copy the right channel in both +front left and right: +

 
pan="stereo: c0=FR : c1=FR"
+
+ + +

21.11 silencedetect

+ +

Detect silence in an audio stream. +

+

This filter logs a message when it detects that the input audio volume is less +or equal to a noise tolerance value for a duration greater or equal to the +minimum detected noise duration. +

+

The printed times and duration are expressed in seconds. +

+
+
duration, d
+

Set silence duration until notification (default is 2 seconds). +

+
+
noise, n
+

Set noise tolerance. Can be specified in dB (in case "dB" is appended to the +specified value) or amplitude ratio. Default is -60dB, or 0.001. +

+
+ +

Detect 5 seconds of silence with -50dB noise tolerance: +

 
silencedetect=n=-50dB:d=5
+
+ +

Complete example with ffmpeg to detect silence with 0.0001 noise +tolerance in ‘silence.mp3’: +

 
ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
+
+ + +

21.12 volume

+ +

Adjust the input audio volume. +

+

The filter accepts exactly one parameter vol, which expresses +how the audio volume will be increased or decreased. +

+

Output values are clipped to the maximum value. +

+

If vol is expressed as a decimal number, the output audio +volume is given by the relation: +

 
output_volume = vol * input_volume
+
+ +

If vol is expressed as a decimal number followed by the string +"dB", the value represents the requested change in decibels of the +input audio power, and the output audio volume is given by the +relation: +

 
output_volume = 10^(vol/20) * input_volume
+
+ +

Otherwise vol is considered an expression and its evaluated +value is used for computing the output audio volume according to the +first relation. +

+

Default value for vol is 1.0. +

+ +

21.12.1 Examples

+ + + + + +

22. Audio Sources

+ +

Below is a description of the currently available audio sources. +

+ +

22.1 abuffer

+ +

Buffer audio frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/asrc_abuffer.h’. +

+

It accepts the following mandatory parameters: +sample_rate:sample_fmt:channel_layout:packing +

+
+
sample_rate
+

The sample rate of the incoming audio buffers. +

+
+
sample_fmt
+

The sample format of the incoming audio buffers. +Either a sample format name or its corresponging integer representation from +the enum AVSampleFormat in ‘libavutil/samplefmt.h’ +

+
+
channel_layout
+

The channel layout of the incoming audio buffers. +Either a channel layout name from channel_layout_map in +‘libavutil/audioconvert.c’ or its corresponding integer representation +from the AV_CH_LAYOUT_* macros in ‘libavutil/audioconvert.h’ +

+
+
packing
+

Either "packed" or "planar", or their integer representation: 0 or 1 +respectively. +

+
+
+ +

For example: +

 
abuffer=44100:s16:stereo:planar
+
+ +

will instruct the source to accept planar 16bit signed stereo at 44100Hz. +Since the sample format with name "s16" corresponds to the number +1 and the "stereo" channel layout corresponds to the value 3, this is +equivalent to: +

 
abuffer=44100:1:3:1
+
+ + +

22.2 aevalsrc

+ +

Generate an audio signal specified by an expression. +

+

This source accepts in input one or more expressions (one for each +channel), which are evaluated and used to generate a corresponding +audio signal. +

+

It accepts the syntax: exprs[::options]. +exprs is a list of expressions separated by ":", one for each +separate channel. The output channel layout depends on the number of +provided expressions, up to 8 channels are supported. +

+

options is an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
duration, d
+

Set the minimum duration of the sourced audio. See the function +av_parse_time() for the accepted format. +Note that the resulting duration may be greater than the specified +duration, as the generated audio is always cut at the end of a +complete frame. +

+

If not specified, or the expressed duration is negative, the audio is +supposed to be generated forever. +

+
+
nb_samples, n
+

Set the number of samples per channel per each output frame, +default to 1024. +

+
+
sample_rate, s
+

Specify the sample rate, default to 44100. +

+
+ +

Each expression in exprs can contain the following constants: +

+
+
n
+

number of the evaluated sample, starting from 0 +

+
+
t
+

time of the evaluated sample expressed in seconds, starting from 0 +

+
+
s
+

sample rate +

+
+
+ + +

22.2.1 Examples

+ + + + +

22.3 amovie

+ +

Read an audio stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specify the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specify the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specify the index of the audio stream to read. If the value is -1, +the best suited audio stream will be automatically selected. Default +value is "-1". +

+
+
+ + +

22.4 anullsrc

+ +

Null audio source, return unprocessed audio frames. It is mainly useful +as a template and to be employed in analysis / debugging tools, or as +the source for filters which ignore the input data (for example the sox +synth filter). +

+

It accepts an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
sample_rate, s
+

Specify the sample rate, and defaults to 44100. +

+
+
channel_layout, cl
+
+

Specify the channel layout, and can be either an integer or a string +representing a channel layout. The default value of channel_layout +is "stereo". +

+

Check the channel_layout_map definition in +‘libavcodec/audioconvert.c’ for the mapping between strings and +channel layout values. +

+
+
nb_samples, n
+

Set the number of samples per requested frames. +

+
+
+ +

Follow some examples: +

 
#  set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
+anullsrc=r=48000:cl=4
+
+# same as
+anullsrc=r=48000:cl=mono
+
+ + + +

23. Audio Sinks

+ +

Below is a description of the currently available audio sinks. +

+ +

23.1 abuffersink

+ +

Buffer audio frames, and make them available to the end of filter chain. +

+

This sink is mainly intended for programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It requires a pointer to an AVABufferSinkContext structure, which +defines the incoming buffers’ formats, to be passed as the opaque +parameter to avfilter_init_filter for initialization. +

+ +

23.2 anullsink

+ +

Null audio sink, do absolutely nothing with the input audio. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + +

24. Video Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the video filters included in your +build. +

+

Below is a description of the currently available video filters. +

+ +

24.1 ass

+ +

Draw ASS (Advanced Substation Alpha) subtitles on top of input video +using the libass library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libass. +

+

This filter accepts in input the name of the ass file to render. +

+

For example, to render the file ‘sub.ass’ on top of the input +video, use the command: +

 
ass=sub.ass
+
+ + +

24.2 blackframe

+ +

Detect frames that are (almost) completely black. Can be useful to +detect chapter transitions or commercials. Output lines consist of +the frame number of the detected frame, the percentage of blackness, +the position in the file if known or -1 and the timestamp in seconds. +

+

In order to display the output lines, you need to set the loglevel at +least to the AV_LOG_INFO value. +

+

The filter accepts the syntax: +

 
blackframe[=amount:[threshold]]
+
+ +

amount is the percentage of the pixels that have to be below the +threshold, and defaults to 98. +

+

threshold is the threshold below which a pixel value is +considered black, and defaults to 32. +

+ +

24.3 boxblur

+ +

Apply boxblur algorithm to the input video. +

+

This filter accepts the parameters: +luma_radius:luma_power:chroma_radius:chroma_power:alpha_radius:alpha_power +

+

Chroma and alpha parameters are optional, if not specified they default +to the corresponding values set for luma_radius and +luma_power. +

+

luma_radius, chroma_radius, and alpha_radius represent +the radius in pixels of the box used for blurring the corresponding +input plane. They are expressions, and can contain the following +constants: +

+
w, h
+

the input width and height in pixels +

+
+
cw, ch
+

the input chroma image width and height in pixels +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

The radius must be a non-negative number, and must not be greater than +the value of the expression min(w,h)/2 for the luma and alpha planes, +and of min(cw,ch)/2 for the chroma planes. +

+

luma_power, chroma_power, and alpha_power represent +how many times the boxblur filter is applied to the corresponding +plane. +

+

Some examples follow: +

+ + + +

24.4 copy

+ +

Copy the input source unchanged to the output. Mainly useful for +testing purposes. +

+ +

24.5 crop

+ +

Crop the input video to out_w:out_h:x:y. +

+

The parameters are expressions containing the following constants: +

+
+
x, y
+

the computed values for x and y. They are evaluated for +each new frame. +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
pos
+

the position in the file of the input frame, NAN if unknown +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
+ +

The out_w and out_h parameters specify the expressions for +the width and height of the output (cropped) video. They are +evaluated just at the configuration of the filter. +

+

The default value of out_w is "in_w", and the default value of +out_h is "in_h". +

+

The expression for out_w may depend on the value of out_h, +and the expression for out_h may depend on out_w, but they +cannot depend on x and y, as x and y are +evaluated after out_w and out_h. +

+

The x and y parameters specify the expressions for the +position of the top-left corner of the output (non-cropped) area. They +are evaluated for each frame. If the evaluated value is not valid, it +is approximated to the nearest valid value. +

+

The default value of x is "(in_w-out_w)/2", and the default +value for y is "(in_h-out_h)/2", which set the cropped area at +the center of the input image. +

+

The expression for x may depend on y, and the expression +for y may depend on x. +

+

Follow some examples: +

 
# crop the central input area with size 100x100
+crop=100:100
+
+# crop the central input area with size 2/3 of the input video
+"crop=2/3*in_w:2/3*in_h"
+
+# crop the input video central square
+crop=in_h
+
+# delimit the rectangle with the top-left corner placed at position
+# 100:100 and the right-bottom corner corresponding to the right-bottom
+# corner of the input image.
+crop=in_w-100:in_h-100:100:100
+
+# crop 10 pixels from the left and right borders, and 20 pixels from
+# the top and bottom borders
+"crop=in_w-2*10:in_h-2*20"
+
+# keep only the bottom right quarter of the input image
+"crop=in_w/2:in_h/2:in_w/2:in_h/2"
+
+# crop height for getting Greek harmony
+"crop=in_w:1/PHI*in_w"
+
+# trembling effect
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
+
+# erratic camera effect depending on timestamp
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
+
+# set x depending on the value of y
+"crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
+
+ + +

24.6 cropdetect

+ +

Auto-detect crop size. +

+

Calculate necessary cropping parameters and prints the recommended +parameters through the logging system. The detected dimensions +correspond to the non-black area of the input video. +

+

It accepts the syntax: +

 
cropdetect[=limit[:round[:reset]]]
+
+ +
+
limit
+

Threshold, which can be optionally specified from nothing (0) to +everything (255), defaults to 24. +

+
+
round
+

Value which the width/height should be divisible by, defaults to +16. The offset is automatically adjusted to center the video. Use 2 to +get only even dimensions (needed for 4:2:2 video). 16 is best when +encoding to most video codecs. +

+
+
reset
+

Counter that determines after how many frames cropdetect will reset +the previously detected largest video area and start over to detect +the current optimal crop area. Defaults to 0. +

+

This can be useful when channel logos distort the video area. 0 +indicates never reset and return the largest area encountered during +playback. +

+
+ + +

24.7 delogo

+ +

Suppress a TV station logo by a simple interpolation of the surrounding +pixels. Just set a rectangle covering the logo and watch it disappear +(and sometimes something even uglier appear - your mileage may vary). +

+

The filter accepts parameters as a string of the form +"x:y:w:h:band", or as a list of +key=value pairs, separated by ":". +

+

The description of the accepted parameters follows. +

+
+
x, y
+

Specify the top left corner coordinates of the logo. They must be +specified. +

+
+
w, h
+

Specify the width and height of the logo to clear. They must be +specified. +

+
+
band, t
+

Specify the thickness of the fuzzy edge of the rectangle (added to +w and h). The default value is 4. +

+
+
show
+

When set to 1, a green rectangle is drawn on the screen to simplify +finding the right x, y, w, h parameters, and +band is set to 4. The default value is 0. +

+
+
+ +

Some examples follow. +

+ + + +

24.8 deshake

+ +

Attempt to fix small changes in horizontal and/or vertical shift. This +filter helps remove camera shake from hand-holding a camera, bumping a +tripod, moving on a vehicle, etc. +

+

The filter accepts parameters as a string of the form +"x:y:w:h:rx:ry:edge:blocksize:contrast:search:filename" +

+

A description of the accepted parameters follows. +

+
+
x, y, w, h
+

Specify a rectangular area where to limit the search for motion +vectors. +If desired the search for motion vectors can be limited to a +rectangular area of the frame defined by its top left corner, width +and height. These parameters have the same meaning as the drawbox +filter which can be used to visualise the position of the bounding +box. +

+

This is useful when simultaneous movement of subjects within the frame +might be confused for camera motion by the motion vector search. +

+

If any or all of x, y, w and h are set to -1 +then the full frame is used. This allows later options to be set +without specifying the bounding box for the motion vector search. +

+

Default - search the whole frame. +

+
+
rx, ry
+

Specify the maximum extent of movement in x and y directions in the +range 0-64 pixels. Default 16. +

+
+
edge
+

Specify how to generate pixels to fill blanks at the edge of the +frame. An integer from 0 to 3 as follows: +

+
0
+

Fill zeroes at blank locations +

+
1
+

Original image at blank locations +

+
2
+

Extruded edge value at blank locations +

+
3
+

Mirrored edge at blank locations +

+
+ +

The default setting is mirror edge at blank locations. +

+
+
blocksize
+

Specify the blocksize to use for motion search. Range 4-128 pixels, +default 8. +

+
+
contrast
+

Specify the contrast threshold for blocks. Only blocks with more than +the specified contrast (difference between darkest and lightest +pixels) will be considered. Range 1-255, default 125. +

+
+
search
+

Specify the search strategy 0 = exhaustive search, 1 = less exhaustive +search. Default - exhaustive search. +

+
+
filename
+

If set then a detailed log of the motion search is written to the +specified file. +

+
+
+ + +

24.9 drawbox

+ +

Draw a colored box on the input image. +

+

It accepts the syntax: +

 
drawbox=x:y:width:height:color
+
+ +
+
x, y
+

Specify the top left corner coordinates of the box. Default to 0. +

+
+
width, height
+

Specify the width and height of the box, if 0 they are interpreted as +the input width and height. Default to 0. +

+
+
color
+

Specify the color of the box to write, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+
+ +

Follow some examples: +

 
# draw a black box around the edge of the input image
+drawbox
+
+# draw a box with color red and an opacity of 50%
+drawbox=10:20:200:60:red@0.5"
+
+ + +

24.10 drawtext

+ +

Draw text string or text from specified file on top of video using the +libfreetype library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libfreetype. +

+

The filter also recognizes strftime() sequences in the provided text +and expands them accordingly. Check the documentation of strftime(). +

+

The filter accepts parameters as a list of key=value pairs, +separated by ":". +

+

The description of the accepted parameters follows. +

+
+
fontfile
+

The font file to be used for drawing text. Path must be included. +This parameter is mandatory. +

+
+
text
+

The text string to be drawn. The text must be a sequence of UTF-8 +encoded characters. +This parameter is mandatory if no file is specified with the parameter +textfile. +

+
+
textfile
+

A text file containing text to be drawn. The text must be a sequence +of UTF-8 encoded characters. +

+

This parameter is mandatory if no text string is specified with the +parameter text. +

+

If both text and textfile are specified, an error is thrown. +

+
+
x, y
+

The expressions which specify the offsets where text will be drawn +within the video frame. They are relative to the top/left border of the +output image. +

+

The default value of x and y is "0". +

+

See below for the list of accepted constants. +

+
+
fontsize
+

The font size to be used for drawing text. +The default value of fontsize is 16. +

+
+
fontcolor
+

The color to be used for drawing fonts. +Either a string (e.g. "red") or in 0xRRGGBB[AA] format +(e.g. "0xff000033"), possibly followed by an alpha specifier. +The default value of fontcolor is "black". +

+
+
boxcolor
+

The color to be used for drawing box around text. +Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format +(e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of boxcolor is "white". +

+
+
box
+

Used to draw a box around text using background color. +Value should be either 1 (enable) or 0 (disable). +The default value of box is 0. +

+
+
shadowx, shadowy
+

The x and y offsets for the text shadow position with respect to the +position of the text. They can be either positive or negative +values. Default value for both is "0". +

+
+
shadowcolor
+

The color to be used for drawing a shadow behind the drawn text. It +can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA] +form (e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of shadowcolor is "black". +

+
+
ft_load_flags
+

Flags to be used for loading the fonts. +

+

The flags map the corresponding flags supported by libfreetype, and are +a combination of the following values: +

+
default
+
no_scale
+
no_hinting
+
render
+
no_bitmap
+
vertical_layout
+
force_autohint
+
crop_bitmap
+
pedantic
+
ignore_global_advance_width
+
no_recurse
+
ignore_transform
+
monochrome
+
linear_design
+
no_autohint
+
end table
+
+ +

Default value is "render". +

+

For more information consult the documentation for the FT_LOAD_* +libfreetype flags. +

+
+
tabsize
+

The size in number of spaces to use for rendering the tab. +Default value is 4. +

+
+ +

The parameters for x and y are expressions containing the +following constants: +

+
+
W, H
+

the input width and height +

+
+
tw, text_w
+

the width of the rendered text +

+
+
th, text_h
+

the height of the rendered text +

+
+
lh, line_h
+

the height of each text line +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (w / h) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
max_glyph_w
+

maximum glyph width, that is the maximum width for all the glyphs +contained in the rendered text +

+
+
max_glyph_h
+

maximum glyph height, that is the maximum height for all the glyphs +contained in the rendered text, it is equivalent to ascent - +descent. +

+
+
max_glyph_a, ascent
+
+

the maximum distance from the baseline to the highest/upper grid +coordinate used to place a glyph outline point, for all the rendered +glyphs. +It is a positive value, due to the grid’s orientation with the Y axis +upwards. +

+
+
max_glyph_d, descent
+

the maximum distance from the baseline to the lowest grid coordinate +used to place a glyph outline point, for all the rendered glyphs. +This is a negative value, due to the grid’s orientation, with the Y axis +upwards. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
timecode
+

initial timecode representation in "hh:mm:ss[:;.]ff" format. It can be used +with or without text parameter. rate option must be specified. +Note that timecode options are not effective if FFmpeg is build with +--disable-avcodec. +

+
+
r, rate
+

frame rate (timecode only) +

+
+ +

Some examples follow. +

+ + +

For more information about libfreetype, check: +http://www.freetype.org/. +

+ +

24.11 fade

+ +

Apply fade-in/out effect to input video. +

+

It accepts the parameters: +type:start_frame:nb_frames[:options] +

+

type specifies if the effect type, can be either "in" for +fade-in, or "out" for a fade-out effect. +

+

start_frame specifies the number of the start frame for starting +to apply the fade effect. +

+

nb_frames specifies the number of frames for which the fade +effect has to last. At the end of the fade-in effect the output video +will have the same intensity as the input video, at the end of the +fade-out transition the output video will be completely black. +

+

options is an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
type, t
+

See type. +

+
+
start_frame, s
+

See start_frame. +

+
+
nb_frames, n
+

See nb_frames. +

+
+
alpha
+

If set to 1, fade only alpha channel, if one exists on the input. +Default value is 0. +

+
+ +

A few usage examples follow, usable too as test scenarios. +

 
# fade in first 30 frames of video
+fade=in:0:30
+
+# fade out last 45 frames of a 200-frame video
+fade=out:155:45
+
+# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
+fade=in:0:25, fade=out:975:25
+
+# make first 5 frames black, then fade in from frame 5-24
+fade=in:5:20
+
+# fade in alpha over first 25 frames of video
+fade=in:0:25:alpha=1
+
+ + +

24.12 fieldorder

+ +

Transform the field order of the input video. +

+

It accepts one parameter which specifies the required field order that +the input interlaced video will be transformed to. The parameter can +assume one of the following values: +

+
+
0 or bff
+

output bottom field first +

+
1 or tff
+

output top field first +

+
+ +

Default value is "tff". +

+

Transformation is achieved by shifting the picture content up or down +by one line, and filling the remaining line with appropriate picture content. +This method is consistent with most broadcast field order converters. +

+

If the input video is not flagged as being interlaced, or it is already +flagged as being of the required output field order then this filter does +not alter the incoming video. +

+

This filter is very useful when converting to or from PAL DV material, +which is bottom field first. +

+

For example: +

 
ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
+
+ + +

24.13 fifo

+ +

Buffer input images and send them when they are requested. +

+

This filter is mainly useful when auto-inserted by the libavfilter +framework. +

+

The filter does not take parameters. +

+ +

24.14 format

+ +

Convert the input video to one of the specified pixel formats. +Libavfilter will try to pick one that is supported for the input to +the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# convert the input video to the format "yuv420p"
+format=yuv420p
+
+# convert the input video to any of the formats in the list
+format=yuv420p:yuv444p:yuv410p
+
+ +

+

+

24.15 frei0r

+ +

Apply a frei0r effect to the input video. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The filter supports the syntax: +

 
filter_name[{:|=}param1:param2:...:paramN]
+
+ +

filter_name is the name to the frei0r effect to load. If the +environment variable FREI0R_PATH is defined, the frei0r effect +is searched in each one of the directories specified by the colon +separated list in FREIOR_PATH, otherwise in the standard frei0r +paths, which are in this order: ‘HOME/.frei0r-1/lib/’, +‘/usr/local/lib/frei0r-1/’, ‘/usr/lib/frei0r-1/’. +

+

param1, param2, ... , paramN specify the parameters +for the frei0r effect. +

+

A frei0r effect parameter can be a boolean (whose values are specified +with "y" and "n"), a double, a color (specified by the syntax +R/G/B, R, G, and B being float +numbers from 0.0 to 1.0) or by an av_parse_color() color +description), a position (specified by the syntax X/Y, +X and Y being float numbers) and a string. +

+

The number and kind of parameters depend on the loaded effect. If an +effect parameter is not specified the default value is set. +

+

Some examples follow: +

 
# apply the distort0r effect, set the first two double parameters
+frei0r=distort0r:0.5:0.01
+
+# apply the colordistance effect, takes a color as first parameter
+frei0r=colordistance:0.2/0.3/0.4
+frei0r=colordistance:violet
+frei0r=colordistance:0x112233
+
+# apply the perspective effect, specify the top left and top right
+# image positions
+frei0r=perspective:0.2/0.2:0.8/0.2
+
+ +

For more information see: +http://piksel.org/frei0r +

+ +

24.16 gradfun

+ +

Fix the banding artifacts that are sometimes introduced into nearly flat +regions by truncation to 8bit color depth. +Interpolate the gradients that should go where the bands are, and +dither them. +

+

This filter is designed for playback only. Do not use it prior to +lossy compression, because compression tends to lose the dither and +bring back the bands. +

+

The filter takes two optional parameters, separated by ’:’: +strength:radius +

+

strength is the maximum amount by which the filter will change +any one pixel. Also the threshold for detecting nearly flat +regions. Acceptable values range from .51 to 255, default value is +1.2, out-of-range values will be clipped to the valid range. +

+

radius is the neighborhood to fit the gradient to. A larger +radius makes for smoother gradients, but also prevents the filter from +modifying the pixels near detailed regions. Acceptable values are +8-32, default value is 16, out-of-range values will be clipped to the +valid range. +

+
 
# default parameters
+gradfun=1.2:16
+
+# omitting radius
+gradfun=1.2
+
+ + +

24.17 hflip

+ +

Flip the input video horizontally. +

+

For example to horizontally flip the input video with ffmpeg: +

 
ffmpeg -i in.avi -vf "hflip" out.avi
+
+ + +

24.18 hqdn3d

+ +

High precision/quality 3d denoise filter. This filter aims to reduce +image noise producing smooth images and making still images really +still. It should enhance compressibility. +

+

It accepts the following optional parameters: +luma_spatial:chroma_spatial:luma_tmp:chroma_tmp +

+
+
luma_spatial
+

a non-negative float number which specifies spatial luma strength, +defaults to 4.0 +

+
+
chroma_spatial
+

a non-negative float number which specifies spatial chroma strength, +defaults to 3.0*luma_spatial/4.0 +

+
+
luma_tmp
+

a float number which specifies luma temporal strength, defaults to +6.0*luma_spatial/4.0 +

+
+
chroma_tmp
+

a float number which specifies chroma temporal strength, defaults to +luma_tmp*chroma_spatial/luma_spatial +

+
+ + +

24.19 lut, lutrgb, lutyuv

+ +

Compute a look-up table for binding each pixel component input value +to an output value, and apply it to input video. +

+

lutyuv applies a lookup table to a YUV input video, lutrgb +to an RGB input video. +

+

These filters accept in input a ":"-separated list of options, which +specify the expressions used for computing the lookup table for the +corresponding pixel component values. +

+

The lut filter requires either YUV or RGB pixel formats in +input, and accepts the options: +

+
c0
+

first pixel component +

+
c1
+

second pixel component +

+
c2
+

third pixel component +

+
c3
+

fourth pixel component, corresponds to the alpha component +

+
+ +

The exact component associated to each option depends on the format in +input. +

+

The lutrgb filter requires RGB pixel formats in input, and +accepts the options: +

+
r
+

red component +

+
g
+

green component +

+
b
+

blue component +

+
a
+

alpha component +

+
+ +

The lutyuv filter requires YUV pixel formats in input, and +accepts the options: +

+
y
+

Y/luminance component +

+
u
+

U/Cb component +

+
v
+

V/Cr component +

+
a
+

alpha component +

+
+ +

The expressions can contain the following constants and functions: +

+
+
w, h
+

the input width and height +

+
+
val
+

input value for the pixel component +

+
+
clipval
+

the input value clipped in the minval-maxval range +

+
+
maxval
+

maximum value for the pixel component +

+
+
minval
+

minimum value for the pixel component +

+
+
negval
+

the negated value for the pixel component value clipped in the +minval-maxval range , it corresponds to the expression +"maxval-clipval+minval" +

+
+
clip(val)
+

the computed value in val clipped in the +minval-maxval range +

+
+
gammaval(gamma)
+

the computed gamma correction value of the pixel component value +clipped in the minval-maxval range, corresponds to the +expression +"pow((clipval-minval)/(maxval-minval)\,gamma)*(maxval-minval)+minval" +

+
+
+ +

All expressions default to "val". +

+

Some examples follow: +

 
# negate input video
+lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
+lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
+
+# the above is the same as
+lutrgb="r=negval:g=negval:b=negval"
+lutyuv="y=negval:u=negval:v=negval"
+
+# negate luminance
+lutyuv=y=negval
+
+# remove chroma components, turns the video into a graytone image
+lutyuv="u=128:v=128"
+
+# apply a luma burning effect
+lutyuv="y=2*val"
+
+# remove green and blue components
+lutrgb="g=0:b=0"
+
+# set a constant alpha channel value on input
+format=rgba,lutrgb=a="maxval-minval/2"
+
+# correct luminance gamma by a 0.5 factor
+lutyuv=y=gammaval(0.5)
+
+ + +

24.20 mp

+ +

Apply an MPlayer filter to the input video. +

+

This filter provides a wrapper around most of the filters of +MPlayer/MEncoder. +

+

This wrapper is considered experimental. Some of the wrapped filters +may not work properly and we may drop support for them, as they will +be implemented natively into FFmpeg. Thus you should avoid +depending on them when writing portable scripts. +

+

The filters accepts the parameters: +filter_name[:=]filter_params +

+

filter_name is the name of a supported MPlayer filter, +filter_params is a string containing the parameters accepted by +the named filter. +

+

The list of the currently supported filters follows: +

+
2xsai
+
decimate
+
denoise3d
+
detc
+
dint
+
divtc
+
down3dright
+
dsize
+
eq2
+
eq
+
field
+
fil
+
fixpts
+
framestep
+
fspp
+
geq
+
harddup
+
hqdn3d
+
hue
+
il
+
ilpack
+
ivtc
+
kerndeint
+
mcdeint
+
mirror
+
noise
+
ow
+
palette
+
perspective
+
phase
+
pp7
+
pullup
+
qp
+
rectangle
+
remove-logo
+
rotate
+
sab
+
screenshot
+
smartblur
+
softpulldown
+
softskip
+
spp
+
swapuv
+
telecine
+
tile
+
tinterlace
+
unsharp
+
uspp
+
yuvcsp
+
yvu9
+
+ +

The parameter syntax and behavior for the listed filters are the same +of the corresponding MPlayer filters. For detailed instructions check +the "VIDEO FILTERS" section in the MPlayer manual. +

+

Some examples follow: +

 
# remove a logo by interpolating the surrounding pixels
+mp=delogo=200:200:80:20:1
+
+# adjust gamma, brightness, contrast
+mp=eq2=1.0:2:0.5
+
+# tweak hue and saturation
+mp=hue=100:-10
+
+ +

See also mplayer(1), http://www.mplayerhq.hu/. +

+ +

24.21 negate

+ +

Negate input video. +

+

This filter accepts an integer in input, if non-zero it negates the +alpha component (if available). The default value in input is 0. +

+ +

24.22 noformat

+ +

Force libavfilter not to use any of the specified pixel formats for the +input to the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# force libavfilter to use a format different from "yuv420p" for the
+# input to the vflip filter
+noformat=yuv420p,vflip
+
+# convert the input video to any of the formats not contained in the list
+noformat=yuv420p:yuv444p:yuv410p
+
+ + +

24.23 null

+ +

Pass the video source unchanged to the output. +

+ +

24.24 ocv

+ +

Apply video transform using libopencv. +

+

To enable this filter install libopencv library and headers and +configure FFmpeg with --enable-libopencv. +

+

The filter takes the parameters: filter_name{:=}filter_params. +

+

filter_name is the name of the libopencv filter to apply. +

+

filter_params specifies the parameters to pass to the libopencv +filter. If not specified the default values are assumed. +

+

Refer to the official libopencv documentation for more precise +information: +http://opencv.willowgarage.com/documentation/c/image_filtering.html +

+

Follows the list of supported libopencv filters. +

+

+

+

24.24.1 dilate

+ +

Dilate an image by using a specific structuring element. +This filter corresponds to the libopencv function cvDilate. +

+

It accepts the parameters: struct_el:nb_iterations. +

+

struct_el represents a structuring element, and has the syntax: +colsxrows+anchor_xxanchor_y/shape +

+

cols and rows represent the number of columns and rows of +the structuring element, anchor_x and anchor_y the anchor +point, and shape the shape for the structuring element, and +can be one of the values "rect", "cross", "ellipse", "custom". +

+

If the value for shape is "custom", it must be followed by a +string of the form "=filename". The file with name +filename is assumed to represent a binary image, with each +printable character corresponding to a bright pixel. When a custom +shape is used, cols and rows are ignored, the number +or columns and rows of the read file are assumed instead. +

+

The default value for struct_el is "3x3+0x0/rect". +

+

nb_iterations specifies the number of times the transform is +applied to the image, and defaults to 1. +

+

Follow some example: +

 
# use the default values
+ocv=dilate
+
+# dilate using a structuring element with a 5x5 cross, iterate two times
+ocv=dilate=5x5+2x2/cross:2
+
+# read the shape from the file diamond.shape, iterate two times
+# the file diamond.shape may contain a pattern of characters like this:
+#   *
+#  ***
+# *****
+#  ***
+#   *
+# the specified cols and rows are ignored (but not the anchor point coordinates)
+ocv=0x0+2x2/custom=diamond.shape:2
+
+ + +

24.24.2 erode

+ +

Erode an image by using a specific structuring element. +This filter corresponds to the libopencv function cvErode. +

+

The filter accepts the parameters: struct_el:nb_iterations, +with the same syntax and semantics as the dilate filter. +

+ +

24.24.3 smooth

+ +

Smooth the input video. +

+

The filter takes the following parameters: +type:param1:param2:param3:param4. +

+

type is the type of smooth filter to apply, and can be one of +the following values: "blur", "blur_no_scale", "median", "gaussian", +"bilateral". The default value is "gaussian". +

+

param1, param2, param3, and param4 are +parameters whose meanings depend on smooth type. param1 and +param2 accept integer positive values or 0, param3 and +param4 accept float values. +

+

The default value for param1 is 3, the default value for the +other parameters is 0. +

+

These parameters correspond to the parameters assigned to the +libopencv function cvSmooth. +

+

+

+

24.25 overlay

+ +

Overlay one video on top of another. +

+

It takes two inputs and one output, the first input is the "main" +video on which the second input is overlayed. +

+

It accepts the parameters: x:y[:options]. +

+

x is the x coordinate of the overlayed video on the main video, +y is the y coordinate. x and y are expressions containing +the following parameters: +

+
+
main_w, main_h
+

main input width and height +

+
+
W, H
+

same as main_w and main_h +

+
+
overlay_w, overlay_h
+

overlay input width and height +

+
+
w, h
+

same as overlay_w and overlay_h +

+
+ +

options is an optional list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
rgb
+

If set to 1, force the filter to accept inputs in the RGB +color space. Default value is 0. +

+
+ +

Be aware that frames are taken from each input video in timestamp +order, hence, if their initial timestamps differ, it is a a good idea +to pass the two inputs through a setpts=PTS-STARTPTS filter to +have them begin in the same zero timestamp, as it does the example for +the movie filter. +

+

Follow some examples: +

 
# draw the overlay at 10 pixels from the bottom right
+# corner of the main video.
+overlay=main_w-overlay_w-10:main_h-overlay_h-10
+
+# insert a transparent PNG logo in the bottom left corner of the input
+movie=logo.png [logo];
+[in][logo] overlay=10:main_h-overlay_h-10 [out]
+
+# insert 2 different transparent PNG logos (second logo on bottom
+# right corner):
+movie=logo1.png [logo1];
+movie=logo2.png [logo2];
+[in][logo1]       overlay=10:H-h-10 [in+logo1];
+[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
+
+# add a transparent color layer on top of the main video,
+# WxH specifies the size of the main input to the overlay filter
+color=red.3:WxH [over]; [in][over] overlay [out]
+
+ +

You can chain together more overlays but the efficiency of such +approach is yet to be tested. +

+ +

24.26 pad

+ +

Add paddings to the input image, and places the original input at the +given coordinates x, y. +

+

It accepts the following parameters: +width:height:x:y:color. +

+

The parameters width, height, x, and y are +expressions containing the following constants: +

+
+
in_w, in_h
+

the input video width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output width and height, that is the size of the padded area as +specified by the width and height expressions +

+
+
ow, oh
+

same as out_w and out_h +

+
+
x, y
+

x and y offsets as specified by the x and y +expressions, or NAN if not yet specified +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

Follows the description of the accepted parameters. +

+
+
width, height
+
+

Specify the size of the output image with the paddings added. If the +value for width or height is 0, the corresponding input size +is used for the output. +

+

The width expression can reference the value set by the +height expression, and vice versa. +

+

The default value of width and height is 0. +

+
+
x, y
+
+

Specify the offsets where to place the input image in the padded area +with respect to the top/left border of the output image. +

+

The x expression can reference the value set by the y +expression, and vice versa. +

+

The default value of x and y is 0. +

+
+
color
+
+

Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+

The default value of color is "black". +

+
+
+ +

Some examples follow: +

+
 
# Add paddings with color "violet" to the input video. Output video
+# size is 640x480, the top-left corner of the input video is placed at
+# column 0, row 40.
+pad=640:480:0:40:violet
+
+# pad the input to get an output with dimensions increased bt 3/2,
+# and put the input video at the center of the padded area
+pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a squared output with size equal to the maximum
+# value between the input width and height, and put the input video at
+# the center of the padded area
+pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a final w/h ratio of 16:9
+pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
+
+# for anamorphic video, in order to set the output display aspect ratio,
+# it is necessary to use sar in the expression, according to the relation:
+# (ih * X / ih) * sar = output_dar
+# X = output_dar / sar
+pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
+
+# double output size and put the input video in the bottom-right
+# corner of the output padded area
+pad="2*iw:2*ih:ow-iw:oh-ih"
+
+ + +

24.27 pixdesctest

+ +

Pixel format descriptor test filter, mainly useful for internal +testing. The output video should be equal to the input video. +

+

For example: +

 
format=monow, pixdesctest
+
+ +

can be used to test the monowhite pixel format descriptor definition. +

+ +

24.28 scale

+ +

Scale the input video to width:height[:interl={1|-1}] and/or convert the image format. +

+

The parameters width and height are expressions containing +the following constants: +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

If the input image format is different from the format requested by +the next filter, the scale filter will convert the input to the +requested format. +

+

If the value for width or height is 0, the respective input +size is used for the output. +

+

If the value for width or height is -1, the scale filter will +use, for the respective output size, a value that maintains the aspect +ratio of the input image. +

+

The default value of width and height is 0. +

+

Valid values for the optional parameter interl are: +

+
+
1
+

force interlaced aware scaling +

+
+
-1
+

select interlaced aware scaling depending on whether the source frames +are flagged as interlaced or not +

+
+ +

Some examples follow: +

 
# scale the input video to a size of 200x100.
+scale=200:100
+
+# scale the input to 2x
+scale=2*iw:2*ih
+# the above is the same as
+scale=2*in_w:2*in_h
+
+# scale the input to half size
+scale=iw/2:ih/2
+
+# increase the width, and set the height to the same size
+scale=3/2*iw:ow
+
+# seek for Greek harmony
+scale=iw:1/PHI*iw
+scale=ih*PHI:ih
+
+# increase the height, and set the width to 3/2 of the height
+scale=3/2*oh:3/5*ih
+
+# increase the size, but make the size a multiple of the chroma
+scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
+
+# increase the width to a maximum of 500 pixels, keep the same input aspect ratio
+scale='min(500\, iw*3/2):-1'
+
+ + +

24.29 select

+

Select frames to pass in output. +

+

It accepts in input an expression, which is evaluated for each input +frame. If the expression is evaluated to a non-zero value, the frame +is selected and passed to the output, otherwise it is discarded. +

+

The expression can contain the following constants: +

+
+
n
+

the sequential number of the filtered frame, starting from 0 +

+
+
selected_n
+

the sequential number of the selected frame, starting from 0 +

+
+
prev_selected_n
+

the sequential number of the last selected frame, NAN if undefined +

+
+
TB
+

timebase of the input timestamps +

+
+
pts
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in TB units, NAN if undefined +

+
+
t
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in seconds, NAN if undefined +

+
+
prev_pts
+

the PTS of the previously filtered video frame, NAN if undefined +

+
+
prev_selected_pts
+

the PTS of the last previously filtered video frame, NAN if undefined +

+
+
prev_selected_t
+

the PTS of the last previously selected video frame, NAN if undefined +

+
+
start_pts
+

the PTS of the first video frame in the video, NAN if undefined +

+
+
start_t
+

the time of the first video frame in the video, NAN if undefined +

+
+
pict_type
+

the type of the filtered frame, can assume one of the following +values: +

+
I
+
P
+
B
+
S
+
SI
+
SP
+
BI
+
+ +
+
interlace_type
+

the frame interlace type, can assume one of the following values: +

+
PROGRESSIVE
+

the frame is progressive (not interlaced) +

+
TOPFIRST
+

the frame is top-field-first +

+
BOTTOMFIRST
+

the frame is bottom-field-first +

+
+ +
+
key
+

1 if the filtered frame is a key-frame, 0 otherwise +

+
+
pos
+

the position in the file of the filtered frame, -1 if the information +is not available (e.g. for synthetic video) +

+
+ +

The default value of the select expression is "1". +

+

Some examples follow: +

+
 
# select all frames in input
+select
+
+# the above is the same as:
+select=1
+
+# skip all frames:
+select=0
+
+# select only I-frames
+select='eq(pict_type\,I)'
+
+# select one frame every 100
+select='not(mod(n\,100))'
+
+# select only frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)'
+
+# select only I frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
+
+# select frames with a minimum distance of 10 seconds
+select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
+
+ +

+

+

24.30 setdar

+ +

Set the Display Aspect Ratio for the filter output video. +

+

This is done by changing the specified Sample (aka Pixel) Aspect +Ratio, according to the following equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that this filter does not modify the pixel dimensions of +the video frame. Also the display aspect ratio set by this filter may +be changed by later filters in the filterchain, e.g. in case of +scaling or if another "setdar" or a "setsar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +display aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the display aspect ratio to 16:9, specify: +

 
setdar=16:9
+# the above is equivalent to
+setdar=1.77777
+
+ +

See also the setsar filter documentation. +

+ +

24.31 setpts

+ +

Change the PTS (presentation timestamp) of the input video frames. +

+

Accept in input an expression evaluated through the eval API, which +can contain the following constants: +

+
+
PTS
+

the presentation timestamp in input +

+
+
N
+

the count of the input frame, starting from 0. +

+
+
STARTPTS
+

the PTS of the first video frame +

+
+
INTERLACED
+

tell if the current frame is interlaced +

+
+
POS
+

original position in the file of the frame, or undefined if undefined +for the current frame +

+
+
PREV_INPTS
+

previous input PTS +

+
+
PREV_OUTPTS
+

previous output PTS +

+
+
+ +

Some examples follow: +

+
 
# start counting PTS from zero
+setpts=PTS-STARTPTS
+
+# fast motion
+setpts=0.5*PTS
+
+# slow motion
+setpts=2.0*PTS
+
+# fixed rate 25 fps
+setpts=N/(25*TB)
+
+# fixed rate 25 fps with some jitter
+setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
+
+ +

+

+

24.32 setsar

+ +

Set the Sample (aka Pixel) Aspect Ratio for the filter output video. +

+

Note that as a consequence of the application of this filter, the +output display aspect ratio will change according to the following +equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that the sample aspect ratio set by this filter may be +changed by later filters in the filterchain, e.g. if another "setsar" +or a "setdar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +sample aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the sample aspect ratio to 10:11, specify: +

 
setsar=10:11
+
+ + +

24.33 settb

+ +

Set the timebase to use for the output frames timestamps. +It is mainly useful for testing timebase configuration. +

+

It accepts in input an arithmetic expression representing a rational. +The expression can contain the constants "AVTB" (the +default timebase), and "intb" (the input timebase). +

+

The default value for the input is "intb". +

+

Follow some examples. +

+
 
# set the timebase to 1/25
+settb=1/25
+
+# set the timebase to 1/10
+settb=0.1
+
+#set the timebase to 1001/1000
+settb=1+0.001
+
+#set the timebase to 2*intb
+settb=2*intb
+
+#set the default timebase value
+settb=AVTB
+
+ + +

24.34 showinfo

+ +

Show a line containing various information for each input video frame. +The input video is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

Presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad. +

+
+
pts_time
+

Presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic video) +

+
+
fmt
+

pixel format name +

+
+
sar
+

sample aspect ratio of the input frame, expressed in the form +num/den +

+
+
s
+

size of the input frame, expressed in the form +widthxheight +

+
+
i
+

interlaced mode ("P" for "progressive", "T" for top field first, "B" +for bottom field first) +

+
+
iskey
+

1 if the frame is a key frame, 0 otherwise +

+
+
type
+

picture type of the input frame ("I" for an I-frame, "P" for a +P-frame, "B" for a B-frame, "?" for unknown type). +Check also the documentation of the AVPictureType enum and of +the av_get_picture_type_char function defined in +‘libavutil/avutil.h’. +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) of each plane of the input frame, +expressed in the form "[c0 c1 c2 c3]" +

+
+ + +

24.35 slicify

+ +

Pass the images of input video on to next video filter as multiple +slices. +

+
 
ffmpeg -i in.avi -vf "slicify=32" out.avi
+
+ +

The filter accepts the slice height as parameter. If the parameter is +not specified it will use the default value of 16. +

+

Adding this in the beginning of filter chains should make filtering +faster due to better use of the memory cache. +

+ +

24.36 split

+ +

Pass on the input video to two outputs. Both outputs are identical to +the input video. +

+

For example: +

 
[in] split [splitout1][splitout2];
+[splitout1] crop=100:100:0:0    [cropout];
+[splitout2] pad=200:200:100:100 [padout];
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

24.37 thumbnail

+

Select the most representative frame in a given sequence of consecutive frames. +

+

It accepts as argument the frames batch size to analyze (default N=100); +in a set of N frames, the filter will pick one of them, and then handle +the next batch of N frames until the end. +

+

Since the filter keeps track of the whole frames sequence, a bigger N +value will result in a higher memory usage, so a high value is not recommended. +

+

The following example extract one picture each 50 frames: +

 
thumbnail=50
+
+ +

Complete example of a thumbnail creation with ffmpeg: +

 
ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
+
+ + +

24.38 tinterlace

+ +

Perform various types of temporal field interlacing. +

+

Frames are counted starting from 1, so the first input frame is +considered odd. +

+

This filter accepts a single parameter specifying the mode. Available +modes are: +

+
+
0
+

Move odd frames into the upper field, even into the lower field, +generating a double height frame at half framerate. +

+
+
1
+

Only output even frames, odd frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
2
+

Only output odd frames, even frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
3
+

Expand each frame to full height, but pad alternate lines with black, +generating a frame with double height at the same input framerate. +

+
+
4
+

Interleave the upper field from odd frames with the lower field from +even frames, generating a frame with unchanged height at half framerate. +

+
+
5
+

Interleave the lower field from odd frames with the upper field from +even frames, generating a frame with unchanged height at half framerate. +

+
+ +

Default mode is 0. +

+ +

24.39 transpose

+ +

Transpose rows with columns in the input video and optionally flip it. +

+

It accepts a parameter representing an integer, which can assume the +values: +

+
+
0
+

Rotate by 90 degrees counterclockwise and vertically flip (default), that is: +

 
L.R     L.l
+. . ->  . .
+l.r     R.r
+
+ +
+
1
+

Rotate by 90 degrees clockwise, that is: +

 
L.R     l.L
+. . ->  . .
+l.r     r.R
+
+ +
+
2
+

Rotate by 90 degrees counterclockwise, that is: +

 
L.R     R.r
+. . ->  . .
+l.r     L.l
+
+ +
+
3
+

Rotate by 90 degrees clockwise and vertically flip, that is: +

 
L.R     r.R
+. . ->  . .
+l.r     l.L
+
+
+
+ + +

24.40 unsharp

+ +

Sharpen or blur the input video. +

+

It accepts the following parameters: +luma_msize_x:luma_msize_y:luma_amount:chroma_msize_x:chroma_msize_y:chroma_amount +

+

Negative values for the amount will blur the input video, while positive +values will sharpen. All parameters are optional and default to the +equivalent of the string ’5:5:1.0:5:5:0.0’. +

+
+
luma_msize_x
+

Set the luma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_msize_y
+

Set the luma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_amount
+

Set the luma effect strength. It can be a float number between -2.0 +and 5.0, default value is 1.0. +

+
+
chroma_msize_x
+

Set the chroma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_msize_y
+

Set the chroma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_amount
+

Set the chroma effect strength. It can be a float number between -2.0 +and 5.0, default value is 0.0. +

+
+
+ +
 
# Strong luma sharpen effect parameters
+unsharp=7:7:2.5
+
+# Strong blur of both luma and chroma parameters
+unsharp=7:7:-2:7:7:-2
+
+# Use the default values with ffmpeg
+ffmpeg -i in.avi -vf "unsharp" out.mp4
+
+ + +

24.41 vflip

+ +

Flip the input video vertically. +

+
 
ffmpeg -i in.avi -vf "vflip" out.avi
+
+ + +

24.42 yadif

+ +

Deinterlace the input video ("yadif" means "yet another deinterlacing +filter"). +

+

It accepts the optional parameters: mode:parity:auto. +

+

mode specifies the interlacing mode to adopt, accepts one of the +following values: +

+
+
0
+

output 1 frame for each frame +

+
1
+

output 1 frame for each field +

+
2
+

like 0 but skips spatial interlacing check +

+
3
+

like 1 but skips spatial interlacing check +

+
+ +

Default value is 0. +

+

parity specifies the picture field parity assumed for the input +interlaced video, accepts one of the following values: +

+
+
0
+

assume top field first +

+
1
+

assume bottom field first +

+
-1
+

enable automatic detection +

+
+ +

Default value is -1. +If interlacing is unknown or decoder does not export this information, +top field first will be assumed. +

+

auto specifies if deinterlacer should trust the interlaced flag +and only deinterlace frames marked as interlaced +

+
+
0
+

deinterlace all frames +

+
1
+

only deinterlace frames marked as interlaced +

+
+ +

Default value is 0. +

+ + +

25. Video Sources

+ +

Below is a description of the currently available video sources. +

+ +

25.1 buffer

+ +

Buffer video frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/vsrc_buffer.h’. +

+

It accepts the following parameters: +width:height:pix_fmt_string:timebase_num:timebase_den:sample_aspect_ratio_num:sample_aspect_ratio.den:scale_params +

+

All the parameters but scale_params need to be explicitly +defined. +

+

Follows the list of the accepted parameters. +

+
+
width, height
+

Specify the width and height of the buffered video frames. +

+
+
pix_fmt_string
+

A string representing the pixel format of the buffered video frames. +It may be a number corresponding to a pixel format, or a pixel format +name. +

+
+
timebase_num, timebase_den
+

Specify numerator and denomitor of the timebase assumed by the +timestamps of the buffered frames. +

+
+
sample_aspect_ratio.num, sample_aspect_ratio.den
+

Specify numerator and denominator of the sample aspect ratio assumed +by the video frames. +

+
+
scale_params
+

Specify the optional parameters to be used for the scale filter which +is automatically inserted when an input change is detected in the +input size or format. +

+
+ +

For example: +

 
buffer=320:240:yuv410p:1:24:1:1
+
+ +

will instruct the source to accept video frames with size 320x240 and +with format "yuv410p", assuming 1/24 as the timestamps timebase and +square pixels (1:1 sample aspect ratio). +Since the pixel format with name "yuv410p" corresponds to the number 6 +(check the enum PixelFormat definition in ‘libavutil/pixfmt.h’), +this example corresponds to: +

 
buffer=320:240:6:1:24:1:1
+
+ + +

25.2 cellauto

+ +

Create a pattern generated by an elementary cellular automaton. +

+

The initial state of the cellular automaton can be defined through the +‘filename’, and ‘pattern’ options. If such options are +not specified an initial state is created randomly. +

+

At each new frame a new row in the video is filled with the result of +the cellular automaton next generation. The behavior when the whole +frame is filled is defined by the ‘scroll’ option. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified file. +In the file, each non-whitespace character is considered an alive +cell, a newline will terminate the row, and further characters in the +file will be ignored. +

+
+
pattern, p
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified string. +

+

Each non-whitespace character in the string is considered an alive +cell, a newline will terminate the row, and further characters in the +string will be ignored. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial cellular automaton row. It +is a floating point number value ranging from 0 to 1, defaults to +1/PHI. +

+

This option is ignored when a file or a pattern is specified. +

+
+
random_seed, seed
+

Set the seed for filling randomly the initial row, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the cellular automaton rule, it is a number ranging from 0 to 255. +Default value is 110. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ or ‘pattern’ is specified, the size is set +by default to the width of the specified initial state row, and the +height is set to width * PHI. +

+

If ‘size’ is set, it must contain the width of the specified +pattern string, and the specified pattern will be centered in the +larger row. +

+

If a filename or a pattern string is not specified, the size value +defaults to "320x518" (used for a randomly generated initial state). +

+
+
scroll
+

If set to 1, scroll the output upward when all the rows in the output +have been already filled. If set to 0, the new generated row will be +written over the top row just after the bottom row is filled. +Defaults to 1. +

+
+
start_full, full
+

If set to 1, completely fill the output with generated rows before +outputting the first frame. +This is the default behavior, for disabling set the value to 0. +

+
+
stitch
+

If set to 1, stitch the left and right row edges together. +This is the default behavior, for disabling set the value to 0. +

+
+ + +

25.2.1 Examples

+ + + + +

25.3 color

+ +

Provide an uniformly colored input. +

+

It accepts the following parameters: +color:frame_size:frame_rate +

+

Follows the description of the accepted parameters. +

+
+
color
+

Specify the color of the source. It can be the name of a color (case +insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an +alpha specifier. The default value is "black". +

+
+
frame_size
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
frame_rate
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
+ +

For example the following graph description will generate a red source +with an opacity of 0.2, with size "qcif" and a frame rate of 10 +frames per second, which will be overlayed over the source connected +to the pad with identifier "in". +

+
 
"color=red@0.2:qcif:10 [color]; [in][color] overlay [out]"
+
+ + +

25.4 movie

+ +

Read a video stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specifies the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specifies the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specifies the index of the video stream to read. If the value is -1, +the best suited video stream will be automatically selected. Default +value is "-1". +

+
+
+ +

This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +

 
input -----------> deltapts0 --> overlay --> output
+                                    ^
+                                    |
+movie --> scale--> deltapts1 -------+
+
+ +

Some examples follow: +

 
# skip 3.2 seconds from the start of the avi file in.avi, and overlay it
+# on top of the input labelled as "in".
+movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+# read from a video4linux2 device, and overlay it on top of the input
+# labelled as "in"
+movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+
+ + +

25.5 mptestsrc

+ +

Generate various test patterns, as generated by the MPlayer test filter. +

+

The size of the generated video is fixed, and is 256x256. +This source is useful in particular for testing encoding features. +

+

This source accepts an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
test, t
+
+

Set the number or the name of the test to perform. Supported tests are: +

+
dc_luma
+
dc_chroma
+
freq_luma
+
freq_chroma
+
amp_luma
+
amp_chroma
+
cbp
+
mv
+
ring1
+
ring2
+
all
+
+ +

Default value is "all", which will cycle through the list of all tests. +

+
+ +

For example the following: +

 
testsrc=t=dc_luma
+
+ +

will generate a "dc_luma" test pattern. +

+ +

25.6 frei0r_src

+ +

Provide a frei0r source. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The source supports the syntax: +

 
size:rate:src_name[{=|:}param1:param2:...:paramN]
+
+ +

size is the size of the video to generate, may be a string of the +form widthxheight or a frame size abbreviation. +rate is the rate of the video to generate, may be a string of +the form num/den or a frame rate abbreviation. +src_name is the name to the frei0r source to load. For more +information regarding frei0r and how to set the parameters read the +section frei0r in the description of the video filters. +

+

Some examples follow: +

 
# generate a frei0r partik0l source with size 200x200 and frame rate 10
+# which is overlayed on the overlay filter main input
+frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
+
+ + +

25.7 life

+ +

Generate a life pattern. +

+

This source is based on a generalization of John Conway’s life game. +

+

The sourced input represents a life grid, each pixel represents a cell +which can be in one of two possible states, alive or dead. Every cell +interacts with its eight neighbours, which are the cells that are +horizontally, vertically, or diagonally adjacent. +

+

At each interaction the grid evolves according to the adopted rule, +which specifies the number of neighbor alive cells which will make a +cell stay alive or born. The ‘rule’ option allows to specify +the rule to adopt. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Set the file from which to read the initial grid state. In the file, +each non-whitespace character is considered an alive cell, and newline +is used to delimit the end of each row. +

+

If this option is not specified, the initial grid is generated +randomly. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial random grid. It is a +floating point number value ranging from 0 to 1, defaults to 1/PHI. +It is ignored when a file is specified. +

+
+
random_seed, seed
+

Set the seed for filling the initial random grid, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the life rule. +

+

A rule can be specified with a code of the kind "SNS/BNB", +where NS and NB are sequences of numbers in the range 0-8, +NS specifies the number of alive neighbor cells which make a +live cell stay alive, and NB the number of alive neighbor cells +which make a dead cell to become alive (i.e. to "born"). +"s" and "b" can be used in place of "S" and "B", respectively. +

+

Alternatively a rule can be specified by an 18-bits integer. The 9 +high order bits are used to encode the next cell state if it is alive +for each number of neighbor alive cells, the low order bits specify +the rule for "borning" new cells. Higher order bits encode for an +higher number of neighbor cells. +For example the number 6153 = (12<<9)+9 specifies a stay alive +rule of 12 and a born rule of 9, which corresponds to "S23/B03". +

+

Default value is "S23/B3", which is the original Conway’s game of life +rule, and will keep a cell alive if it has 2 or 3 neighbor alive +cells, and will born a new cell if there are three alive cells around +a dead cell. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ is specified, the size is set by default to the +same size of the input file. If ‘size’ is set, it must contain +the size specified in the input file, and the initial grid defined in +that file is centered in the larger resulting area. +

+

If a filename is not specified, the size value defaults to "320x240" +(used for a randomly generated initial grid). +

+
+
stitch
+

If set to 1, stitch the left and right grid edges together, and the +top and bottom edges also. Defaults to 1. +

+
+
mold
+

Set cell mold speed. If set, a dead cell will go from ‘death_color’ to +‘mold_color’ with a step of ‘mold’. ‘mold’ can have a +value from 0 to 255. +

+
+
life_color
+

Set the color of living (or new born) cells. +

+
+
death_color
+

Set the color of dead cells. If ‘mold’ is set, this is the first color +used to represent a dead cell. +

+
+
mold_color
+

Set mold color, for definitely dead and moldy cells. +

+
+ + +

25.7.1 Examples

+ + + + +

25.8 nullsrc, rgbtestsrc, testsrc

+ +

The nullsrc source returns unprocessed video frames. It is +mainly useful to be employed in analysis / debugging tools, or as the +source for filters which ignore the input data. +

+

The rgbtestsrc source generates an RGB test pattern useful for +detecting RGB vs BGR issues. You should see a red, green and blue +stripe from top to bottom. +

+

The testsrc source generates a test video pattern, showing a +color pattern, a scrolling gradient and a timestamp. This is mainly +intended for testing purposes. +

+

These sources accept an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
size, s
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
sar
+

Set the sample aspect ratio of the sourced video. +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
decimals, n
+

Set the number of decimals to show in the timestamp, only used in the +testsrc source. +

+

The displayed timestamp value will correspond to the original +timestamp value multiplied by the power of 10 of the specified +value. Default value is 0. +

+
+ +

For example the following: +

 
testsrc=duration=5.3:size=qcif:rate=10
+
+ +

will generate a video with a duration of 5.3 seconds, with size +176x144 and a frame rate of 10 frames per second. +

+

If the input content is to be ignored, nullsrc can be used. The +following command generates noise in the luminance plane by employing +the mp=geq filter: +

 
nullsrc=s=256x256, mp=geq=random(1)*255:128:128
+
+ + + +

26. Video Sinks

+ +

Below is a description of the currently available video sinks. +

+ +

26.1 buffersink

+ +

Buffer video frames, and make them available to the end of the filter +graph. +

+

This sink is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It does not require a string parameter in input, but you need to +specify a pointer to a list of supported pixel formats terminated by +-1 in the opaque parameter provided to avfilter_init_filter +when initializing this sink. +

+ +

26.2 nullsink

+ +

Null video sink, do absolutely nothing with the input video. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + +

27. Metadata

+ +

FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded +INI-like text file and then load it back using the metadata muxer/demuxer. +

+

The file format is as follows: +

    +
  1. +A file consists of a header and a number of metadata tags divided into sections, +each on its own line. + +
  2. +The header is a ’;FFMETADATA’ string, followed by a version number (now 1). + +
  3. +Metadata tags are of the form ’key=value’ + +
  4. +Immediately after header follows global metadata + +
  5. +After global metadata there may be sections with per-stream/per-chapter +metadata. + +
  6. +A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in +brackets (’[’, ’]’) and ends with next section or end of file. + +
  7. +At the beginning of a chapter section there may be an optional timebase to be +used for start/end values. It must be in form ’TIMEBASE=num/den’, where num and +den are integers. If the timebase is missing then start/end times are assumed to +be in milliseconds. +Next a chapter section must contain chapter start and end times in form +’START=num’, ’END=num’, where num is a positive integer. + +
  8. +Empty lines and lines starting with ’;’ or ’#’ are ignored. + +
  9. +Metadata keys or values containing special characters (’=’, ’;’, ’#’, ’\’ and a +newline) must be escaped with a backslash ’\’. + +
  10. +Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of +the tag (in the example above key is ’foo ’, value is ’ bar’). +
+ +

A ffmetadata file might look like this: +

 
;FFMETADATA1
+title=bike\\shed
+;this is a comment
+artist=FFmpeg troll team
+
+[CHAPTER]
+TIMEBASE=1/1000
+START=0
+#chapter ends at 0:01:00
+END=60000
+title=chapter \#1
+[STREAM]
+title=multi\
+line
+
+ + +
+

+ + +
diff --git a/extern/ffmpeg/doc/ffplay.html b/extern/ffmpeg/doc/ffplay.html new file mode 100644 index 0000000000..4903a1997b --- /dev/null +++ b/extern/ffmpeg/doc/ffplay.html @@ -0,0 +1,6251 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

ffplay Documentation

+ + +

Table of Contents

+
+ + +
+ + +

1. Synopsis

+ +
 
ffplay [options] [‘input_file’]
+
+ + +

2. Description

+ +

FFplay is a very simple and portable media player using the FFmpeg +libraries and the SDL library. It is mostly used as a testbed for the +various FFmpeg APIs. +

+ +

3. Options

+ +

All the numerical options, if not specified otherwise, accept in input +a string representing a number, which may contain one of the +International System number postfixes, for example ’K’, ’M’, ’G’. +If ’i’ is appended after the postfix, powers of 2 are used instead of +powers of 10. The ’B’ postfix multiplies the value for 8, and can be +appended after another postfix or used alone. This allows using for +example ’KB’, ’MiB’, ’G’ and ’B’ as postfix. +

+

Options which do not take arguments are boolean options, and set the +corresponding value to true. They can be set to false by prefixing +with "no" the option name, for example using "-nofoo" in the +command line will set to false the boolean option with name "foo". +

+

+

+

3.1 Stream specifiers

+

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers +are used to precisely specify which stream(s) does a given option belong to. +

+

A stream specifier is a string generally appended to the option name and +separated from it by a colon. E.g. -codec:a:1 ac3 option contains +a:1 stream specifer, which matches the second audio stream. Therefore it +would select the ac3 codec for the second audio stream. +

+

A stream specifier can match several stream, the option is then applied to all +of them. E.g. the stream specifier in -b:a 128k matches all audio +streams. +

+

An empty stream specifier matches all streams, for example -codec copy +or -codec: copy would copy all the streams without reencoding. +

+

Possible forms of stream specifiers are: +

+
stream_index
+

Matches the stream with this index. E.g. -threads:1 4 would set the +thread count for the second stream to 4. +

+
stream_type[:stream_index]
+

stream_type is one of: ’v’ for video, ’a’ for audio, ’s’ for subtitle, +’d’ for data and ’t’ for attachments. If stream_index is given, then +matches stream number stream_index of this type. Otherwise matches all +streams of this type. +

+
p:program_id[:stream_index]
+

If stream_index is given, then matches stream number stream_index in +program with id program_id. Otherwise matches all streams in this program. +

+
+ +

3.2 Generic options

+ +

These options are shared amongst the av* tools. +

+
+
-L
+

Show license. +

+
+
-h, -?, -help, --help
+

Show help. +

+
+
-version
+

Show version. +

+
+
-formats
+

Show available formats. +

+

The fields preceding the format names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
+ +
+
-codecs
+

Show available codecs. +

+

The fields preceding the codec names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
V/A/S
+

Video/audio/subtitle codec +

+
S
+

Codec supports slices +

+
D
+

Codec supports direct rendering +

+
T
+

Codec can handle input truncated at random locations instead of only at frame boundaries +

+
+ +
+
-bsfs
+

Show available bitstream filters. +

+
+
-protocols
+

Show available protocols. +

+
+
-filters
+

Show available libavfilter filters. +

+
+
-pix_fmts
+

Show available pixel formats. +

+
+
-sample_fmts
+

Show available sample formats. +

+
+
-loglevel loglevel | -v loglevel
+

Set the logging level used by the library. +loglevel is a number or a string containing one of the following values: +

+
quiet
+
panic
+
fatal
+
error
+
warning
+
info
+
verbose
+
debug
+
+ +

By default the program logs to stderr, if coloring is supported by the +terminal, colors are used to mark errors and warnings. Log coloring +can be disabled setting the environment variable +AV_LOG_FORCE_NOCOLOR or NO_COLOR, or can be forced setting +the environment variable AV_LOG_FORCE_COLOR. +The use of the environment variable NO_COLOR is deprecated and +will be dropped in a following FFmpeg version. +

+
+
-report
+

Dump full command line and console output to a file named +program-YYYYMMDD-HHMMSS.log in the current +directory. +This file can be useful for bug reports. +It also implies -loglevel verbose. +

+

Note: setting the environment variable FFREPORT to any value has the +same effect. +

+
+
+ + +

3.3 AVOptions

+ +

These options are provided directly by the libavformat, libavdevice and +libavcodec libraries. To see the list of available AVOptions, use the +‘-help’ option. They are separated into two categories: +

+
generic
+

These options can be set for any container, codec or device. Generic options +are listed under AVFormatContext options for containers/devices and under +AVCodecContext options for codecs. +

+
private
+

These options are specific to the given container, device or codec. Private +options are listed under their corresponding containers/devices/codecs. +

+
+ +

For example to write an ID3v2.3 header instead of a default ID3v2.4 to +an MP3 file, use the ‘id3v2_version’ private option of the MP3 +muxer: +

 
ffmpeg -i input.flac -id3v2_version 3 out.mp3
+
+ +

All codec AVOptions are obviously per-stream, so the chapter on stream +specifiers applies to them +

+

Note ‘-nooption’ syntax cannot be used for boolean AVOptions, +use ‘-option 0’/‘-option 1’. +

+

Note2 old undocumented way of specifying per-stream AVOptions by prepending +v/a/s to the options name is now obsolete and will be removed soon. +

+ +

3.4 Main options

+ +
+
-x width
+

Force displayed width. +

+
-y height
+

Force displayed height. +

+
-s size
+

Set frame size (WxH or abbreviation), needed for videos which do +not contain a header with the frame size like raw YUV. This option +has been deprecated in favor of private options, try -video_size. +

+
-an
+

Disable audio. +

+
-vn
+

Disable video. +

+
-ss pos
+

Seek to a given position in seconds. +

+
-t duration
+

play <duration> seconds of audio/video +

+
-bytes
+

Seek by bytes. +

+
-nodisp
+

Disable graphical display. +

+
-f fmt
+

Force format. +

+
-window_title title
+

Set window title (default is the input filename). +

+
-loop number
+

Loops movie playback <number> times. 0 means forever. +

+
-showmode mode
+

Set the show mode to use. +Available values for mode are: +

+
0, video
+

show video +

+
1, waves
+

show audio waves +

+
2, rdft
+

show audio frequency band using RDFT ((Inverse) Real Discrete Fourier Transform) +

+
+ +

Default value is "video", if video is not present or cannot be played +"rdft" is automatically selected. +

+

You can interactively cycle through the available show modes by +pressing the key <w>. +

+
+
-vf filter_graph
+

filter_graph is a description of the filter graph to apply to +the input video. +Use the option "-filters" to show all the available filters (including +also sources and sinks). +

+
+
-i input_file
+

Read input_file. +

+
+ + +

3.5 Advanced options

+
+
-pix_fmt format
+

Set pixel format. +This option has been deprecated in favor of private options, try -pixel_format. +

+
-stats
+

Show the stream duration, the codec parameters, the current position in +the stream and the audio/video synchronisation drift. +

+
-bug
+

Work around bugs. +

+
-fast
+

Non-spec-compliant optimizations. +

+
-genpts
+

Generate pts. +

+
-rtp_tcp
+

Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful +if you are streaming with the RTSP protocol. +

+
-sync type
+

Set the master clock to audio (type=audio), video +(type=video) or external (type=ext). Default is audio. The +master clock is used to control audio-video synchronization. Most media +players use audio as master clock, but in some cases (streaming or high +quality broadcast) it is necessary to change that. This option is mainly +used for debugging purposes. +

+
-threads count
+

Set the thread count. +

+
-ast audio_stream_number
+

Select the desired audio stream number, counting from 0. The number +refers to the list of all the input audio streams. If it is greater +than the number of audio streams minus one, then the last one is +selected, if it is negative the audio playback is disabled. +

+
-vst video_stream_number
+

Select the desired video stream number, counting from 0. The number +refers to the list of all the input video streams. If it is greater +than the number of video streams minus one, then the last one is +selected, if it is negative the video playback is disabled. +

+
-sst subtitle_stream_number
+

Select the desired subtitle stream number, counting from 0. The number +refers to the list of all the input subtitle streams. If it is greater +than the number of subtitle streams minus one, then the last one is +selected, if it is negative the subtitle rendering is disabled. +

+
-autoexit
+

Exit when video is done playing. +

+
-exitonkeydown
+

Exit if any key is pressed. +

+
-exitonmousedown
+

Exit if any mouse button is pressed. +

+
-codec:stream_type
+

Force a specific decoder implementation +

+
+ + +

3.6 While playing

+ +
+
<q, ESC>
+

Quit. +

+
+
<f>
+

Toggle full screen. +

+
+
<p, SPC>
+

Pause. +

+
+
<a>
+

Cycle audio channel. +

+
+
<v>
+

Cycle video channel. +

+
+
<t>
+

Cycle subtitle channel. +

+
+
<w>
+

Show audio waves. +

+
+
<left/right>
+

Seek backward/forward 10 seconds. +

+
+
<down/up>
+

Seek backward/forward 1 minute. +

+
+
<page down/page up>
+

Seek backward/forward 10 minutes. +

+
+
<mouse click>
+

Seek to percentage in file corresponding to fraction of width. +

+
+
+ + + +

4. Expression Evaluation

+ +

When evaluating an arithmetic expression, FFmpeg uses an internal +formula evaluator, implemented through the ‘libavutil/eval.h’ +interface. +

+

An expression may contain unary, binary operators, constants, and +functions. +

+

Two expressions expr1 and expr2 can be combined to form +another expression "expr1;expr2". +expr1 and expr2 are evaluated in turn, and the new +expression evaluates to the value of expr2. +

+

The following binary operators are available: +, -, +*, /, ^. +

+

The following unary operators are available: +, -. +

+

The following functions are available: +

+
sinh(x)
+
cosh(x)
+
tanh(x)
+
sin(x)
+
cos(x)
+
tan(x)
+
atan(x)
+
asin(x)
+
acos(x)
+
exp(x)
+
log(x)
+
abs(x)
+
squish(x)
+
gauss(x)
+
isnan(x)
+

Return 1.0 if x is NAN, 0.0 otherwise. +

+
+
mod(x, y)
+
max(x, y)
+
min(x, y)
+
eq(x, y)
+
gte(x, y)
+
gt(x, y)
+
lte(x, y)
+
lt(x, y)
+
st(var, expr)
+

Allow to store the value of the expression expr in an internal +variable. var specifies the number of the variable where to +store the value, and it is a value ranging from 0 to 9. The function +returns the value stored in the internal variable. +Note, Variables are currently not shared between expressions. +

+
+
ld(var)
+

Allow to load the value of the internal variable with number +var, which was previously stored with st(var, expr). +The function returns the loaded value. +

+
+
while(cond, expr)
+

Evaluate expression expr while the expression cond is +non-zero, and returns the value of the last expr evaluation, or +NAN if cond was always false. +

+
+
ceil(expr)
+

Round the value of expression expr upwards to the nearest +integer. For example, "ceil(1.5)" is "2.0". +

+
+
floor(expr)
+

Round the value of expression expr downwards to the nearest +integer. For example, "floor(-1.5)" is "-2.0". +

+
+
trunc(expr)
+

Round the value of expression expr towards zero to the nearest +integer. For example, "trunc(-1.5)" is "-1.0". +

+
+
sqrt(expr)
+

Compute the square root of expr. This is equivalent to +"(expr)^.5". +

+
+
not(expr)
+

Return 1.0 if expr is zero, 0.0 otherwise. +

+
+
pow(x, y)
+

Compute the power of x elevated y, it is equivalent to +"(x)^(y)". +

+
+
random(x)
+

Return a pseudo random value between 0.0 and 1.0. x is the index of the +internal variable which will be used to save the seed/state. +

+
+
hypot(x, y)
+

This function is similar to the C function with the same name; it returns +"sqrt(x*x + y*y)", the length of the hypotenuse of a +right triangle with sides of length x and y, or the distance of the +point (x, y) from the origin. +

+
+
gcd(x, y)
+

Return the greatest common divisor of x and y. If both x and +y are 0 or either or both are less than zero then behavior is undefined. +

+
+
if(x, y)
+

Evaluate x, and if the result is non-zero return the result of +the evaluation of y, return 0 otherwise. +

+
+
ifnot(x, y)
+

Evaluate x, and if the result is zero return the result of the +evaluation of y, return 0 otherwise. +

+
+ +

The following constants are available: +

+
PI
+

area of the unit disc, approximately 3.14 +

+
E
+

exp(1) (Euler’s number), approximately 2.718 +

+
PHI
+

golden ratio (1+sqrt(5))/2, approximately 1.618 +

+
+ +

Assuming that an expression is considered "true" if it has a non-zero +value, note that: +

+

* works like AND +

+

+ works like OR +

+

and the construct: +

 
if A then B else C
+
+

is equivalent to +

 
if(A,B) + ifnot(A,C)
+
+ +

In your C code, you can extend the list of unary and binary functions, +and define recognized constants, so that they are available for your +expressions. +

+

The evaluator also recognizes the International System number +postfixes. If ’i’ is appended after the postfix, powers of 2 are used +instead of powers of 10. The ’B’ postfix multiplies the value for 8, +and can be appended after another postfix or used alone. This allows +using for example ’KB’, ’MiB’, ’G’ and ’B’ as postfix. +

+

Follows the list of available International System postfixes, with +indication of the corresponding powers of 10 and of 2. +

+
y
+

-24 / -80 +

+
z
+

-21 / -70 +

+
a
+

-18 / -60 +

+
f
+

-15 / -50 +

+
p
+

-12 / -40 +

+
n
+

-9 / -30 +

+
u
+

-6 / -20 +

+
m
+

-3 / -10 +

+
c
+

-2 +

+
d
+

-1 +

+
h
+

2 +

+
k
+

3 / 10 +

+
K
+

3 / 10 +

+
M
+

6 / 20 +

+
G
+

9 / 30 +

+
T
+

12 / 40 +

+
P
+

15 / 40 +

+
E
+

18 / 50 +

+
Z
+

21 / 60 +

+
Y
+

24 / 70 +

+
+ + +

5. Decoders

+ +

Decoders are configured elements in FFmpeg which allow the decoding of +multimedia streams. +

+

When you configure your FFmpeg build, all the supported native decoders +are enabled by default. Decoders requiring an external library must be enabled +manually via the corresponding --enable-lib option. You can list all +available decoders using the configure option --list-decoders. +

+

You can disable all the decoders with the configure option +--disable-decoders and selectively enable / disable single decoders +with the options --enable-decoder=DECODER / +--disable-decoder=DECODER. +

+

The option -codecs of the ff* tools will display the list of +enabled decoders. +

+ + +

6. Video Decoders

+ +

A description of some of the currently available video decoders +follows. +

+ +

6.1 rawvideo

+ +

Raw video decoder. +

+

This decoder decodes rawvideo streams. +

+ +

6.1.1 Options

+ +
+
top top_field_first
+

Specify the assumed field type of the input video. +

+
-1
+

the video is assumed to be progressive (default) +

+
0
+

bottom-field-first is assumed +

+
1
+

top-field-first is assumed +

+
+ +
+
+ + + +

7. Audio Decoders

+ + +

7.1 ffwavesynth

+ +

Internal wave synthetizer. +

+

This decoder generates wave patterns according to predefined sequences. Its +use is purely internal and the format of the data it accepts is not publicly +documented. +

+ +

8. Demuxers

+ +

Demuxers are configured elements in FFmpeg which allow to read the +multimedia streams from a particular type of file. +

+

When you configure your FFmpeg build, all the supported demuxers +are enabled by default. You can list all available ones using the +configure option "–list-demuxers". +

+

You can disable all the demuxers using the configure option +"–disable-demuxers", and selectively enable a single demuxer with +the option "–enable-demuxer=DEMUXER", or disable it +with the option "–disable-demuxer=DEMUXER". +

+

The option "-formats" of the ff* tools will display the list of +enabled demuxers. +

+

The description of some of the currently available demuxers follows. +

+ +

8.1 image2

+ +

Image file demuxer. +

+

This demuxer reads from a list of image files specified by a pattern. +

+

The pattern may contain the string "%d" or "%0Nd", which +specifies the position of the characters representing a sequential +number in each filename matched by the pattern. If the form +"%d0Nd" is used, the string representing the number in each +filename is 0-padded and N is the total number of 0-padded +digits representing the number. The literal character ’%’ can be +specified in the pattern with the string "%%". +

+

If the pattern contains "%d" or "%0Nd", the first filename of +the file list specified by the pattern must contain a number +inclusively contained between 0 and 4, all the following numbers must +be sequential. This limitation may be hopefully fixed. +

+

The pattern may contain a suffix which is used to automatically +determine the format of the images contained in the files. +

+

For example the pattern "img-%03d.bmp" will match a sequence of +filenames of the form ‘img-001.bmp’, ‘img-002.bmp’, ..., +‘img-010.bmp’, etc.; the pattern "i%%m%%g-%d.jpg" will match a +sequence of filenames of the form ‘i%m%g-1.jpg’, +‘i%m%g-2.jpg’, ..., ‘i%m%g-10.jpg’, etc. +

+

The size, the pixel format, and the format of each image must be the +same for all the files in the sequence. +

+

The following example shows how to use ffmpeg for creating a +video from the images in the file sequence ‘img-001.jpeg’, +‘img-002.jpeg’, ..., assuming an input frame rate of 10 frames per +second: +

 
ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv
+
+ +

Note that the pattern must not necessarily contain "%d" or +"%0Nd", for example to convert a single image file +‘img.jpeg’ you can employ the command: +

 
ffmpeg -i img.jpeg img.png
+
+ + +

8.2 applehttp

+ +

Apple HTTP Live Streaming demuxer. +

+

This demuxer presents all AVStreams from all variant streams. +The id field is set to the bitrate variant index number. By setting +the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay), +the caller can decide which variant streams to actually receive. +The total bitrate of the variant that the stream belongs to is +available in a metadata key named "variant_bitrate". +

+ +

8.3 sbg

+ +

SBaGen script demuxer. +

+

This demuxer reads the script language used by SBaGen +http://uazu.net/sbagen/ to generate binaural beats sessions. A SBG +script looks like that: +

 
-SE
+a: 300-2.5/3 440+4.5/0
+b: 300-2.5/0 440+4.5/3
+off: -
+NOW      == a
++0:07:00 == b
++0:14:00 == a
++0:21:00 == b
++0:30:00    off
+
+ +

A SBG script can mix absolute and relative timestamps. If the script uses +either only absolute timestamps (including the script start time) or only +relative ones, then its layout is fixed, and the conversion is +straightforward. On the other hand, if the script mixes both kind of +timestamps, then the NOW reference for relative timestamps will be +taken from the current time of day at the time the script is read, and the +script layout will be frozen according to that reference. That means that if +the script is directly played, the actual times will match the absolute +timestamps up to the sound controller’s clock accuracy, but if the user +somehow pauses the playback or seeks, all times will be shifted accordingly. +

+ +

9. Muxers

+ +

Muxers are configured elements in FFmpeg which allow writing +multimedia streams to a particular type of file. +

+

When you configure your FFmpeg build, all the supported muxers +are enabled by default. You can list all available muxers using the +configure option --list-muxers. +

+

You can disable all the muxers with the configure option +--disable-muxers and selectively enable / disable single muxers +with the options --enable-muxer=MUXER / +--disable-muxer=MUXER. +

+

The option -formats of the ff* tools will display the list of +enabled muxers. +

+

A description of some of the currently available muxers follows. +

+

+

+

9.1 crc

+ +

CRC (Cyclic Redundancy Check) testing format. +

+

This muxer computes and prints the Adler-32 CRC of all the input audio +and video frames. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. +

+

The output of the muxer consists of a single line of the form: +CRC=0xCRC, where CRC is a hexadecimal number 0-padded to +8 digits containing the CRC for all the decoded input frames. +

+

For example to compute the CRC of the input, and store it in the file +‘out.crc’: +

 
ffmpeg -i INPUT -f crc out.crc
+
+ +

You can print the CRC to stdout with the command: +

 
ffmpeg -i INPUT -f crc -
+
+ +

You can select the output format of each frame with ffmpeg by +specifying the audio and video codec and format. For example to +compute the CRC of the input audio converted to PCM unsigned 8-bit +and the input video converted to MPEG-2 video, use the command: +

 
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
+
+ +

See also the framecrc muxer. +

+

+

+

9.2 framecrc

+ +

Per-frame CRC (Cyclic Redundancy Check) testing format. +

+

This muxer computes and prints the Adler-32 CRC for each decoded audio +and video frame. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. +

+

The output of the muxer consists of a line for each audio and video +frame of the form: stream_index, frame_dts, +frame_size, 0xCRC, where CRC is a hexadecimal +number 0-padded to 8 digits containing the CRC of the decoded frame. +

+

For example to compute the CRC of each decoded frame in the input, and +store it in the file ‘out.crc’: +

 
ffmpeg -i INPUT -f framecrc out.crc
+
+ +

You can print the CRC of each decoded frame to stdout with the command: +

 
ffmpeg -i INPUT -f framecrc -
+
+ +

You can select the output format of each frame with ffmpeg by +specifying the audio and video codec and format. For example, to +compute the CRC of each decoded input audio frame converted to PCM +unsigned 8-bit and of each decoded input video frame converted to +MPEG-2 video, use the command: +

 
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
+
+ +

See also the crc muxer. +

+

+

+

9.3 image2

+ +

Image file muxer. +

+

The image file muxer writes video frames to image files. +

+

The output filenames are specified by a pattern, which can be used to +produce sequentially numbered series of files. +The pattern may contain the string "%d" or "%0Nd", this string +specifies the position of the characters representing a numbering in +the filenames. If the form "%0Nd" is used, the string +representing the number in each filename is 0-padded to N +digits. The literal character ’%’ can be specified in the pattern with +the string "%%". +

+

If the pattern contains "%d" or "%0Nd", the first filename of +the file list specified will contain the number 1, all the following +numbers will be sequential. +

+

The pattern may contain a suffix which is used to automatically +determine the format of the image files to write. +

+

For example the pattern "img-%03d.bmp" will specify a sequence of +filenames of the form ‘img-001.bmp’, ‘img-002.bmp’, ..., +‘img-010.bmp’, etc. +The pattern "img%%-%d.jpg" will specify a sequence of filenames of the +form ‘img%-1.jpg’, ‘img%-2.jpg’, ..., ‘img%-10.jpg’, +etc. +

+

The following example shows how to use ffmpeg for creating a +sequence of files ‘img-001.jpeg’, ‘img-002.jpeg’, ..., +taking one image every second from the input video: +

 
ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
+
+ +

Note that with ffmpeg, if the format is not specified with the +-f option and the output filename specifies an image file +format, the image2 muxer is automatically selected, so the previous +command can be written as: +

 
ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
+
+ +

Note also that the pattern must not necessarily contain "%d" or +"%0Nd", for example to create a single image file +‘img.jpeg’ from the input video you can employ the command: +

 
ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
+
+ +

The image muxer supports the .Y.U.V image file format. This format is +special in that that each image frame consists of three files, for +each of the YUV420P components. To read or write this image file format, +specify the name of the ’.Y’ file. The muxer will automatically open the +’.U’ and ’.V’ files as required. +

+ +

9.4 mov

+ +

MOV / MP4 muxer +

+

The muxer options are: +

+
+
-moov_size bytes
+

Reserves space for the moov atom at the beginning of the file instead of placing the +moov atom at the end. If the space reserved is insufficient, muxing will fail. +

+
+ + +

9.5 mpegts

+ +

MPEG transport stream muxer. +

+

This muxer implements ISO 13818-1 and part of ETSI EN 300 468. +

+

The muxer options are: +

+
+
-mpegts_original_network_id number
+

Set the original_network_id (default 0x0001). This is unique identifier +of a network in DVB. Its main use is in the unique identification of a +service through the path Original_Network_ID, Transport_Stream_ID. +

+
-mpegts_transport_stream_id number
+

Set the transport_stream_id (default 0x0001). This identifies a +transponder in DVB. +

+
-mpegts_service_id number
+

Set the service_id (default 0x0001) also known as program in DVB. +

+
-mpegts_pmt_start_pid number
+

Set the first PID for PMT (default 0x1000, max 0x1f00). +

+
-mpegts_start_pid number
+

Set the first PID for data packets (default 0x0100, max 0x0f00). +

+
+ +

The recognized metadata settings in mpegts muxer are service_provider +and service_name. If they are not set the default for +service_provider is "FFmpeg" and the default for +service_name is "Service01". +

+
 
ffmpeg -i file.mpg -c copy \
+     -mpegts_original_network_id 0x1122 \
+     -mpegts_transport_stream_id 0x3344 \
+     -mpegts_service_id 0x5566 \
+     -mpegts_pmt_start_pid 0x1500 \
+     -mpegts_start_pid 0x150 \
+     -metadata service_provider="Some provider" \
+     -metadata service_name="Some Channel" \
+     -y out.ts
+
+ + +

9.6 null

+ +

Null muxer. +

+

This muxer does not generate any output file, it is mainly useful for +testing or benchmarking purposes. +

+

For example to benchmark decoding with ffmpeg you can use the +command: +

 
ffmpeg -benchmark -i INPUT -f null out.null
+
+ +

Note that the above command does not read or write the ‘out.null’ +file, but specifying the output file is required by the ffmpeg +syntax. +

+

Alternatively you can write the command as: +

 
ffmpeg -benchmark -i INPUT -f null -
+
+ + +

9.7 matroska

+ +

Matroska container muxer. +

+

This muxer implements the matroska and webm container specs. +

+

The recognized metadata settings in this muxer are: +

+
+
title=title name
+

Name provided to a single track +

+
+ +
+
language=language name
+

Specifies the language of the track in the Matroska languages form +

+
+ +
+
stereo_mode=mode
+

Stereo 3D video layout of two views in a single video track +

+
mono
+

video is not stereo +

+
left_right
+

Both views are arranged side by side, Left-eye view is on the left +

+
bottom_top
+

Both views are arranged in top-bottom orientation, Left-eye view is at bottom +

+
top_bottom
+

Both views are arranged in top-bottom orientation, Left-eye view is on top +

+
checkerboard_rl
+

Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first +

+
checkerboard_lr
+

Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first +

+
row_interleaved_rl
+

Each view is constituted by a row based interleaving, Right-eye view is first row +

+
row_interleaved_lr
+

Each view is constituted by a row based interleaving, Left-eye view is first row +

+
col_interleaved_rl
+

Both views are arranged in a column based interleaving manner, Right-eye view is first column +

+
col_interleaved_lr
+

Both views are arranged in a column based interleaving manner, Left-eye view is first column +

+
anaglyph_cyan_red
+

All frames are in anaglyph format viewable through red-cyan filters +

+
right_left
+

Both views are arranged side by side, Right-eye view is on the left +

+
anaglyph_green_magenta
+

All frames are in anaglyph format viewable through green-magenta filters +

+
block_lr
+

Both eyes laced in one Block, Left-eye view is first +

+
block_rl
+

Both eyes laced in one Block, Right-eye view is first +

+
+
+
+ +

For example a 3D WebM clip can be created using the following command line: +

 
ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
+
+ + +

9.8 segment

+ +

Basic stream segmenter. +

+

The segmenter muxer outputs streams to a number of separate files of nearly +fixed duration. Output filename pattern can be set in a fashion similar to +image2. +

+

Every segment starts with a video keyframe, if a video stream is present. +The segment muxer works best with a single constant frame rate video. +

+

Optionally it can generate a flat list of the created segments, one segment +per line. +

+
+
segment_format format
+

Override the inner container format, by default it is guessed by the filename +extension. +

+
segment_time t
+

Set segment duration to t seconds. +

+
segment_list name
+

Generate also a listfile named name. +

+
segment_list_size size
+

Overwrite the listfile once it reaches size entries. +

+
+ +
 
ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
+
+ + + +

10. Input Devices

+ +

Input devices are configured elements in FFmpeg which allow to access +the data coming from a multimedia device attached to your system. +

+

When you configure your FFmpeg build, all the supported input devices +are enabled by default. You can list all available ones using the +configure option "–list-indevs". +

+

You can disable all the input devices using the configure option +"–disable-indevs", and selectively enable an input device using the +option "–enable-indev=INDEV", or you can disable a particular +input device using the option "–disable-indev=INDEV". +

+

The option "-formats" of the ff* tools will display the list of +supported input devices (amongst the demuxers). +

+

A description of the currently available input devices follows. +

+ +

10.1 alsa

+ +

ALSA (Advanced Linux Sound Architecture) input device. +

+

To enable this input device during configuration you need libasound +installed on your system. +

+

This device allows capturing from an ALSA device. The name of the +device to capture has to be an ALSA card identifier. +

+

An ALSA identifier has the syntax: +

 
hw:CARD[,DEV[,SUBDEV]]
+
+ +

where the DEV and SUBDEV components are optional. +

+

The three arguments (in order: CARD,DEV,SUBDEV) +specify card number or identifier, device number and subdevice number +(-1 means any). +

+

To see the list of cards currently recognized by your system check the +files ‘/proc/asound/cards’ and ‘/proc/asound/devices’. +

+

For example to capture with ffmpeg from an ALSA device with +card id 0, you may run the command: +

 
ffmpeg -f alsa -i hw:0 alsaout.wav
+
+ +

For more information see: +http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html +

+ +

10.2 bktr

+ +

BSD video input device. +

+ +

10.3 dshow

+ +

Windows DirectShow input device. +

+

DirectShow support is enabled when FFmpeg is built with mingw-w64. +Currently only audio and video devices are supported. +

+

Multiple devices may be opened as separate inputs, but they may also be +opened on the same input, which should improve synchronism between them. +

+

The input name should be in the format: +

+
 
TYPE=NAME[:TYPE=NAME]
+
+ +

where TYPE can be either audio or video, +and NAME is the device’s name. +

+ +

10.3.1 Options

+ +

If no options are specified, the device’s defaults are used. +If the device does not support the requested options, it will +fail to open. +

+
+
video_size
+

Set the video size in the captured video. +

+
+
framerate
+

Set the framerate in the captured video. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. +

+
+
channels
+

Set the number of channels in the captured audio. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +

+
+
list_options
+

If set to ‘true’, print a list of selected device’s options +and exit. +

+
+
video_device_number
+

Set video device number for devices with same name (starts at 0, +defaults to 0). +

+
+
audio_device_number
+

Set audio device number for devices with same name (starts at 0, +defaults to 0). +

+
+
+ + +

10.3.2 Examples

+ + + + +

10.4 dv1394

+ +

Linux DV 1394 input device. +

+ +

10.5 fbdev

+ +

Linux framebuffer input device. +

+

The Linux framebuffer is a graphic hardware-independent abstraction +layer to show graphics on a computer monitor, typically on the +console. It is accessed through a file device node, usually +‘/dev/fb0’. +

+

For more detailed information read the file +Documentation/fb/framebuffer.txt included in the Linux source tree. +

+

To record from the framebuffer device ‘/dev/fb0’ with +ffmpeg: +

 
ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
+
+ +

You can take a single screenshot image with the command: +

 
ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
+
+ +

See also http://linux-fbdev.sourceforge.net/, and fbset(1). +

+ +

10.6 jack

+ +

JACK input device. +

+

To enable this input device during configuration you need libjack +installed on your system. +

+

A JACK input device creates one or more JACK writable clients, one for +each audio channel, with name client_name:input_N, where +client_name is the name provided by the application, and N +is a number which identifies the channel. +Each writable client will send the acquired data to the FFmpeg input +device. +

+

Once you have created one or more JACK readable clients, you need to +connect them to one or more JACK writable clients. +

+

To connect or disconnect JACK clients you can use the jack_connect +and jack_disconnect programs, or do it through a graphical interface, +for example with qjackctl. +

+

To list the JACK clients and their properties you can invoke the command +jack_lsp. +

+

Follows an example which shows how to capture a JACK readable client +with ffmpeg. +

 
# Create a JACK writable client with name "ffmpeg".
+$ ffmpeg -f jack -i ffmpeg -y out.wav
+
+# Start the sample jack_metro readable client.
+$ jack_metro -b 120 -d 0.2 -f 4000
+
+# List the current JACK clients.
+$ jack_lsp -c
+system:capture_1
+system:capture_2
+system:playback_1
+system:playback_2
+ffmpeg:input_1
+metro:120_bpm
+
+# Connect metro to the ffmpeg writable client.
+$ jack_connect metro:120_bpm ffmpeg:input_1
+
+ +

For more information read: +http://jackaudio.org/ +

+ +

10.7 lavfi

+ +

Libavfilter input virtual device. +

+

This input device reads data from the open output pads of a libavfilter +filtergraph. +

+

For each filtergraph open output, the input device will create a +corresponding stream which is mapped to the generated output. Currently +only video data is supported. The filtergraph is specified through the +option ‘graph’. +

+ +

10.7.1 Options

+ +
+
graph
+

Specify the filtergraph to use as input. Each video open output must be +labelled by a unique string of the form "outN", where N is a +number starting from 0 corresponding to the mapped input stream +generated by the device. +The first unlabelled output is automatically assigned to the "out0" +label, but all the others need to be specified explicitly. +

+

If not specified defaults to the filename specified for the input +device. +

+
+ + +

10.7.2 Examples

+ + + + +

10.8 libdc1394

+ +

IIDC1394 input device, based on libdc1394 and libraw1394. +

+ +

10.9 openal

+ +

The OpenAL input device provides audio capture on all systems with a +working OpenAL 1.1 implementation. +

+

To enable this input device during configuration, you need OpenAL +headers and libraries installed on your system, and need to configure +FFmpeg with --enable-openal. +

+

OpenAL headers and libraries should be provided as part of your OpenAL +implementation, or as an additional download (an SDK). Depending on your +installation you may need to specify additional flags via the +--extra-cflags and --extra-ldflags for allowing the build +system to locate the OpenAL headers and libraries. +

+

An incomplete list of OpenAL implementations follows: +

+
+
Creative
+

The official Windows implementation, providing hardware acceleration +with supported devices and software fallback. +See http://openal.org/. +

+
OpenAL Soft
+

Portable, open source (LGPL) software implementation. Includes +backends for the most common sound APIs on the Windows, Linux, +Solaris, and BSD operating systems. +See http://kcat.strangesoft.net/openal.html. +

+
Apple
+

OpenAL is part of Core Audio, the official Mac OS X Audio interface. +See http://developer.apple.com/technologies/mac/audio-and-video.html +

+
+ +

This device allows to capture from an audio input device handled +through OpenAL. +

+

You need to specify the name of the device to capture in the provided +filename. If the empty string is provided, the device will +automatically select the default device. You can get the list of the +supported devices by using the option list_devices. +

+ +

10.9.1 Options

+ +
+
channels
+

Set the number of channels in the captured audio. Only the values +‘1’ (monaural) and ‘2’ (stereo) are currently supported. +Defaults to ‘2’. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. Only the values +‘8’ and ‘16’ are currently supported. Defaults to +‘16’. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +Defaults to ‘44.1k’. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +Defaults to ‘false’. +

+
+
+ + +

10.9.2 Examples

+ +

Print the list of OpenAL supported devices and exit: +

 
$ ffmpeg -list_devices true -f openal -i dummy out.ogg
+
+ +

Capture from the OpenAL device ‘DR-BT101 via PulseAudio’: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
+
+ +

Capture from the default device (note the empty string ” as filename): +

 
$ ffmpeg -f openal -i '' out.ogg
+
+ +

Capture from two devices simultaneously, writing to two different files, +within the same ffmpeg command: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
+
+

Note: not all OpenAL implementations support multiple simultaneous capture - +try the latest OpenAL Soft if the above does not work. +

+ +

10.10 oss

+ +

Open Sound System input device. +

+

The filename to provide to the input device is the device node +representing the OSS input device, and is usually set to +‘/dev/dsp’. +

+

For example to grab from ‘/dev/dsp’ using ffmpeg use the +command: +

 
ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
+
+ +

For more information about OSS see: +http://manuals.opensound.com/usersguide/dsp.html +

+ +

10.11 pulse

+ +

pulseaudio input device. +

+

To enable this input device during configuration you need libpulse-simple +installed in your system. +

+

The filename to provide to the input device is a source device or the +string "default" +

+

To list the pulse source devices and their properties you can invoke +the command pactl list sources. +

+
 
ffmpeg -f pulse -i default /tmp/pulse.wav
+
+ + +

10.11.1 server AVOption

+ +

The syntax is: +

 
-server server name
+
+ +

Connects to a specific server. +

+ +

10.11.2 name AVOption

+ +

The syntax is: +

 
-name application name
+
+ +

Specify the application name pulse will use when showing active clients, +by default it is the LIBAVFORMAT_IDENT string +

+ +

10.11.3 stream_name AVOption

+ +

The syntax is: +

 
-stream_name stream name
+
+ +

Specify the stream name pulse will use when showing active streams, +by default it is "record" +

+ +

10.11.4 sample_rate AVOption

+ +

The syntax is: +

 
-sample_rate samplerate
+
+ +

Specify the samplerate in Hz, by default 48kHz is used. +

+ +

10.11.5 channels AVOption

+ +

The syntax is: +

 
-channels N
+
+ +

Specify the channels in use, by default 2 (stereo) is set. +

+ +

10.11.6 frame_size AVOption

+ +

The syntax is: +

 
-frame_size bytes
+
+ +

Specify the number of byte per frame, by default it is set to 1024. +

+ +

10.11.7 fragment_size AVOption

+ +

The syntax is: +

 
-fragment_size bytes
+
+ +

Specify the minimal buffering fragment in pulseaudio, it will affect the +audio latency. By default it is unset. +

+ +

10.12 sndio

+ +

sndio input device. +

+

To enable this input device during configuration you need libsndio +installed on your system. +

+

The filename to provide to the input device is the device node +representing the sndio input device, and is usually set to +‘/dev/audio0’. +

+

For example to grab from ‘/dev/audio0’ using ffmpeg use the +command: +

 
ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
+
+ + +

10.13 video4linux and video4linux2

+ +

Video4Linux and Video4Linux2 input video devices. +

+

The name of the device to grab is a file device node, usually Linux +systems tend to automatically create such nodes when the device +(e.g. an USB webcam) is plugged into the system, and has a name of the +kind ‘/dev/videoN’, where N is a number associated to +the device. +

+

Video4Linux and Video4Linux2 devices only support a limited set of +widthxheight sizes and framerates. You can check which are +supported for example with the command dov4l for Video4Linux +devices and using -list_formats all for Video4Linux2 devices. +

+

If the size for the device is set to 0x0, the input device will +try to auto-detect the size to use. +Only for the video4linux2 device, if the frame rate is set to 0/0 the +input device will use the frame rate value already set in the driver. +

+

Video4Linux support is deprecated since Linux 2.6.30, and will be +dropped in later versions. +

+

Note that if FFmpeg is build with v4l-utils support ("–enable-libv4l2" +option), it will always be used. +

+

Follow some usage examples of the video4linux devices with the ff* +tools. +

 
# Grab and show the input of a video4linux device, frame rate is set
+# to the default of 25/1.
+ffplay -s 320x240 -f video4linux /dev/video0
+
+# Grab and show the input of a video4linux2 device, auto-adjust size.
+ffplay -f video4linux2 /dev/video0
+
+# Grab and record the input of a video4linux2 device, auto-adjust size,
+# frame rate value defaults to 0/0 so it is read from the video4linux2
+# driver.
+ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
+
+ +

"v4l" and "v4l2" can be used as aliases for the respective "video4linux" and +"video4linux2". +

+ +

10.14 vfwcap

+ +

VfW (Video for Windows) capture input device. +

+

The filename passed as input is the capture driver number, ranging from +0 to 9. You may use "list" as filename to print a list of drivers. Any +other filename will be interpreted as device number 0. +

+ +

10.15 x11grab

+ +

X11 video input device. +

+

This device allows to capture a region of an X11 display. +

+

The filename passed as input has the syntax: +

 
[hostname]:display_number.screen_number[+x_offset,y_offset]
+
+ +

hostname:display_number.screen_number specifies the +X11 display name of the screen to grab from. hostname can be +omitted, and defaults to "localhost". The environment variable +DISPLAY contains the default display name. +

+

x_offset and y_offset specify the offsets of the grabbed +area with respect to the top-left border of the X11 screen. They +default to 0. +

+

Check the X11 documentation (e.g. man X) for more detailed information. +

+

Use the dpyinfo program for getting basic information about the +properties of your X11 display (e.g. grep for "name" or "dimensions"). +

+

For example to grab from ‘:0.0’ using ffmpeg: +

 
ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
+
+# Grab at position 10,20.
+ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
+
+ + +

10.15.1 follow_mouse AVOption

+ +

The syntax is: +

 
-follow_mouse centered|PIXELS
+
+ +

When it is specified with "centered", the grabbing region follows the mouse +pointer and keeps the pointer at the center of region; otherwise, the region +follows only when the mouse pointer reaches within PIXELS (greater than +zero) to the edge of region. +

+

For example: +

 
ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
+
+# Follows only when the mouse pointer reaches within 100 pixels to edge
+ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
+
+ + +

10.15.2 show_region AVOption

+ +

The syntax is: +

 
-show_region 1
+
+ +

If show_region AVOption is specified with 1, then the grabbing +region will be indicated on screen. With this option, it’s easy to know what is +being grabbed if only a portion of the screen is grabbed. +

+

For example: +

 
ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
+
+# With follow_mouse
+ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
+
+ + +

11. Output Devices

+ +

Output devices are configured elements in FFmpeg which allow to write +multimedia data to an output device attached to your system. +

+

When you configure your FFmpeg build, all the supported output devices +are enabled by default. You can list all available ones using the +configure option "–list-outdevs". +

+

You can disable all the output devices using the configure option +"–disable-outdevs", and selectively enable an output device using the +option "–enable-outdev=OUTDEV", or you can disable a particular +input device using the option "–disable-outdev=OUTDEV". +

+

The option "-formats" of the ff* tools will display the list of +enabled output devices (amongst the muxers). +

+

A description of the currently available output devices follows. +

+ +

11.1 alsa

+ +

ALSA (Advanced Linux Sound Architecture) output device. +

+ +

11.2 oss

+ +

OSS (Open Sound System) output device. +

+ +

11.3 sdl

+ +

SDL (Simple DirectMedia Layer) output device. +

+

This output devices allows to show a video stream in an SDL +window. Only one SDL window is allowed per application, so you can +have only one instance of this output device in an application. +

+

To enable this output device you need libsdl installed on your system +when configuring your build. +

+

For more information about SDL, check: +http://www.libsdl.org/ +

+ +

11.3.1 Options

+ +
+
window_title
+

Set the SDL window title, if not specified default to the filename +specified for the output device. +

+
+
icon_title
+

Set the name of the iconified SDL window, if not specified it is set +to the same value of window_title. +

+
+
window_size
+

Set the SDL window size, can be a string of the form +widthxheight or a video size abbreviation. +If not specified it defaults to the size of the input video. +

+
+ + +

11.3.2 Examples

+ +

The following command shows the ffmpeg output is an +SDL window, forcing its size to the qcif format: +

 
ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL output"
+
+ + +

11.4 sndio

+ +

sndio audio output device. +

+ +

12. Protocols

+ +

Protocols are configured elements in FFmpeg which allow to access +resources which require the use of a particular protocol. +

+

When you configure your FFmpeg build, all the supported protocols are +enabled by default. You can list all available ones using the +configure option "–list-protocols". +

+

You can disable all the protocols using the configure option +"–disable-protocols", and selectively enable a protocol using the +option "–enable-protocol=PROTOCOL", or you can disable a +particular protocol using the option +"–disable-protocol=PROTOCOL". +

+

The option "-protocols" of the ff* tools will display the list of +supported protocols. +

+

A description of the currently available protocols follows. +

+ +

12.1 applehttp

+ +

Read Apple HTTP Live Streaming compliant segmented stream as +a uniform one. The M3U8 playlists describing the segments can be +remote HTTP resources or local files, accessed using the standard +file protocol. +HTTP is default, specific protocol can be declared by specifying +"+proto" after the applehttp URI scheme name, where proto +is either "file" or "http". +

+
 
applehttp://host/path/to/remote/resource.m3u8
+applehttp+http://host/path/to/remote/resource.m3u8
+applehttp+file://path/to/local/resource.m3u8
+
+ + +

12.2 concat

+ +

Physical concatenation protocol. +

+

Allow to read and seek from many resource in sequence as if they were +a unique resource. +

+

A URL accepted by this protocol has the syntax: +

 
concat:URL1|URL2|...|URLN
+
+ +

where URL1, URL2, ..., URLN are the urls of the +resource to be concatenated, each one possibly specifying a distinct +protocol. +

+

For example to read a sequence of files ‘split1.mpeg’, +‘split2.mpeg’, ‘split3.mpeg’ with ffplay use the +command: +

 
ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
+
+ +

Note that you may need to escape the character "|" which is special for +many shells. +

+ +

12.3 file

+ +

File access protocol. +

+

Allow to read from or read to a file. +

+

For example to read from a file ‘input.mpeg’ with ffmpeg +use the command: +

 
ffmpeg -i file:input.mpeg output.mpeg
+
+ +

The ff* tools default to the file protocol, that is a resource +specified with the name "FILE.mpeg" is interpreted as the URL +"file:FILE.mpeg". +

+ +

12.4 gopher

+ +

Gopher protocol. +

+ +

12.5 http

+ +

HTTP (Hyper Text Transfer Protocol). +

+ +

12.6 mmst

+ +

MMS (Microsoft Media Server) protocol over TCP. +

+ +

12.7 mmsh

+ +

MMS (Microsoft Media Server) protocol over HTTP. +

+

The required syntax is: +

 
mmsh://server[:port][/app][/playpath]
+
+ + +

12.8 md5

+ +

MD5 output protocol. +

+

Computes the MD5 hash of the data to be written, and on close writes +this to the designated output or stdout if none is specified. It can +be used to test muxers without writing an actual file. +

+

Some examples follow. +

 
# Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
+ffmpeg -i input.flv -f avi -y md5:output.avi.md5
+
+# Write the MD5 hash of the encoded AVI file to stdout.
+ffmpeg -i input.flv -f avi -y md5:
+
+ +

Note that some formats (typically MOV) require the output protocol to +be seekable, so they will fail with the MD5 output protocol. +

+ +

12.9 pipe

+ +

UNIX pipe access protocol. +

+

Allow to read and write from UNIX pipes. +

+

The accepted syntax is: +

 
pipe:[number]
+
+ +

number is the number corresponding to the file descriptor of the +pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number +is not specified, by default the stdout file descriptor will be used +for writing, stdin for reading. +

+

For example to read from stdin with ffmpeg: +

 
cat test.wav | ffmpeg -i pipe:0
+# ...this is the same as...
+cat test.wav | ffmpeg -i pipe:
+
+ +

For writing to stdout with ffmpeg: +

 
ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
+# ...this is the same as...
+ffmpeg -i test.wav -f avi pipe: | cat > test.avi
+
+ +

Note that some formats (typically MOV), require the output protocol to +be seekable, so they will fail with the pipe output protocol. +

+ +

12.10 rtmp

+ +

Real-Time Messaging Protocol. +

+

The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia +content across a TCP/IP network. +

+

The required syntax is: +

 
rtmp://server[:port][/app][/playpath]
+
+ +

The accepted parameters are: +

+
server
+

The address of the RTMP server. +

+
+
port
+

The number of the TCP port to use (by default is 1935). +

+
+
app
+

It is the name of the application to access. It usually corresponds to +the path where the application is installed on the RTMP server +(e.g. ‘/ondemand/’, ‘/flash/live/’, etc.). +

+
+
playpath
+

It is the path or name of the resource to play with reference to the +application specified in app, may be prefixed by "mp4:". +

+
+
+ +

For example to read with ffplay a multimedia resource named +"sample" from the application "vod" from an RTMP server "myserver": +

 
ffplay rtmp://myserver/vod/sample
+
+ + +

12.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte

+ +

Real-Time Messaging Protocol and its variants supported through +librtmp. +

+

Requires the presence of the librtmp headers and library during +configuration. You need to explicitly configure the build with +"–enable-librtmp". If enabled this will replace the native RTMP +protocol. +

+

This protocol provides most client functions and a few server +functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), +encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled +variants of these encrypted types (RTMPTE, RTMPTS). +

+

The required syntax is: +

 
rtmp_proto://server[:port][/app][/playpath] options
+
+ +

where rtmp_proto is one of the strings "rtmp", "rtmpt", "rtmpe", +"rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and +server, port, app and playpath have the same +meaning as specified for the RTMP native protocol. +options contains a list of space-separated options of the form +key=val. +

+

See the librtmp manual page (man 3 librtmp) for more information. +

+

For example, to stream a file in real-time to an RTMP server using +ffmpeg: +

 
ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
+
+ +

To play the same stream using ffplay: +

 
ffplay "rtmp://myserver/live/mystream live=1"
+
+ + +

12.12 rtp

+ +

Real-Time Protocol. +

+ +

12.13 rtsp

+ +

RTSP is not technically a protocol handler in libavformat, it is a demuxer +and muxer. The demuxer supports both normal RTSP (with data transferred +over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with +data transferred over RDT). +

+

The muxer can be used to send a stream using RTSP ANNOUNCE to a server +supporting it (currently Darwin Streaming Server and Mischa Spiegelmock’s +RTSP server). +

+

The required syntax for a RTSP url is: +

 
rtsp://hostname[:port]/path
+
+ +

The following options (set on the ffmpeg/ffplay command +line, or set in code via AVOptions or in avformat_open_input), +are supported: +

+

Flags for rtsp_transport: +

+
+
udp
+

Use UDP as lower transport protocol. +

+
+
tcp
+

Use TCP (interleaving within the RTSP control channel) as lower +transport protocol. +

+
+
udp_multicast
+

Use UDP multicast as lower transport protocol. +

+
+
http
+

Use HTTP tunneling as lower transport protocol, which is useful for +passing proxies. +

+
+ +

Multiple lower transport protocols may be specified, in that case they are +tried one at a time (if the setup of one fails, the next one is tried). +For the muxer, only the tcp and udp options are supported. +

+

Flags for rtsp_flags: +

+
+
filter_src
+

Accept packets only from negotiated peer address and port. +

+
+ +

When receiving data over UDP, the demuxer tries to reorder received packets +(since they may arrive out of order, or packets may get lost totally). In +order for this to be enabled, a maximum delay must be specified in the +max_delay field of AVFormatContext. +

+

When watching multi-bitrate Real-RTSP streams with ffplay, the +streams to display can be chosen with -vst n and +-ast n for video and audio respectively, and can be switched +on the fly by pressing v and a. +

+

Example command lines: +

+

To watch a stream over UDP, with a max reordering delay of 0.5 seconds: +

+
 
ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
+
+ +

To watch a stream tunneled over HTTP: +

+
 
ffplay -rtsp_transport http rtsp://server/video.mp4
+
+ +

To send a stream in realtime to a RTSP server, for others to watch: +

+
 
ffmpeg -re -i input -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
+
+ + +

12.14 sap

+ +

Session Announcement Protocol (RFC 2974). This is not technically a +protocol handler in libavformat, it is a muxer and demuxer. +It is used for signalling of RTP streams, by announcing the SDP for the +streams regularly on a separate port. +

+ +

12.14.1 Muxer

+ +

The syntax for a SAP url given to the muxer is: +

 
sap://destination[:port][?options]
+
+ +

The RTP packets are sent to destination on port port, +or to port 5004 if no port is specified. +options is a &-separated list. The following options +are supported: +

+
+
announce_addr=address
+

Specify the destination IP address for sending the announcements to. +If omitted, the announcements are sent to the commonly used SAP +announcement multicast address 224.2.127.254 (sap.mcast.net), or +ff0e::2:7ffe if destination is an IPv6 address. +

+
+
announce_port=port
+

Specify the port to send the announcements on, defaults to +9875 if not specified. +

+
+
ttl=ttl
+

Specify the time to live value for the announcements and RTP packets, +defaults to 255. +

+
+
same_port=0|1
+

If set to 1, send all RTP streams on the same port pair. If zero (the +default), all streams are sent on unique ports, with each stream on a +port 2 numbers higher than the previous. +VLC/Live555 requires this to be set to 1, to be able to receive the stream. +The RTP stack in libavformat for receiving requires all streams to be sent +on unique ports. +

+
+ +

Example command lines follow. +

+

To broadcast a stream on the local subnet, for watching in VLC: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255?same_port=1
+
+ +

Similarly, for watching in ffplay: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255
+
+ +

And for watching in ffplay, over IPv6: +

+
 
ffmpeg -re -i input -f sap sap://[ff0e::1:2:3:4]
+
+ + +

12.14.2 Demuxer

+ +

The syntax for a SAP url given to the demuxer is: +

 
sap://[address][:port]
+
+ +

address is the multicast address to listen for announcements on, +if omitted, the default 224.2.127.254 (sap.mcast.net) is used. port +is the port that is listened on, 9875 if omitted. +

+

The demuxers listens for announcements on the given address and port. +Once an announcement is received, it tries to receive that particular stream. +

+

Example command lines follow. +

+

To play back the first stream announced on the normal SAP multicast address: +

+
 
ffplay sap://
+
+ +

To play back the first stream announced on one the default IPv6 SAP multicast address: +

+
 
ffplay sap://[ff0e::2:7ffe]
+
+ + +

12.15 tcp

+ +

Trasmission Control Protocol. +

+

The required syntax for a TCP url is: +

 
tcp://hostname:port[?options]
+
+ +
+
listen
+

Listen for an incoming connection +

+
 
ffmpeg -i input -f format tcp://hostname:port?listen
+ffplay tcp://hostname:port
+
+ +
+
+ + +

12.16 udp

+ +

User Datagram Protocol. +

+

The required syntax for a UDP url is: +

 
udp://hostname:port[?options]
+
+ +

options contains a list of &-seperated options of the form key=val. +Follow the list of supported options. +

+
+
buffer_size=size
+

set the UDP buffer size in bytes +

+
+
localport=port
+

override the local UDP port to bind with +

+
+
localaddr=addr
+

Choose the local IP address. This is useful e.g. if sending multicast +and the host has multiple interfaces, where the user can choose +which interface to send on by specifying the IP address of that interface. +

+
+
pkt_size=size
+

set the size in bytes of UDP packets +

+
+
reuse=1|0
+

explicitly allow or disallow reusing UDP sockets +

+
+
ttl=ttl
+

set the time to live value (for multicast only) +

+
+
connect=1|0
+

Initialize the UDP socket with connect(). In this case, the +destination address can’t be changed with ff_udp_set_remote_url later. +If the destination address isn’t known at the start, this option can +be specified in ff_udp_set_remote_url, too. +This allows finding out the source address for the packets with getsockname, +and makes writes return with AVERROR(ECONNREFUSED) if "destination +unreachable" is received. +For receiving, this gives the benefit of only receiving packets from +the specified peer address/port. +

+
+ +

Some usage examples of the udp protocol with ffmpeg follow. +

+

To stream over UDP to a remote endpoint: +

 
ffmpeg -i input -f format udp://hostname:port
+
+ +

To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer: +

 
ffmpeg -i input -f mpegts udp://hostname:port?pkt_size=188&buffer_size=65535
+
+ +

To receive over UDP from a remote endpoint: +

 
ffmpeg -i udp://[multicast-address]:port
+
+ + +

13. Filtergraph description

+ +

A filtergraph is a directed graph of connected filters. It can contain +cycles, and there can be multiple links between a pair of +filters. Each link has one input pad on one side connecting it to one +filter from which it takes its input, and one output pad on the other +side connecting it to the one filter accepting its output. +

+

Each filter in a filtergraph is an instance of a filter class +registered in the application, which defines the features and the +number of input and output pads of the filter. +

+

A filter with no input pads is called a "source", a filter with no +output pads is called a "sink". +

+ +

13.1 Filtergraph syntax

+ +

A filtergraph can be represented using a textual representation, which +is recognized by the -vf option of the ff* +tools, and by the avfilter_graph_parse() function defined in +‘libavfilter/avfiltergraph.h’. +

+

A filterchain consists of a sequence of connected filters, each one +connected to the previous one in the sequence. A filterchain is +represented by a list of ","-separated filter descriptions. +

+

A filtergraph consists of a sequence of filterchains. A sequence of +filterchains is represented by a list of ";"-separated filterchain +descriptions. +

+

A filter is represented by a string of the form: +[in_link_1]...[in_link_N]filter_name=arguments[out_link_1]...[out_link_M] +

+

filter_name is the name of the filter class of which the +described filter is an instance of, and has to be the name of one of +the filter classes registered in the program. +The name of the filter class is optionally followed by a string +"=arguments". +

+

arguments is a string which contains the parameters used to +initialize the filter instance, and are described in the filter +descriptions below. +

+

The list of arguments can be quoted using the character "’" as initial +and ending mark, and the character ’\’ for escaping the characters +within the quoted text; otherwise the argument string is considered +terminated when the next special character (belonging to the set +"[]=;,") is encountered. +

+

The name and arguments of the filter are optionally preceded and +followed by a list of link labels. +A link label allows to name a link and associate it to a filter output +or input pad. The preceding labels in_link_1 +... in_link_N, are associated to the filter input pads, +the following labels out_link_1 ... out_link_M, are +associated to the output pads. +

+

When two link labels with the same name are found in the +filtergraph, a link between the corresponding input and output pad is +created. +

+

If an output pad is not labelled, it is linked by default to the first +unlabelled input pad of the next filter in the filterchain. +For example in the filterchain: +

 
nullsrc, split[L1], [L2]overlay, nullsink
+
+

the split filter instance has two output pads, and the overlay filter +instance two input pads. The first output pad of split is labelled +"L1", the first input pad of overlay is labelled "L2", and the second +output pad of split is linked to the second input pad of overlay, +which are both unlabelled. +

+

In a complete filterchain all the unlabelled filter input and output +pads must be connected. A filtergraph is considered valid if all the +filter input and output pads of all the filterchains are connected. +

+

Follows a BNF description for the filtergraph syntax: +

 
NAME             ::= sequence of alphanumeric characters and '_'
+LINKLABEL        ::= "[" NAME "]"
+LINKLABELS       ::= LINKLABEL [LINKLABELS]
+FILTER_ARGUMENTS ::= sequence of chars (eventually quoted)
+FILTER           ::= [LINKNAMES] NAME ["=" ARGUMENTS] [LINKNAMES]
+FILTERCHAIN      ::= FILTER [,FILTERCHAIN]
+FILTERGRAPH      ::= FILTERCHAIN [;FILTERGRAPH]
+
+ + + +

14. Audio Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the audio filters included in your +build. +

+

Below is a description of the currently available audio filters. +

+ +

14.1 aconvert

+ +

Convert the input audio format to the specified formats. +

+

The filter accepts a string of the form: +"sample_format:channel_layout:packing_format". +

+

sample_format specifies the sample format, and can be a string or +the corresponding numeric value defined in ‘libavutil/samplefmt.h’. +

+

channel_layout specifies the channel layout, and can be a string +or the corresponding number value defined in ‘libavutil/audioconvert.h’. +

+

packing_format specifies the type of packing in output, can be one +of "planar" or "packed", or the corresponding numeric values "0" or "1". +

+

The special parameter "auto", signifies that the filter will +automatically select the output format depending on the output filter. +

+

Some examples follow. +

+ + + +

14.2 aformat

+ +

Convert the input audio to one of the specified formats. The framework will +negotiate the most appropriate format to minimize conversions. +

+

The filter accepts three lists of formats, separated by ":", in the form: +"sample_formats:channel_layouts:packing_formats". +

+

Elements in each list are separated by "," which has to be escaped in the +filtergraph specification. +

+

The special parameter "all", in place of a list of elements, signifies all +supported formats. +

+

Some examples follow: +

 
aformat=u8\\,s16:mono:packed
+
+aformat=s16:mono\\,stereo:all
+
+ + +

14.3 amerge

+ +

Merge two audio streams into a single multi-channel stream. +

+

This filter does not need any argument. +

+

If the channel layouts of the inputs are disjoint, and therefore compatible, +the channel layout of the output will be set accordingly and the channels +will be reordered as necessary. If the channel layouts of the inputs are not +disjoint, the output will have all the channels of the first input then all +the channels of the second input, in that order, and the channel layout of +the output will be the default value corresponding to the total number of +channels. +

+

For example, if the first input is in 2.1 (FL+FR+LF) and the second input +is FC+BL+BR, then the output will be in 5.1, with the channels in the +following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the +first input, b1 is the first channel of the second input). +

+

On the other hand, if both input are in stereo, the output channels will be +in the default order: a1, a2, b1, b2, and the channel layout will be +arbitrarily set to 4.0, which may or may not be the expected value. +

+

Both inputs must have the same sample rate, format and packing. +

+

If inputs do not have the same duration, the output will stop with the +shortest. +

+

Example: merge two mono files into a stereo stream: +

 
amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
+
+ + +

14.4 anull

+ +

Pass the audio source unchanged to the output. +

+ +

14.5 aresample

+ +

Resample the input audio to the specified sample rate. +

+

The filter accepts exactly one parameter, the output sample rate. If not +specified then the filter will automatically convert between its input +and output sample rates. +

+

For example, to resample the input audio to 44100Hz: +

 
aresample=44100
+
+ + +

14.6 ashowinfo

+ +

Show a line containing various information for each input audio frame. +The input audio is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad, and +is usually 1/sample_rate. +

+
+
pts_time
+

presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic audio) +

+
+
fmt
+

sample format name +

+
+
chlayout
+

channel layout description +

+
+
nb_samples
+

number of samples (per each channel) contained in the filtered frame +

+
+
rate
+

sample rate for the audio frame +

+
+
planar
+

if the packing format is planar, 0 if packed +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) for each input frame plane, +expressed in the form "[c0 c1 c2 c3 c4 c5 +c6 c7]" +

+
+ + +

14.7 asplit

+ +

Pass on the input audio to two outputs. Both outputs are identical to +the input audio. +

+

For example: +

 
[in] asplit[out0], showaudio[out1]
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

14.8 astreamsync

+ +

Forward two audio streams and control the order the buffers are forwarded. +

+

The argument to the filter is an expression deciding which stream should be +forwarded next: if the result is negative, the first stream is forwarded; if +the result is positive or zero, the second stream is forwarded. It can use +the following variables: +

+
+
b1 b2
+

number of buffers forwarded so far on each stream +

+
s1 s2
+

number of samples forwarded so far on each stream +

+
t1 t2
+

current timestamp of each stream +

+
+ +

The default value is t1-t2, which means to always forward the stream +that has a smaller timestamp. +

+

Example: stress-test amerge by randomly sending buffers on the wrong +input, while avoiding too much of a desynchronization: +

 
amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
+[a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
+[a2] [b2] amerge
+
+ + +

14.9 earwax

+ +

Make audio easier to listen to on headphones. +

+

This filter adds ‘cues’ to 44.1kHz stereo (i.e. audio CD format) audio +so that when listened to on headphones the stereo image is moved from +inside your head (standard for headphones) to outside and in front of +the listener (standard for speakers). +

+

Ported from SoX. +

+ +

14.10 pan

+ +

Mix channels with specific gain levels. The filter accepts the output +channel layout followed by a set of channels definitions. +

+

This filter is also designed to remap efficiently the channels of an audio +stream. +

+

The filter accepts parameters of the form: +"l:outdef:outdef:..." +

+
+
l
+

output channel layout or number of channels +

+
+
outdef
+

output channel specification, of the form: +"out_name=[gain*]in_name[+[gain*]in_name...]" +

+
+
out_name
+

output channel to define, either a channel name (FL, FR, etc.) or a channel +number (c0, c1, etc.) +

+
+
gain
+

multiplicative coefficient for the channel, 1 leaving the volume unchanged +

+
+
in_name
+

input channel to use, see out_name for details; it is not possible to mix +named and numbered input channels +

+
+ +

If the ‘=’ in a channel specification is replaced by ‘<’, then the gains for +that specification will be renormalized so that the total is 1, thus +avoiding clipping noise. +

+ +

14.10.1 Mixing examples

+ +

For example, if you want to down-mix from stereo to mono, but with a bigger +factor for the left channel: +

 
pan=1:c0=0.9*c0+0.1*c1
+
+ +

A customized down-mix to stereo that works automatically for 3-, 4-, 5- and +7-channels surround: +

 
pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
+
+ +

Note that ffmpeg integrates a default down-mix (and up-mix) system +that should be preferred (see "-ac" option) unless you have very specific +needs. +

+ +

14.10.2 Remapping examples

+ +

The channel remapping will be effective if, and only if: +

+ + +

If all these conditions are satisfied, the filter will notify the user ("Pure +channel mapping detected"), and use an optimized and lossless method to do the +remapping. +

+

For example, if you have a 5.1 source and want a stereo audio stream by +dropping the extra channels: +

 
pan="stereo: c0=FL : c1=FR"
+
+ +

Given the same source, you can also switch front left and front right channels +and keep the input channel layout: +

 
pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
+
+ +

If the input is a stereo audio stream, you can mute the front left channel (and +still keep the stereo channel layout) with: +

 
pan="stereo:c1=c1"
+
+ +

Still with a stereo audio stream input, you can copy the right channel in both +front left and right: +

 
pan="stereo: c0=FR : c1=FR"
+
+ + +

14.11 silencedetect

+ +

Detect silence in an audio stream. +

+

This filter logs a message when it detects that the input audio volume is less +or equal to a noise tolerance value for a duration greater or equal to the +minimum detected noise duration. +

+

The printed times and duration are expressed in seconds. +

+
+
duration, d
+

Set silence duration until notification (default is 2 seconds). +

+
+
noise, n
+

Set noise tolerance. Can be specified in dB (in case "dB" is appended to the +specified value) or amplitude ratio. Default is -60dB, or 0.001. +

+
+ +

Detect 5 seconds of silence with -50dB noise tolerance: +

 
silencedetect=n=-50dB:d=5
+
+ +

Complete example with ffmpeg to detect silence with 0.0001 noise +tolerance in ‘silence.mp3’: +

 
ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
+
+ + +

14.12 volume

+ +

Adjust the input audio volume. +

+

The filter accepts exactly one parameter vol, which expresses +how the audio volume will be increased or decreased. +

+

Output values are clipped to the maximum value. +

+

If vol is expressed as a decimal number, the output audio +volume is given by the relation: +

 
output_volume = vol * input_volume
+
+ +

If vol is expressed as a decimal number followed by the string +"dB", the value represents the requested change in decibels of the +input audio power, and the output audio volume is given by the +relation: +

 
output_volume = 10^(vol/20) * input_volume
+
+ +

Otherwise vol is considered an expression and its evaluated +value is used for computing the output audio volume according to the +first relation. +

+

Default value for vol is 1.0. +

+ +

14.12.1 Examples

+ + + + + +

15. Audio Sources

+ +

Below is a description of the currently available audio sources. +

+ +

15.1 abuffer

+ +

Buffer audio frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/asrc_abuffer.h’. +

+

It accepts the following mandatory parameters: +sample_rate:sample_fmt:channel_layout:packing +

+
+
sample_rate
+

The sample rate of the incoming audio buffers. +

+
+
sample_fmt
+

The sample format of the incoming audio buffers. +Either a sample format name or its corresponging integer representation from +the enum AVSampleFormat in ‘libavutil/samplefmt.h’ +

+
+
channel_layout
+

The channel layout of the incoming audio buffers. +Either a channel layout name from channel_layout_map in +‘libavutil/audioconvert.c’ or its corresponding integer representation +from the AV_CH_LAYOUT_* macros in ‘libavutil/audioconvert.h’ +

+
+
packing
+

Either "packed" or "planar", or their integer representation: 0 or 1 +respectively. +

+
+
+ +

For example: +

 
abuffer=44100:s16:stereo:planar
+
+ +

will instruct the source to accept planar 16bit signed stereo at 44100Hz. +Since the sample format with name "s16" corresponds to the number +1 and the "stereo" channel layout corresponds to the value 3, this is +equivalent to: +

 
abuffer=44100:1:3:1
+
+ + +

15.2 aevalsrc

+ +

Generate an audio signal specified by an expression. +

+

This source accepts in input one or more expressions (one for each +channel), which are evaluated and used to generate a corresponding +audio signal. +

+

It accepts the syntax: exprs[::options]. +exprs is a list of expressions separated by ":", one for each +separate channel. The output channel layout depends on the number of +provided expressions, up to 8 channels are supported. +

+

options is an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
duration, d
+

Set the minimum duration of the sourced audio. See the function +av_parse_time() for the accepted format. +Note that the resulting duration may be greater than the specified +duration, as the generated audio is always cut at the end of a +complete frame. +

+

If not specified, or the expressed duration is negative, the audio is +supposed to be generated forever. +

+
+
nb_samples, n
+

Set the number of samples per channel per each output frame, +default to 1024. +

+
+
sample_rate, s
+

Specify the sample rate, default to 44100. +

+
+ +

Each expression in exprs can contain the following constants: +

+
+
n
+

number of the evaluated sample, starting from 0 +

+
+
t
+

time of the evaluated sample expressed in seconds, starting from 0 +

+
+
s
+

sample rate +

+
+
+ + +

15.2.1 Examples

+ + + + +

15.3 amovie

+ +

Read an audio stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specify the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specify the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specify the index of the audio stream to read. If the value is -1, +the best suited audio stream will be automatically selected. Default +value is "-1". +

+
+
+ + +

15.4 anullsrc

+ +

Null audio source, return unprocessed audio frames. It is mainly useful +as a template and to be employed in analysis / debugging tools, or as +the source for filters which ignore the input data (for example the sox +synth filter). +

+

It accepts an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
sample_rate, s
+

Specify the sample rate, and defaults to 44100. +

+
+
channel_layout, cl
+
+

Specify the channel layout, and can be either an integer or a string +representing a channel layout. The default value of channel_layout +is "stereo". +

+

Check the channel_layout_map definition in +‘libavcodec/audioconvert.c’ for the mapping between strings and +channel layout values. +

+
+
nb_samples, n
+

Set the number of samples per requested frames. +

+
+
+ +

Follow some examples: +

 
#  set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
+anullsrc=r=48000:cl=4
+
+# same as
+anullsrc=r=48000:cl=mono
+
+ + + +

16. Audio Sinks

+ +

Below is a description of the currently available audio sinks. +

+ +

16.1 abuffersink

+ +

Buffer audio frames, and make them available to the end of filter chain. +

+

This sink is mainly intended for programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It requires a pointer to an AVABufferSinkContext structure, which +defines the incoming buffers’ formats, to be passed as the opaque +parameter to avfilter_init_filter for initialization. +

+ +

16.2 anullsink

+ +

Null audio sink, do absolutely nothing with the input audio. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + +

17. Video Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the video filters included in your +build. +

+

Below is a description of the currently available video filters. +

+ +

17.1 ass

+ +

Draw ASS (Advanced Substation Alpha) subtitles on top of input video +using the libass library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libass. +

+

This filter accepts in input the name of the ass file to render. +

+

For example, to render the file ‘sub.ass’ on top of the input +video, use the command: +

 
ass=sub.ass
+
+ + +

17.2 blackframe

+ +

Detect frames that are (almost) completely black. Can be useful to +detect chapter transitions or commercials. Output lines consist of +the frame number of the detected frame, the percentage of blackness, +the position in the file if known or -1 and the timestamp in seconds. +

+

In order to display the output lines, you need to set the loglevel at +least to the AV_LOG_INFO value. +

+

The filter accepts the syntax: +

 
blackframe[=amount:[threshold]]
+
+ +

amount is the percentage of the pixels that have to be below the +threshold, and defaults to 98. +

+

threshold is the threshold below which a pixel value is +considered black, and defaults to 32. +

+ +

17.3 boxblur

+ +

Apply boxblur algorithm to the input video. +

+

This filter accepts the parameters: +luma_radius:luma_power:chroma_radius:chroma_power:alpha_radius:alpha_power +

+

Chroma and alpha parameters are optional, if not specified they default +to the corresponding values set for luma_radius and +luma_power. +

+

luma_radius, chroma_radius, and alpha_radius represent +the radius in pixels of the box used for blurring the corresponding +input plane. They are expressions, and can contain the following +constants: +

+
w, h
+

the input width and height in pixels +

+
+
cw, ch
+

the input chroma image width and height in pixels +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

The radius must be a non-negative number, and must not be greater than +the value of the expression min(w,h)/2 for the luma and alpha planes, +and of min(cw,ch)/2 for the chroma planes. +

+

luma_power, chroma_power, and alpha_power represent +how many times the boxblur filter is applied to the corresponding +plane. +

+

Some examples follow: +

+ + + +

17.4 copy

+ +

Copy the input source unchanged to the output. Mainly useful for +testing purposes. +

+ +

17.5 crop

+ +

Crop the input video to out_w:out_h:x:y. +

+

The parameters are expressions containing the following constants: +

+
+
x, y
+

the computed values for x and y. They are evaluated for +each new frame. +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
pos
+

the position in the file of the input frame, NAN if unknown +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
+ +

The out_w and out_h parameters specify the expressions for +the width and height of the output (cropped) video. They are +evaluated just at the configuration of the filter. +

+

The default value of out_w is "in_w", and the default value of +out_h is "in_h". +

+

The expression for out_w may depend on the value of out_h, +and the expression for out_h may depend on out_w, but they +cannot depend on x and y, as x and y are +evaluated after out_w and out_h. +

+

The x and y parameters specify the expressions for the +position of the top-left corner of the output (non-cropped) area. They +are evaluated for each frame. If the evaluated value is not valid, it +is approximated to the nearest valid value. +

+

The default value of x is "(in_w-out_w)/2", and the default +value for y is "(in_h-out_h)/2", which set the cropped area at +the center of the input image. +

+

The expression for x may depend on y, and the expression +for y may depend on x. +

+

Follow some examples: +

 
# crop the central input area with size 100x100
+crop=100:100
+
+# crop the central input area with size 2/3 of the input video
+"crop=2/3*in_w:2/3*in_h"
+
+# crop the input video central square
+crop=in_h
+
+# delimit the rectangle with the top-left corner placed at position
+# 100:100 and the right-bottom corner corresponding to the right-bottom
+# corner of the input image.
+crop=in_w-100:in_h-100:100:100
+
+# crop 10 pixels from the left and right borders, and 20 pixels from
+# the top and bottom borders
+"crop=in_w-2*10:in_h-2*20"
+
+# keep only the bottom right quarter of the input image
+"crop=in_w/2:in_h/2:in_w/2:in_h/2"
+
+# crop height for getting Greek harmony
+"crop=in_w:1/PHI*in_w"
+
+# trembling effect
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
+
+# erratic camera effect depending on timestamp
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
+
+# set x depending on the value of y
+"crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
+
+ + +

17.6 cropdetect

+ +

Auto-detect crop size. +

+

Calculate necessary cropping parameters and prints the recommended +parameters through the logging system. The detected dimensions +correspond to the non-black area of the input video. +

+

It accepts the syntax: +

 
cropdetect[=limit[:round[:reset]]]
+
+ +
+
limit
+

Threshold, which can be optionally specified from nothing (0) to +everything (255), defaults to 24. +

+
+
round
+

Value which the width/height should be divisible by, defaults to +16. The offset is automatically adjusted to center the video. Use 2 to +get only even dimensions (needed for 4:2:2 video). 16 is best when +encoding to most video codecs. +

+
+
reset
+

Counter that determines after how many frames cropdetect will reset +the previously detected largest video area and start over to detect +the current optimal crop area. Defaults to 0. +

+

This can be useful when channel logos distort the video area. 0 +indicates never reset and return the largest area encountered during +playback. +

+
+ + +

17.7 delogo

+ +

Suppress a TV station logo by a simple interpolation of the surrounding +pixels. Just set a rectangle covering the logo and watch it disappear +(and sometimes something even uglier appear - your mileage may vary). +

+

The filter accepts parameters as a string of the form +"x:y:w:h:band", or as a list of +key=value pairs, separated by ":". +

+

The description of the accepted parameters follows. +

+
+
x, y
+

Specify the top left corner coordinates of the logo. They must be +specified. +

+
+
w, h
+

Specify the width and height of the logo to clear. They must be +specified. +

+
+
band, t
+

Specify the thickness of the fuzzy edge of the rectangle (added to +w and h). The default value is 4. +

+
+
show
+

When set to 1, a green rectangle is drawn on the screen to simplify +finding the right x, y, w, h parameters, and +band is set to 4. The default value is 0. +

+
+
+ +

Some examples follow. +

+ + + +

17.8 deshake

+ +

Attempt to fix small changes in horizontal and/or vertical shift. This +filter helps remove camera shake from hand-holding a camera, bumping a +tripod, moving on a vehicle, etc. +

+

The filter accepts parameters as a string of the form +"x:y:w:h:rx:ry:edge:blocksize:contrast:search:filename" +

+

A description of the accepted parameters follows. +

+
+
x, y, w, h
+

Specify a rectangular area where to limit the search for motion +vectors. +If desired the search for motion vectors can be limited to a +rectangular area of the frame defined by its top left corner, width +and height. These parameters have the same meaning as the drawbox +filter which can be used to visualise the position of the bounding +box. +

+

This is useful when simultaneous movement of subjects within the frame +might be confused for camera motion by the motion vector search. +

+

If any or all of x, y, w and h are set to -1 +then the full frame is used. This allows later options to be set +without specifying the bounding box for the motion vector search. +

+

Default - search the whole frame. +

+
+
rx, ry
+

Specify the maximum extent of movement in x and y directions in the +range 0-64 pixels. Default 16. +

+
+
edge
+

Specify how to generate pixels to fill blanks at the edge of the +frame. An integer from 0 to 3 as follows: +

+
0
+

Fill zeroes at blank locations +

+
1
+

Original image at blank locations +

+
2
+

Extruded edge value at blank locations +

+
3
+

Mirrored edge at blank locations +

+
+ +

The default setting is mirror edge at blank locations. +

+
+
blocksize
+

Specify the blocksize to use for motion search. Range 4-128 pixels, +default 8. +

+
+
contrast
+

Specify the contrast threshold for blocks. Only blocks with more than +the specified contrast (difference between darkest and lightest +pixels) will be considered. Range 1-255, default 125. +

+
+
search
+

Specify the search strategy 0 = exhaustive search, 1 = less exhaustive +search. Default - exhaustive search. +

+
+
filename
+

If set then a detailed log of the motion search is written to the +specified file. +

+
+
+ + +

17.9 drawbox

+ +

Draw a colored box on the input image. +

+

It accepts the syntax: +

 
drawbox=x:y:width:height:color
+
+ +
+
x, y
+

Specify the top left corner coordinates of the box. Default to 0. +

+
+
width, height
+

Specify the width and height of the box, if 0 they are interpreted as +the input width and height. Default to 0. +

+
+
color
+

Specify the color of the box to write, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+
+ +

Follow some examples: +

 
# draw a black box around the edge of the input image
+drawbox
+
+# draw a box with color red and an opacity of 50%
+drawbox=10:20:200:60:red@0.5"
+
+ + +

17.10 drawtext

+ +

Draw text string or text from specified file on top of video using the +libfreetype library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libfreetype. +

+

The filter also recognizes strftime() sequences in the provided text +and expands them accordingly. Check the documentation of strftime(). +

+

The filter accepts parameters as a list of key=value pairs, +separated by ":". +

+

The description of the accepted parameters follows. +

+
+
fontfile
+

The font file to be used for drawing text. Path must be included. +This parameter is mandatory. +

+
+
text
+

The text string to be drawn. The text must be a sequence of UTF-8 +encoded characters. +This parameter is mandatory if no file is specified with the parameter +textfile. +

+
+
textfile
+

A text file containing text to be drawn. The text must be a sequence +of UTF-8 encoded characters. +

+

This parameter is mandatory if no text string is specified with the +parameter text. +

+

If both text and textfile are specified, an error is thrown. +

+
+
x, y
+

The expressions which specify the offsets where text will be drawn +within the video frame. They are relative to the top/left border of the +output image. +

+

The default value of x and y is "0". +

+

See below for the list of accepted constants. +

+
+
fontsize
+

The font size to be used for drawing text. +The default value of fontsize is 16. +

+
+
fontcolor
+

The color to be used for drawing fonts. +Either a string (e.g. "red") or in 0xRRGGBB[AA] format +(e.g. "0xff000033"), possibly followed by an alpha specifier. +The default value of fontcolor is "black". +

+
+
boxcolor
+

The color to be used for drawing box around text. +Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format +(e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of boxcolor is "white". +

+
+
box
+

Used to draw a box around text using background color. +Value should be either 1 (enable) or 0 (disable). +The default value of box is 0. +

+
+
shadowx, shadowy
+

The x and y offsets for the text shadow position with respect to the +position of the text. They can be either positive or negative +values. Default value for both is "0". +

+
+
shadowcolor
+

The color to be used for drawing a shadow behind the drawn text. It +can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA] +form (e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of shadowcolor is "black". +

+
+
ft_load_flags
+

Flags to be used for loading the fonts. +

+

The flags map the corresponding flags supported by libfreetype, and are +a combination of the following values: +

+
default
+
no_scale
+
no_hinting
+
render
+
no_bitmap
+
vertical_layout
+
force_autohint
+
crop_bitmap
+
pedantic
+
ignore_global_advance_width
+
no_recurse
+
ignore_transform
+
monochrome
+
linear_design
+
no_autohint
+
end table
+
+ +

Default value is "render". +

+

For more information consult the documentation for the FT_LOAD_* +libfreetype flags. +

+
+
tabsize
+

The size in number of spaces to use for rendering the tab. +Default value is 4. +

+
+ +

The parameters for x and y are expressions containing the +following constants: +

+
+
W, H
+

the input width and height +

+
+
tw, text_w
+

the width of the rendered text +

+
+
th, text_h
+

the height of the rendered text +

+
+
lh, line_h
+

the height of each text line +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (w / h) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
max_glyph_w
+

maximum glyph width, that is the maximum width for all the glyphs +contained in the rendered text +

+
+
max_glyph_h
+

maximum glyph height, that is the maximum height for all the glyphs +contained in the rendered text, it is equivalent to ascent - +descent. +

+
+
max_glyph_a, ascent
+
+

the maximum distance from the baseline to the highest/upper grid +coordinate used to place a glyph outline point, for all the rendered +glyphs. +It is a positive value, due to the grid’s orientation with the Y axis +upwards. +

+
+
max_glyph_d, descent
+

the maximum distance from the baseline to the lowest grid coordinate +used to place a glyph outline point, for all the rendered glyphs. +This is a negative value, due to the grid’s orientation, with the Y axis +upwards. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
timecode
+

initial timecode representation in "hh:mm:ss[:;.]ff" format. It can be used +with or without text parameter. rate option must be specified. +Note that timecode options are not effective if FFmpeg is build with +--disable-avcodec. +

+
+
r, rate
+

frame rate (timecode only) +

+
+ +

Some examples follow. +

+ + +

For more information about libfreetype, check: +http://www.freetype.org/. +

+ +

17.11 fade

+ +

Apply fade-in/out effect to input video. +

+

It accepts the parameters: +type:start_frame:nb_frames[:options] +

+

type specifies if the effect type, can be either "in" for +fade-in, or "out" for a fade-out effect. +

+

start_frame specifies the number of the start frame for starting +to apply the fade effect. +

+

nb_frames specifies the number of frames for which the fade +effect has to last. At the end of the fade-in effect the output video +will have the same intensity as the input video, at the end of the +fade-out transition the output video will be completely black. +

+

options is an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
type, t
+

See type. +

+
+
start_frame, s
+

See start_frame. +

+
+
nb_frames, n
+

See nb_frames. +

+
+
alpha
+

If set to 1, fade only alpha channel, if one exists on the input. +Default value is 0. +

+
+ +

A few usage examples follow, usable too as test scenarios. +

 
# fade in first 30 frames of video
+fade=in:0:30
+
+# fade out last 45 frames of a 200-frame video
+fade=out:155:45
+
+# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
+fade=in:0:25, fade=out:975:25
+
+# make first 5 frames black, then fade in from frame 5-24
+fade=in:5:20
+
+# fade in alpha over first 25 frames of video
+fade=in:0:25:alpha=1
+
+ + +

17.12 fieldorder

+ +

Transform the field order of the input video. +

+

It accepts one parameter which specifies the required field order that +the input interlaced video will be transformed to. The parameter can +assume one of the following values: +

+
+
0 or bff
+

output bottom field first +

+
1 or tff
+

output top field first +

+
+ +

Default value is "tff". +

+

Transformation is achieved by shifting the picture content up or down +by one line, and filling the remaining line with appropriate picture content. +This method is consistent with most broadcast field order converters. +

+

If the input video is not flagged as being interlaced, or it is already +flagged as being of the required output field order then this filter does +not alter the incoming video. +

+

This filter is very useful when converting to or from PAL DV material, +which is bottom field first. +

+

For example: +

 
ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
+
+ + +

17.13 fifo

+ +

Buffer input images and send them when they are requested. +

+

This filter is mainly useful when auto-inserted by the libavfilter +framework. +

+

The filter does not take parameters. +

+ +

17.14 format

+ +

Convert the input video to one of the specified pixel formats. +Libavfilter will try to pick one that is supported for the input to +the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# convert the input video to the format "yuv420p"
+format=yuv420p
+
+# convert the input video to any of the formats in the list
+format=yuv420p:yuv444p:yuv410p
+
+ +

+

+

17.15 frei0r

+ +

Apply a frei0r effect to the input video. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The filter supports the syntax: +

 
filter_name[{:|=}param1:param2:...:paramN]
+
+ +

filter_name is the name to the frei0r effect to load. If the +environment variable FREI0R_PATH is defined, the frei0r effect +is searched in each one of the directories specified by the colon +separated list in FREIOR_PATH, otherwise in the standard frei0r +paths, which are in this order: ‘HOME/.frei0r-1/lib/’, +‘/usr/local/lib/frei0r-1/’, ‘/usr/lib/frei0r-1/’. +

+

param1, param2, ... , paramN specify the parameters +for the frei0r effect. +

+

A frei0r effect parameter can be a boolean (whose values are specified +with "y" and "n"), a double, a color (specified by the syntax +R/G/B, R, G, and B being float +numbers from 0.0 to 1.0) or by an av_parse_color() color +description), a position (specified by the syntax X/Y, +X and Y being float numbers) and a string. +

+

The number and kind of parameters depend on the loaded effect. If an +effect parameter is not specified the default value is set. +

+

Some examples follow: +

 
# apply the distort0r effect, set the first two double parameters
+frei0r=distort0r:0.5:0.01
+
+# apply the colordistance effect, takes a color as first parameter
+frei0r=colordistance:0.2/0.3/0.4
+frei0r=colordistance:violet
+frei0r=colordistance:0x112233
+
+# apply the perspective effect, specify the top left and top right
+# image positions
+frei0r=perspective:0.2/0.2:0.8/0.2
+
+ +

For more information see: +http://piksel.org/frei0r +

+ +

17.16 gradfun

+ +

Fix the banding artifacts that are sometimes introduced into nearly flat +regions by truncation to 8bit color depth. +Interpolate the gradients that should go where the bands are, and +dither them. +

+

This filter is designed for playback only. Do not use it prior to +lossy compression, because compression tends to lose the dither and +bring back the bands. +

+

The filter takes two optional parameters, separated by ’:’: +strength:radius +

+

strength is the maximum amount by which the filter will change +any one pixel. Also the threshold for detecting nearly flat +regions. Acceptable values range from .51 to 255, default value is +1.2, out-of-range values will be clipped to the valid range. +

+

radius is the neighborhood to fit the gradient to. A larger +radius makes for smoother gradients, but also prevents the filter from +modifying the pixels near detailed regions. Acceptable values are +8-32, default value is 16, out-of-range values will be clipped to the +valid range. +

+
 
# default parameters
+gradfun=1.2:16
+
+# omitting radius
+gradfun=1.2
+
+ + +

17.17 hflip

+ +

Flip the input video horizontally. +

+

For example to horizontally flip the input video with ffmpeg: +

 
ffmpeg -i in.avi -vf "hflip" out.avi
+
+ + +

17.18 hqdn3d

+ +

High precision/quality 3d denoise filter. This filter aims to reduce +image noise producing smooth images and making still images really +still. It should enhance compressibility. +

+

It accepts the following optional parameters: +luma_spatial:chroma_spatial:luma_tmp:chroma_tmp +

+
+
luma_spatial
+

a non-negative float number which specifies spatial luma strength, +defaults to 4.0 +

+
+
chroma_spatial
+

a non-negative float number which specifies spatial chroma strength, +defaults to 3.0*luma_spatial/4.0 +

+
+
luma_tmp
+

a float number which specifies luma temporal strength, defaults to +6.0*luma_spatial/4.0 +

+
+
chroma_tmp
+

a float number which specifies chroma temporal strength, defaults to +luma_tmp*chroma_spatial/luma_spatial +

+
+ + +

17.19 lut, lutrgb, lutyuv

+ +

Compute a look-up table for binding each pixel component input value +to an output value, and apply it to input video. +

+

lutyuv applies a lookup table to a YUV input video, lutrgb +to an RGB input video. +

+

These filters accept in input a ":"-separated list of options, which +specify the expressions used for computing the lookup table for the +corresponding pixel component values. +

+

The lut filter requires either YUV or RGB pixel formats in +input, and accepts the options: +

+
c0
+

first pixel component +

+
c1
+

second pixel component +

+
c2
+

third pixel component +

+
c3
+

fourth pixel component, corresponds to the alpha component +

+
+ +

The exact component associated to each option depends on the format in +input. +

+

The lutrgb filter requires RGB pixel formats in input, and +accepts the options: +

+
r
+

red component +

+
g
+

green component +

+
b
+

blue component +

+
a
+

alpha component +

+
+ +

The lutyuv filter requires YUV pixel formats in input, and +accepts the options: +

+
y
+

Y/luminance component +

+
u
+

U/Cb component +

+
v
+

V/Cr component +

+
a
+

alpha component +

+
+ +

The expressions can contain the following constants and functions: +

+
+
w, h
+

the input width and height +

+
+
val
+

input value for the pixel component +

+
+
clipval
+

the input value clipped in the minval-maxval range +

+
+
maxval
+

maximum value for the pixel component +

+
+
minval
+

minimum value for the pixel component +

+
+
negval
+

the negated value for the pixel component value clipped in the +minval-maxval range , it corresponds to the expression +"maxval-clipval+minval" +

+
+
clip(val)
+

the computed value in val clipped in the +minval-maxval range +

+
+
gammaval(gamma)
+

the computed gamma correction value of the pixel component value +clipped in the minval-maxval range, corresponds to the +expression +"pow((clipval-minval)/(maxval-minval)\,gamma)*(maxval-minval)+minval" +

+
+
+ +

All expressions default to "val". +

+

Some examples follow: +

 
# negate input video
+lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
+lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
+
+# the above is the same as
+lutrgb="r=negval:g=negval:b=negval"
+lutyuv="y=negval:u=negval:v=negval"
+
+# negate luminance
+lutyuv=y=negval
+
+# remove chroma components, turns the video into a graytone image
+lutyuv="u=128:v=128"
+
+# apply a luma burning effect
+lutyuv="y=2*val"
+
+# remove green and blue components
+lutrgb="g=0:b=0"
+
+# set a constant alpha channel value on input
+format=rgba,lutrgb=a="maxval-minval/2"
+
+# correct luminance gamma by a 0.5 factor
+lutyuv=y=gammaval(0.5)
+
+ + +

17.20 mp

+ +

Apply an MPlayer filter to the input video. +

+

This filter provides a wrapper around most of the filters of +MPlayer/MEncoder. +

+

This wrapper is considered experimental. Some of the wrapped filters +may not work properly and we may drop support for them, as they will +be implemented natively into FFmpeg. Thus you should avoid +depending on them when writing portable scripts. +

+

The filters accepts the parameters: +filter_name[:=]filter_params +

+

filter_name is the name of a supported MPlayer filter, +filter_params is a string containing the parameters accepted by +the named filter. +

+

The list of the currently supported filters follows: +

+
2xsai
+
decimate
+
denoise3d
+
detc
+
dint
+
divtc
+
down3dright
+
dsize
+
eq2
+
eq
+
field
+
fil
+
fixpts
+
framestep
+
fspp
+
geq
+
harddup
+
hqdn3d
+
hue
+
il
+
ilpack
+
ivtc
+
kerndeint
+
mcdeint
+
mirror
+
noise
+
ow
+
palette
+
perspective
+
phase
+
pp7
+
pullup
+
qp
+
rectangle
+
remove-logo
+
rotate
+
sab
+
screenshot
+
smartblur
+
softpulldown
+
softskip
+
spp
+
swapuv
+
telecine
+
tile
+
tinterlace
+
unsharp
+
uspp
+
yuvcsp
+
yvu9
+
+ +

The parameter syntax and behavior for the listed filters are the same +of the corresponding MPlayer filters. For detailed instructions check +the "VIDEO FILTERS" section in the MPlayer manual. +

+

Some examples follow: +

 
# remove a logo by interpolating the surrounding pixels
+mp=delogo=200:200:80:20:1
+
+# adjust gamma, brightness, contrast
+mp=eq2=1.0:2:0.5
+
+# tweak hue and saturation
+mp=hue=100:-10
+
+ +

See also mplayer(1), http://www.mplayerhq.hu/. +

+ +

17.21 negate

+ +

Negate input video. +

+

This filter accepts an integer in input, if non-zero it negates the +alpha component (if available). The default value in input is 0. +

+ +

17.22 noformat

+ +

Force libavfilter not to use any of the specified pixel formats for the +input to the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# force libavfilter to use a format different from "yuv420p" for the
+# input to the vflip filter
+noformat=yuv420p,vflip
+
+# convert the input video to any of the formats not contained in the list
+noformat=yuv420p:yuv444p:yuv410p
+
+ + +

17.23 null

+ +

Pass the video source unchanged to the output. +

+ +

17.24 ocv

+ +

Apply video transform using libopencv. +

+

To enable this filter install libopencv library and headers and +configure FFmpeg with --enable-libopencv. +

+

The filter takes the parameters: filter_name{:=}filter_params. +

+

filter_name is the name of the libopencv filter to apply. +

+

filter_params specifies the parameters to pass to the libopencv +filter. If not specified the default values are assumed. +

+

Refer to the official libopencv documentation for more precise +information: +http://opencv.willowgarage.com/documentation/c/image_filtering.html +

+

Follows the list of supported libopencv filters. +

+

+

+

17.24.1 dilate

+ +

Dilate an image by using a specific structuring element. +This filter corresponds to the libopencv function cvDilate. +

+

It accepts the parameters: struct_el:nb_iterations. +

+

struct_el represents a structuring element, and has the syntax: +colsxrows+anchor_xxanchor_y/shape +

+

cols and rows represent the number of columns and rows of +the structuring element, anchor_x and anchor_y the anchor +point, and shape the shape for the structuring element, and +can be one of the values "rect", "cross", "ellipse", "custom". +

+

If the value for shape is "custom", it must be followed by a +string of the form "=filename". The file with name +filename is assumed to represent a binary image, with each +printable character corresponding to a bright pixel. When a custom +shape is used, cols and rows are ignored, the number +or columns and rows of the read file are assumed instead. +

+

The default value for struct_el is "3x3+0x0/rect". +

+

nb_iterations specifies the number of times the transform is +applied to the image, and defaults to 1. +

+

Follow some example: +

 
# use the default values
+ocv=dilate
+
+# dilate using a structuring element with a 5x5 cross, iterate two times
+ocv=dilate=5x5+2x2/cross:2
+
+# read the shape from the file diamond.shape, iterate two times
+# the file diamond.shape may contain a pattern of characters like this:
+#   *
+#  ***
+# *****
+#  ***
+#   *
+# the specified cols and rows are ignored (but not the anchor point coordinates)
+ocv=0x0+2x2/custom=diamond.shape:2
+
+ + +

17.24.2 erode

+ +

Erode an image by using a specific structuring element. +This filter corresponds to the libopencv function cvErode. +

+

The filter accepts the parameters: struct_el:nb_iterations, +with the same syntax and semantics as the dilate filter. +

+ +

17.24.3 smooth

+ +

Smooth the input video. +

+

The filter takes the following parameters: +type:param1:param2:param3:param4. +

+

type is the type of smooth filter to apply, and can be one of +the following values: "blur", "blur_no_scale", "median", "gaussian", +"bilateral". The default value is "gaussian". +

+

param1, param2, param3, and param4 are +parameters whose meanings depend on smooth type. param1 and +param2 accept integer positive values or 0, param3 and +param4 accept float values. +

+

The default value for param1 is 3, the default value for the +other parameters is 0. +

+

These parameters correspond to the parameters assigned to the +libopencv function cvSmooth. +

+

+

+

17.25 overlay

+ +

Overlay one video on top of another. +

+

It takes two inputs and one output, the first input is the "main" +video on which the second input is overlayed. +

+

It accepts the parameters: x:y[:options]. +

+

x is the x coordinate of the overlayed video on the main video, +y is the y coordinate. x and y are expressions containing +the following parameters: +

+
+
main_w, main_h
+

main input width and height +

+
+
W, H
+

same as main_w and main_h +

+
+
overlay_w, overlay_h
+

overlay input width and height +

+
+
w, h
+

same as overlay_w and overlay_h +

+
+ +

options is an optional list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
rgb
+

If set to 1, force the filter to accept inputs in the RGB +color space. Default value is 0. +

+
+ +

Be aware that frames are taken from each input video in timestamp +order, hence, if their initial timestamps differ, it is a a good idea +to pass the two inputs through a setpts=PTS-STARTPTS filter to +have them begin in the same zero timestamp, as it does the example for +the movie filter. +

+

Follow some examples: +

 
# draw the overlay at 10 pixels from the bottom right
+# corner of the main video.
+overlay=main_w-overlay_w-10:main_h-overlay_h-10
+
+# insert a transparent PNG logo in the bottom left corner of the input
+movie=logo.png [logo];
+[in][logo] overlay=10:main_h-overlay_h-10 [out]
+
+# insert 2 different transparent PNG logos (second logo on bottom
+# right corner):
+movie=logo1.png [logo1];
+movie=logo2.png [logo2];
+[in][logo1]       overlay=10:H-h-10 [in+logo1];
+[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
+
+# add a transparent color layer on top of the main video,
+# WxH specifies the size of the main input to the overlay filter
+color=red.3:WxH [over]; [in][over] overlay [out]
+
+ +

You can chain together more overlays but the efficiency of such +approach is yet to be tested. +

+ +

17.26 pad

+ +

Add paddings to the input image, and places the original input at the +given coordinates x, y. +

+

It accepts the following parameters: +width:height:x:y:color. +

+

The parameters width, height, x, and y are +expressions containing the following constants: +

+
+
in_w, in_h
+

the input video width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output width and height, that is the size of the padded area as +specified by the width and height expressions +

+
+
ow, oh
+

same as out_w and out_h +

+
+
x, y
+

x and y offsets as specified by the x and y +expressions, or NAN if not yet specified +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

Follows the description of the accepted parameters. +

+
+
width, height
+
+

Specify the size of the output image with the paddings added. If the +value for width or height is 0, the corresponding input size +is used for the output. +

+

The width expression can reference the value set by the +height expression, and vice versa. +

+

The default value of width and height is 0. +

+
+
x, y
+
+

Specify the offsets where to place the input image in the padded area +with respect to the top/left border of the output image. +

+

The x expression can reference the value set by the y +expression, and vice versa. +

+

The default value of x and y is 0. +

+
+
color
+
+

Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+

The default value of color is "black". +

+
+
+ +

Some examples follow: +

+
 
# Add paddings with color "violet" to the input video. Output video
+# size is 640x480, the top-left corner of the input video is placed at
+# column 0, row 40.
+pad=640:480:0:40:violet
+
+# pad the input to get an output with dimensions increased bt 3/2,
+# and put the input video at the center of the padded area
+pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a squared output with size equal to the maximum
+# value between the input width and height, and put the input video at
+# the center of the padded area
+pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a final w/h ratio of 16:9
+pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
+
+# for anamorphic video, in order to set the output display aspect ratio,
+# it is necessary to use sar in the expression, according to the relation:
+# (ih * X / ih) * sar = output_dar
+# X = output_dar / sar
+pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
+
+# double output size and put the input video in the bottom-right
+# corner of the output padded area
+pad="2*iw:2*ih:ow-iw:oh-ih"
+
+ + +

17.27 pixdesctest

+ +

Pixel format descriptor test filter, mainly useful for internal +testing. The output video should be equal to the input video. +

+

For example: +

 
format=monow, pixdesctest
+
+ +

can be used to test the monowhite pixel format descriptor definition. +

+ +

17.28 scale

+ +

Scale the input video to width:height[:interl={1|-1}] and/or convert the image format. +

+

The parameters width and height are expressions containing +the following constants: +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

If the input image format is different from the format requested by +the next filter, the scale filter will convert the input to the +requested format. +

+

If the value for width or height is 0, the respective input +size is used for the output. +

+

If the value for width or height is -1, the scale filter will +use, for the respective output size, a value that maintains the aspect +ratio of the input image. +

+

The default value of width and height is 0. +

+

Valid values for the optional parameter interl are: +

+
+
1
+

force interlaced aware scaling +

+
+
-1
+

select interlaced aware scaling depending on whether the source frames +are flagged as interlaced or not +

+
+ +

Some examples follow: +

 
# scale the input video to a size of 200x100.
+scale=200:100
+
+# scale the input to 2x
+scale=2*iw:2*ih
+# the above is the same as
+scale=2*in_w:2*in_h
+
+# scale the input to half size
+scale=iw/2:ih/2
+
+# increase the width, and set the height to the same size
+scale=3/2*iw:ow
+
+# seek for Greek harmony
+scale=iw:1/PHI*iw
+scale=ih*PHI:ih
+
+# increase the height, and set the width to 3/2 of the height
+scale=3/2*oh:3/5*ih
+
+# increase the size, but make the size a multiple of the chroma
+scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
+
+# increase the width to a maximum of 500 pixels, keep the same input aspect ratio
+scale='min(500\, iw*3/2):-1'
+
+ + +

17.29 select

+

Select frames to pass in output. +

+

It accepts in input an expression, which is evaluated for each input +frame. If the expression is evaluated to a non-zero value, the frame +is selected and passed to the output, otherwise it is discarded. +

+

The expression can contain the following constants: +

+
+
n
+

the sequential number of the filtered frame, starting from 0 +

+
+
selected_n
+

the sequential number of the selected frame, starting from 0 +

+
+
prev_selected_n
+

the sequential number of the last selected frame, NAN if undefined +

+
+
TB
+

timebase of the input timestamps +

+
+
pts
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in TB units, NAN if undefined +

+
+
t
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in seconds, NAN if undefined +

+
+
prev_pts
+

the PTS of the previously filtered video frame, NAN if undefined +

+
+
prev_selected_pts
+

the PTS of the last previously filtered video frame, NAN if undefined +

+
+
prev_selected_t
+

the PTS of the last previously selected video frame, NAN if undefined +

+
+
start_pts
+

the PTS of the first video frame in the video, NAN if undefined +

+
+
start_t
+

the time of the first video frame in the video, NAN if undefined +

+
+
pict_type
+

the type of the filtered frame, can assume one of the following +values: +

+
I
+
P
+
B
+
S
+
SI
+
SP
+
BI
+
+ +
+
interlace_type
+

the frame interlace type, can assume one of the following values: +

+
PROGRESSIVE
+

the frame is progressive (not interlaced) +

+
TOPFIRST
+

the frame is top-field-first +

+
BOTTOMFIRST
+

the frame is bottom-field-first +

+
+ +
+
key
+

1 if the filtered frame is a key-frame, 0 otherwise +

+
+
pos
+

the position in the file of the filtered frame, -1 if the information +is not available (e.g. for synthetic video) +

+
+ +

The default value of the select expression is "1". +

+

Some examples follow: +

+
 
# select all frames in input
+select
+
+# the above is the same as:
+select=1
+
+# skip all frames:
+select=0
+
+# select only I-frames
+select='eq(pict_type\,I)'
+
+# select one frame every 100
+select='not(mod(n\,100))'
+
+# select only frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)'
+
+# select only I frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
+
+# select frames with a minimum distance of 10 seconds
+select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
+
+ +

+

+

17.30 setdar

+ +

Set the Display Aspect Ratio for the filter output video. +

+

This is done by changing the specified Sample (aka Pixel) Aspect +Ratio, according to the following equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that this filter does not modify the pixel dimensions of +the video frame. Also the display aspect ratio set by this filter may +be changed by later filters in the filterchain, e.g. in case of +scaling or if another "setdar" or a "setsar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +display aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the display aspect ratio to 16:9, specify: +

 
setdar=16:9
+# the above is equivalent to
+setdar=1.77777
+
+ +

See also the setsar filter documentation. +

+ +

17.31 setpts

+ +

Change the PTS (presentation timestamp) of the input video frames. +

+

Accept in input an expression evaluated through the eval API, which +can contain the following constants: +

+
+
PTS
+

the presentation timestamp in input +

+
+
N
+

the count of the input frame, starting from 0. +

+
+
STARTPTS
+

the PTS of the first video frame +

+
+
INTERLACED
+

tell if the current frame is interlaced +

+
+
POS
+

original position in the file of the frame, or undefined if undefined +for the current frame +

+
+
PREV_INPTS
+

previous input PTS +

+
+
PREV_OUTPTS
+

previous output PTS +

+
+
+ +

Some examples follow: +

+
 
# start counting PTS from zero
+setpts=PTS-STARTPTS
+
+# fast motion
+setpts=0.5*PTS
+
+# slow motion
+setpts=2.0*PTS
+
+# fixed rate 25 fps
+setpts=N/(25*TB)
+
+# fixed rate 25 fps with some jitter
+setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
+
+ +

+

+

17.32 setsar

+ +

Set the Sample (aka Pixel) Aspect Ratio for the filter output video. +

+

Note that as a consequence of the application of this filter, the +output display aspect ratio will change according to the following +equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that the sample aspect ratio set by this filter may be +changed by later filters in the filterchain, e.g. if another "setsar" +or a "setdar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +sample aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the sample aspect ratio to 10:11, specify: +

 
setsar=10:11
+
+ + +

17.33 settb

+ +

Set the timebase to use for the output frames timestamps. +It is mainly useful for testing timebase configuration. +

+

It accepts in input an arithmetic expression representing a rational. +The expression can contain the constants "AVTB" (the +default timebase), and "intb" (the input timebase). +

+

The default value for the input is "intb". +

+

Follow some examples. +

+
 
# set the timebase to 1/25
+settb=1/25
+
+# set the timebase to 1/10
+settb=0.1
+
+#set the timebase to 1001/1000
+settb=1+0.001
+
+#set the timebase to 2*intb
+settb=2*intb
+
+#set the default timebase value
+settb=AVTB
+
+ + +

17.34 showinfo

+ +

Show a line containing various information for each input video frame. +The input video is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

Presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad. +

+
+
pts_time
+

Presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic video) +

+
+
fmt
+

pixel format name +

+
+
sar
+

sample aspect ratio of the input frame, expressed in the form +num/den +

+
+
s
+

size of the input frame, expressed in the form +widthxheight +

+
+
i
+

interlaced mode ("P" for "progressive", "T" for top field first, "B" +for bottom field first) +

+
+
iskey
+

1 if the frame is a key frame, 0 otherwise +

+
+
type
+

picture type of the input frame ("I" for an I-frame, "P" for a +P-frame, "B" for a B-frame, "?" for unknown type). +Check also the documentation of the AVPictureType enum and of +the av_get_picture_type_char function defined in +‘libavutil/avutil.h’. +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) of each plane of the input frame, +expressed in the form "[c0 c1 c2 c3]" +

+
+ + +

17.35 slicify

+ +

Pass the images of input video on to next video filter as multiple +slices. +

+
 
ffmpeg -i in.avi -vf "slicify=32" out.avi
+
+ +

The filter accepts the slice height as parameter. If the parameter is +not specified it will use the default value of 16. +

+

Adding this in the beginning of filter chains should make filtering +faster due to better use of the memory cache. +

+ +

17.36 split

+ +

Pass on the input video to two outputs. Both outputs are identical to +the input video. +

+

For example: +

 
[in] split [splitout1][splitout2];
+[splitout1] crop=100:100:0:0    [cropout];
+[splitout2] pad=200:200:100:100 [padout];
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

17.37 thumbnail

+

Select the most representative frame in a given sequence of consecutive frames. +

+

It accepts as argument the frames batch size to analyze (default N=100); +in a set of N frames, the filter will pick one of them, and then handle +the next batch of N frames until the end. +

+

Since the filter keeps track of the whole frames sequence, a bigger N +value will result in a higher memory usage, so a high value is not recommended. +

+

The following example extract one picture each 50 frames: +

 
thumbnail=50
+
+ +

Complete example of a thumbnail creation with ffmpeg: +

 
ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
+
+ + +

17.38 tinterlace

+ +

Perform various types of temporal field interlacing. +

+

Frames are counted starting from 1, so the first input frame is +considered odd. +

+

This filter accepts a single parameter specifying the mode. Available +modes are: +

+
+
0
+

Move odd frames into the upper field, even into the lower field, +generating a double height frame at half framerate. +

+
+
1
+

Only output even frames, odd frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
2
+

Only output odd frames, even frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
3
+

Expand each frame to full height, but pad alternate lines with black, +generating a frame with double height at the same input framerate. +

+
+
4
+

Interleave the upper field from odd frames with the lower field from +even frames, generating a frame with unchanged height at half framerate. +

+
+
5
+

Interleave the lower field from odd frames with the upper field from +even frames, generating a frame with unchanged height at half framerate. +

+
+ +

Default mode is 0. +

+ +

17.39 transpose

+ +

Transpose rows with columns in the input video and optionally flip it. +

+

It accepts a parameter representing an integer, which can assume the +values: +

+
+
0
+

Rotate by 90 degrees counterclockwise and vertically flip (default), that is: +

 
L.R     L.l
+. . ->  . .
+l.r     R.r
+
+ +
+
1
+

Rotate by 90 degrees clockwise, that is: +

 
L.R     l.L
+. . ->  . .
+l.r     r.R
+
+ +
+
2
+

Rotate by 90 degrees counterclockwise, that is: +

 
L.R     R.r
+. . ->  . .
+l.r     L.l
+
+ +
+
3
+

Rotate by 90 degrees clockwise and vertically flip, that is: +

 
L.R     r.R
+. . ->  . .
+l.r     l.L
+
+
+
+ + +

17.40 unsharp

+ +

Sharpen or blur the input video. +

+

It accepts the following parameters: +luma_msize_x:luma_msize_y:luma_amount:chroma_msize_x:chroma_msize_y:chroma_amount +

+

Negative values for the amount will blur the input video, while positive +values will sharpen. All parameters are optional and default to the +equivalent of the string ’5:5:1.0:5:5:0.0’. +

+
+
luma_msize_x
+

Set the luma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_msize_y
+

Set the luma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_amount
+

Set the luma effect strength. It can be a float number between -2.0 +and 5.0, default value is 1.0. +

+
+
chroma_msize_x
+

Set the chroma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_msize_y
+

Set the chroma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_amount
+

Set the chroma effect strength. It can be a float number between -2.0 +and 5.0, default value is 0.0. +

+
+
+ +
 
# Strong luma sharpen effect parameters
+unsharp=7:7:2.5
+
+# Strong blur of both luma and chroma parameters
+unsharp=7:7:-2:7:7:-2
+
+# Use the default values with ffmpeg
+ffmpeg -i in.avi -vf "unsharp" out.mp4
+
+ + +

17.41 vflip

+ +

Flip the input video vertically. +

+
 
ffmpeg -i in.avi -vf "vflip" out.avi
+
+ + +

17.42 yadif

+ +

Deinterlace the input video ("yadif" means "yet another deinterlacing +filter"). +

+

It accepts the optional parameters: mode:parity:auto. +

+

mode specifies the interlacing mode to adopt, accepts one of the +following values: +

+
+
0
+

output 1 frame for each frame +

+
1
+

output 1 frame for each field +

+
2
+

like 0 but skips spatial interlacing check +

+
3
+

like 1 but skips spatial interlacing check +

+
+ +

Default value is 0. +

+

parity specifies the picture field parity assumed for the input +interlaced video, accepts one of the following values: +

+
+
0
+

assume top field first +

+
1
+

assume bottom field first +

+
-1
+

enable automatic detection +

+
+ +

Default value is -1. +If interlacing is unknown or decoder does not export this information, +top field first will be assumed. +

+

auto specifies if deinterlacer should trust the interlaced flag +and only deinterlace frames marked as interlaced +

+
+
0
+

deinterlace all frames +

+
1
+

only deinterlace frames marked as interlaced +

+
+ +

Default value is 0. +

+ + +

18. Video Sources

+ +

Below is a description of the currently available video sources. +

+ +

18.1 buffer

+ +

Buffer video frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/vsrc_buffer.h’. +

+

It accepts the following parameters: +width:height:pix_fmt_string:timebase_num:timebase_den:sample_aspect_ratio_num:sample_aspect_ratio.den:scale_params +

+

All the parameters but scale_params need to be explicitly +defined. +

+

Follows the list of the accepted parameters. +

+
+
width, height
+

Specify the width and height of the buffered video frames. +

+
+
pix_fmt_string
+

A string representing the pixel format of the buffered video frames. +It may be a number corresponding to a pixel format, or a pixel format +name. +

+
+
timebase_num, timebase_den
+

Specify numerator and denomitor of the timebase assumed by the +timestamps of the buffered frames. +

+
+
sample_aspect_ratio.num, sample_aspect_ratio.den
+

Specify numerator and denominator of the sample aspect ratio assumed +by the video frames. +

+
+
scale_params
+

Specify the optional parameters to be used for the scale filter which +is automatically inserted when an input change is detected in the +input size or format. +

+
+ +

For example: +

 
buffer=320:240:yuv410p:1:24:1:1
+
+ +

will instruct the source to accept video frames with size 320x240 and +with format "yuv410p", assuming 1/24 as the timestamps timebase and +square pixels (1:1 sample aspect ratio). +Since the pixel format with name "yuv410p" corresponds to the number 6 +(check the enum PixelFormat definition in ‘libavutil/pixfmt.h’), +this example corresponds to: +

 
buffer=320:240:6:1:24:1:1
+
+ + +

18.2 cellauto

+ +

Create a pattern generated by an elementary cellular automaton. +

+

The initial state of the cellular automaton can be defined through the +‘filename’, and ‘pattern’ options. If such options are +not specified an initial state is created randomly. +

+

At each new frame a new row in the video is filled with the result of +the cellular automaton next generation. The behavior when the whole +frame is filled is defined by the ‘scroll’ option. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified file. +In the file, each non-whitespace character is considered an alive +cell, a newline will terminate the row, and further characters in the +file will be ignored. +

+
+
pattern, p
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified string. +

+

Each non-whitespace character in the string is considered an alive +cell, a newline will terminate the row, and further characters in the +string will be ignored. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial cellular automaton row. It +is a floating point number value ranging from 0 to 1, defaults to +1/PHI. +

+

This option is ignored when a file or a pattern is specified. +

+
+
random_seed, seed
+

Set the seed for filling randomly the initial row, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the cellular automaton rule, it is a number ranging from 0 to 255. +Default value is 110. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ or ‘pattern’ is specified, the size is set +by default to the width of the specified initial state row, and the +height is set to width * PHI. +

+

If ‘size’ is set, it must contain the width of the specified +pattern string, and the specified pattern will be centered in the +larger row. +

+

If a filename or a pattern string is not specified, the size value +defaults to "320x518" (used for a randomly generated initial state). +

+
+
scroll
+

If set to 1, scroll the output upward when all the rows in the output +have been already filled. If set to 0, the new generated row will be +written over the top row just after the bottom row is filled. +Defaults to 1. +

+
+
start_full, full
+

If set to 1, completely fill the output with generated rows before +outputting the first frame. +This is the default behavior, for disabling set the value to 0. +

+
+
stitch
+

If set to 1, stitch the left and right row edges together. +This is the default behavior, for disabling set the value to 0. +

+
+ + +

18.2.1 Examples

+ + + + +

18.3 color

+ +

Provide an uniformly colored input. +

+

It accepts the following parameters: +color:frame_size:frame_rate +

+

Follows the description of the accepted parameters. +

+
+
color
+

Specify the color of the source. It can be the name of a color (case +insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an +alpha specifier. The default value is "black". +

+
+
frame_size
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
frame_rate
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
+ +

For example the following graph description will generate a red source +with an opacity of 0.2, with size "qcif" and a frame rate of 10 +frames per second, which will be overlayed over the source connected +to the pad with identifier "in". +

+
 
"color=red@0.2:qcif:10 [color]; [in][color] overlay [out]"
+
+ + +

18.4 movie

+ +

Read a video stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specifies the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specifies the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specifies the index of the video stream to read. If the value is -1, +the best suited video stream will be automatically selected. Default +value is "-1". +

+
+
+ +

This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +

 
input -----------> deltapts0 --> overlay --> output
+                                    ^
+                                    |
+movie --> scale--> deltapts1 -------+
+
+ +

Some examples follow: +

 
# skip 3.2 seconds from the start of the avi file in.avi, and overlay it
+# on top of the input labelled as "in".
+movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+# read from a video4linux2 device, and overlay it on top of the input
+# labelled as "in"
+movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+
+ + +

18.5 mptestsrc

+ +

Generate various test patterns, as generated by the MPlayer test filter. +

+

The size of the generated video is fixed, and is 256x256. +This source is useful in particular for testing encoding features. +

+

This source accepts an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
test, t
+
+

Set the number or the name of the test to perform. Supported tests are: +

+
dc_luma
+
dc_chroma
+
freq_luma
+
freq_chroma
+
amp_luma
+
amp_chroma
+
cbp
+
mv
+
ring1
+
ring2
+
all
+
+ +

Default value is "all", which will cycle through the list of all tests. +

+
+ +

For example the following: +

 
testsrc=t=dc_luma
+
+ +

will generate a "dc_luma" test pattern. +

+ +

18.6 frei0r_src

+ +

Provide a frei0r source. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The source supports the syntax: +

 
size:rate:src_name[{=|:}param1:param2:...:paramN]
+
+ +

size is the size of the video to generate, may be a string of the +form widthxheight or a frame size abbreviation. +rate is the rate of the video to generate, may be a string of +the form num/den or a frame rate abbreviation. +src_name is the name to the frei0r source to load. For more +information regarding frei0r and how to set the parameters read the +section frei0r in the description of the video filters. +

+

Some examples follow: +

 
# generate a frei0r partik0l source with size 200x200 and frame rate 10
+# which is overlayed on the overlay filter main input
+frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
+
+ + +

18.7 life

+ +

Generate a life pattern. +

+

This source is based on a generalization of John Conway’s life game. +

+

The sourced input represents a life grid, each pixel represents a cell +which can be in one of two possible states, alive or dead. Every cell +interacts with its eight neighbours, which are the cells that are +horizontally, vertically, or diagonally adjacent. +

+

At each interaction the grid evolves according to the adopted rule, +which specifies the number of neighbor alive cells which will make a +cell stay alive or born. The ‘rule’ option allows to specify +the rule to adopt. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Set the file from which to read the initial grid state. In the file, +each non-whitespace character is considered an alive cell, and newline +is used to delimit the end of each row. +

+

If this option is not specified, the initial grid is generated +randomly. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial random grid. It is a +floating point number value ranging from 0 to 1, defaults to 1/PHI. +It is ignored when a file is specified. +

+
+
random_seed, seed
+

Set the seed for filling the initial random grid, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the life rule. +

+

A rule can be specified with a code of the kind "SNS/BNB", +where NS and NB are sequences of numbers in the range 0-8, +NS specifies the number of alive neighbor cells which make a +live cell stay alive, and NB the number of alive neighbor cells +which make a dead cell to become alive (i.e. to "born"). +"s" and "b" can be used in place of "S" and "B", respectively. +

+

Alternatively a rule can be specified by an 18-bits integer. The 9 +high order bits are used to encode the next cell state if it is alive +for each number of neighbor alive cells, the low order bits specify +the rule for "borning" new cells. Higher order bits encode for an +higher number of neighbor cells. +For example the number 6153 = (12<<9)+9 specifies a stay alive +rule of 12 and a born rule of 9, which corresponds to "S23/B03". +

+

Default value is "S23/B3", which is the original Conway’s game of life +rule, and will keep a cell alive if it has 2 or 3 neighbor alive +cells, and will born a new cell if there are three alive cells around +a dead cell. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ is specified, the size is set by default to the +same size of the input file. If ‘size’ is set, it must contain +the size specified in the input file, and the initial grid defined in +that file is centered in the larger resulting area. +

+

If a filename is not specified, the size value defaults to "320x240" +(used for a randomly generated initial grid). +

+
+
stitch
+

If set to 1, stitch the left and right grid edges together, and the +top and bottom edges also. Defaults to 1. +

+
+
mold
+

Set cell mold speed. If set, a dead cell will go from ‘death_color’ to +‘mold_color’ with a step of ‘mold’. ‘mold’ can have a +value from 0 to 255. +

+
+
life_color
+

Set the color of living (or new born) cells. +

+
+
death_color
+

Set the color of dead cells. If ‘mold’ is set, this is the first color +used to represent a dead cell. +

+
+
mold_color
+

Set mold color, for definitely dead and moldy cells. +

+
+ + +

18.7.1 Examples

+ + + + +

18.8 nullsrc, rgbtestsrc, testsrc

+ +

The nullsrc source returns unprocessed video frames. It is +mainly useful to be employed in analysis / debugging tools, or as the +source for filters which ignore the input data. +

+

The rgbtestsrc source generates an RGB test pattern useful for +detecting RGB vs BGR issues. You should see a red, green and blue +stripe from top to bottom. +

+

The testsrc source generates a test video pattern, showing a +color pattern, a scrolling gradient and a timestamp. This is mainly +intended for testing purposes. +

+

These sources accept an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
size, s
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
sar
+

Set the sample aspect ratio of the sourced video. +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
decimals, n
+

Set the number of decimals to show in the timestamp, only used in the +testsrc source. +

+

The displayed timestamp value will correspond to the original +timestamp value multiplied by the power of 10 of the specified +value. Default value is 0. +

+
+ +

For example the following: +

 
testsrc=duration=5.3:size=qcif:rate=10
+
+ +

will generate a video with a duration of 5.3 seconds, with size +176x144 and a frame rate of 10 frames per second. +

+

If the input content is to be ignored, nullsrc can be used. The +following command generates noise in the luminance plane by employing +the mp=geq filter: +

 
nullsrc=s=256x256, mp=geq=random(1)*255:128:128
+
+ + + +

19. Video Sinks

+ +

Below is a description of the currently available video sinks. +

+ +

19.1 buffersink

+ +

Buffer video frames, and make them available to the end of the filter +graph. +

+

This sink is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It does not require a string parameter in input, but you need to +specify a pointer to a list of supported pixel formats terminated by +-1 in the opaque parameter provided to avfilter_init_filter +when initializing this sink. +

+ +

19.2 nullsink

+ +

Null video sink, do absolutely nothing with the input video. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + + +
+

+ + +
diff --git a/extern/ffmpeg/doc/ffprobe.html b/extern/ffmpeg/doc/ffprobe.html new file mode 100644 index 0000000000..1e2cee2252 --- /dev/null +++ b/extern/ffmpeg/doc/ffprobe.html @@ -0,0 +1,2036 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

ffprobe Documentation

+ + +

Table of Contents

+ + + +

1. Synopsis

+ +

The generic syntax is: +

+
 
ffprobe [options] [‘input_file’]
+
+ + +

2. Description

+ +

ffprobe gathers information from multimedia streams and prints it in +human- and machine-readable fashion. +

+

For example it can be used to check the format of the container used +by a multimedia stream and the format and type of each media stream +contained in it. +

+

If a filename is specified in input, ffprobe will try to open and +probe the file content. If the file cannot be opened or recognized as +a multimedia file, a positive exit code is returned. +

+

ffprobe may be employed both as a standalone application or in +combination with a textual filter, which may perform more +sophisticated processing, e.g. statistical processing or plotting. +

+

Options are used to list some of the formats supported by ffprobe or +for specifying which information to display, and for setting how +ffprobe will show it. +

+

ffprobe output is designed to be easily parsable by a textual filter, +and consists of one or more sections of a form defined by the selected +writer, which is specified by the ‘print_format’ option. +

+

Metadata tags stored in the container or in the streams are recognized +and printed in the corresponding "FORMAT" or "STREAM" section. +

+ + +

3. Options

+ +

All the numerical options, if not specified otherwise, accept in input +a string representing a number, which may contain one of the +International System number postfixes, for example ’K’, ’M’, ’G’. +If ’i’ is appended after the postfix, powers of 2 are used instead of +powers of 10. The ’B’ postfix multiplies the value for 8, and can be +appended after another postfix or used alone. This allows using for +example ’KB’, ’MiB’, ’G’ and ’B’ as postfix. +

+

Options which do not take arguments are boolean options, and set the +corresponding value to true. They can be set to false by prefixing +with "no" the option name, for example using "-nofoo" in the +command line will set to false the boolean option with name "foo". +

+

+

+

3.1 Stream specifiers

+

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers +are used to precisely specify which stream(s) does a given option belong to. +

+

A stream specifier is a string generally appended to the option name and +separated from it by a colon. E.g. -codec:a:1 ac3 option contains +a:1 stream specifer, which matches the second audio stream. Therefore it +would select the ac3 codec for the second audio stream. +

+

A stream specifier can match several stream, the option is then applied to all +of them. E.g. the stream specifier in -b:a 128k matches all audio +streams. +

+

An empty stream specifier matches all streams, for example -codec copy +or -codec: copy would copy all the streams without reencoding. +

+

Possible forms of stream specifiers are: +

+
stream_index
+

Matches the stream with this index. E.g. -threads:1 4 would set the +thread count for the second stream to 4. +

+
stream_type[:stream_index]
+

stream_type is one of: ’v’ for video, ’a’ for audio, ’s’ for subtitle, +’d’ for data and ’t’ for attachments. If stream_index is given, then +matches stream number stream_index of this type. Otherwise matches all +streams of this type. +

+
p:program_id[:stream_index]
+

If stream_index is given, then matches stream number stream_index in +program with id program_id. Otherwise matches all streams in this program. +

+
+ +

3.2 Generic options

+ +

These options are shared amongst the av* tools. +

+
+
-L
+

Show license. +

+
+
-h, -?, -help, --help
+

Show help. +

+
+
-version
+

Show version. +

+
+
-formats
+

Show available formats. +

+

The fields preceding the format names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
+ +
+
-codecs
+

Show available codecs. +

+

The fields preceding the codec names have the following meanings: +

+
D
+

Decoding available +

+
E
+

Encoding available +

+
V/A/S
+

Video/audio/subtitle codec +

+
S
+

Codec supports slices +

+
D
+

Codec supports direct rendering +

+
T
+

Codec can handle input truncated at random locations instead of only at frame boundaries +

+
+ +
+
-bsfs
+

Show available bitstream filters. +

+
+
-protocols
+

Show available protocols. +

+
+
-filters
+

Show available libavfilter filters. +

+
+
-pix_fmts
+

Show available pixel formats. +

+
+
-sample_fmts
+

Show available sample formats. +

+
+
-loglevel loglevel | -v loglevel
+

Set the logging level used by the library. +loglevel is a number or a string containing one of the following values: +

+
quiet
+
panic
+
fatal
+
error
+
warning
+
info
+
verbose
+
debug
+
+ +

By default the program logs to stderr, if coloring is supported by the +terminal, colors are used to mark errors and warnings. Log coloring +can be disabled setting the environment variable +AV_LOG_FORCE_NOCOLOR or NO_COLOR, or can be forced setting +the environment variable AV_LOG_FORCE_COLOR. +The use of the environment variable NO_COLOR is deprecated and +will be dropped in a following FFmpeg version. +

+
+
-report
+

Dump full command line and console output to a file named +program-YYYYMMDD-HHMMSS.log in the current +directory. +This file can be useful for bug reports. +It also implies -loglevel verbose. +

+

Note: setting the environment variable FFREPORT to any value has the +same effect. +

+
+
+ + +

3.3 AVOptions

+ +

These options are provided directly by the libavformat, libavdevice and +libavcodec libraries. To see the list of available AVOptions, use the +‘-help’ option. They are separated into two categories: +

+
generic
+

These options can be set for any container, codec or device. Generic options +are listed under AVFormatContext options for containers/devices and under +AVCodecContext options for codecs. +

+
private
+

These options are specific to the given container, device or codec. Private +options are listed under their corresponding containers/devices/codecs. +

+
+ +

For example to write an ID3v2.3 header instead of a default ID3v2.4 to +an MP3 file, use the ‘id3v2_version’ private option of the MP3 +muxer: +

 
ffmpeg -i input.flac -id3v2_version 3 out.mp3
+
+ +

All codec AVOptions are obviously per-stream, so the chapter on stream +specifiers applies to them +

+

Note ‘-nooption’ syntax cannot be used for boolean AVOptions, +use ‘-option 0’/‘-option 1’. +

+

Note2 old undocumented way of specifying per-stream AVOptions by prepending +v/a/s to the options name is now obsolete and will be removed soon. +

+ +

3.4 Main options

+ +
+
-f format
+

Force format to use. +

+
+
-unit
+

Show the unit of the displayed values. +

+
+
-prefix
+

Use SI prefixes for the displayed values. +Unless the "-byte_binary_prefix" option is used all the prefixes +are decimal. +

+
+
-byte_binary_prefix
+

Force the use of binary prefixes for byte values. +

+
+
-sexagesimal
+

Use sexagesimal format HH:MM:SS.MICROSECONDS for time values. +

+
+
-pretty
+

Prettify the format of the displayed values, it corresponds to the +options "-unit -prefix -byte_binary_prefix -sexagesimal". +

+
+
-print_format writer_name[=writer_options]
+

Set the output printing format. +

+

writer_name specifies the name of the writer, and +writer_options specifies the options to be passed to the writer. +

+

For example for printing the output in JSON format, specify: +

 
-print_format json
+
+ +

For more details on the available output printing formats, see the +Writers section below. +

+
+
-show_error
+

Show information about the error found when trying to probe the input. +

+

The error information is printed within a section with name "ERROR". +

+
+
-show_format
+

Show information about the container format of the input multimedia +stream. +

+

All the container format information is printed within a section with +name "FORMAT". +

+
+
-show_packets
+

Show information about each packet contained in the input multimedia +stream. +

+

The information for each single packet is printed within a dedicated +section with name "PACKET". +

+
+
-show_frames
+

Show information about each frame contained in the input multimedia +stream. +

+

The information for each single frame is printed within a dedicated +section with name "FRAME". +

+
+
-show_streams
+

Show information about each media stream contained in the input +multimedia stream. +

+

Each media stream information is printed within a dedicated section +with name "STREAM". +

+
+
-show_private_data, -private
+

Show private data, that is data depending on the format of the +particular shown element. +This option is enabled by default, but you may need to disable it +for specific uses, for example when creating XSD-compliant XML output. +

+
+
-show_program_version
+

Show information related to program version. +

+

Version information is printed within a section with name +"PROGRAM_VERSION". +

+
+
-show_library_versions
+

Show information related to library versions. +

+

Version information for each library is printed within a section with +name "LIBRARY_VERSION". +

+
+
-show_versions
+

Show information related to program and library versions. This is the +equivalent of setting both ‘-show_program_version’ and +‘-show_library_versions’ options. +

+
+
-i input_file
+

Read input_file. +

+
+
+ + +

4. Writers

+ +

A writer defines the output format adopted by ffprobe, and will be +used for printing all the parts of the output. +

+

A writer may accept one or more arguments, which specify the options to +adopt. +

+

A description of the currently available writers follows. +

+ +

4.1 default

+

Default format. +

+

Print each section in the form: +

 
[SECTION]
+key1=val1
+...
+keyN=valN
+[/SECTION]
+
+ +

Metadata tags are printed as a line in the corresponding FORMAT or +STREAM section, and are prefixed by the string "TAG:". +

+ +

4.2 compact

+

Compact format. +

+

Each section is printed on a single line. +If no option is specifid, the output has the form: +

 
section|key1=val1| ... |keyN=valN
+
+ +

Metadata tags are printed in the corresponding "format" or "stream" +section. A metadata tag key, if printed, is prefixed by the string +"tag:". +

+

This writer accepts options as a list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
item_sep, s
+

Specify the character to use for separating fields in the output line. +It must be a single printable character, it is "|" by default. +

+
+
nokey, nk
+

If set to 1 specify not to print the key of each field. Its default +value is 0. +

+
+
escape, e
+

Set the escape mode to use, default to "c". +

+

It can assume one of the following values: +

+
c
+

Perform C-like escaping. Strings containing a newline (’\n’) or +carriage return (’\r’), the escaping character (’\’) or the item +separator character SEP are escaped using C-like fashioned +escaping, so that a newline is converted to the sequence "\n", a +carriage return to "\r", ’\’ to "\\" and the separator SEP is +converted to "\SEP". +

+
+
csv
+

Perform CSV-like escaping, as described in RFC4180. Strings +containing a newline (’\n’), a carriage return (’\r’), a double quote +(’"’), or SEP are enclosed in double-quotes. +

+
+
none
+

Perform no escaping. +

+
+ +
+
+ + +

4.3 csv

+

CSV format. +

+

This writer is equivalent to +compact=item_sep=,:nokey=1:escape=csv. +

+ +

4.4 json

+

JSON based format. +

+

Each section is printed using JSON notation. +

+

This writer accepts options as a list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
compact, c
+

If set to 1 enable compact output, that is each section will be +printed on a single line. Default value is 0. +

+
+ +

For more information about JSON, see http://www.json.org/. +

+ +

4.5 xml

+

XML based format. +

+

The XML output is described in the XML schema description file +‘ffprobe.xsd’ installed in the FFmpeg datadir. +

+

Note that the output issued will be compliant to the +‘ffprobe.xsd’ schema only when no special global output options +(‘unit’, ‘prefix’, ‘byte_binary_prefix’, +‘sexagesimal’ etc.) are specified. +

+

This writer accepts options as a list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
fully_qualified, q
+

If set to 1 specify if the output should be fully qualified. Default +value is 0. +This is required for generating an XML file which can be validated +through an XSD file. +

+
+
xsd_compliant, x
+

If set to 1 perform more checks for ensuring that the output is XSD +compliant. Default value is 0. +This option automatically sets ‘fully_qualified’ to 1. +

+
+ +

For more information about the XML format, see +http://www.w3.org/XML/. +

+ +

5. Timecode

+ +

ffprobe supports Timecode extraction: +

+ + + + +

6. Decoders

+ +

Decoders are configured elements in FFmpeg which allow the decoding of +multimedia streams. +

+

When you configure your FFmpeg build, all the supported native decoders +are enabled by default. Decoders requiring an external library must be enabled +manually via the corresponding --enable-lib option. You can list all +available decoders using the configure option --list-decoders. +

+

You can disable all the decoders with the configure option +--disable-decoders and selectively enable / disable single decoders +with the options --enable-decoder=DECODER / +--disable-decoder=DECODER. +

+

The option -codecs of the ff* tools will display the list of +enabled decoders. +

+ + +

7. Video Decoders

+ +

A description of some of the currently available video decoders +follows. +

+ +

7.1 rawvideo

+ +

Raw video decoder. +

+

This decoder decodes rawvideo streams. +

+ +

7.1.1 Options

+ +
+
top top_field_first
+

Specify the assumed field type of the input video. +

+
-1
+

the video is assumed to be progressive (default) +

+
0
+

bottom-field-first is assumed +

+
1
+

top-field-first is assumed +

+
+ +
+
+ + + +

8. Audio Decoders

+ + +

8.1 ffwavesynth

+ +

Internal wave synthetizer. +

+

This decoder generates wave patterns according to predefined sequences. Its +use is purely internal and the format of the data it accepts is not publicly +documented. +

+ +

9. Demuxers

+ +

Demuxers are configured elements in FFmpeg which allow to read the +multimedia streams from a particular type of file. +

+

When you configure your FFmpeg build, all the supported demuxers +are enabled by default. You can list all available ones using the +configure option "–list-demuxers". +

+

You can disable all the demuxers using the configure option +"–disable-demuxers", and selectively enable a single demuxer with +the option "–enable-demuxer=DEMUXER", or disable it +with the option "–disable-demuxer=DEMUXER". +

+

The option "-formats" of the ff* tools will display the list of +enabled demuxers. +

+

The description of some of the currently available demuxers follows. +

+ +

9.1 image2

+ +

Image file demuxer. +

+

This demuxer reads from a list of image files specified by a pattern. +

+

The pattern may contain the string "%d" or "%0Nd", which +specifies the position of the characters representing a sequential +number in each filename matched by the pattern. If the form +"%d0Nd" is used, the string representing the number in each +filename is 0-padded and N is the total number of 0-padded +digits representing the number. The literal character ’%’ can be +specified in the pattern with the string "%%". +

+

If the pattern contains "%d" or "%0Nd", the first filename of +the file list specified by the pattern must contain a number +inclusively contained between 0 and 4, all the following numbers must +be sequential. This limitation may be hopefully fixed. +

+

The pattern may contain a suffix which is used to automatically +determine the format of the images contained in the files. +

+

For example the pattern "img-%03d.bmp" will match a sequence of +filenames of the form ‘img-001.bmp’, ‘img-002.bmp’, ..., +‘img-010.bmp’, etc.; the pattern "i%%m%%g-%d.jpg" will match a +sequence of filenames of the form ‘i%m%g-1.jpg’, +‘i%m%g-2.jpg’, ..., ‘i%m%g-10.jpg’, etc. +

+

The size, the pixel format, and the format of each image must be the +same for all the files in the sequence. +

+

The following example shows how to use ffmpeg for creating a +video from the images in the file sequence ‘img-001.jpeg’, +‘img-002.jpeg’, ..., assuming an input frame rate of 10 frames per +second: +

 
ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv
+
+ +

Note that the pattern must not necessarily contain "%d" or +"%0Nd", for example to convert a single image file +‘img.jpeg’ you can employ the command: +

 
ffmpeg -i img.jpeg img.png
+
+ + +

9.2 applehttp

+ +

Apple HTTP Live Streaming demuxer. +

+

This demuxer presents all AVStreams from all variant streams. +The id field is set to the bitrate variant index number. By setting +the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay), +the caller can decide which variant streams to actually receive. +The total bitrate of the variant that the stream belongs to is +available in a metadata key named "variant_bitrate". +

+ +

9.3 sbg

+ +

SBaGen script demuxer. +

+

This demuxer reads the script language used by SBaGen +http://uazu.net/sbagen/ to generate binaural beats sessions. A SBG +script looks like that: +

 
-SE
+a: 300-2.5/3 440+4.5/0
+b: 300-2.5/0 440+4.5/3
+off: -
+NOW      == a
++0:07:00 == b
++0:14:00 == a
++0:21:00 == b
++0:30:00    off
+
+ +

A SBG script can mix absolute and relative timestamps. If the script uses +either only absolute timestamps (including the script start time) or only +relative ones, then its layout is fixed, and the conversion is +straightforward. On the other hand, if the script mixes both kind of +timestamps, then the NOW reference for relative timestamps will be +taken from the current time of day at the time the script is read, and the +script layout will be frozen according to that reference. That means that if +the script is directly played, the actual times will match the absolute +timestamps up to the sound controller’s clock accuracy, but if the user +somehow pauses the playback or seeks, all times will be shifted accordingly. +

+ +

10. Protocols

+ +

Protocols are configured elements in FFmpeg which allow to access +resources which require the use of a particular protocol. +

+

When you configure your FFmpeg build, all the supported protocols are +enabled by default. You can list all available ones using the +configure option "–list-protocols". +

+

You can disable all the protocols using the configure option +"–disable-protocols", and selectively enable a protocol using the +option "–enable-protocol=PROTOCOL", or you can disable a +particular protocol using the option +"–disable-protocol=PROTOCOL". +

+

The option "-protocols" of the ff* tools will display the list of +supported protocols. +

+

A description of the currently available protocols follows. +

+ +

10.1 applehttp

+ +

Read Apple HTTP Live Streaming compliant segmented stream as +a uniform one. The M3U8 playlists describing the segments can be +remote HTTP resources or local files, accessed using the standard +file protocol. +HTTP is default, specific protocol can be declared by specifying +"+proto" after the applehttp URI scheme name, where proto +is either "file" or "http". +

+
 
applehttp://host/path/to/remote/resource.m3u8
+applehttp+http://host/path/to/remote/resource.m3u8
+applehttp+file://path/to/local/resource.m3u8
+
+ + +

10.2 concat

+ +

Physical concatenation protocol. +

+

Allow to read and seek from many resource in sequence as if they were +a unique resource. +

+

A URL accepted by this protocol has the syntax: +

 
concat:URL1|URL2|...|URLN
+
+ +

where URL1, URL2, ..., URLN are the urls of the +resource to be concatenated, each one possibly specifying a distinct +protocol. +

+

For example to read a sequence of files ‘split1.mpeg’, +‘split2.mpeg’, ‘split3.mpeg’ with ffplay use the +command: +

 
ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
+
+ +

Note that you may need to escape the character "|" which is special for +many shells. +

+ +

10.3 file

+ +

File access protocol. +

+

Allow to read from or read to a file. +

+

For example to read from a file ‘input.mpeg’ with ffmpeg +use the command: +

 
ffmpeg -i file:input.mpeg output.mpeg
+
+ +

The ff* tools default to the file protocol, that is a resource +specified with the name "FILE.mpeg" is interpreted as the URL +"file:FILE.mpeg". +

+ +

10.4 gopher

+ +

Gopher protocol. +

+ +

10.5 http

+ +

HTTP (Hyper Text Transfer Protocol). +

+ +

10.6 mmst

+ +

MMS (Microsoft Media Server) protocol over TCP. +

+ +

10.7 mmsh

+ +

MMS (Microsoft Media Server) protocol over HTTP. +

+

The required syntax is: +

 
mmsh://server[:port][/app][/playpath]
+
+ + +

10.8 md5

+ +

MD5 output protocol. +

+

Computes the MD5 hash of the data to be written, and on close writes +this to the designated output or stdout if none is specified. It can +be used to test muxers without writing an actual file. +

+

Some examples follow. +

 
# Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
+ffmpeg -i input.flv -f avi -y md5:output.avi.md5
+
+# Write the MD5 hash of the encoded AVI file to stdout.
+ffmpeg -i input.flv -f avi -y md5:
+
+ +

Note that some formats (typically MOV) require the output protocol to +be seekable, so they will fail with the MD5 output protocol. +

+ +

10.9 pipe

+ +

UNIX pipe access protocol. +

+

Allow to read and write from UNIX pipes. +

+

The accepted syntax is: +

 
pipe:[number]
+
+ +

number is the number corresponding to the file descriptor of the +pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number +is not specified, by default the stdout file descriptor will be used +for writing, stdin for reading. +

+

For example to read from stdin with ffmpeg: +

 
cat test.wav | ffmpeg -i pipe:0
+# ...this is the same as...
+cat test.wav | ffmpeg -i pipe:
+
+ +

For writing to stdout with ffmpeg: +

 
ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
+# ...this is the same as...
+ffmpeg -i test.wav -f avi pipe: | cat > test.avi
+
+ +

Note that some formats (typically MOV), require the output protocol to +be seekable, so they will fail with the pipe output protocol. +

+ +

10.10 rtmp

+ +

Real-Time Messaging Protocol. +

+

The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia +content across a TCP/IP network. +

+

The required syntax is: +

 
rtmp://server[:port][/app][/playpath]
+
+ +

The accepted parameters are: +

+
server
+

The address of the RTMP server. +

+
+
port
+

The number of the TCP port to use (by default is 1935). +

+
+
app
+

It is the name of the application to access. It usually corresponds to +the path where the application is installed on the RTMP server +(e.g. ‘/ondemand/’, ‘/flash/live/’, etc.). +

+
+
playpath
+

It is the path or name of the resource to play with reference to the +application specified in app, may be prefixed by "mp4:". +

+
+
+ +

For example to read with ffplay a multimedia resource named +"sample" from the application "vod" from an RTMP server "myserver": +

 
ffplay rtmp://myserver/vod/sample
+
+ + +

10.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte

+ +

Real-Time Messaging Protocol and its variants supported through +librtmp. +

+

Requires the presence of the librtmp headers and library during +configuration. You need to explicitly configure the build with +"–enable-librtmp". If enabled this will replace the native RTMP +protocol. +

+

This protocol provides most client functions and a few server +functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), +encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled +variants of these encrypted types (RTMPTE, RTMPTS). +

+

The required syntax is: +

 
rtmp_proto://server[:port][/app][/playpath] options
+
+ +

where rtmp_proto is one of the strings "rtmp", "rtmpt", "rtmpe", +"rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and +server, port, app and playpath have the same +meaning as specified for the RTMP native protocol. +options contains a list of space-separated options of the form +key=val. +

+

See the librtmp manual page (man 3 librtmp) for more information. +

+

For example, to stream a file in real-time to an RTMP server using +ffmpeg: +

 
ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
+
+ +

To play the same stream using ffplay: +

 
ffplay "rtmp://myserver/live/mystream live=1"
+
+ + +

10.12 rtp

+ +

Real-Time Protocol. +

+ +

10.13 rtsp

+ +

RTSP is not technically a protocol handler in libavformat, it is a demuxer +and muxer. The demuxer supports both normal RTSP (with data transferred +over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with +data transferred over RDT). +

+

The muxer can be used to send a stream using RTSP ANNOUNCE to a server +supporting it (currently Darwin Streaming Server and Mischa Spiegelmock’s +RTSP server). +

+

The required syntax for a RTSP url is: +

 
rtsp://hostname[:port]/path
+
+ +

The following options (set on the ffmpeg/ffplay command +line, or set in code via AVOptions or in avformat_open_input), +are supported: +

+

Flags for rtsp_transport: +

+
+
udp
+

Use UDP as lower transport protocol. +

+
+
tcp
+

Use TCP (interleaving within the RTSP control channel) as lower +transport protocol. +

+
+
udp_multicast
+

Use UDP multicast as lower transport protocol. +

+
+
http
+

Use HTTP tunneling as lower transport protocol, which is useful for +passing proxies. +

+
+ +

Multiple lower transport protocols may be specified, in that case they are +tried one at a time (if the setup of one fails, the next one is tried). +For the muxer, only the tcp and udp options are supported. +

+

Flags for rtsp_flags: +

+
+
filter_src
+

Accept packets only from negotiated peer address and port. +

+
+ +

When receiving data over UDP, the demuxer tries to reorder received packets +(since they may arrive out of order, or packets may get lost totally). In +order for this to be enabled, a maximum delay must be specified in the +max_delay field of AVFormatContext. +

+

When watching multi-bitrate Real-RTSP streams with ffplay, the +streams to display can be chosen with -vst n and +-ast n for video and audio respectively, and can be switched +on the fly by pressing v and a. +

+

Example command lines: +

+

To watch a stream over UDP, with a max reordering delay of 0.5 seconds: +

+
 
ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
+
+ +

To watch a stream tunneled over HTTP: +

+
 
ffplay -rtsp_transport http rtsp://server/video.mp4
+
+ +

To send a stream in realtime to a RTSP server, for others to watch: +

+
 
ffmpeg -re -i input -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
+
+ + +

10.14 sap

+ +

Session Announcement Protocol (RFC 2974). This is not technically a +protocol handler in libavformat, it is a muxer and demuxer. +It is used for signalling of RTP streams, by announcing the SDP for the +streams regularly on a separate port. +

+ +

10.14.1 Muxer

+ +

The syntax for a SAP url given to the muxer is: +

 
sap://destination[:port][?options]
+
+ +

The RTP packets are sent to destination on port port, +or to port 5004 if no port is specified. +options is a &-separated list. The following options +are supported: +

+
+
announce_addr=address
+

Specify the destination IP address for sending the announcements to. +If omitted, the announcements are sent to the commonly used SAP +announcement multicast address 224.2.127.254 (sap.mcast.net), or +ff0e::2:7ffe if destination is an IPv6 address. +

+
+
announce_port=port
+

Specify the port to send the announcements on, defaults to +9875 if not specified. +

+
+
ttl=ttl
+

Specify the time to live value for the announcements and RTP packets, +defaults to 255. +

+
+
same_port=0|1
+

If set to 1, send all RTP streams on the same port pair. If zero (the +default), all streams are sent on unique ports, with each stream on a +port 2 numbers higher than the previous. +VLC/Live555 requires this to be set to 1, to be able to receive the stream. +The RTP stack in libavformat for receiving requires all streams to be sent +on unique ports. +

+
+ +

Example command lines follow. +

+

To broadcast a stream on the local subnet, for watching in VLC: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255?same_port=1
+
+ +

Similarly, for watching in ffplay: +

+
 
ffmpeg -re -i input -f sap sap://224.0.0.255
+
+ +

And for watching in ffplay, over IPv6: +

+
 
ffmpeg -re -i input -f sap sap://[ff0e::1:2:3:4]
+
+ + +

10.14.2 Demuxer

+ +

The syntax for a SAP url given to the demuxer is: +

 
sap://[address][:port]
+
+ +

address is the multicast address to listen for announcements on, +if omitted, the default 224.2.127.254 (sap.mcast.net) is used. port +is the port that is listened on, 9875 if omitted. +

+

The demuxers listens for announcements on the given address and port. +Once an announcement is received, it tries to receive that particular stream. +

+

Example command lines follow. +

+

To play back the first stream announced on the normal SAP multicast address: +

+
 
ffplay sap://
+
+ +

To play back the first stream announced on one the default IPv6 SAP multicast address: +

+
 
ffplay sap://[ff0e::2:7ffe]
+
+ + +

10.15 tcp

+ +

Trasmission Control Protocol. +

+

The required syntax for a TCP url is: +

 
tcp://hostname:port[?options]
+
+ +
+
listen
+

Listen for an incoming connection +

+
 
ffmpeg -i input -f format tcp://hostname:port?listen
+ffplay tcp://hostname:port
+
+ +
+
+ + +

10.16 udp

+ +

User Datagram Protocol. +

+

The required syntax for a UDP url is: +

 
udp://hostname:port[?options]
+
+ +

options contains a list of &-seperated options of the form key=val. +Follow the list of supported options. +

+
+
buffer_size=size
+

set the UDP buffer size in bytes +

+
+
localport=port
+

override the local UDP port to bind with +

+
+
localaddr=addr
+

Choose the local IP address. This is useful e.g. if sending multicast +and the host has multiple interfaces, where the user can choose +which interface to send on by specifying the IP address of that interface. +

+
+
pkt_size=size
+

set the size in bytes of UDP packets +

+
+
reuse=1|0
+

explicitly allow or disallow reusing UDP sockets +

+
+
ttl=ttl
+

set the time to live value (for multicast only) +

+
+
connect=1|0
+

Initialize the UDP socket with connect(). In this case, the +destination address can’t be changed with ff_udp_set_remote_url later. +If the destination address isn’t known at the start, this option can +be specified in ff_udp_set_remote_url, too. +This allows finding out the source address for the packets with getsockname, +and makes writes return with AVERROR(ECONNREFUSED) if "destination +unreachable" is received. +For receiving, this gives the benefit of only receiving packets from +the specified peer address/port. +

+
+ +

Some usage examples of the udp protocol with ffmpeg follow. +

+

To stream over UDP to a remote endpoint: +

 
ffmpeg -i input -f format udp://hostname:port
+
+ +

To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer: +

 
ffmpeg -i input -f mpegts udp://hostname:port?pkt_size=188&buffer_size=65535
+
+ +

To receive over UDP from a remote endpoint: +

 
ffmpeg -i udp://[multicast-address]:port
+
+ + +

11. Input Devices

+ +

Input devices are configured elements in FFmpeg which allow to access +the data coming from a multimedia device attached to your system. +

+

When you configure your FFmpeg build, all the supported input devices +are enabled by default. You can list all available ones using the +configure option "–list-indevs". +

+

You can disable all the input devices using the configure option +"–disable-indevs", and selectively enable an input device using the +option "–enable-indev=INDEV", or you can disable a particular +input device using the option "–disable-indev=INDEV". +

+

The option "-formats" of the ff* tools will display the list of +supported input devices (amongst the demuxers). +

+

A description of the currently available input devices follows. +

+ +

11.1 alsa

+ +

ALSA (Advanced Linux Sound Architecture) input device. +

+

To enable this input device during configuration you need libasound +installed on your system. +

+

This device allows capturing from an ALSA device. The name of the +device to capture has to be an ALSA card identifier. +

+

An ALSA identifier has the syntax: +

 
hw:CARD[,DEV[,SUBDEV]]
+
+ +

where the DEV and SUBDEV components are optional. +

+

The three arguments (in order: CARD,DEV,SUBDEV) +specify card number or identifier, device number and subdevice number +(-1 means any). +

+

To see the list of cards currently recognized by your system check the +files ‘/proc/asound/cards’ and ‘/proc/asound/devices’. +

+

For example to capture with ffmpeg from an ALSA device with +card id 0, you may run the command: +

 
ffmpeg -f alsa -i hw:0 alsaout.wav
+
+ +

For more information see: +http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html +

+ +

11.2 bktr

+ +

BSD video input device. +

+ +

11.3 dshow

+ +

Windows DirectShow input device. +

+

DirectShow support is enabled when FFmpeg is built with mingw-w64. +Currently only audio and video devices are supported. +

+

Multiple devices may be opened as separate inputs, but they may also be +opened on the same input, which should improve synchronism between them. +

+

The input name should be in the format: +

+
 
TYPE=NAME[:TYPE=NAME]
+
+ +

where TYPE can be either audio or video, +and NAME is the device’s name. +

+ +

11.3.1 Options

+ +

If no options are specified, the device’s defaults are used. +If the device does not support the requested options, it will +fail to open. +

+
+
video_size
+

Set the video size in the captured video. +

+
+
framerate
+

Set the framerate in the captured video. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. +

+
+
channels
+

Set the number of channels in the captured audio. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +

+
+
list_options
+

If set to ‘true’, print a list of selected device’s options +and exit. +

+
+
video_device_number
+

Set video device number for devices with same name (starts at 0, +defaults to 0). +

+
+
audio_device_number
+

Set audio device number for devices with same name (starts at 0, +defaults to 0). +

+
+
+ + +

11.3.2 Examples

+ + + + +

11.4 dv1394

+ +

Linux DV 1394 input device. +

+ +

11.5 fbdev

+ +

Linux framebuffer input device. +

+

The Linux framebuffer is a graphic hardware-independent abstraction +layer to show graphics on a computer monitor, typically on the +console. It is accessed through a file device node, usually +‘/dev/fb0’. +

+

For more detailed information read the file +Documentation/fb/framebuffer.txt included in the Linux source tree. +

+

To record from the framebuffer device ‘/dev/fb0’ with +ffmpeg: +

 
ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
+
+ +

You can take a single screenshot image with the command: +

 
ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
+
+ +

See also http://linux-fbdev.sourceforge.net/, and fbset(1). +

+ +

11.6 jack

+ +

JACK input device. +

+

To enable this input device during configuration you need libjack +installed on your system. +

+

A JACK input device creates one or more JACK writable clients, one for +each audio channel, with name client_name:input_N, where +client_name is the name provided by the application, and N +is a number which identifies the channel. +Each writable client will send the acquired data to the FFmpeg input +device. +

+

Once you have created one or more JACK readable clients, you need to +connect them to one or more JACK writable clients. +

+

To connect or disconnect JACK clients you can use the jack_connect +and jack_disconnect programs, or do it through a graphical interface, +for example with qjackctl. +

+

To list the JACK clients and their properties you can invoke the command +jack_lsp. +

+

Follows an example which shows how to capture a JACK readable client +with ffmpeg. +

 
# Create a JACK writable client with name "ffmpeg".
+$ ffmpeg -f jack -i ffmpeg -y out.wav
+
+# Start the sample jack_metro readable client.
+$ jack_metro -b 120 -d 0.2 -f 4000
+
+# List the current JACK clients.
+$ jack_lsp -c
+system:capture_1
+system:capture_2
+system:playback_1
+system:playback_2
+ffmpeg:input_1
+metro:120_bpm
+
+# Connect metro to the ffmpeg writable client.
+$ jack_connect metro:120_bpm ffmpeg:input_1
+
+ +

For more information read: +http://jackaudio.org/ +

+ +

11.7 lavfi

+ +

Libavfilter input virtual device. +

+

This input device reads data from the open output pads of a libavfilter +filtergraph. +

+

For each filtergraph open output, the input device will create a +corresponding stream which is mapped to the generated output. Currently +only video data is supported. The filtergraph is specified through the +option ‘graph’. +

+ +

11.7.1 Options

+ +
+
graph
+

Specify the filtergraph to use as input. Each video open output must be +labelled by a unique string of the form "outN", where N is a +number starting from 0 corresponding to the mapped input stream +generated by the device. +The first unlabelled output is automatically assigned to the "out0" +label, but all the others need to be specified explicitly. +

+

If not specified defaults to the filename specified for the input +device. +

+
+ + +

11.7.2 Examples

+ + + + +

11.8 libdc1394

+ +

IIDC1394 input device, based on libdc1394 and libraw1394. +

+ +

11.9 openal

+ +

The OpenAL input device provides audio capture on all systems with a +working OpenAL 1.1 implementation. +

+

To enable this input device during configuration, you need OpenAL +headers and libraries installed on your system, and need to configure +FFmpeg with --enable-openal. +

+

OpenAL headers and libraries should be provided as part of your OpenAL +implementation, or as an additional download (an SDK). Depending on your +installation you may need to specify additional flags via the +--extra-cflags and --extra-ldflags for allowing the build +system to locate the OpenAL headers and libraries. +

+

An incomplete list of OpenAL implementations follows: +

+
+
Creative
+

The official Windows implementation, providing hardware acceleration +with supported devices and software fallback. +See http://openal.org/. +

+
OpenAL Soft
+

Portable, open source (LGPL) software implementation. Includes +backends for the most common sound APIs on the Windows, Linux, +Solaris, and BSD operating systems. +See http://kcat.strangesoft.net/openal.html. +

+
Apple
+

OpenAL is part of Core Audio, the official Mac OS X Audio interface. +See http://developer.apple.com/technologies/mac/audio-and-video.html +

+
+ +

This device allows to capture from an audio input device handled +through OpenAL. +

+

You need to specify the name of the device to capture in the provided +filename. If the empty string is provided, the device will +automatically select the default device. You can get the list of the +supported devices by using the option list_devices. +

+ +

11.9.1 Options

+ +
+
channels
+

Set the number of channels in the captured audio. Only the values +‘1’ (monaural) and ‘2’ (stereo) are currently supported. +Defaults to ‘2’. +

+
+
sample_size
+

Set the sample size (in bits) of the captured audio. Only the values +‘8’ and ‘16’ are currently supported. Defaults to +‘16’. +

+
+
sample_rate
+

Set the sample rate (in Hz) of the captured audio. +Defaults to ‘44.1k’. +

+
+
list_devices
+

If set to ‘true’, print a list of devices and exit. +Defaults to ‘false’. +

+
+
+ + +

11.9.2 Examples

+ +

Print the list of OpenAL supported devices and exit: +

 
$ ffmpeg -list_devices true -f openal -i dummy out.ogg
+
+ +

Capture from the OpenAL device ‘DR-BT101 via PulseAudio’: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
+
+ +

Capture from the default device (note the empty string ” as filename): +

 
$ ffmpeg -f openal -i '' out.ogg
+
+ +

Capture from two devices simultaneously, writing to two different files, +within the same ffmpeg command: +

 
$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
+
+

Note: not all OpenAL implementations support multiple simultaneous capture - +try the latest OpenAL Soft if the above does not work. +

+ +

11.10 oss

+ +

Open Sound System input device. +

+

The filename to provide to the input device is the device node +representing the OSS input device, and is usually set to +‘/dev/dsp’. +

+

For example to grab from ‘/dev/dsp’ using ffmpeg use the +command: +

 
ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
+
+ +

For more information about OSS see: +http://manuals.opensound.com/usersguide/dsp.html +

+ +

11.11 pulse

+ +

pulseaudio input device. +

+

To enable this input device during configuration you need libpulse-simple +installed in your system. +

+

The filename to provide to the input device is a source device or the +string "default" +

+

To list the pulse source devices and their properties you can invoke +the command pactl list sources. +

+
 
ffmpeg -f pulse -i default /tmp/pulse.wav
+
+ + +

11.11.1 server AVOption

+ +

The syntax is: +

 
-server server name
+
+ +

Connects to a specific server. +

+ +

11.11.2 name AVOption

+ +

The syntax is: +

 
-name application name
+
+ +

Specify the application name pulse will use when showing active clients, +by default it is the LIBAVFORMAT_IDENT string +

+ +

11.11.3 stream_name AVOption

+ +

The syntax is: +

 
-stream_name stream name
+
+ +

Specify the stream name pulse will use when showing active streams, +by default it is "record" +

+ +

11.11.4 sample_rate AVOption

+ +

The syntax is: +

 
-sample_rate samplerate
+
+ +

Specify the samplerate in Hz, by default 48kHz is used. +

+ +

11.11.5 channels AVOption

+ +

The syntax is: +

 
-channels N
+
+ +

Specify the channels in use, by default 2 (stereo) is set. +

+ +

11.11.6 frame_size AVOption

+ +

The syntax is: +

 
-frame_size bytes
+
+ +

Specify the number of byte per frame, by default it is set to 1024. +

+ +

11.11.7 fragment_size AVOption

+ +

The syntax is: +

 
-fragment_size bytes
+
+ +

Specify the minimal buffering fragment in pulseaudio, it will affect the +audio latency. By default it is unset. +

+ +

11.12 sndio

+ +

sndio input device. +

+

To enable this input device during configuration you need libsndio +installed on your system. +

+

The filename to provide to the input device is the device node +representing the sndio input device, and is usually set to +‘/dev/audio0’. +

+

For example to grab from ‘/dev/audio0’ using ffmpeg use the +command: +

 
ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
+
+ + +

11.13 video4linux and video4linux2

+ +

Video4Linux and Video4Linux2 input video devices. +

+

The name of the device to grab is a file device node, usually Linux +systems tend to automatically create such nodes when the device +(e.g. an USB webcam) is plugged into the system, and has a name of the +kind ‘/dev/videoN’, where N is a number associated to +the device. +

+

Video4Linux and Video4Linux2 devices only support a limited set of +widthxheight sizes and framerates. You can check which are +supported for example with the command dov4l for Video4Linux +devices and using -list_formats all for Video4Linux2 devices. +

+

If the size for the device is set to 0x0, the input device will +try to auto-detect the size to use. +Only for the video4linux2 device, if the frame rate is set to 0/0 the +input device will use the frame rate value already set in the driver. +

+

Video4Linux support is deprecated since Linux 2.6.30, and will be +dropped in later versions. +

+

Note that if FFmpeg is build with v4l-utils support ("–enable-libv4l2" +option), it will always be used. +

+

Follow some usage examples of the video4linux devices with the ff* +tools. +

 
# Grab and show the input of a video4linux device, frame rate is set
+# to the default of 25/1.
+ffplay -s 320x240 -f video4linux /dev/video0
+
+# Grab and show the input of a video4linux2 device, auto-adjust size.
+ffplay -f video4linux2 /dev/video0
+
+# Grab and record the input of a video4linux2 device, auto-adjust size,
+# frame rate value defaults to 0/0 so it is read from the video4linux2
+# driver.
+ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
+
+ +

"v4l" and "v4l2" can be used as aliases for the respective "video4linux" and +"video4linux2". +

+ +

11.14 vfwcap

+ +

VfW (Video for Windows) capture input device. +

+

The filename passed as input is the capture driver number, ranging from +0 to 9. You may use "list" as filename to print a list of drivers. Any +other filename will be interpreted as device number 0. +

+ +

11.15 x11grab

+ +

X11 video input device. +

+

This device allows to capture a region of an X11 display. +

+

The filename passed as input has the syntax: +

 
[hostname]:display_number.screen_number[+x_offset,y_offset]
+
+ +

hostname:display_number.screen_number specifies the +X11 display name of the screen to grab from. hostname can be +omitted, and defaults to "localhost". The environment variable +DISPLAY contains the default display name. +

+

x_offset and y_offset specify the offsets of the grabbed +area with respect to the top-left border of the X11 screen. They +default to 0. +

+

Check the X11 documentation (e.g. man X) for more detailed information. +

+

Use the dpyinfo program for getting basic information about the +properties of your X11 display (e.g. grep for "name" or "dimensions"). +

+

For example to grab from ‘:0.0’ using ffmpeg: +

 
ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
+
+# Grab at position 10,20.
+ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
+
+ + +

11.15.1 follow_mouse AVOption

+ +

The syntax is: +

 
-follow_mouse centered|PIXELS
+
+ +

When it is specified with "centered", the grabbing region follows the mouse +pointer and keeps the pointer at the center of region; otherwise, the region +follows only when the mouse pointer reaches within PIXELS (greater than +zero) to the edge of region. +

+

For example: +

 
ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
+
+# Follows only when the mouse pointer reaches within 100 pixels to edge
+ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
+
+ + +

11.15.2 show_region AVOption

+ +

The syntax is: +

 
-show_region 1
+
+ +

If show_region AVOption is specified with 1, then the grabbing +region will be indicated on screen. With this option, it’s easy to know what is +being grabbed if only a portion of the screen is grabbed. +

+

For example: +

 
ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
+
+# With follow_mouse
+ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
+
+ + + +
+

+ + +
diff --git a/extern/ffmpeg/doc/general.html b/extern/ffmpeg/doc/general.html new file mode 100644 index 0000000000..3b41062bc2 --- /dev/null +++ b/extern/ffmpeg/doc/general.html @@ -0,0 +1,825 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

General Documentation

+ + +

Table of Contents

+ + + +

1. External libraries

+ +

FFmpeg can be hooked up with a number of external libraries to add support +for more formats. None of them are used by default, their use has to be +explicitly requested by passing the appropriate flags to ‘./configure’. +

+ +

1.1 OpenJPEG

+ +

FFmpeg can use the OpenJPEG libraries for encoding/decoding J2K videos. Go to +http://www.openjpeg.org/ to get the libraries and follow the installation +instructions. To enable using OpenJPEG in FFmpeg, pass --enable-libopenjpeg to +‘./configure’. +

+ + +

1.2 OpenCORE and VisualOn libraries

+ +

Spun off Google Android sources, OpenCore and VisualOn libraries provide +encoders for a number of audio codecs. +

+
+

OpenCORE and VisualOn libraries are under the Apache License 2.0 +(see http://www.apache.org/licenses/LICENSE-2.0 for details), which is +incompatible with the LGPL version 2.1 and GPL version 2. You have to +upgrade FFmpeg’s license to LGPL version 3 (or if you have enabled +GPL components, GPL version 3) to use it. +

+ +

1.2.1 OpenCORE AMR

+ +

FFmpeg can make use of the OpenCORE libraries for AMR-NB +decoding/encoding and AMR-WB decoding. +

+

Go to http://sourceforge.net/projects/opencore-amr/ and follow the +instructions for installing the libraries. +Then pass --enable-libopencore-amrnb and/or +--enable-libopencore-amrwb to configure to enable them. +

+ +

1.2.2 VisualOn AAC encoder library

+ +

FFmpeg can make use of the VisualOn AACenc library for AAC encoding. +

+

Go to http://sourceforge.net/projects/opencore-amr/ and follow the +instructions for installing the library. +Then pass --enable-libvo-aacenc to configure to enable it. +

+ +

1.2.3 VisualOn AMR-WB encoder library

+ +

FFmpeg can make use of the VisualOn AMR-WBenc library for AMR-WB encoding. +

+

Go to http://sourceforge.net/projects/opencore-amr/ and follow the +instructions for installing the library. +Then pass --enable-libvo-amrwbenc to configure to enable it. +

+ +

1.3 LAME

+ +

FFmpeg can make use of the LAME library for MP3 encoding. +

+

Go to http://lame.sourceforge.net/ and follow the +instructions for installing the library. +Then pass --enable-libmp3lame to configure to enable it. +

+ +

1.4 libvpx

+ +

FFmpeg can make use of the libvpx library for VP8 encoding. +

+

Go to http://www.webmproject.org/ and follow the instructions for +installing the library. Then pass --enable-libvpx to configure to +enable it. +

+ +

1.5 x264

+ +

FFmpeg can make use of the x264 library for H.264 encoding. +

+

Go to http://www.videolan.org/developers/x264.html and follow the +instructions for installing the library. Then pass --enable-libx264 to +configure to enable it. +

+
+

x264 is under the GNU Public License Version 2 or later +(see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html for +details), you must upgrade FFmpeg’s license to GPL in order to use it. +

+ + + +

2. Supported File Formats, Codecs or Features

+ +

You can use the -formats and -codecs options to have an exhaustive list. +

+ +

2.1 File Formats

+ +

FFmpeg supports the following file formats through the libavformat +library: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEncodingDecodingComments
4xmX4X Technologies format, used in some games.
8088flex TMVX
ACT VoiceXcontains G.729 audio
Adobe FilmstripXX
Audio IFF (AIFF)XX
American Laser Games MMXMultimedia format used in games like Mad Dog McCree.
3GPP AMRXX
Apple HTTP Live StreamingX
Artworx Data FormatX
ASFXX
AVIXX
AVISynthX
AVSXMultimedia format used by the Creature Shock game.
Beam Software SIFFXAudio and video format used in some games by Beam Software.
Bethesda Softworks VIDXUsed in some games from Bethesda Softworks.
Binary textX
BinkXMultimedia format used by many games.
Bitmap Brothers JVXUsed in Z and Z95 games.
Brute Force & IgnoranceXUsed in the game Flash Traffic: City of Angels.
BWFXX
CRI ADXXXAudio-only format used in console video games.
Discworld II BMVX
Interplay C93XUsed in the game Cyberia from Interplay.
Delphine Software International CINXMultimedia format used by Delphine Software games.
CD+GXVideo format used by CD+G karaoke disks
Core Audio FormatXXApple Core Audio Format
CRC testing formatX
Creative VoiceXXCreated for the Sound Blaster Pro.
CRYO APCXAudio format used in some games by CRYO Interactive Entertainment.
D-Cinema audioXX
Deluxe Paint AnimationX
DFAXThis format is used in Chronomaster game
DV videoXX
DXAXThis format is used in the non-Windows version of the Feeble Files + game and different game cutscenes repacked for use with ScummVM.
Electronic Arts cdataX
Electronic Arts MultimediaXUsed in various EA games; files have extensions like WVE and UV2.
FFM (FFserver live feed)XX
Flash (SWF)XX
Flash 9 (AVM2)XXOnly embedded audio is decoded.
FLI/FLC/FLX animationX.fli/.flc files
Flash Video (FLV)XXMacromedia Flash video files
framecrc testing formatX
FunCom ISSXAudio format used in various games from FunCom like The Longest Journey.
G.723.1XX
G.729 BITXX
G.729 rawX
GIF AnimationX
GXFXXGeneral eXchange Format SMPTE 360M, used by Thomson Grass Valley + playout servers.
iCEDraw FileX
ICOXMicrosoft Windows ICO
id Quake II CIN videoX
id RoQXXUsed in Quake III, Jedi Knight 2 and other computer games.
IEC61937 encapsulationXX
IFFXInterchange File Format
Interplay MVEXFormat used in various Interplay computer games.
IV8XA format generated by IndigoVision 8000 video server.
IVF (On2)XXA format used by libvpx
LATMXX
LMLM4XUsed by Linux Media Labs MPEG-4 PCI boards
LOASXcontains LATM multiplexed AAC audio
LXFXVR native stream format, used by Leitch/Harris’ video servers.
MatroskaXX
Matroska audioX
FFmpeg metadataXXMetadata in text format.
MAXIS XAXUsed in Sim City 3000; file extension .xa.
MD StudioX
Mobotix .mxgX
Monkey’s AudioX
Motion Pixels MVIX
MOV/QuickTime/MP4XX3GP, 3GP2, PSP, iPod variants supported
MP2XX
MP3XX
MPEG-1 SystemXXmuxed audio and video, VCD format supported
MPEG-PS (program stream)XXalso known as VOB file, SVCD and DVD format supported
MPEG-TS (transport stream)XXalso known as DVB Transport Stream
MPEG-4XXMPEG-4 is a variant of QuickTime.
MIME multipart JPEGX
MSN TCP webcamXUsed by MSN Messenger webcam streams.
MTVX
MusepackX
Musepack SV8X
Material eXchange Format (MXF)XXSMPTE 377M, used by D-Cinema, broadcast industry.
Material eXchange Format (MXF), D-10 MappingXXSMPTE 386M, D-10/IMX Mapping.
NC camera feedXNC (AVIP NC4600) camera streams
NTT TwinVQ (VQF)XNippon Telegraph and Telephone Corporation TwinVQ.
Nullsoft Streaming VideoX
NuppelVideoX
NUTXXNUT Open Container Format
OggXX
Playstation Portable PMPX
TechnoTrend PVAXUsed by TechnoTrend DVB PCI boards.
QCPX
raw ADTS (AAC)XX
raw AC-3XX
raw Chinese AVS videoXX
raw CRI ADXXX
raw DiracXX
raw DNxHDXX
raw DTSXX
raw E-AC-3XX
raw FLACXX
raw GSMX
raw H.261XX
raw H.263XX
raw H.264XX
raw Ingenient MJPEGX
raw MJPEGXX
raw MLPX
raw MPEGX
raw MPEG-1X
raw MPEG-2X
raw MPEG-4XX
raw NULLX
raw videoXX
raw id RoQX
raw ShortenX
raw TrueHDXX
raw VC-1X
raw PCM A-lawXX
raw PCM mu-lawXX
raw PCM signed 8 bitXX
raw PCM signed 16 bit big-endianXX
raw PCM signed 16 bit little-endianXX
raw PCM signed 24 bit big-endianXX
raw PCM signed 24 bit little-endianXX
raw PCM signed 32 bit big-endianXX
raw PCM signed 32 bit little-endianXX
raw PCM unsigned 8 bitXX
raw PCM unsigned 16 bit big-endianXX
raw PCM unsigned 16 bit little-endianXX
raw PCM unsigned 24 bit big-endianXX
raw PCM unsigned 24 bit little-endianXX
raw PCM unsigned 32 bit big-endianXX
raw PCM unsigned 32 bit little-endianXX
raw PCM floating-point 32 bit big-endianXX
raw PCM floating-point 32 bit little-endianXX
raw PCM floating-point 64 bit big-endianXX
raw PCM floating-point 64 bit little-endianXX
RDTX
REDCODE R3DXFile format used by RED Digital cameras, contains JPEG 2000 frames and PCM audio.
RealMediaXX
RedirectorX
Renderware TeXture DictionaryX
RL2XAudio and video format used in some games by Entertainment Software Partners.
RPL/ARMovieX
Lego Mindstorms RSOXX
RTMPXXOutput is performed by publishing stream to RTMP server
RTPXX
RTSPXX
SAPXX
SBGX
SDPX
Sega FILM/CPKXUsed in many Sega Saturn console games.
Sierra SOLX.sol files used in Sierra Online games.
Sierra VMDXUsed in Sierra CD-ROM games.
SmackerXMultimedia format used by many games.
SMJPEGXXUsed in certain Loki game ports.
Sony OpenMG (OMA)XXAudio format used in Sony Sonic Stage and Sony Vegas.
Sony PlayStation STRX
Sony Wave64 (W64)X
SoX native formatXX
SUN AU formatXX
Text filesX
THPXUsed on the Nintendo GameCube.
Tiertex Limited SEQXTiertex .seq files used in the DOS CD-ROM version of the game Flashback.
True AudioX
VC-1 test bitstreamXX
WAVXX
WavPackX
WebMXX
Windows Televison (WTV)XX
Wing Commander III movieXMultimedia format used in Origin’s Wing Commander III computer game.
Westwood Studios audioXMultimedia format used in Westwood Studios games.
Westwood Studios VQAXMultimedia format used in Westwood Studios games.
XMVXMicrosoft video container used in Xbox games.
xWMAXMicrosoft audio container used by XAudio 2.
eXtended BINary text (XBIN)X
YUV4MPEG pipeXX
Psygnosis YOPX
+ +

X means that encoding (resp. decoding) is supported. +

+ +

2.2 Image Formats

+ +

FFmpeg can read and write images for each frame of a video sequence. The +following image formats are supported: +

+ + + + + + + + + + + + + + + + + + + + + + + + +
NameEncodingDecodingComments
.Y.U.VXXone raw file per component
animated GIFXXOnly uncompressed GIFs are generated.
BMPXXMicrosoft BMP image
DPXXXDigital Picture Exchange
JPEGXXProgressive JPEG is not supported.
JPEG 2000XX
JPEG-LSXX
LJPEGXLossless JPEG
PAMXXPAM is a PNM extension with alpha support.
PBMXXPortable BitMap image
PCXXXPC Paintbrush
PGMXXPortable GrayMap image
PGMYUVXXPGM with U and V components in YUV 4:2:0
PICXPictor/PC Paint
PNGXX
PPMXXPortable PixelMap image
PTXXV.Flash PTX format
SGIXXSGI RGB image format
Sun RasterfileXSun RAS image format
TIFFXXYUV, JPEG and some extension is not supported yet.
Truevision TargaXXTarga (.TGA) image format
XWDXXX Window Dump image format
+ +

X means that encoding (resp. decoding) is supported. +

+

E means that support is provided through an external library. +

+ +

2.3 Video Codecs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEncodingDecodingComments
4X MovieXUsed in certain computer games.
8088flex TMVX
8SVX exponentialX
8SVX fibonacciX
A64 multicolorXCreates video suitable to be played on a commodore 64 (multicolor mode).
American Laser Games MMXUsed in games like Mad Dog McCree.
AMV VideoXXUsed in Chinese MP3 players.
ANSI/ASCII artX
Apple MJPEG-BX
Apple ProResXX
Apple QuickDrawXfourcc: qdrw
Asus v1XXfourcc: ASV1
Asus v2XXfourcc: ASV2
ATI VCR1Xfourcc: VCR1
ATI VCR2Xfourcc: VCR2
Auravision AuraX
Auravision Aura 2X
Autodesk Animator Flic videoX
Autodesk RLEXfourcc: AASC
Avid 1:1 10-bit RGB PackerXXfourcc: AVrp
AVS (Audio Video Standard) videoXVideo encoding used by the Creature Shock game.
Beam Software VBX
Bethesda VID videoXUsed in some games from Bethesda Softworks.
Bink VideoX
Bitmap Brothers JV videoX
y41p Brooktree uncompressed 4:1:1 12-bitXX
Brute Force & IgnoranceXUsed in the game Flash Traffic: City of Angels.
C93 videoXCodec used in Cyberia game.
CamStudioXfourcc: CSCD
CD+GXVideo codec for CD+G karaoke disks
Chinese AVS videoEXAVS1-P2, JiZhun profile, encoding through external library libxavs
Delphine Software International CIN videoXCodec used in Delphine Software International games.
Discworld II BMV VideoX
CinepakX
Cirrus Logic AccuPakXXfourcc: CLJR
Creative YUV (CYUV)X
DFAXCodec used in Chronomaster game.
DiracEXsupported through external libdirac/libschroedinger libraries
Deluxe Paint AnimationX
DNxHDXXaka SMPTE VC3
Duck TrueMotion 1.0Xfourcc: DUCK
Duck TrueMotion 2.0Xfourcc: TM20
DV (Digital Video)XX
Dxtory capture formatX
Feeble Files/ScummVM DXAXCodec originally used in Feeble Files game.
Electronic Arts CMV videoXUsed in NHL 95 game.
Electronic Arts Madcow videoX
Electronic Arts TGV videoX
Electronic Arts TGQ videoX
Electronic Arts TQI videoX
Escape 124X
Escape 130X
FFmpeg video codec #1XXexperimental lossless codec (fourcc: FFV1)
Flash Screen Video v1XXfourcc: FSV1
Flash Screen Video v2XX
Flash Video (FLV)XXSorenson H.263 used in Flash
FrapsX
H.261XX
H.263 / H.263-1996XX
H.263+ / H.263-1998 / H.263 version 2XX
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10EXencoding supported through external library libx264
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)EX
HuffYUVXX
HuffYUV FFmpeg variantXX
IBM UltimotionXfourcc: ULTI
id Cinematic videoXUsed in Quake II.
id RoQ videoXXUsed in Quake III, Jedi Knight 2, other computer games.
IFF ILBMXIFF interleaved bitmap
IFF ByteRun1XIFF run length encoded bitmap
Intel H.263X
Intel Indeo 2X
Intel Indeo 3X
Intel Indeo 4X
Intel Indeo 5X
Interplay C93XUsed in the game Cyberia from Interplay.
Interplay MVE videoXUsed in Interplay .MVE files.
J2KXX
Karl Morton’s video codecXCodec used in Worms games.
Kega Game Video (KGV1)XKega emulator screen capture codec.
LagarithX
LCL (LossLess Codec Library) MSZHX
LCL (LossLess Codec Library) ZLIBEE
LOCOX
lossless MJPEGXX
Microsoft RLEX
Microsoft Video 1X
MimicXUsed in MSN Messenger Webcam streams.
Miro VideoXLXfourcc: VIXL
MJPEG (Motion JPEG)XX
Mobotix MxPEG videoX
Motion Pixels videoX
MPEG-1 videoXX
MPEG-1/2 video XvMC (X-Video Motion Compensation)X
MPEG-1/2 video (VDPAU acceleration)X
MPEG-2 videoXX
MPEG-4 part 2XXlibxvidcore can be used alternatively for encoding.
MPEG-4 part 2 Microsoft variant version 1X
MPEG-4 part 2 Microsoft variant version 2XX
MPEG-4 part 2 Microsoft variant version 3XX
Nintendo Gamecube THP videoX
NuppelVideo/RTjpegXVideo encoding used in NuppelVideo files.
On2 VP3Xstill experimental
On2 VP5Xfourcc: VP50
On2 VP6Xfourcc: VP60,VP61,VP62
VP8EXfourcc: VP80, encoding supported through external library libvpx
planar RGBXfourcc: 8BPS
ProresXfourcc: apch,apcn,apcs,apco
Q-team QPEGXfourccs: QPEG, Q1.0, Q1.1
QuickTime 8BPS videoX
QuickTime Animation (RLE) videoXXfourcc: ’rle ’
QuickTime Graphics (SMC)Xfourcc: ’smc ’
QuickTime video (RPZA)Xfourcc: rpza
R10K AJA Kona 10-bit RGB CodecXX
R210 Quicktime Uncompressed RGB 10-bitXX
Raw VideoXX
RealVideo 1.0XX
RealVideo 2.0XX
RealVideo 3.0Xstill far from ideal
RealVideo 4.0X
Renderware TXD (TeXture Dictionary)XTexture dictionaries used by the Renderware Engine.
RL2 videoXused in some games by Entertainment Software Partners
Sierra VMD videoXUsed in Sierra VMD files.
Smacker videoXVideo encoding used in Smacker.
SMPTE VC-1X
SnowXXexperimental wavelet codec (fourcc: SNOW)
Sony PlayStation MDEC (Motion DECoder)X
Sorenson Vector Quantizer 1XXfourcc: SVQ1
Sorenson Vector Quantizer 3Xfourcc: SVQ3
Sunplus JPEG (SP5X)Xfourcc: SP5X
TechSmith Screen Capture CodecXfourcc: TSCC
TheoraEXencoding supported through external library libtheora
Tiertex Limited SEQ videoXCodec used in DOS CD-ROM FlashBack game.
Ut VideoX
v210 QuickTime uncompressed 4:2:2 10-bitXX
v308 QuickTime uncompressed 4:4:4XX
v410 QuickTime uncompressed 4:4:4 10-bitXX
VBLE Lossless CodecX
VMware Screen Codec / VMware VideoXCodec used in videos captured by VMware.
Westwood Studios VQA (Vector Quantized Animation) videoX
Windows Media ImageX
Windows Media Video 7XX
Windows Media Video 8XX
Windows Media Video 9Xnot completely working
Wing Commander III / XanXUsed in Wing Commander III .MVE files.
Wing Commander IV / XanXUsed in Wing Commander IV.
Winnov WNV1X
WMV7XX
YAMAHA SMAFXX
Psygnosis YOP VideoX
yuv4XXlibquicktime uncompressed packed 4:2:0
ZLIBXXpart of LCL, encoder experimental
Zip Motion Blocks VideoXXEncoder works only in PAL8.
+ +

X means that encoding (resp. decoding) is supported. +

+

E means that support is provided through an external library. +

+ +

2.4 Audio Codecs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEncodingDecodingComments
8SVX audioX
AAC+EXencoding supported through external library libaacplus
AACEXencoding supported through external library libfaac and libvo-aacenc
AC-3IXX
ADPCM 4X MovieX
ADPCM CDROM XAX
ADPCM Creative TechnologyX16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
ADPCM Electronic ArtsXUsed in various EA titles.
ADPCM Electronic Arts Maxis CDROM XSXUsed in Sim City 3000.
ADPCM Electronic Arts R1X
ADPCM Electronic Arts R2X
ADPCM Electronic Arts R3X
ADPCM Electronic Arts XASX
ADPCM G.722XX
ADPCM G.726XX
ADPCM IMA AMVXUsed in AMV files
ADPCM IMA Electronic Arts EACSX
ADPCM IMA Electronic Arts SEADX
ADPCM IMA FuncomX
ADPCM IMA QuickTimeXX
ADPCM IMA Loki SDL MJPEGX
ADPCM IMA WAVXX
ADPCM IMA WestwoodX
ADPCM ISS IMAXUsed in FunCom games.
ADPCM IMA Duck DK3XUsed in some Sega Saturn console games.
ADPCM IMA Duck DK4XUsed in some Sega Saturn console games.
ADPCM MicrosoftXX
ADPCM MS IMAXX
ADPCM Nintendo Gamecube THPX
ADPCM QT IMAXX
ADPCM SEGA CRI ADXXXUsed in Sega Dreamcast games.
ADPCM Shockwave FlashXX
ADPCM SMJPEG IMAXUsed in certain Loki game ports.
ADPCM Sound Blaster Pro 2-bitX
ADPCM Sound Blaster Pro 2.6-bitX
ADPCM Sound Blaster Pro 4-bitX
ADPCM Westwood Studios IMAXUsed in Westwood Studios games like Command and Conquer.
ADPCM YamahaXX
AMR-NBEXencoding supported through external library libopencore-amrnb
AMR-WBEXencoding supported through external library libvo-amrwbenc
Apple lossless audioXXQuickTime fourcc ’alac’
Atrac 1X
Atrac 3X
Bink AudioXUsed in Bink and Smacker files in many games.
CELTEdecoding supported through external library libcelt
Delphine Software International CIN audioXCodec used in Delphine Software International games.
Discworld II BMV AudioX
COOKXAll versions except 5.1 are supported.
DCA (DTS Coherent Acoustics)XX
DPCM id RoQXXUsed in Quake III, Jedi Knight 2 and other computer games.
DPCM InterplayXUsed in various Interplay computer games.
DPCM Sierra OnlineXUsed in Sierra Online game audio files.
DPCM SolX
DPCM XanXUsed in Origin’s Wing Commander IV AVI files.
DSP Group TrueSpeechX
DV audioX
Enhanced AC-3XX
FLAC (Free Lossless Audio Codec)XIX
G.723.1XX
G.729X
GSMEXencoding supported through external library libgsm
GSM Microsoft variantEXencoding supported through external library libgsm
IMC (Intel Music Coder)X
MACE (Macintosh Audio Compression/Expansion) 3:1X
MACE (Macintosh Audio Compression/Expansion) 6:1X
MLP (Meridian Lossless Packing)XUsed in DVD-Audio discs.
Monkey’s AudioXOnly versions 3.97-3.99 are supported.
MP1 (MPEG audio layer 1)IX
MP2 (MPEG audio layer 2)IXIX
MP3 (MPEG audio layer 3)EIXencoding supported through external library LAME, ADU MP3 and MP3onMP4 also supported
MPEG-4 Audio Lossless Coding (ALS)X
Musepack SV7X
Musepack SV8X
Nellymoser AsaoXX
PCM A-lawXX
PCM mu-lawXX
PCM 16-bit little-endian planarX
PCM 32-bit floating point big-endianXX
PCM 32-bit floating point little-endianXX
PCM 64-bit floating point big-endianXX
PCM 64-bit floating point little-endianXX
PCM D-Cinema audio signed 24-bitXX
PCM signed 8-bitXX
PCM signed 16-bit big-endianXX
PCM signed 16-bit little-endianXX
PCM signed 24-bit big-endianXX
PCM signed 24-bit little-endianXX
PCM signed 32-bit big-endianXX
PCM signed 32-bit little-endianXX
PCM signed 16/20/24-bit big-endian in MPEG-TSX
PCM unsigned 8-bitXX
PCM unsigned 16-bit big-endianXX
PCM unsigned 16-bit little-endianXX
PCM unsigned 24-bit big-endianXX
PCM unsigned 24-bit little-endianXX
PCM unsigned 32-bit big-endianXX
PCM unsigned 32-bit little-endianXX
PCM ZorkX
QCELP / PureVoiceX
QDesign Music Codec 2XThere are still some distortions.
RealAudio 1.0 (14.4K)XXReal 14400 bit/s codec
RealAudio 2.0 (28.8K)XReal 28800 bit/s codec
RealAudio 3.0 (dnet)IXXReal low bitrate AC-3 codec
RealAudio SIPR / ACELP.NETX
ShortenX
Sierra VMD audioXUsed in Sierra VMD files.
Smacker audioX
SMPTE 302M AES3 audioX
SonicXXexperimental codec
Sonic losslessXXexperimental codec
SpeexEEsupported through external library libspeex
True Audio (TTA)X
TrueHDXUsed in HD-DVD and Blu-Ray discs.
TwinVQ (VQF flavor)X
VorbisEXA native but very primitive encoder exists.
WavPackX
Westwood Audio (SND1)X
Windows Media Audio 1XX
Windows Media Audio 2XX
Windows Media Audio ProX
Windows Media Audio VoiceX
+ +

X means that encoding (resp. decoding) is supported. +

+

E means that support is provided through an external library. +

+

I means that an integer-only version is available, too (ensures high +performance on systems without hardware floating point support). +

+ +

2.5 Subtitle Formats

+ + + + + + + + + + +
NameMuxingDemuxingEncodingDecoding
SSA/ASSXXXX
DVBXXXX
DVDXXXX
MicroDVDXX
PGSX
SubRip (SRT)XXXX
XSUBXX
+ +

X means that the feature is supported. +

+ +

2.6 Network Protocols

+ + + + + + + + + + + + +
NameSupport
Apple HTTP Live StreamingX
fileX
GopherX
HTTPX
MMSX
pipeX
RTPX
TCPX
UDPX
+ +

X means that the protocol is supported. +

+ + +

2.7 Input/Output Devices

+ + + + + + + + + + + + + + +
NameInputOutput
ALSAXX
BKTRX
DV1394X
JACKX
LIBDC1394X
OSSXX
PulseaudioX
Video4LinuxX
Video4Linux2X
VfW captureX
X11 grabbingX
+ +

X means that input/output is supported. +

+ +

2.8 Timecode

+ + + + + + + + +
Codec/formatReadWrite
DVXX
GXFXX
MOVX
MPEG1/2XX
MXFX
+ +
+

+ + +
diff --git a/extern/ffmpeg/doc/git-howto.html b/extern/ffmpeg/doc/git-howto.html new file mode 100644 index 0000000000..ab71cb21ff --- /dev/null +++ b/extern/ffmpeg/doc/git-howto.html @@ -0,0 +1,449 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

Using git to develop FFmpeg

+ + +

Table of Contents

+ + + +

1. Introduction

+ +

This document aims in giving some quick references on a set of useful git +commands. You should always use the extensive and detailed documentation +provided directly by git: +

+
 
git --help
+man git
+
+ +

shows you the available subcommands, +

+
 
git <command> --help
+man git-<command>
+
+ +

shows information about the subcommand <command>. +

+

Additional information could be found on the +Git Reference website +

+

For more information about the Git project, visit the +

+

Git website +

+

Consult these resources whenever you have problems, they are quite exhaustive. +

+

What follows now is a basic introduction to Git and some FFmpeg-specific +guidelines to ease the contribution to the project +

+ +

2. Basics Usage

+ + +

2.1 Get GIT

+ +

You can get git from http://git-scm.com/ +Most distribution and operating system provide a package for it. +

+ + +

2.2 Cloning the source tree

+ +
 
git clone git://source.ffmpeg.org/ffmpeg <target>
+
+ +

This will put the FFmpeg sources into the directory <target>. +

+
 
git clone git@source.ffmpeg.org:ffmpeg <target>
+
+ +

This will put the FFmpeg sources into the directory <target> and let +you push back your changes to the remote repository. +

+ + +

2.3 Updating the source tree to the latest revision

+ +
 
git pull (--rebase)
+
+ +

pulls in the latest changes from the tracked branch. The tracked branch +can be remote. By default the master branch tracks the branch master in +the remote origin. +

+
+

--rebase (see below) is recommended. +

+ +

2.4 Rebasing your local branches

+ +
 
git pull --rebase
+
+ +

fetches the changes from the main repository and replays your local commits +over it. This is required to keep all your local changes at the top of +FFmpeg’s master tree. The master tree will reject pushes with merge commits. +

+ + +

2.5 Adding/removing files/directories

+ +
 
git add [-A] <filename/dirname>
+git rm [-r] <filename/dirname>
+
+ +

GIT needs to get notified of all changes you make to your working +directory that makes files appear or disappear. +Line moves across files are automatically tracked. +

+ + +

2.6 Showing modifications

+ +
 
git diff <filename(s)>
+
+ +

will show all local modifications in your working directory as unified diff. +

+ + +

2.7 Inspecting the changelog

+ +
 
git log <filename(s)>
+
+ +

You may also use the graphical tools like gitview or gitk or the web +interface available at http://source.ffmpeg.org/ +

+ +

2.8 Checking source tree status

+ +
 
git status
+
+ +

detects all the changes you made and lists what actions will be taken in case +of a commit (additions, modifications, deletions, etc.). +

+ + +

2.9 Committing

+ +
 
git diff --check
+
+ +

to double check your changes before committing them to avoid trouble later +on. All experienced developers do this on each and every commit, no matter +how small. +Every one of them has been saved from looking like a fool by this many times. +It’s very easy for stray debug output or cosmetic modifications to slip in, +please avoid problems through this extra level of scrutiny. +

+

For cosmetics-only commits you should get (almost) empty output from +

+
 
git diff -w -b <filename(s)>
+
+ +

Also check the output of +

+
 
git status
+
+ +

to make sure you don’t have untracked files or deletions. +

+
 
git add [-i|-p|-A] <filenames/dirnames>
+
+ +

Make sure you have told git your name and email address +

+
 
git config --global user.name "My Name"
+git config --global user.email my@email.invalid
+
+ +

Use –global to set the global configuration for all your git checkouts. +

+

Git will select the changes to the files for commit. Optionally you can use +the interactive or the patch mode to select hunk by hunk what should be +added to the commit. +

+ +
 
git commit
+
+ +

Git will commit the selected changes to your current local branch. +

+

You will be prompted for a log message in an editor, which is either +set in your personal configuration file through +

+
 
git config --global core.editor
+
+ +

or set by one of the following environment variables: +GIT_EDITOR, VISUAL or EDITOR. +

+

Log messages should be concise but descriptive. Explain why you made a change, +what you did will be obvious from the changes themselves most of the time. +Saying just "bug fix" or "10l" is bad. Remember that people of varying skill +levels look at and educate themselves while reading through your code. Don’t +include filenames in log messages, Git provides that information. +

+

Possibly make the commit message have a terse, descriptive first line, an +empty line and then a full description. The first line will be used to name +the patch by git format-patch. +

+ +

2.10 Preparing a patchset

+ +
 
git format-patch <commit> [-o directory]
+
+ +

will generate a set of patches for each commit between <commit> and +current HEAD. E.g. +

+
 
git format-patch origin/master
+
+ +

will generate patches for all commits on current branch which are not +present in upstream. +A useful shortcut is also +

+
 
git format-patch -n
+
+ +

which will generate patches from last n commits. +By default the patches are created in the current directory. +

+ +

2.11 Sending patches for review

+ +
 
git send-email <commit list|directory>
+
+ +

will send the patches created by git format-patch or directly +generates them. All the email fields can be configured in the global/local +configuration or overridden by command line. +Note that this tool must often be installed separately (e.g. git-email +package on Debian-based distros). +

+ + +

2.12 Renaming/moving/copying files or contents of files

+ +

Git automatically tracks such changes, making those normal commits. +

+
 
mv/cp path/file otherpath/otherfile
+git add [-A] .
+git commit
+
+ + + +

3. FFmpeg specific

+ + +

3.1 Reverting broken commits

+ +
 
git reset <commit>
+
+ +

git reset will uncommit the changes till <commit> rewriting +the current branch history. +

+
 
git commit --amend
+
+ +

allows to amend the last commit details quickly. +

+
 
git rebase -i origin/master
+
+ +

will replay local commits over the main repository allowing to edit, merge +or remove some of them in the process. +

+
+

git reset, git commit --amend and git rebase +rewrite history, so you should use them ONLY on your local or topic branches. +The main repository will reject those changes. +

+
 
git revert <commit>
+
+ +

git revert will generate a revert commit. This will not make the +faulty commit disappear from the history. +

+ +

3.2 Pushing changes to remote trees

+ +
 
git push
+
+ +

Will push the changes to the default remote (origin). +Git will prevent you from pushing changes if the local and remote trees are +out of sync. Refer to and to sync the local tree. +

+
 
git remote add <name> <url>
+
+ +

Will add additional remote with a name reference, it is useful if you want +to push your local branch for review on a remote host. +

+
 
git push <remote> <refspec>
+
+ +

Will push the changes to the <remote> repository. +Omitting <refspec> makes git push update all the remote +branches matching the local ones. +

+ +

3.3 Finding a specific svn revision

+ +

Since version 1.7.1 git supports :/foo syntax for specifying commits +based on a regular expression. see man gitrevisions +

+
 
git show :/'as revision 23456'
+
+ +

will show the svn changeset r23456. With older git versions searching in +the git log output is the easiest option (especially if a pager with +search capabilities is used). +This commit can be checked out with +

+
 
git checkout -b svn_23456 :/'as revision 23456'
+
+ +

or for git < 1.7.1 with +

+
 
git checkout -b svn_23456 $SHA1
+
+ +

where $SHA1 is the commit hash from the git log output. +

+ +

4. Server Issues

+ +

Contact the project admins root@ffmpeg.org if you have technical +problems with the GIT server. +

+

+ + +
diff --git a/extern/ffmpeg/doc/libavfilter.html b/extern/ffmpeg/doc/libavfilter.html new file mode 100644 index 0000000000..2d5a2cf7ca --- /dev/null +++ b/extern/ffmpeg/doc/libavfilter.html @@ -0,0 +1,3856 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

Libavfilter Documentation

+ + +

Table of Contents

+ + + +

1. Introduction

+ +

Libavfilter is the filtering API of FFmpeg. It is the substitute of the +now deprecated ’vhooks’ and started as a Google Summer of Code project. +

+

Audio filtering integration into the main FFmpeg repository is a work in +progress, so audio API and ABI should not be considered stable yet. +

+ +

2. Tutorial

+ +

In libavfilter, it is possible for filters to have multiple inputs and +multiple outputs. +To illustrate the sorts of things that are possible, we can +use a complex filter graph. For example, the following one: +

+
 
input --> split --> fifo -----------------------> overlay --> output
+            |                                        ^
+            |                                        |
+            +------> fifo --> crop --> vflip --------+
+
+ +

splits the stream in two streams, sends one stream through the crop filter +and the vflip filter before merging it back with the other stream by +overlaying it on top. You can use the following command to achieve this: +

+
 
ffmpeg -i input -vf "[in] split [T1], fifo, [T2] overlay=0:H/2 [out]; [T1] fifo, crop=iw:ih/2:0:ih/2, vflip [T2]" output
+
+ +

The result will be that in output the top half of the video is mirrored +onto the bottom half. +

+

Video filters are loaded using the -vf option passed to +ffmpeg or to ffplay. Filters in the same linear +chain are separated by commas. In our example, split, fifo, +overlay are in one linear chain, and fifo, crop, vflip are in +another. The points where the linear chains join are labeled by names +enclosed in square brackets. In our example, that is [T1] and +[T2]. The magic labels [in] and [out] are the points +where video is input and output. +

+

Some filters take in input a list of parameters: they are specified +after the filter name and an equal sign, and are separated each other +by a semicolon. +

+

There exist so-called source filters that do not have a video +input, and we expect in the future some sink filters that will +not have video output. +

+ +

3. graph2dot

+ +

The ‘graph2dot’ program included in the FFmpeg ‘tools’ +directory can be used to parse a filter graph description and issue a +corresponding textual representation in the dot language. +

+

Invoke the command: +

 
graph2dot -h
+
+ +

to see how to use ‘graph2dot’. +

+

You can then pass the dot description to the ‘dot’ program (from +the graphviz suite of programs) and obtain a graphical representation +of the filter graph. +

+

For example the sequence of commands: +

 
echo GRAPH_DESCRIPTION | \
+tools/graph2dot -o graph.tmp && \
+dot -Tpng graph.tmp -o graph.png && \
+display graph.png
+
+ +

can be used to create and display an image representing the graph +described by the GRAPH_DESCRIPTION string. +

+ +

4. Filtergraph description

+ +

A filtergraph is a directed graph of connected filters. It can contain +cycles, and there can be multiple links between a pair of +filters. Each link has one input pad on one side connecting it to one +filter from which it takes its input, and one output pad on the other +side connecting it to the one filter accepting its output. +

+

Each filter in a filtergraph is an instance of a filter class +registered in the application, which defines the features and the +number of input and output pads of the filter. +

+

A filter with no input pads is called a "source", a filter with no +output pads is called a "sink". +

+ +

4.1 Filtergraph syntax

+ +

A filtergraph can be represented using a textual representation, which +is recognized by the -vf option of the ff* +tools, and by the avfilter_graph_parse() function defined in +‘libavfilter/avfiltergraph.h’. +

+

A filterchain consists of a sequence of connected filters, each one +connected to the previous one in the sequence. A filterchain is +represented by a list of ","-separated filter descriptions. +

+

A filtergraph consists of a sequence of filterchains. A sequence of +filterchains is represented by a list of ";"-separated filterchain +descriptions. +

+

A filter is represented by a string of the form: +[in_link_1]...[in_link_N]filter_name=arguments[out_link_1]...[out_link_M] +

+

filter_name is the name of the filter class of which the +described filter is an instance of, and has to be the name of one of +the filter classes registered in the program. +The name of the filter class is optionally followed by a string +"=arguments". +

+

arguments is a string which contains the parameters used to +initialize the filter instance, and are described in the filter +descriptions below. +

+

The list of arguments can be quoted using the character "’" as initial +and ending mark, and the character ’\’ for escaping the characters +within the quoted text; otherwise the argument string is considered +terminated when the next special character (belonging to the set +"[]=;,") is encountered. +

+

The name and arguments of the filter are optionally preceded and +followed by a list of link labels. +A link label allows to name a link and associate it to a filter output +or input pad. The preceding labels in_link_1 +... in_link_N, are associated to the filter input pads, +the following labels out_link_1 ... out_link_M, are +associated to the output pads. +

+

When two link labels with the same name are found in the +filtergraph, a link between the corresponding input and output pad is +created. +

+

If an output pad is not labelled, it is linked by default to the first +unlabelled input pad of the next filter in the filterchain. +For example in the filterchain: +

 
nullsrc, split[L1], [L2]overlay, nullsink
+
+

the split filter instance has two output pads, and the overlay filter +instance two input pads. The first output pad of split is labelled +"L1", the first input pad of overlay is labelled "L2", and the second +output pad of split is linked to the second input pad of overlay, +which are both unlabelled. +

+

In a complete filterchain all the unlabelled filter input and output +pads must be connected. A filtergraph is considered valid if all the +filter input and output pads of all the filterchains are connected. +

+

Follows a BNF description for the filtergraph syntax: +

 
NAME             ::= sequence of alphanumeric characters and '_'
+LINKLABEL        ::= "[" NAME "]"
+LINKLABELS       ::= LINKLABEL [LINKLABELS]
+FILTER_ARGUMENTS ::= sequence of chars (eventually quoted)
+FILTER           ::= [LINKNAMES] NAME ["=" ARGUMENTS] [LINKNAMES]
+FILTERCHAIN      ::= FILTER [,FILTERCHAIN]
+FILTERGRAPH      ::= FILTERCHAIN [;FILTERGRAPH]
+
+ + + +

5. Audio Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the audio filters included in your +build. +

+

Below is a description of the currently available audio filters. +

+ +

5.1 aconvert

+ +

Convert the input audio format to the specified formats. +

+

The filter accepts a string of the form: +"sample_format:channel_layout:packing_format". +

+

sample_format specifies the sample format, and can be a string or +the corresponding numeric value defined in ‘libavutil/samplefmt.h’. +

+

channel_layout specifies the channel layout, and can be a string +or the corresponding number value defined in ‘libavutil/audioconvert.h’. +

+

packing_format specifies the type of packing in output, can be one +of "planar" or "packed", or the corresponding numeric values "0" or "1". +

+

The special parameter "auto", signifies that the filter will +automatically select the output format depending on the output filter. +

+

Some examples follow. +

+ + + +

5.2 aformat

+ +

Convert the input audio to one of the specified formats. The framework will +negotiate the most appropriate format to minimize conversions. +

+

The filter accepts three lists of formats, separated by ":", in the form: +"sample_formats:channel_layouts:packing_formats". +

+

Elements in each list are separated by "," which has to be escaped in the +filtergraph specification. +

+

The special parameter "all", in place of a list of elements, signifies all +supported formats. +

+

Some examples follow: +

 
aformat=u8\\,s16:mono:packed
+
+aformat=s16:mono\\,stereo:all
+
+ + +

5.3 amerge

+ +

Merge two audio streams into a single multi-channel stream. +

+

This filter does not need any argument. +

+

If the channel layouts of the inputs are disjoint, and therefore compatible, +the channel layout of the output will be set accordingly and the channels +will be reordered as necessary. If the channel layouts of the inputs are not +disjoint, the output will have all the channels of the first input then all +the channels of the second input, in that order, and the channel layout of +the output will be the default value corresponding to the total number of +channels. +

+

For example, if the first input is in 2.1 (FL+FR+LF) and the second input +is FC+BL+BR, then the output will be in 5.1, with the channels in the +following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the +first input, b1 is the first channel of the second input). +

+

On the other hand, if both input are in stereo, the output channels will be +in the default order: a1, a2, b1, b2, and the channel layout will be +arbitrarily set to 4.0, which may or may not be the expected value. +

+

Both inputs must have the same sample rate, format and packing. +

+

If inputs do not have the same duration, the output will stop with the +shortest. +

+

Example: merge two mono files into a stereo stream: +

 
amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
+
+ + +

5.4 anull

+ +

Pass the audio source unchanged to the output. +

+ +

5.5 aresample

+ +

Resample the input audio to the specified sample rate. +

+

The filter accepts exactly one parameter, the output sample rate. If not +specified then the filter will automatically convert between its input +and output sample rates. +

+

For example, to resample the input audio to 44100Hz: +

 
aresample=44100
+
+ + +

5.6 ashowinfo

+ +

Show a line containing various information for each input audio frame. +The input audio is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad, and +is usually 1/sample_rate. +

+
+
pts_time
+

presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic audio) +

+
+
fmt
+

sample format name +

+
+
chlayout
+

channel layout description +

+
+
nb_samples
+

number of samples (per each channel) contained in the filtered frame +

+
+
rate
+

sample rate for the audio frame +

+
+
planar
+

if the packing format is planar, 0 if packed +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) for each input frame plane, +expressed in the form "[c0 c1 c2 c3 c4 c5 +c6 c7]" +

+
+ + +

5.7 asplit

+ +

Pass on the input audio to two outputs. Both outputs are identical to +the input audio. +

+

For example: +

 
[in] asplit[out0], showaudio[out1]
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

5.8 astreamsync

+ +

Forward two audio streams and control the order the buffers are forwarded. +

+

The argument to the filter is an expression deciding which stream should be +forwarded next: if the result is negative, the first stream is forwarded; if +the result is positive or zero, the second stream is forwarded. It can use +the following variables: +

+
+
b1 b2
+

number of buffers forwarded so far on each stream +

+
s1 s2
+

number of samples forwarded so far on each stream +

+
t1 t2
+

current timestamp of each stream +

+
+ +

The default value is t1-t2, which means to always forward the stream +that has a smaller timestamp. +

+

Example: stress-test amerge by randomly sending buffers on the wrong +input, while avoiding too much of a desynchronization: +

 
amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
+[a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
+[a2] [b2] amerge
+
+ + +

5.9 earwax

+ +

Make audio easier to listen to on headphones. +

+

This filter adds ‘cues’ to 44.1kHz stereo (i.e. audio CD format) audio +so that when listened to on headphones the stereo image is moved from +inside your head (standard for headphones) to outside and in front of +the listener (standard for speakers). +

+

Ported from SoX. +

+ +

5.10 pan

+ +

Mix channels with specific gain levels. The filter accepts the output +channel layout followed by a set of channels definitions. +

+

This filter is also designed to remap efficiently the channels of an audio +stream. +

+

The filter accepts parameters of the form: +"l:outdef:outdef:..." +

+
+
l
+

output channel layout or number of channels +

+
+
outdef
+

output channel specification, of the form: +"out_name=[gain*]in_name[+[gain*]in_name...]" +

+
+
out_name
+

output channel to define, either a channel name (FL, FR, etc.) or a channel +number (c0, c1, etc.) +

+
+
gain
+

multiplicative coefficient for the channel, 1 leaving the volume unchanged +

+
+
in_name
+

input channel to use, see out_name for details; it is not possible to mix +named and numbered input channels +

+
+ +

If the ‘=’ in a channel specification is replaced by ‘<’, then the gains for +that specification will be renormalized so that the total is 1, thus +avoiding clipping noise. +

+ +

5.10.1 Mixing examples

+ +

For example, if you want to down-mix from stereo to mono, but with a bigger +factor for the left channel: +

 
pan=1:c0=0.9*c0+0.1*c1
+
+ +

A customized down-mix to stereo that works automatically for 3-, 4-, 5- and +7-channels surround: +

 
pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
+
+ +

Note that ffmpeg integrates a default down-mix (and up-mix) system +that should be preferred (see "-ac" option) unless you have very specific +needs. +

+ +

5.10.2 Remapping examples

+ +

The channel remapping will be effective if, and only if: +

+ + +

If all these conditions are satisfied, the filter will notify the user ("Pure +channel mapping detected"), and use an optimized and lossless method to do the +remapping. +

+

For example, if you have a 5.1 source and want a stereo audio stream by +dropping the extra channels: +

 
pan="stereo: c0=FL : c1=FR"
+
+ +

Given the same source, you can also switch front left and front right channels +and keep the input channel layout: +

 
pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
+
+ +

If the input is a stereo audio stream, you can mute the front left channel (and +still keep the stereo channel layout) with: +

 
pan="stereo:c1=c1"
+
+ +

Still with a stereo audio stream input, you can copy the right channel in both +front left and right: +

 
pan="stereo: c0=FR : c1=FR"
+
+ + +

5.11 silencedetect

+ +

Detect silence in an audio stream. +

+

This filter logs a message when it detects that the input audio volume is less +or equal to a noise tolerance value for a duration greater or equal to the +minimum detected noise duration. +

+

The printed times and duration are expressed in seconds. +

+
+
duration, d
+

Set silence duration until notification (default is 2 seconds). +

+
+
noise, n
+

Set noise tolerance. Can be specified in dB (in case "dB" is appended to the +specified value) or amplitude ratio. Default is -60dB, or 0.001. +

+
+ +

Detect 5 seconds of silence with -50dB noise tolerance: +

 
silencedetect=n=-50dB:d=5
+
+ +

Complete example with ffmpeg to detect silence with 0.0001 noise +tolerance in ‘silence.mp3’: +

 
ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
+
+ + +

5.12 volume

+ +

Adjust the input audio volume. +

+

The filter accepts exactly one parameter vol, which expresses +how the audio volume will be increased or decreased. +

+

Output values are clipped to the maximum value. +

+

If vol is expressed as a decimal number, the output audio +volume is given by the relation: +

 
output_volume = vol * input_volume
+
+ +

If vol is expressed as a decimal number followed by the string +"dB", the value represents the requested change in decibels of the +input audio power, and the output audio volume is given by the +relation: +

 
output_volume = 10^(vol/20) * input_volume
+
+ +

Otherwise vol is considered an expression and its evaluated +value is used for computing the output audio volume according to the +first relation. +

+

Default value for vol is 1.0. +

+ +

5.12.1 Examples

+ + + + + +

6. Audio Sources

+ +

Below is a description of the currently available audio sources. +

+ +

6.1 abuffer

+ +

Buffer audio frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/asrc_abuffer.h’. +

+

It accepts the following mandatory parameters: +sample_rate:sample_fmt:channel_layout:packing +

+
+
sample_rate
+

The sample rate of the incoming audio buffers. +

+
+
sample_fmt
+

The sample format of the incoming audio buffers. +Either a sample format name or its corresponging integer representation from +the enum AVSampleFormat in ‘libavutil/samplefmt.h’ +

+
+
channel_layout
+

The channel layout of the incoming audio buffers. +Either a channel layout name from channel_layout_map in +‘libavutil/audioconvert.c’ or its corresponding integer representation +from the AV_CH_LAYOUT_* macros in ‘libavutil/audioconvert.h’ +

+
+
packing
+

Either "packed" or "planar", or their integer representation: 0 or 1 +respectively. +

+
+
+ +

For example: +

 
abuffer=44100:s16:stereo:planar
+
+ +

will instruct the source to accept planar 16bit signed stereo at 44100Hz. +Since the sample format with name "s16" corresponds to the number +1 and the "stereo" channel layout corresponds to the value 3, this is +equivalent to: +

 
abuffer=44100:1:3:1
+
+ + +

6.2 aevalsrc

+ +

Generate an audio signal specified by an expression. +

+

This source accepts in input one or more expressions (one for each +channel), which are evaluated and used to generate a corresponding +audio signal. +

+

It accepts the syntax: exprs[::options]. +exprs is a list of expressions separated by ":", one for each +separate channel. The output channel layout depends on the number of +provided expressions, up to 8 channels are supported. +

+

options is an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
duration, d
+

Set the minimum duration of the sourced audio. See the function +av_parse_time() for the accepted format. +Note that the resulting duration may be greater than the specified +duration, as the generated audio is always cut at the end of a +complete frame. +

+

If not specified, or the expressed duration is negative, the audio is +supposed to be generated forever. +

+
+
nb_samples, n
+

Set the number of samples per channel per each output frame, +default to 1024. +

+
+
sample_rate, s
+

Specify the sample rate, default to 44100. +

+
+ +

Each expression in exprs can contain the following constants: +

+
+
n
+

number of the evaluated sample, starting from 0 +

+
+
t
+

time of the evaluated sample expressed in seconds, starting from 0 +

+
+
s
+

sample rate +

+
+
+ + +

6.2.1 Examples

+ + + + +

6.3 amovie

+ +

Read an audio stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specify the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specify the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specify the index of the audio stream to read. If the value is -1, +the best suited audio stream will be automatically selected. Default +value is "-1". +

+
+
+ + +

6.4 anullsrc

+ +

Null audio source, return unprocessed audio frames. It is mainly useful +as a template and to be employed in analysis / debugging tools, or as +the source for filters which ignore the input data (for example the sox +synth filter). +

+

It accepts an optional sequence of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
sample_rate, s
+

Specify the sample rate, and defaults to 44100. +

+
+
channel_layout, cl
+
+

Specify the channel layout, and can be either an integer or a string +representing a channel layout. The default value of channel_layout +is "stereo". +

+

Check the channel_layout_map definition in +‘libavcodec/audioconvert.c’ for the mapping between strings and +channel layout values. +

+
+
nb_samples, n
+

Set the number of samples per requested frames. +

+
+
+ +

Follow some examples: +

 
#  set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
+anullsrc=r=48000:cl=4
+
+# same as
+anullsrc=r=48000:cl=mono
+
+ + + +

7. Audio Sinks

+ +

Below is a description of the currently available audio sinks. +

+ +

7.1 abuffersink

+ +

Buffer audio frames, and make them available to the end of filter chain. +

+

This sink is mainly intended for programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It requires a pointer to an AVABufferSinkContext structure, which +defines the incoming buffers’ formats, to be passed as the opaque +parameter to avfilter_init_filter for initialization. +

+ +

7.2 anullsink

+ +

Null audio sink, do absolutely nothing with the input audio. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + +

8. Video Filters

+ +

When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the video filters included in your +build. +

+

Below is a description of the currently available video filters. +

+ +

8.1 ass

+ +

Draw ASS (Advanced Substation Alpha) subtitles on top of input video +using the libass library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libass. +

+

This filter accepts in input the name of the ass file to render. +

+

For example, to render the file ‘sub.ass’ on top of the input +video, use the command: +

 
ass=sub.ass
+
+ + +

8.2 blackframe

+ +

Detect frames that are (almost) completely black. Can be useful to +detect chapter transitions or commercials. Output lines consist of +the frame number of the detected frame, the percentage of blackness, +the position in the file if known or -1 and the timestamp in seconds. +

+

In order to display the output lines, you need to set the loglevel at +least to the AV_LOG_INFO value. +

+

The filter accepts the syntax: +

 
blackframe[=amount:[threshold]]
+
+ +

amount is the percentage of the pixels that have to be below the +threshold, and defaults to 98. +

+

threshold is the threshold below which a pixel value is +considered black, and defaults to 32. +

+ +

8.3 boxblur

+ +

Apply boxblur algorithm to the input video. +

+

This filter accepts the parameters: +luma_radius:luma_power:chroma_radius:chroma_power:alpha_radius:alpha_power +

+

Chroma and alpha parameters are optional, if not specified they default +to the corresponding values set for luma_radius and +luma_power. +

+

luma_radius, chroma_radius, and alpha_radius represent +the radius in pixels of the box used for blurring the corresponding +input plane. They are expressions, and can contain the following +constants: +

+
w, h
+

the input width and height in pixels +

+
+
cw, ch
+

the input chroma image width and height in pixels +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

The radius must be a non-negative number, and must not be greater than +the value of the expression min(w,h)/2 for the luma and alpha planes, +and of min(cw,ch)/2 for the chroma planes. +

+

luma_power, chroma_power, and alpha_power represent +how many times the boxblur filter is applied to the corresponding +plane. +

+

Some examples follow: +

+ + + +

8.4 copy

+ +

Copy the input source unchanged to the output. Mainly useful for +testing purposes. +

+ +

8.5 crop

+ +

Crop the input video to out_w:out_h:x:y. +

+

The parameters are expressions containing the following constants: +

+
+
x, y
+

the computed values for x and y. They are evaluated for +each new frame. +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
pos
+

the position in the file of the input frame, NAN if unknown +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
+ +

The out_w and out_h parameters specify the expressions for +the width and height of the output (cropped) video. They are +evaluated just at the configuration of the filter. +

+

The default value of out_w is "in_w", and the default value of +out_h is "in_h". +

+

The expression for out_w may depend on the value of out_h, +and the expression for out_h may depend on out_w, but they +cannot depend on x and y, as x and y are +evaluated after out_w and out_h. +

+

The x and y parameters specify the expressions for the +position of the top-left corner of the output (non-cropped) area. They +are evaluated for each frame. If the evaluated value is not valid, it +is approximated to the nearest valid value. +

+

The default value of x is "(in_w-out_w)/2", and the default +value for y is "(in_h-out_h)/2", which set the cropped area at +the center of the input image. +

+

The expression for x may depend on y, and the expression +for y may depend on x. +

+

Follow some examples: +

 
# crop the central input area with size 100x100
+crop=100:100
+
+# crop the central input area with size 2/3 of the input video
+"crop=2/3*in_w:2/3*in_h"
+
+# crop the input video central square
+crop=in_h
+
+# delimit the rectangle with the top-left corner placed at position
+# 100:100 and the right-bottom corner corresponding to the right-bottom
+# corner of the input image.
+crop=in_w-100:in_h-100:100:100
+
+# crop 10 pixels from the left and right borders, and 20 pixels from
+# the top and bottom borders
+"crop=in_w-2*10:in_h-2*20"
+
+# keep only the bottom right quarter of the input image
+"crop=in_w/2:in_h/2:in_w/2:in_h/2"
+
+# crop height for getting Greek harmony
+"crop=in_w:1/PHI*in_w"
+
+# trembling effect
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
+
+# erratic camera effect depending on timestamp
+"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
+
+# set x depending on the value of y
+"crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
+
+ + +

8.6 cropdetect

+ +

Auto-detect crop size. +

+

Calculate necessary cropping parameters and prints the recommended +parameters through the logging system. The detected dimensions +correspond to the non-black area of the input video. +

+

It accepts the syntax: +

 
cropdetect[=limit[:round[:reset]]]
+
+ +
+
limit
+

Threshold, which can be optionally specified from nothing (0) to +everything (255), defaults to 24. +

+
+
round
+

Value which the width/height should be divisible by, defaults to +16. The offset is automatically adjusted to center the video. Use 2 to +get only even dimensions (needed for 4:2:2 video). 16 is best when +encoding to most video codecs. +

+
+
reset
+

Counter that determines after how many frames cropdetect will reset +the previously detected largest video area and start over to detect +the current optimal crop area. Defaults to 0. +

+

This can be useful when channel logos distort the video area. 0 +indicates never reset and return the largest area encountered during +playback. +

+
+ + +

8.7 delogo

+ +

Suppress a TV station logo by a simple interpolation of the surrounding +pixels. Just set a rectangle covering the logo and watch it disappear +(and sometimes something even uglier appear - your mileage may vary). +

+

The filter accepts parameters as a string of the form +"x:y:w:h:band", or as a list of +key=value pairs, separated by ":". +

+

The description of the accepted parameters follows. +

+
+
x, y
+

Specify the top left corner coordinates of the logo. They must be +specified. +

+
+
w, h
+

Specify the width and height of the logo to clear. They must be +specified. +

+
+
band, t
+

Specify the thickness of the fuzzy edge of the rectangle (added to +w and h). The default value is 4. +

+
+
show
+

When set to 1, a green rectangle is drawn on the screen to simplify +finding the right x, y, w, h parameters, and +band is set to 4. The default value is 0. +

+
+
+ +

Some examples follow. +

+ + + +

8.8 deshake

+ +

Attempt to fix small changes in horizontal and/or vertical shift. This +filter helps remove camera shake from hand-holding a camera, bumping a +tripod, moving on a vehicle, etc. +

+

The filter accepts parameters as a string of the form +"x:y:w:h:rx:ry:edge:blocksize:contrast:search:filename" +

+

A description of the accepted parameters follows. +

+
+
x, y, w, h
+

Specify a rectangular area where to limit the search for motion +vectors. +If desired the search for motion vectors can be limited to a +rectangular area of the frame defined by its top left corner, width +and height. These parameters have the same meaning as the drawbox +filter which can be used to visualise the position of the bounding +box. +

+

This is useful when simultaneous movement of subjects within the frame +might be confused for camera motion by the motion vector search. +

+

If any or all of x, y, w and h are set to -1 +then the full frame is used. This allows later options to be set +without specifying the bounding box for the motion vector search. +

+

Default - search the whole frame. +

+
+
rx, ry
+

Specify the maximum extent of movement in x and y directions in the +range 0-64 pixels. Default 16. +

+
+
edge
+

Specify how to generate pixels to fill blanks at the edge of the +frame. An integer from 0 to 3 as follows: +

+
0
+

Fill zeroes at blank locations +

+
1
+

Original image at blank locations +

+
2
+

Extruded edge value at blank locations +

+
3
+

Mirrored edge at blank locations +

+
+ +

The default setting is mirror edge at blank locations. +

+
+
blocksize
+

Specify the blocksize to use for motion search. Range 4-128 pixels, +default 8. +

+
+
contrast
+

Specify the contrast threshold for blocks. Only blocks with more than +the specified contrast (difference between darkest and lightest +pixels) will be considered. Range 1-255, default 125. +

+
+
search
+

Specify the search strategy 0 = exhaustive search, 1 = less exhaustive +search. Default - exhaustive search. +

+
+
filename
+

If set then a detailed log of the motion search is written to the +specified file. +

+
+
+ + +

8.9 drawbox

+ +

Draw a colored box on the input image. +

+

It accepts the syntax: +

 
drawbox=x:y:width:height:color
+
+ +
+
x, y
+

Specify the top left corner coordinates of the box. Default to 0. +

+
+
width, height
+

Specify the width and height of the box, if 0 they are interpreted as +the input width and height. Default to 0. +

+
+
color
+

Specify the color of the box to write, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+
+ +

Follow some examples: +

 
# draw a black box around the edge of the input image
+drawbox
+
+# draw a box with color red and an opacity of 50%
+drawbox=10:20:200:60:red@0.5"
+
+ + +

8.10 drawtext

+ +

Draw text string or text from specified file on top of video using the +libfreetype library. +

+

To enable compilation of this filter you need to configure FFmpeg with +--enable-libfreetype. +

+

The filter also recognizes strftime() sequences in the provided text +and expands them accordingly. Check the documentation of strftime(). +

+

The filter accepts parameters as a list of key=value pairs, +separated by ":". +

+

The description of the accepted parameters follows. +

+
+
fontfile
+

The font file to be used for drawing text. Path must be included. +This parameter is mandatory. +

+
+
text
+

The text string to be drawn. The text must be a sequence of UTF-8 +encoded characters. +This parameter is mandatory if no file is specified with the parameter +textfile. +

+
+
textfile
+

A text file containing text to be drawn. The text must be a sequence +of UTF-8 encoded characters. +

+

This parameter is mandatory if no text string is specified with the +parameter text. +

+

If both text and textfile are specified, an error is thrown. +

+
+
x, y
+

The expressions which specify the offsets where text will be drawn +within the video frame. They are relative to the top/left border of the +output image. +

+

The default value of x and y is "0". +

+

See below for the list of accepted constants. +

+
+
fontsize
+

The font size to be used for drawing text. +The default value of fontsize is 16. +

+
+
fontcolor
+

The color to be used for drawing fonts. +Either a string (e.g. "red") or in 0xRRGGBB[AA] format +(e.g. "0xff000033"), possibly followed by an alpha specifier. +The default value of fontcolor is "black". +

+
+
boxcolor
+

The color to be used for drawing box around text. +Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format +(e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of boxcolor is "white". +

+
+
box
+

Used to draw a box around text using background color. +Value should be either 1 (enable) or 0 (disable). +The default value of box is 0. +

+
+
shadowx, shadowy
+

The x and y offsets for the text shadow position with respect to the +position of the text. They can be either positive or negative +values. Default value for both is "0". +

+
+
shadowcolor
+

The color to be used for drawing a shadow behind the drawn text. It +can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA] +form (e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of shadowcolor is "black". +

+
+
ft_load_flags
+

Flags to be used for loading the fonts. +

+

The flags map the corresponding flags supported by libfreetype, and are +a combination of the following values: +

+
default
+
no_scale
+
no_hinting
+
render
+
no_bitmap
+
vertical_layout
+
force_autohint
+
crop_bitmap
+
pedantic
+
ignore_global_advance_width
+
no_recurse
+
ignore_transform
+
monochrome
+
linear_design
+
no_autohint
+
end table
+
+ +

Default value is "render". +

+

For more information consult the documentation for the FT_LOAD_* +libfreetype flags. +

+
+
tabsize
+

The size in number of spaces to use for rendering the tab. +Default value is 4. +

+
+ +

The parameters for x and y are expressions containing the +following constants: +

+
+
W, H
+

the input width and height +

+
+
tw, text_w
+

the width of the rendered text +

+
+
th, text_h
+

the height of the rendered text +

+
+
lh, line_h
+

the height of each text line +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (w / h) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+
max_glyph_w
+

maximum glyph width, that is the maximum width for all the glyphs +contained in the rendered text +

+
+
max_glyph_h
+

maximum glyph height, that is the maximum height for all the glyphs +contained in the rendered text, it is equivalent to ascent - +descent. +

+
+
max_glyph_a, ascent
+
+

the maximum distance from the baseline to the highest/upper grid +coordinate used to place a glyph outline point, for all the rendered +glyphs. +It is a positive value, due to the grid’s orientation with the Y axis +upwards. +

+
+
max_glyph_d, descent
+

the maximum distance from the baseline to the lowest grid coordinate +used to place a glyph outline point, for all the rendered glyphs. +This is a negative value, due to the grid’s orientation, with the Y axis +upwards. +

+
+
n
+

the number of input frame, starting from 0 +

+
+
t
+

timestamp expressed in seconds, NAN if the input timestamp is unknown +

+
+
timecode
+

initial timecode representation in "hh:mm:ss[:;.]ff" format. It can be used +with or without text parameter. rate option must be specified. +Note that timecode options are not effective if FFmpeg is build with +--disable-avcodec. +

+
+
r, rate
+

frame rate (timecode only) +

+
+ +

Some examples follow. +

+ + +

For more information about libfreetype, check: +http://www.freetype.org/. +

+ +

8.11 fade

+ +

Apply fade-in/out effect to input video. +

+

It accepts the parameters: +type:start_frame:nb_frames[:options] +

+

type specifies if the effect type, can be either "in" for +fade-in, or "out" for a fade-out effect. +

+

start_frame specifies the number of the start frame for starting +to apply the fade effect. +

+

nb_frames specifies the number of frames for which the fade +effect has to last. At the end of the fade-in effect the output video +will have the same intensity as the input video, at the end of the +fade-out transition the output video will be completely black. +

+

options is an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
type, t
+

See type. +

+
+
start_frame, s
+

See start_frame. +

+
+
nb_frames, n
+

See nb_frames. +

+
+
alpha
+

If set to 1, fade only alpha channel, if one exists on the input. +Default value is 0. +

+
+ +

A few usage examples follow, usable too as test scenarios. +

 
# fade in first 30 frames of video
+fade=in:0:30
+
+# fade out last 45 frames of a 200-frame video
+fade=out:155:45
+
+# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
+fade=in:0:25, fade=out:975:25
+
+# make first 5 frames black, then fade in from frame 5-24
+fade=in:5:20
+
+# fade in alpha over first 25 frames of video
+fade=in:0:25:alpha=1
+
+ + +

8.12 fieldorder

+ +

Transform the field order of the input video. +

+

It accepts one parameter which specifies the required field order that +the input interlaced video will be transformed to. The parameter can +assume one of the following values: +

+
+
0 or bff
+

output bottom field first +

+
1 or tff
+

output top field first +

+
+ +

Default value is "tff". +

+

Transformation is achieved by shifting the picture content up or down +by one line, and filling the remaining line with appropriate picture content. +This method is consistent with most broadcast field order converters. +

+

If the input video is not flagged as being interlaced, or it is already +flagged as being of the required output field order then this filter does +not alter the incoming video. +

+

This filter is very useful when converting to or from PAL DV material, +which is bottom field first. +

+

For example: +

 
ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
+
+ + +

8.13 fifo

+ +

Buffer input images and send them when they are requested. +

+

This filter is mainly useful when auto-inserted by the libavfilter +framework. +

+

The filter does not take parameters. +

+ +

8.14 format

+ +

Convert the input video to one of the specified pixel formats. +Libavfilter will try to pick one that is supported for the input to +the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# convert the input video to the format "yuv420p"
+format=yuv420p
+
+# convert the input video to any of the formats in the list
+format=yuv420p:yuv444p:yuv410p
+
+ +

+

+

8.15 frei0r

+ +

Apply a frei0r effect to the input video. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The filter supports the syntax: +

 
filter_name[{:|=}param1:param2:...:paramN]
+
+ +

filter_name is the name to the frei0r effect to load. If the +environment variable FREI0R_PATH is defined, the frei0r effect +is searched in each one of the directories specified by the colon +separated list in FREIOR_PATH, otherwise in the standard frei0r +paths, which are in this order: ‘HOME/.frei0r-1/lib/’, +‘/usr/local/lib/frei0r-1/’, ‘/usr/lib/frei0r-1/’. +

+

param1, param2, ... , paramN specify the parameters +for the frei0r effect. +

+

A frei0r effect parameter can be a boolean (whose values are specified +with "y" and "n"), a double, a color (specified by the syntax +R/G/B, R, G, and B being float +numbers from 0.0 to 1.0) or by an av_parse_color() color +description), a position (specified by the syntax X/Y, +X and Y being float numbers) and a string. +

+

The number and kind of parameters depend on the loaded effect. If an +effect parameter is not specified the default value is set. +

+

Some examples follow: +

 
# apply the distort0r effect, set the first two double parameters
+frei0r=distort0r:0.5:0.01
+
+# apply the colordistance effect, takes a color as first parameter
+frei0r=colordistance:0.2/0.3/0.4
+frei0r=colordistance:violet
+frei0r=colordistance:0x112233
+
+# apply the perspective effect, specify the top left and top right
+# image positions
+frei0r=perspective:0.2/0.2:0.8/0.2
+
+ +

For more information see: +http://piksel.org/frei0r +

+ +

8.16 gradfun

+ +

Fix the banding artifacts that are sometimes introduced into nearly flat +regions by truncation to 8bit color depth. +Interpolate the gradients that should go where the bands are, and +dither them. +

+

This filter is designed for playback only. Do not use it prior to +lossy compression, because compression tends to lose the dither and +bring back the bands. +

+

The filter takes two optional parameters, separated by ’:’: +strength:radius +

+

strength is the maximum amount by which the filter will change +any one pixel. Also the threshold for detecting nearly flat +regions. Acceptable values range from .51 to 255, default value is +1.2, out-of-range values will be clipped to the valid range. +

+

radius is the neighborhood to fit the gradient to. A larger +radius makes for smoother gradients, but also prevents the filter from +modifying the pixels near detailed regions. Acceptable values are +8-32, default value is 16, out-of-range values will be clipped to the +valid range. +

+
 
# default parameters
+gradfun=1.2:16
+
+# omitting radius
+gradfun=1.2
+
+ + +

8.17 hflip

+ +

Flip the input video horizontally. +

+

For example to horizontally flip the input video with ffmpeg: +

 
ffmpeg -i in.avi -vf "hflip" out.avi
+
+ + +

8.18 hqdn3d

+ +

High precision/quality 3d denoise filter. This filter aims to reduce +image noise producing smooth images and making still images really +still. It should enhance compressibility. +

+

It accepts the following optional parameters: +luma_spatial:chroma_spatial:luma_tmp:chroma_tmp +

+
+
luma_spatial
+

a non-negative float number which specifies spatial luma strength, +defaults to 4.0 +

+
+
chroma_spatial
+

a non-negative float number which specifies spatial chroma strength, +defaults to 3.0*luma_spatial/4.0 +

+
+
luma_tmp
+

a float number which specifies luma temporal strength, defaults to +6.0*luma_spatial/4.0 +

+
+
chroma_tmp
+

a float number which specifies chroma temporal strength, defaults to +luma_tmp*chroma_spatial/luma_spatial +

+
+ + +

8.19 lut, lutrgb, lutyuv

+ +

Compute a look-up table for binding each pixel component input value +to an output value, and apply it to input video. +

+

lutyuv applies a lookup table to a YUV input video, lutrgb +to an RGB input video. +

+

These filters accept in input a ":"-separated list of options, which +specify the expressions used for computing the lookup table for the +corresponding pixel component values. +

+

The lut filter requires either YUV or RGB pixel formats in +input, and accepts the options: +

+
c0
+

first pixel component +

+
c1
+

second pixel component +

+
c2
+

third pixel component +

+
c3
+

fourth pixel component, corresponds to the alpha component +

+
+ +

The exact component associated to each option depends on the format in +input. +

+

The lutrgb filter requires RGB pixel formats in input, and +accepts the options: +

+
r
+

red component +

+
g
+

green component +

+
b
+

blue component +

+
a
+

alpha component +

+
+ +

The lutyuv filter requires YUV pixel formats in input, and +accepts the options: +

+
y
+

Y/luminance component +

+
u
+

U/Cb component +

+
v
+

V/Cr component +

+
a
+

alpha component +

+
+ +

The expressions can contain the following constants and functions: +

+
+
w, h
+

the input width and height +

+
+
val
+

input value for the pixel component +

+
+
clipval
+

the input value clipped in the minval-maxval range +

+
+
maxval
+

maximum value for the pixel component +

+
+
minval
+

minimum value for the pixel component +

+
+
negval
+

the negated value for the pixel component value clipped in the +minval-maxval range , it corresponds to the expression +"maxval-clipval+minval" +

+
+
clip(val)
+

the computed value in val clipped in the +minval-maxval range +

+
+
gammaval(gamma)
+

the computed gamma correction value of the pixel component value +clipped in the minval-maxval range, corresponds to the +expression +"pow((clipval-minval)/(maxval-minval)\,gamma)*(maxval-minval)+minval" +

+
+
+ +

All expressions default to "val". +

+

Some examples follow: +

 
# negate input video
+lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
+lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
+
+# the above is the same as
+lutrgb="r=negval:g=negval:b=negval"
+lutyuv="y=negval:u=negval:v=negval"
+
+# negate luminance
+lutyuv=y=negval
+
+# remove chroma components, turns the video into a graytone image
+lutyuv="u=128:v=128"
+
+# apply a luma burning effect
+lutyuv="y=2*val"
+
+# remove green and blue components
+lutrgb="g=0:b=0"
+
+# set a constant alpha channel value on input
+format=rgba,lutrgb=a="maxval-minval/2"
+
+# correct luminance gamma by a 0.5 factor
+lutyuv=y=gammaval(0.5)
+
+ + +

8.20 mp

+ +

Apply an MPlayer filter to the input video. +

+

This filter provides a wrapper around most of the filters of +MPlayer/MEncoder. +

+

This wrapper is considered experimental. Some of the wrapped filters +may not work properly and we may drop support for them, as they will +be implemented natively into FFmpeg. Thus you should avoid +depending on them when writing portable scripts. +

+

The filters accepts the parameters: +filter_name[:=]filter_params +

+

filter_name is the name of a supported MPlayer filter, +filter_params is a string containing the parameters accepted by +the named filter. +

+

The list of the currently supported filters follows: +

+
2xsai
+
decimate
+
denoise3d
+
detc
+
dint
+
divtc
+
down3dright
+
dsize
+
eq2
+
eq
+
field
+
fil
+
fixpts
+
framestep
+
fspp
+
geq
+
harddup
+
hqdn3d
+
hue
+
il
+
ilpack
+
ivtc
+
kerndeint
+
mcdeint
+
mirror
+
noise
+
ow
+
palette
+
perspective
+
phase
+
pp7
+
pullup
+
qp
+
rectangle
+
remove-logo
+
rotate
+
sab
+
screenshot
+
smartblur
+
softpulldown
+
softskip
+
spp
+
swapuv
+
telecine
+
tile
+
tinterlace
+
unsharp
+
uspp
+
yuvcsp
+
yvu9
+
+ +

The parameter syntax and behavior for the listed filters are the same +of the corresponding MPlayer filters. For detailed instructions check +the "VIDEO FILTERS" section in the MPlayer manual. +

+

Some examples follow: +

 
# remove a logo by interpolating the surrounding pixels
+mp=delogo=200:200:80:20:1
+
+# adjust gamma, brightness, contrast
+mp=eq2=1.0:2:0.5
+
+# tweak hue and saturation
+mp=hue=100:-10
+
+ +

See also mplayer(1), http://www.mplayerhq.hu/. +

+ +

8.21 negate

+ +

Negate input video. +

+

This filter accepts an integer in input, if non-zero it negates the +alpha component (if available). The default value in input is 0. +

+ +

8.22 noformat

+ +

Force libavfilter not to use any of the specified pixel formats for the +input to the next filter. +

+

The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". +

+

Some examples follow: +

 
# force libavfilter to use a format different from "yuv420p" for the
+# input to the vflip filter
+noformat=yuv420p,vflip
+
+# convert the input video to any of the formats not contained in the list
+noformat=yuv420p:yuv444p:yuv410p
+
+ + +

8.23 null

+ +

Pass the video source unchanged to the output. +

+ +

8.24 ocv

+ +

Apply video transform using libopencv. +

+

To enable this filter install libopencv library and headers and +configure FFmpeg with --enable-libopencv. +

+

The filter takes the parameters: filter_name{:=}filter_params. +

+

filter_name is the name of the libopencv filter to apply. +

+

filter_params specifies the parameters to pass to the libopencv +filter. If not specified the default values are assumed. +

+

Refer to the official libopencv documentation for more precise +information: +http://opencv.willowgarage.com/documentation/c/image_filtering.html +

+

Follows the list of supported libopencv filters. +

+

+

+

8.24.1 dilate

+ +

Dilate an image by using a specific structuring element. +This filter corresponds to the libopencv function cvDilate. +

+

It accepts the parameters: struct_el:nb_iterations. +

+

struct_el represents a structuring element, and has the syntax: +colsxrows+anchor_xxanchor_y/shape +

+

cols and rows represent the number of columns and rows of +the structuring element, anchor_x and anchor_y the anchor +point, and shape the shape for the structuring element, and +can be one of the values "rect", "cross", "ellipse", "custom". +

+

If the value for shape is "custom", it must be followed by a +string of the form "=filename". The file with name +filename is assumed to represent a binary image, with each +printable character corresponding to a bright pixel. When a custom +shape is used, cols and rows are ignored, the number +or columns and rows of the read file are assumed instead. +

+

The default value for struct_el is "3x3+0x0/rect". +

+

nb_iterations specifies the number of times the transform is +applied to the image, and defaults to 1. +

+

Follow some example: +

 
# use the default values
+ocv=dilate
+
+# dilate using a structuring element with a 5x5 cross, iterate two times
+ocv=dilate=5x5+2x2/cross:2
+
+# read the shape from the file diamond.shape, iterate two times
+# the file diamond.shape may contain a pattern of characters like this:
+#   *
+#  ***
+# *****
+#  ***
+#   *
+# the specified cols and rows are ignored (but not the anchor point coordinates)
+ocv=0x0+2x2/custom=diamond.shape:2
+
+ + +

8.24.2 erode

+ +

Erode an image by using a specific structuring element. +This filter corresponds to the libopencv function cvErode. +

+

The filter accepts the parameters: struct_el:nb_iterations, +with the same syntax and semantics as the dilate filter. +

+ +

8.24.3 smooth

+ +

Smooth the input video. +

+

The filter takes the following parameters: +type:param1:param2:param3:param4. +

+

type is the type of smooth filter to apply, and can be one of +the following values: "blur", "blur_no_scale", "median", "gaussian", +"bilateral". The default value is "gaussian". +

+

param1, param2, param3, and param4 are +parameters whose meanings depend on smooth type. param1 and +param2 accept integer positive values or 0, param3 and +param4 accept float values. +

+

The default value for param1 is 3, the default value for the +other parameters is 0. +

+

These parameters correspond to the parameters assigned to the +libopencv function cvSmooth. +

+

+

+

8.25 overlay

+ +

Overlay one video on top of another. +

+

It takes two inputs and one output, the first input is the "main" +video on which the second input is overlayed. +

+

It accepts the parameters: x:y[:options]. +

+

x is the x coordinate of the overlayed video on the main video, +y is the y coordinate. x and y are expressions containing +the following parameters: +

+
+
main_w, main_h
+

main input width and height +

+
+
W, H
+

same as main_w and main_h +

+
+
overlay_w, overlay_h
+

overlay input width and height +

+
+
w, h
+

same as overlay_w and overlay_h +

+
+ +

options is an optional list of key=value pairs, +separated by ":". +

+

The description of the accepted options follows. +

+
+
rgb
+

If set to 1, force the filter to accept inputs in the RGB +color space. Default value is 0. +

+
+ +

Be aware that frames are taken from each input video in timestamp +order, hence, if their initial timestamps differ, it is a a good idea +to pass the two inputs through a setpts=PTS-STARTPTS filter to +have them begin in the same zero timestamp, as it does the example for +the movie filter. +

+

Follow some examples: +

 
# draw the overlay at 10 pixels from the bottom right
+# corner of the main video.
+overlay=main_w-overlay_w-10:main_h-overlay_h-10
+
+# insert a transparent PNG logo in the bottom left corner of the input
+movie=logo.png [logo];
+[in][logo] overlay=10:main_h-overlay_h-10 [out]
+
+# insert 2 different transparent PNG logos (second logo on bottom
+# right corner):
+movie=logo1.png [logo1];
+movie=logo2.png [logo2];
+[in][logo1]       overlay=10:H-h-10 [in+logo1];
+[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
+
+# add a transparent color layer on top of the main video,
+# WxH specifies the size of the main input to the overlay filter
+color=red.3:WxH [over]; [in][over] overlay [out]
+
+ +

You can chain together more overlays but the efficiency of such +approach is yet to be tested. +

+ +

8.26 pad

+ +

Add paddings to the input image, and places the original input at the +given coordinates x, y. +

+

It accepts the following parameters: +width:height:x:y:color. +

+

The parameters width, height, x, and y are +expressions containing the following constants: +

+
+
in_w, in_h
+

the input video width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output width and height, that is the size of the padded area as +specified by the width and height expressions +

+
+
ow, oh
+

same as out_w and out_h +

+
+
x, y
+

x and y offsets as specified by the x and y +expressions, or NAN if not yet specified +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

Follows the description of the accepted parameters. +

+
+
width, height
+
+

Specify the size of the output image with the paddings added. If the +value for width or height is 0, the corresponding input size +is used for the output. +

+

The width expression can reference the value set by the +height expression, and vice versa. +

+

The default value of width and height is 0. +

+
+
x, y
+
+

Specify the offsets where to place the input image in the padded area +with respect to the top/left border of the output image. +

+

The x expression can reference the value set by the y +expression, and vice versa. +

+

The default value of x and y is 0. +

+
+
color
+
+

Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +

+

The default value of color is "black". +

+
+
+ +

Some examples follow: +

+
 
# Add paddings with color "violet" to the input video. Output video
+# size is 640x480, the top-left corner of the input video is placed at
+# column 0, row 40.
+pad=640:480:0:40:violet
+
+# pad the input to get an output with dimensions increased bt 3/2,
+# and put the input video at the center of the padded area
+pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a squared output with size equal to the maximum
+# value between the input width and height, and put the input video at
+# the center of the padded area
+pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
+
+# pad the input to get a final w/h ratio of 16:9
+pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
+
+# for anamorphic video, in order to set the output display aspect ratio,
+# it is necessary to use sar in the expression, according to the relation:
+# (ih * X / ih) * sar = output_dar
+# X = output_dar / sar
+pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
+
+# double output size and put the input video in the bottom-right
+# corner of the output padded area
+pad="2*iw:2*ih:ow-iw:oh-ih"
+
+ + +

8.27 pixdesctest

+ +

Pixel format descriptor test filter, mainly useful for internal +testing. The output video should be equal to the input video. +

+

For example: +

 
format=monow, pixdesctest
+
+ +

can be used to test the monowhite pixel format descriptor definition. +

+ +

8.28 scale

+ +

Scale the input video to width:height[:interl={1|-1}] and/or convert the image format. +

+

The parameters width and height are expressions containing +the following constants: +

+
+
in_w, in_h
+

the input width and height +

+
+
iw, ih
+

same as in_w and in_h +

+
+
out_w, out_h
+

the output (cropped) width and height +

+
+
ow, oh
+

same as out_w and out_h +

+
+
a
+

same as iw / ih +

+
+
sar
+

input sample aspect ratio +

+
+
dar
+

input display aspect ratio, it is the same as (iw / ih) * sar +

+
+
hsub, vsub
+

horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" hsub is 2 and vsub is 1. +

+
+ +

If the input image format is different from the format requested by +the next filter, the scale filter will convert the input to the +requested format. +

+

If the value for width or height is 0, the respective input +size is used for the output. +

+

If the value for width or height is -1, the scale filter will +use, for the respective output size, a value that maintains the aspect +ratio of the input image. +

+

The default value of width and height is 0. +

+

Valid values for the optional parameter interl are: +

+
+
1
+

force interlaced aware scaling +

+
+
-1
+

select interlaced aware scaling depending on whether the source frames +are flagged as interlaced or not +

+
+ +

Some examples follow: +

 
# scale the input video to a size of 200x100.
+scale=200:100
+
+# scale the input to 2x
+scale=2*iw:2*ih
+# the above is the same as
+scale=2*in_w:2*in_h
+
+# scale the input to half size
+scale=iw/2:ih/2
+
+# increase the width, and set the height to the same size
+scale=3/2*iw:ow
+
+# seek for Greek harmony
+scale=iw:1/PHI*iw
+scale=ih*PHI:ih
+
+# increase the height, and set the width to 3/2 of the height
+scale=3/2*oh:3/5*ih
+
+# increase the size, but make the size a multiple of the chroma
+scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
+
+# increase the width to a maximum of 500 pixels, keep the same input aspect ratio
+scale='min(500\, iw*3/2):-1'
+
+ + +

8.29 select

+

Select frames to pass in output. +

+

It accepts in input an expression, which is evaluated for each input +frame. If the expression is evaluated to a non-zero value, the frame +is selected and passed to the output, otherwise it is discarded. +

+

The expression can contain the following constants: +

+
+
n
+

the sequential number of the filtered frame, starting from 0 +

+
+
selected_n
+

the sequential number of the selected frame, starting from 0 +

+
+
prev_selected_n
+

the sequential number of the last selected frame, NAN if undefined +

+
+
TB
+

timebase of the input timestamps +

+
+
pts
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in TB units, NAN if undefined +

+
+
t
+

the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in seconds, NAN if undefined +

+
+
prev_pts
+

the PTS of the previously filtered video frame, NAN if undefined +

+
+
prev_selected_pts
+

the PTS of the last previously filtered video frame, NAN if undefined +

+
+
prev_selected_t
+

the PTS of the last previously selected video frame, NAN if undefined +

+
+
start_pts
+

the PTS of the first video frame in the video, NAN if undefined +

+
+
start_t
+

the time of the first video frame in the video, NAN if undefined +

+
+
pict_type
+

the type of the filtered frame, can assume one of the following +values: +

+
I
+
P
+
B
+
S
+
SI
+
SP
+
BI
+
+ +
+
interlace_type
+

the frame interlace type, can assume one of the following values: +

+
PROGRESSIVE
+

the frame is progressive (not interlaced) +

+
TOPFIRST
+

the frame is top-field-first +

+
BOTTOMFIRST
+

the frame is bottom-field-first +

+
+ +
+
key
+

1 if the filtered frame is a key-frame, 0 otherwise +

+
+
pos
+

the position in the file of the filtered frame, -1 if the information +is not available (e.g. for synthetic video) +

+
+ +

The default value of the select expression is "1". +

+

Some examples follow: +

+
 
# select all frames in input
+select
+
+# the above is the same as:
+select=1
+
+# skip all frames:
+select=0
+
+# select only I-frames
+select='eq(pict_type\,I)'
+
+# select one frame every 100
+select='not(mod(n\,100))'
+
+# select only frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)'
+
+# select only I frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
+
+# select frames with a minimum distance of 10 seconds
+select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
+
+ +

+

+

8.30 setdar

+ +

Set the Display Aspect Ratio for the filter output video. +

+

This is done by changing the specified Sample (aka Pixel) Aspect +Ratio, according to the following equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that this filter does not modify the pixel dimensions of +the video frame. Also the display aspect ratio set by this filter may +be changed by later filters in the filterchain, e.g. in case of +scaling or if another "setdar" or a "setsar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +display aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the display aspect ratio to 16:9, specify: +

 
setdar=16:9
+# the above is equivalent to
+setdar=1.77777
+
+ +

See also the setsar filter documentation. +

+ +

8.31 setpts

+ +

Change the PTS (presentation timestamp) of the input video frames. +

+

Accept in input an expression evaluated through the eval API, which +can contain the following constants: +

+
+
PTS
+

the presentation timestamp in input +

+
+
N
+

the count of the input frame, starting from 0. +

+
+
STARTPTS
+

the PTS of the first video frame +

+
+
INTERLACED
+

tell if the current frame is interlaced +

+
+
POS
+

original position in the file of the frame, or undefined if undefined +for the current frame +

+
+
PREV_INPTS
+

previous input PTS +

+
+
PREV_OUTPTS
+

previous output PTS +

+
+
+ +

Some examples follow: +

+
 
# start counting PTS from zero
+setpts=PTS-STARTPTS
+
+# fast motion
+setpts=0.5*PTS
+
+# slow motion
+setpts=2.0*PTS
+
+# fixed rate 25 fps
+setpts=N/(25*TB)
+
+# fixed rate 25 fps with some jitter
+setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
+
+ +

+

+

8.32 setsar

+ +

Set the Sample (aka Pixel) Aspect Ratio for the filter output video. +

+

Note that as a consequence of the application of this filter, the +output display aspect ratio will change according to the following +equation: +DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR +

+

Keep in mind that the sample aspect ratio set by this filter may be +changed by later filters in the filterchain, e.g. if another "setsar" +or a "setdar" filter is applied. +

+

The filter accepts a parameter string which represents the wanted +sample aspect ratio. +The parameter can be a floating point number string, or an expression +of the form num:den, where num and den are the +numerator and denominator of the aspect ratio. +If the parameter is not specified, it is assumed the value "0:1". +

+

For example to change the sample aspect ratio to 10:11, specify: +

 
setsar=10:11
+
+ + +

8.33 settb

+ +

Set the timebase to use for the output frames timestamps. +It is mainly useful for testing timebase configuration. +

+

It accepts in input an arithmetic expression representing a rational. +The expression can contain the constants "AVTB" (the +default timebase), and "intb" (the input timebase). +

+

The default value for the input is "intb". +

+

Follow some examples. +

+
 
# set the timebase to 1/25
+settb=1/25
+
+# set the timebase to 1/10
+settb=0.1
+
+#set the timebase to 1001/1000
+settb=1+0.001
+
+#set the timebase to 2*intb
+settb=2*intb
+
+#set the default timebase value
+settb=AVTB
+
+ + +

8.34 showinfo

+ +

Show a line containing various information for each input video frame. +The input video is not modified. +

+

The shown line contains a sequence of key/value pairs of the form +key:value. +

+

A description of each shown parameter follows: +

+
+
n
+

sequential number of the input frame, starting from 0 +

+
+
pts
+

Presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad. +

+
+
pts_time
+

Presentation TimeStamp of the input frame, expressed as a number of +seconds +

+
+
pos
+

position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic video) +

+
+
fmt
+

pixel format name +

+
+
sar
+

sample aspect ratio of the input frame, expressed in the form +num/den +

+
+
s
+

size of the input frame, expressed in the form +widthxheight +

+
+
i
+

interlaced mode ("P" for "progressive", "T" for top field first, "B" +for bottom field first) +

+
+
iskey
+

1 if the frame is a key frame, 0 otherwise +

+
+
type
+

picture type of the input frame ("I" for an I-frame, "P" for a +P-frame, "B" for a B-frame, "?" for unknown type). +Check also the documentation of the AVPictureType enum and of +the av_get_picture_type_char function defined in +‘libavutil/avutil.h’. +

+
+
checksum
+

Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame +

+
+
plane_checksum
+

Adler-32 checksum (printed in hexadecimal) of each plane of the input frame, +expressed in the form "[c0 c1 c2 c3]" +

+
+ + +

8.35 slicify

+ +

Pass the images of input video on to next video filter as multiple +slices. +

+
 
ffmpeg -i in.avi -vf "slicify=32" out.avi
+
+ +

The filter accepts the slice height as parameter. If the parameter is +not specified it will use the default value of 16. +

+

Adding this in the beginning of filter chains should make filtering +faster due to better use of the memory cache. +

+ +

8.36 split

+ +

Pass on the input video to two outputs. Both outputs are identical to +the input video. +

+

For example: +

 
[in] split [splitout1][splitout2];
+[splitout1] crop=100:100:0:0    [cropout];
+[splitout2] pad=200:200:100:100 [padout];
+
+ +

will create two separate outputs from the same input, one cropped and +one padded. +

+ +

8.37 thumbnail

+

Select the most representative frame in a given sequence of consecutive frames. +

+

It accepts as argument the frames batch size to analyze (default N=100); +in a set of N frames, the filter will pick one of them, and then handle +the next batch of N frames until the end. +

+

Since the filter keeps track of the whole frames sequence, a bigger N +value will result in a higher memory usage, so a high value is not recommended. +

+

The following example extract one picture each 50 frames: +

 
thumbnail=50
+
+ +

Complete example of a thumbnail creation with ffmpeg: +

 
ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
+
+ + +

8.38 tinterlace

+ +

Perform various types of temporal field interlacing. +

+

Frames are counted starting from 1, so the first input frame is +considered odd. +

+

This filter accepts a single parameter specifying the mode. Available +modes are: +

+
+
0
+

Move odd frames into the upper field, even into the lower field, +generating a double height frame at half framerate. +

+
+
1
+

Only output even frames, odd frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
2
+

Only output odd frames, even frames are dropped, generating a frame with +unchanged height at half framerate. +

+
+
3
+

Expand each frame to full height, but pad alternate lines with black, +generating a frame with double height at the same input framerate. +

+
+
4
+

Interleave the upper field from odd frames with the lower field from +even frames, generating a frame with unchanged height at half framerate. +

+
+
5
+

Interleave the lower field from odd frames with the upper field from +even frames, generating a frame with unchanged height at half framerate. +

+
+ +

Default mode is 0. +

+ +

8.39 transpose

+ +

Transpose rows with columns in the input video and optionally flip it. +

+

It accepts a parameter representing an integer, which can assume the +values: +

+
+
0
+

Rotate by 90 degrees counterclockwise and vertically flip (default), that is: +

 
L.R     L.l
+. . ->  . .
+l.r     R.r
+
+ +
+
1
+

Rotate by 90 degrees clockwise, that is: +

 
L.R     l.L
+. . ->  . .
+l.r     r.R
+
+ +
+
2
+

Rotate by 90 degrees counterclockwise, that is: +

 
L.R     R.r
+. . ->  . .
+l.r     L.l
+
+ +
+
3
+

Rotate by 90 degrees clockwise and vertically flip, that is: +

 
L.R     r.R
+. . ->  . .
+l.r     l.L
+
+
+
+ + +

8.40 unsharp

+ +

Sharpen or blur the input video. +

+

It accepts the following parameters: +luma_msize_x:luma_msize_y:luma_amount:chroma_msize_x:chroma_msize_y:chroma_amount +

+

Negative values for the amount will blur the input video, while positive +values will sharpen. All parameters are optional and default to the +equivalent of the string ’5:5:1.0:5:5:0.0’. +

+
+
luma_msize_x
+

Set the luma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_msize_y
+

Set the luma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
luma_amount
+

Set the luma effect strength. It can be a float number between -2.0 +and 5.0, default value is 1.0. +

+
+
chroma_msize_x
+

Set the chroma matrix horizontal size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_msize_y
+

Set the chroma matrix vertical size. It can be an integer between 3 +and 13, default value is 5. +

+
+
chroma_amount
+

Set the chroma effect strength. It can be a float number between -2.0 +and 5.0, default value is 0.0. +

+
+
+ +
 
# Strong luma sharpen effect parameters
+unsharp=7:7:2.5
+
+# Strong blur of both luma and chroma parameters
+unsharp=7:7:-2:7:7:-2
+
+# Use the default values with ffmpeg
+ffmpeg -i in.avi -vf "unsharp" out.mp4
+
+ + +

8.41 vflip

+ +

Flip the input video vertically. +

+
 
ffmpeg -i in.avi -vf "vflip" out.avi
+
+ + +

8.42 yadif

+ +

Deinterlace the input video ("yadif" means "yet another deinterlacing +filter"). +

+

It accepts the optional parameters: mode:parity:auto. +

+

mode specifies the interlacing mode to adopt, accepts one of the +following values: +

+
+
0
+

output 1 frame for each frame +

+
1
+

output 1 frame for each field +

+
2
+

like 0 but skips spatial interlacing check +

+
3
+

like 1 but skips spatial interlacing check +

+
+ +

Default value is 0. +

+

parity specifies the picture field parity assumed for the input +interlaced video, accepts one of the following values: +

+
+
0
+

assume top field first +

+
1
+

assume bottom field first +

+
-1
+

enable automatic detection +

+
+ +

Default value is -1. +If interlacing is unknown or decoder does not export this information, +top field first will be assumed. +

+

auto specifies if deinterlacer should trust the interlaced flag +and only deinterlace frames marked as interlaced +

+
+
0
+

deinterlace all frames +

+
1
+

only deinterlace frames marked as interlaced +

+
+ +

Default value is 0. +

+ + +

9. Video Sources

+ +

Below is a description of the currently available video sources. +

+ +

9.1 buffer

+ +

Buffer video frames, and make them available to the filter chain. +

+

This source is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/vsrc_buffer.h’. +

+

It accepts the following parameters: +width:height:pix_fmt_string:timebase_num:timebase_den:sample_aspect_ratio_num:sample_aspect_ratio.den:scale_params +

+

All the parameters but scale_params need to be explicitly +defined. +

+

Follows the list of the accepted parameters. +

+
+
width, height
+

Specify the width and height of the buffered video frames. +

+
+
pix_fmt_string
+

A string representing the pixel format of the buffered video frames. +It may be a number corresponding to a pixel format, or a pixel format +name. +

+
+
timebase_num, timebase_den
+

Specify numerator and denomitor of the timebase assumed by the +timestamps of the buffered frames. +

+
+
sample_aspect_ratio.num, sample_aspect_ratio.den
+

Specify numerator and denominator of the sample aspect ratio assumed +by the video frames. +

+
+
scale_params
+

Specify the optional parameters to be used for the scale filter which +is automatically inserted when an input change is detected in the +input size or format. +

+
+ +

For example: +

 
buffer=320:240:yuv410p:1:24:1:1
+
+ +

will instruct the source to accept video frames with size 320x240 and +with format "yuv410p", assuming 1/24 as the timestamps timebase and +square pixels (1:1 sample aspect ratio). +Since the pixel format with name "yuv410p" corresponds to the number 6 +(check the enum PixelFormat definition in ‘libavutil/pixfmt.h’), +this example corresponds to: +

 
buffer=320:240:6:1:24:1:1
+
+ + +

9.2 cellauto

+ +

Create a pattern generated by an elementary cellular automaton. +

+

The initial state of the cellular automaton can be defined through the +‘filename’, and ‘pattern’ options. If such options are +not specified an initial state is created randomly. +

+

At each new frame a new row in the video is filled with the result of +the cellular automaton next generation. The behavior when the whole +frame is filled is defined by the ‘scroll’ option. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified file. +In the file, each non-whitespace character is considered an alive +cell, a newline will terminate the row, and further characters in the +file will be ignored. +

+
+
pattern, p
+

Read the initial cellular automaton state, i.e. the starting row, from +the specified string. +

+

Each non-whitespace character in the string is considered an alive +cell, a newline will terminate the row, and further characters in the +string will be ignored. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial cellular automaton row. It +is a floating point number value ranging from 0 to 1, defaults to +1/PHI. +

+

This option is ignored when a file or a pattern is specified. +

+
+
random_seed, seed
+

Set the seed for filling randomly the initial row, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the cellular automaton rule, it is a number ranging from 0 to 255. +Default value is 110. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ or ‘pattern’ is specified, the size is set +by default to the width of the specified initial state row, and the +height is set to width * PHI. +

+

If ‘size’ is set, it must contain the width of the specified +pattern string, and the specified pattern will be centered in the +larger row. +

+

If a filename or a pattern string is not specified, the size value +defaults to "320x518" (used for a randomly generated initial state). +

+
+
scroll
+

If set to 1, scroll the output upward when all the rows in the output +have been already filled. If set to 0, the new generated row will be +written over the top row just after the bottom row is filled. +Defaults to 1. +

+
+
start_full, full
+

If set to 1, completely fill the output with generated rows before +outputting the first frame. +This is the default behavior, for disabling set the value to 0. +

+
+
stitch
+

If set to 1, stitch the left and right row edges together. +This is the default behavior, for disabling set the value to 0. +

+
+ + +

9.2.1 Examples

+ + + + +

9.3 color

+ +

Provide an uniformly colored input. +

+

It accepts the following parameters: +color:frame_size:frame_rate +

+

Follows the description of the accepted parameters. +

+
+
color
+

Specify the color of the source. It can be the name of a color (case +insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an +alpha specifier. The default value is "black". +

+
+
frame_size
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
frame_rate
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
+ +

For example the following graph description will generate a red source +with an opacity of 0.2, with size "qcif" and a frame rate of 10 +frames per second, which will be overlayed over the source connected +to the pad with identifier "in". +

+
 
"color=red@0.2:qcif:10 [color]; [in][color] overlay [out]"
+
+ + +

9.4 movie

+ +

Read a video stream from a movie container. +

+

It accepts the syntax: movie_name[:options] where +movie_name is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and options is an optional sequence of key=value +pairs, separated by ":". +

+

The description of the accepted options follows. +

+
+
format_name, f
+

Specifies the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from movie_name or by probing. +

+
+
seek_point, sp
+

Specifies the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +av_strtod so the numerical value may be suffixed by an IS +postfix. Default value is "0". +

+
+
stream_index, si
+

Specifies the index of the video stream to read. If the value is -1, +the best suited video stream will be automatically selected. Default +value is "-1". +

+
+
+ +

This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +

 
input -----------> deltapts0 --> overlay --> output
+                                    ^
+                                    |
+movie --> scale--> deltapts1 -------+
+
+ +

Some examples follow: +

 
# skip 3.2 seconds from the start of the avi file in.avi, and overlay it
+# on top of the input labelled as "in".
+movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+# read from a video4linux2 device, and overlay it on top of the input
+# labelled as "in"
+movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+
+ + +

9.5 mptestsrc

+ +

Generate various test patterns, as generated by the MPlayer test filter. +

+

The size of the generated video is fixed, and is 256x256. +This source is useful in particular for testing encoding features. +

+

This source accepts an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
test, t
+
+

Set the number or the name of the test to perform. Supported tests are: +

+
dc_luma
+
dc_chroma
+
freq_luma
+
freq_chroma
+
amp_luma
+
amp_chroma
+
cbp
+
mv
+
ring1
+
ring2
+
all
+
+ +

Default value is "all", which will cycle through the list of all tests. +

+
+ +

For example the following: +

 
testsrc=t=dc_luma
+
+ +

will generate a "dc_luma" test pattern. +

+ +

9.6 frei0r_src

+ +

Provide a frei0r source. +

+

To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. +

+

The source supports the syntax: +

 
size:rate:src_name[{=|:}param1:param2:...:paramN]
+
+ +

size is the size of the video to generate, may be a string of the +form widthxheight or a frame size abbreviation. +rate is the rate of the video to generate, may be a string of +the form num/den or a frame rate abbreviation. +src_name is the name to the frei0r source to load. For more +information regarding frei0r and how to set the parameters read the +section frei0r in the description of the video filters. +

+

Some examples follow: +

 
# generate a frei0r partik0l source with size 200x200 and frame rate 10
+# which is overlayed on the overlay filter main input
+frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
+
+ + +

9.7 life

+ +

Generate a life pattern. +

+

This source is based on a generalization of John Conway’s life game. +

+

The sourced input represents a life grid, each pixel represents a cell +which can be in one of two possible states, alive or dead. Every cell +interacts with its eight neighbours, which are the cells that are +horizontally, vertically, or diagonally adjacent. +

+

At each interaction the grid evolves according to the adopted rule, +which specifies the number of neighbor alive cells which will make a +cell stay alive or born. The ‘rule’ option allows to specify +the rule to adopt. +

+

This source accepts a list of options in the form of +key=value pairs separated by ":". A description of the +accepted options follows. +

+
+
filename, f
+

Set the file from which to read the initial grid state. In the file, +each non-whitespace character is considered an alive cell, and newline +is used to delimit the end of each row. +

+

If this option is not specified, the initial grid is generated +randomly. +

+
+
rate, r
+

Set the video rate, that is the number of frames generated per second. +Default is 25. +

+
+
random_fill_ratio, ratio
+

Set the random fill ratio for the initial random grid. It is a +floating point number value ranging from 0 to 1, defaults to 1/PHI. +It is ignored when a file is specified. +

+
+
random_seed, seed
+

Set the seed for filling the initial random grid, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. +

+
+
rule
+

Set the life rule. +

+

A rule can be specified with a code of the kind "SNS/BNB", +where NS and NB are sequences of numbers in the range 0-8, +NS specifies the number of alive neighbor cells which make a +live cell stay alive, and NB the number of alive neighbor cells +which make a dead cell to become alive (i.e. to "born"). +"s" and "b" can be used in place of "S" and "B", respectively. +

+

Alternatively a rule can be specified by an 18-bits integer. The 9 +high order bits are used to encode the next cell state if it is alive +for each number of neighbor alive cells, the low order bits specify +the rule for "borning" new cells. Higher order bits encode for an +higher number of neighbor cells. +For example the number 6153 = (12<<9)+9 specifies a stay alive +rule of 12 and a born rule of 9, which corresponds to "S23/B03". +

+

Default value is "S23/B3", which is the original Conway’s game of life +rule, and will keep a cell alive if it has 2 or 3 neighbor alive +cells, and will born a new cell if there are three alive cells around +a dead cell. +

+
+
size, s
+

Set the size of the output video. +

+

If ‘filename’ is specified, the size is set by default to the +same size of the input file. If ‘size’ is set, it must contain +the size specified in the input file, and the initial grid defined in +that file is centered in the larger resulting area. +

+

If a filename is not specified, the size value defaults to "320x240" +(used for a randomly generated initial grid). +

+
+
stitch
+

If set to 1, stitch the left and right grid edges together, and the +top and bottom edges also. Defaults to 1. +

+
+
mold
+

Set cell mold speed. If set, a dead cell will go from ‘death_color’ to +‘mold_color’ with a step of ‘mold’. ‘mold’ can have a +value from 0 to 255. +

+
+
life_color
+

Set the color of living (or new born) cells. +

+
+
death_color
+

Set the color of dead cells. If ‘mold’ is set, this is the first color +used to represent a dead cell. +

+
+
mold_color
+

Set mold color, for definitely dead and moldy cells. +

+
+ + +

9.7.1 Examples

+ + + + +

9.8 nullsrc, rgbtestsrc, testsrc

+ +

The nullsrc source returns unprocessed video frames. It is +mainly useful to be employed in analysis / debugging tools, or as the +source for filters which ignore the input data. +

+

The rgbtestsrc source generates an RGB test pattern useful for +detecting RGB vs BGR issues. You should see a red, green and blue +stripe from top to bottom. +

+

The testsrc source generates a test video pattern, showing a +color pattern, a scrolling gradient and a timestamp. This is mainly +intended for testing purposes. +

+

These sources accept an optional sequence of key=value pairs, +separated by ":". The description of the accepted options follows. +

+
+
size, s
+

Specify the size of the sourced video, it may be a string of the form +widthxheight, or the name of a size abbreviation. The +default value is "320x240". +

+
+
rate, r
+

Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +frame_rate_num/frame_rate_den, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". +

+
+
sar
+

Set the sample aspect ratio of the sourced video. +

+
+
duration, d
+

Set the video duration of the sourced video. The accepted syntax is: +

 
[-]HH[:MM[:SS[.m...]]]
+[-]S+[.m...]
+
+

See also the function av_parse_time(). +

+

If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +

+
+
decimals, n
+

Set the number of decimals to show in the timestamp, only used in the +testsrc source. +

+

The displayed timestamp value will correspond to the original +timestamp value multiplied by the power of 10 of the specified +value. Default value is 0. +

+
+ +

For example the following: +

 
testsrc=duration=5.3:size=qcif:rate=10
+
+ +

will generate a video with a duration of 5.3 seconds, with size +176x144 and a frame rate of 10 frames per second. +

+

If the input content is to be ignored, nullsrc can be used. The +following command generates noise in the luminance plane by employing +the mp=geq filter: +

 
nullsrc=s=256x256, mp=geq=random(1)*255:128:128
+
+ + + +

10. Video Sinks

+ +

Below is a description of the currently available video sinks. +

+ +

10.1 buffersink

+ +

Buffer video frames, and make them available to the end of the filter +graph. +

+

This sink is mainly intended for a programmatic use, in particular +through the interface defined in ‘libavfilter/buffersink.h’. +

+

It does not require a string parameter in input, but you need to +specify a pointer to a list of supported pixel formats terminated by +-1 in the opaque parameter provided to avfilter_init_filter +when initializing this sink. +

+ +

10.2 nullsink

+ +

Null video sink, do absolutely nothing with the input video. It is +mainly useful as a template and to be employed in analysis / debugging +tools. +

+ + +
+

+ + +
diff --git a/extern/ffmpeg/doc/platform.html b/extern/ffmpeg/doc/platform.html new file mode 100644 index 0000000000..bba58bb74d --- /dev/null +++ b/extern/ffmpeg/doc/platform.html @@ -0,0 +1,501 @@ + + + + + +FFmpeg documentation : : + + + + + + + + + + + + + + + +
+ +
+ +

Platform Specific information

+ + +

Table of Contents

+ + + +

1. Unix-like

+ +

Some parts of FFmpeg cannot be built with version 2.15 of the GNU +assembler which is still provided by a few AMD64 distributions. To +make sure your compiler really uses the required version of gas +after a binutils upgrade, run: +

+
 
$(gcc -print-prog-name=as) --version
+
+ +

If not, then you should install a different compiler that has no +hard-coded path to gas. In the worst case pass --disable-asm +to configure. +

+ +

1.1 BSD

+ +

BSD make will not build FFmpeg, you need to install and use GNU Make +(‘gmake’). +

+ +

1.2 (Open)Solaris

+ +

GNU Make is required to build FFmpeg, so you have to invoke (‘gmake’), +standard Solaris Make will not work. When building with a non-c99 front-end +(gcc, generic suncc) add either --extra-libs=/usr/lib/values-xpg6.o +or --extra-libs=/usr/lib/64/values-xpg6.o to the configure options +since the libc is not c99-compliant by default. The probes performed by +configure may raise an exception leading to the death of configure itself +due to a bug in the system shell. Simply invoke a different shell such as +bash directly to work around this: +

+
 
bash ./configure
+
+ +

+

+

1.3 Darwin (Mac OS X, iPhone)

+ +

The toolchain provided with Xcode is sufficient to build the basic +unacelerated code. +

+

Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from +http://github.com/yuvi/gas-preprocessor to build the optimized +assembler functions. Just download the Perl script and put it somewhere +in your PATH, FFmpeg’s configure will pick it up automatically. +

+

Mac OS X on amd64 and x86 requires yasm to build most of the +optimized assembler functions. Fink, +Gentoo Prefix, +Homebrew +or MacPorts can easily provide it. +

+ + +

2. DOS

+ +

Using a cross-compiler is preferred for various reasons. +http://www.delorie.com/howto/djgpp/linux-x-djgpp.html +

+ + +

3. OS/2

+ +

For information about compiling FFmpeg on OS/2 see +http://www.edm2.com/index.php/FFmpeg. +

+ + +

4. Windows

+ +

To get help and instructions for building FFmpeg under Windows, check out +the FFmpeg Windows Help Forum at +http://ffmpeg.arrozcru.org/. +

+ +

4.1 Native Windows compilation

+ +

FFmpeg can be built to run natively on Windows using the MinGW tools. Install +the latest versions of MSYS and MinGW from http://www.mingw.org/. +You can find detailed installation instructions in the download +section and the FAQ. +

+

FFmpeg does not build out-of-the-box with the packages the automated MinGW +installer provides. It also requires coreutils to be installed and many other +packages updated to the latest version. The minimum version for some packages +are listed below: +

+ + +

FFmpeg automatically passes -fno-common to the compiler to work around +a GCC bug (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216). +

+

Notes: +

+ + + +

4.2 Microsoft Visual C++ compatibility

+ +

As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you +want to use the libav* libraries in your own applications, you can still +compile those applications using MSVC++. But the libav* libraries you link +to must be built with MinGW. However, you will not be able to debug +inside the libav* libraries, since MSVC++ does not recognize the debug +symbols generated by GCC. +We strongly recommend you to move over from MSVC++ to MinGW tools. +

+

This description of how to use the FFmpeg libraries with MSVC++ is based on +Microsoft Visual C++ 2005 Express Edition. If you have a different version, +you might have to modify the procedures slightly. +

+ +

4.2.1 Using static libraries

+ +

Assuming you have just built and installed FFmpeg in ‘/usr/local’. +

+
    +
  1. Create a new console application ("File / New / Project") and then +select "Win32 Console Application". On the appropriate page of the +Application Wizard, uncheck the "Precompiled headers" option. + +
  2. Write the source code for your application, or, for testing, just +copy the code from an existing sample application into the source file +that MSVC++ has already created for you. For example, you can copy +‘libavformat/output-example.c’ from the FFmpeg distribution. + +
  3. Open the "Project / Properties" dialog box. In the "Configuration" +combo box, select "All Configurations" so that the changes you make will +affect both debug and release builds. In the tree view on the left hand +side, select "C/C++ / General", then edit the "Additional Include +Directories" setting to contain the path where the FFmpeg includes were +installed (i.e. ‘c:\msys\1.0\local\include’). +Do not add MinGW’s include directory here, or the include files will +conflict with MSVC’s. + +
  4. Still in the "Project / Properties" dialog box, select +"Linker / General" from the tree view and edit the +"Additional Library Directories" setting to contain the ‘lib’ +directory where FFmpeg was installed (i.e. ‘c:\msys\1.0\local\lib’), +the directory where MinGW libs are installed (i.e. ‘c:\mingw\lib’), +and the directory where MinGW’s GCC libs are installed +(i.e. ‘C:\mingw\lib\gcc\mingw32\4.2.1-sjlj’). Then select +"Linker / Input" from the tree view, and add the files ‘libavformat.a’, +‘libavcodec.a’, ‘libavutil.a’, ‘libmingwex.a’, +‘libgcc.a’, and any other libraries you used (i.e. ‘libz.a’) +to the end of "Additional Dependencies". + +
  5. Now, select "C/C++ / Code Generation" from the tree view. Select +"Debug" in the "Configuration" combo box. Make sure that "Runtime +Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in +the "Configuration" combo box and make sure that "Runtime Library" is +set to "Multi-threaded DLL". + +
  6. Click "OK" to close the "Project / Properties" dialog box. + +
  7. MSVC++ lacks some C99 header files that are fundamental for FFmpeg. +Get msinttypes from http://code.google.com/p/msinttypes/downloads/list +and install it in MSVC++’s include directory +(i.e. ‘C:\Program Files\Microsoft Visual Studio 8\VC\include’). + +
  8. MSVC++ also does not understand the inline keyword used by +FFmpeg, so you must add this line before #includeing libav*: +
     
    #define inline _inline
    +
    + +
  9. Build your application, everything should work. + +
+ + +

4.2.2 Using shared libraries

+ +

This is how to create DLL and LIB files that are compatible with MSVC++: +

+
    +
  1. Add a call to ‘vcvars32.bat’ (which sets up the environment +variables for the Visual C++ tools) as the first line of ‘msys.bat’. +The standard location for ‘vcvars32.bat’ is +‘C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat’, +and the standard location for ‘msys.bat’ is ‘C:\msys\1.0\msys.bat’. +If this corresponds to your setup, add the following line as the first line +of ‘msys.bat’: + +
     
    call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
    +
    + +

    Alternatively, you may start the ‘Visual Studio 2005 Command Prompt’, +and run ‘c:\msys\1.0\msys.bat’ from there. +

    +
  2. Within the MSYS shell, run lib.exe. If you get a help message +from ‘Microsoft (R) Library Manager’, this means your environment +variables are set up correctly, the ‘Microsoft (R) Library Manager’ +is on the path and will be used by FFmpeg to create +MSVC++-compatible import libraries. + +
  3. Build FFmpeg with + +
     
    ./configure --enable-shared
    +make
    +make install
    +
    + +

    Your install path (‘/usr/local/’ by default) should now have the +necessary DLL and LIB files under the ‘bin’ directory. +

    +
+ +

Alternatively, build the libraries with a cross compiler, according to +the instructions below in Cross compilation for Windows with Linux. +

+

To use those files with MSVC++, do the same as you would do with +the static libraries, as described above. But in Step 4, +you should only need to add the directory where the LIB files are installed +(i.e. ‘c:\msys\usr\local\bin’). This is not a typo, the LIB files are +installed in the ‘bin’ directory. And instead of adding the static +libraries (‘libxxx.a’ files) you should add the MSVC import libraries +(‘avcodec.lib’, ‘avformat.lib’, and +‘avutil.lib’). Note that you should not use the GCC import +libraries (‘libxxx.dll.a’ files), as these will give you undefined +reference errors. There should be no need for ‘libmingwex.a’, +‘libgcc.a’, and ‘wsock32.lib’, nor any other external library +statically linked into the DLLs. +

+

FFmpeg headers do not declare global data for Windows DLLs through the usual +dllexport/dllimport interface. Such data will be exported properly while +building, but to use them in your MSVC++ code you will have to edit the +appropriate headers and mark the data as dllimport. For example, in +libavutil/pixdesc.h you should have: +

 
extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
+
+ +

Note that using import libraries created by dlltool requires +the linker optimization option to be set to +"References: Keep Unreferenced Data (/OPT:NOREF)", otherwise +the resulting binaries will fail during runtime. This isn’t +required when using import libraries generated by lib.exe. +This issue is reported upstream at +http://sourceware.org/bugzilla/show_bug.cgi?id=12633. +

+

To create import libraries that work with the /OPT:REF option +(which is enabled by default in Release mode), follow these steps: +

+
    +
  1. Open ‘Visual Studio 2005 Command Prompt’. + +

    Alternatively, in a normal command line prompt, call ‘vcvars32.bat’ +which sets up the environment variables for the Visual C++ tools +(the standard location for this file is +‘C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat’). +

    +
  2. Enter the ‘bin’ directory where the created LIB and DLL files +are stored. + +
  3. Generate new import libraries with ‘lib.exe’: + +
     
    lib /machine:i386 /def:..\lib\avcodec-53.def  /out:avcodec.lib
    +lib /machine:i386 /def:..\lib\avdevice-53.def /out:avdevice.lib
    +lib /machine:i386 /def:..\lib\avfilter-2.def  /out:avfilter.lib
    +lib /machine:i386 /def:..\lib\avformat-53.def /out:avformat.lib
    +lib /machine:i386 /def:..\lib\avutil-51.def   /out:avutil.lib
    +lib /machine:i386 /def:..\lib\swscale-2.def   /out:swscale.lib
    +
    + +
+ +

+

+

4.3 Cross compilation for Windows with Linux

+ +

You must use the MinGW cross compilation tools available at +http://www.mingw.org/. +

+

Then configure FFmpeg with the following options: +

 
./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
+
+

(you can change the cross-prefix according to the prefix chosen for the +MinGW tools). +

+

Then you can easily test FFmpeg with Wine. +

+ +

4.4 Compilation under Cygwin

+ +

Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack +llrint() in its C library. +

+

Install your Cygwin with all the "Base" packages, plus the +following "Devel" ones: +

 
binutils, gcc4-core, make, git, mingw-runtime, texi2html
+
+ +

And the following "Utils" one: +

 
diffutils
+
+ +

Then run +

+
 
./configure
+
+ +

to make a static build. +

+

The current gcc4-core package is buggy and needs this flag to build +shared libraries: +

+
 
./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions
+
+ +

If you want to build FFmpeg with additional libraries, download Cygwin +"Devel" packages for Ogg and Vorbis from any Cygwin packages repository: +

 
libogg-devel, libvorbis-devel
+
+ +

These library packages are only available from +Cygwin Ports: +

+
 
yasm, libSDL-devel, libdirac-devel, libfaac-devel, libaacplus-devel, libgsm-devel,
+libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel,
+libxvidcore-devel
+
+ +

The recommendation for libnut and x264 is to build them from source by +yourself, as they evolve too quickly for Cygwin Ports to be up to date. +

+

Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means +of the libgetaddrinfo-devel package, available at Cygwin Ports. +

+ +

4.5 Crosscompilation for Windows under Cygwin

+ +

With Cygwin you can create Windows binaries that do not need the cygwin1.dll. +

+

Just install your Cygwin as explained before, plus these additional +"Devel" packages: +

 
gcc-mingw-core, mingw-runtime, mingw-zlib
+
+ +

and add some special flags to your configure invocation. +

+

For a static build run +

 
./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
+
+ +

and for a build with shared libraries +

 
./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
+
+ +
+

+ + +
diff --git a/src/ffmpeg/modern_working/include/inttypes.h b/extern/ffmpeg/include/inttypes.h similarity index 96% rename from src/ffmpeg/modern_working/include/inttypes.h rename to extern/ffmpeg/include/inttypes.h index 0e8af69cb0..25542771f5 100644 --- a/src/ffmpeg/modern_working/include/inttypes.h +++ b/extern/ffmpeg/include/inttypes.h @@ -1,305 +1,305 @@ -// ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_INTTYPES_H_ // [ -#define _MSC_INTTYPES_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// 7.8 Format conversion of integer types - -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -// 7.8.1 Macros for format specifiers - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 - -// The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" - -// The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" - -// The fscanf macros for signed integers are: -#define SCNd8 "d" -#define SCNi8 "i" -#define SCNdLEAST8 "d" -#define SCNiLEAST8 "i" -#define SCNdFAST8 "d" -#define SCNiFAST8 "i" - -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" - -#ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] - -// The fscanf macros for unsigned integers are: -#define SCNo8 "o" -#define SCNu8 "u" -#define SCNx8 "x" -#define SCNX8 "X" -#define SCNoLEAST8 "o" -#define SCNuLEAST8 "u" -#define SCNxLEAST8 "x" -#define SCNXLEAST8 "X" -#define SCNoFAST8 "o" -#define SCNuFAST8 "u" -#define SCNxFAST8 "x" -#define SCNXFAST8 "X" - -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" - -#ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] - -#endif // __STDC_FORMAT_MACROS ] - -// 7.8.2 Functions for greatest-width integer types - -// 7.8.2.1 The imaxabs function -#define imaxabs _abs64 - -// 7.8.2.2 The imaxdiv function - -// This is modified version of div() function from Microsoft's div.c found -// in %MSVC.NET%\crt\src\div.c -#ifdef STATIC_IMAXDIV // [ -static -#else // STATIC_IMAXDIV ][ -_inline -#endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - - result.quot = numer / denom; - result.rem = numer % denom; - - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } - - return result; -} - -// 7.8.2.3 The strtoimax and strtoumax functions -#define strtoimax _strtoi64 -#define strtoumax _strtoui64 - -// 7.8.2.4 The wcstoimax and wcstoumax functions -#define wcstoimax _wcstoi64 -#define wcstoumax _wcstoui64 - - -#endif // _MSC_INTTYPES_H_ ] +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include "stdint.h" + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +#endif // __STDC_FORMAT_MACROS ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + + +#endif // _MSC_INTTYPES_H_ ] diff --git a/src/ffmpeg/modern_working/include/libavcodec/avcodec.h b/extern/ffmpeg/include/libavcodec/avcodec.h similarity index 61% rename from src/ffmpeg/modern_working/include/libavcodec/avcodec.h rename to extern/ffmpeg/include/libavcodec/avcodec.h index edd695eecf..62e90be012 100644 --- a/src/ffmpeg/modern_working/include/libavcodec/avcodec.h +++ b/extern/ffmpeg/include/libavcodec/avcodec.h @@ -22,33 +22,54 @@ #define AVCODEC_AVCODEC_H /** - * @file libavcodec/avcodec.h + * @file * external API header */ #include +#include "libavutil/samplefmt.h" #include "libavutil/avutil.h" +#include "libavutil/cpu.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" -#define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 43 -#define LIBAVCODEC_VERSION_MICRO 0 +#include "libavcodec/version.h" +/** + * @defgroup libavc Encoding/Decoding Library + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + * + */ -#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} /** - * Identifies the syntax and semantics of the bitstream. + * Identify the syntax and semantics of the bitstream. * The principle is roughly: * Two decoders with the same ID can decode the same streams. * Two encoders with the same ID can encode compatible streams. @@ -57,7 +78,8 @@ * * If you add a codec ID to this list, add it so that * 1. no value of a existing codec ID changes (that would break ABI), - * 2. it is as close as possible to similar codecs. + * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec. + * This ensures that 2 forks can independantly add CodecIDs without producing conflicts. */ enum CodecID { CODEC_ID_NONE, @@ -125,7 +147,6 @@ enum CodecID { CODEC_ID_QDRAW, CODEC_ID_VIXL, CODEC_ID_QPEG, - CODEC_ID_XVID, CODEC_ID_PNG, CODEC_ID_PPM, CODEC_ID_PBM, @@ -163,7 +184,9 @@ enum CodecID { CODEC_ID_TIERTEXSEQVIDEO, CODEC_ID_TIFF, CODEC_ID_GIF, +#if LIBAVCODEC_VERSION_MAJOR == 53 CODEC_ID_FFH264, +#endif CODEC_ID_DXA, CODEC_ID_DNXHD, CODEC_ID_THP, @@ -181,8 +204,10 @@ enum CodecID { CODEC_ID_INDEO5, CODEC_ID_MIMIC, CODEC_ID_RL2, +#if LIBAVCODEC_VERSION_MAJOR == 53 CODEC_ID_8SVX_EXP, CODEC_ID_8SVX_FIB, +#endif CODEC_ID_ESCAPE124, CODEC_ID_DIRAC, CODEC_ID_BFI, @@ -200,9 +225,49 @@ enum CodecID { CODEC_ID_MAD, CODEC_ID_FRWU, CODEC_ID_FLASHSV2, + CODEC_ID_CDGRAPHICS, + CODEC_ID_R210, + CODEC_ID_ANM, + CODEC_ID_BINKVIDEO, + CODEC_ID_IFF_ILBM, + CODEC_ID_IFF_BYTERUN1, + CODEC_ID_KGV1, + CODEC_ID_YOP, + CODEC_ID_VP8, + CODEC_ID_PICTOR, + CODEC_ID_ANSI, + CODEC_ID_A64_MULTI, + CODEC_ID_A64_MULTI5, + CODEC_ID_R10K, + CODEC_ID_MXPEG, + CODEC_ID_LAGARITH, + CODEC_ID_PRORES, + CODEC_ID_JV, + CODEC_ID_DFA, + CODEC_ID_WMV3IMAGE, + CODEC_ID_VC1IMAGE, +#if LIBAVCODEC_VERSION_MAJOR == 53 + CODEC_ID_G723_1_DEPRECATED, + CODEC_ID_G729_DEPRECATED, +#endif + CODEC_ID_UTVIDEO_DEPRECATED, + CODEC_ID_BMV_VIDEO, + CODEC_ID_VBLE, + CODEC_ID_DXTORY, + CODEC_ID_V410, + CODEC_ID_XWD, + CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), + CODEC_ID_UTVIDEO = 0x800, + CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), + CODEC_ID_AVRP = MKBETAG('A','V','R','P'), + + CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), + CODEC_ID_V308 = MKBETAG('V','3','0','8'), + CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), /* various PCM "codecs" */ - CODEC_ID_PCM_S16LE= 0x10000, + CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + CODEC_ID_PCM_S16LE = 0x10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, CODEC_ID_PCM_U16BE, @@ -227,9 +292,12 @@ enum CodecID { CODEC_ID_PCM_F64BE, CODEC_ID_PCM_F64LE, CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, + CODEC_ID_S302M, + CODEC_ID_PCM_S8_PLANAR, /* various ADPCM codecs */ - CODEC_ID_ADPCM_IMA_QT= 0x11000, + CODEC_ID_ADPCM_IMA_QT = 0x11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, CODEC_ID_ADPCM_IMA_DK4, @@ -257,23 +325,25 @@ enum CodecID { CODEC_ID_ADPCM_EA_XAS, CODEC_ID_ADPCM_EA_MAXIS_XA, CODEC_ID_ADPCM_IMA_ISS, + CODEC_ID_ADPCM_G722, + CODEC_ID_ADPCM_IMA_APC, /* AMR */ - CODEC_ID_AMR_NB= 0x12000, + CODEC_ID_AMR_NB = 0x12000, CODEC_ID_AMR_WB, /* RealAudio codecs*/ - CODEC_ID_RA_144= 0x13000, + CODEC_ID_RA_144 = 0x13000, CODEC_ID_RA_288, /* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= 0x14000, + CODEC_ID_ROQ_DPCM = 0x14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, CODEC_ID_SOL_DPCM, /* audio codecs */ - CODEC_ID_MP2= 0x15000, + CODEC_ID_MP2 = 0x15000, CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 CODEC_ID_AAC, CODEC_ID_AC3, @@ -285,8 +355,10 @@ enum CodecID { CODEC_ID_MACE3, CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, +#if LIBAVCODEC_VERSION_MAJOR == 53 CODEC_ID_SONIC, CODEC_ID_SONIC_LS, +#endif CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, @@ -323,9 +395,26 @@ enum CodecID { CODEC_ID_TRUEHD, CODEC_ID_MP4ALS, CODEC_ID_ATRAC1, + CODEC_ID_BINKAUDIO_RDFT, + CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, + CODEC_ID_CELT, +#if LIBAVCODEC_VERSION_MAJOR > 53 + CODEC_ID_G723_1_DEPRECATED, + CODEC_ID_G729_DEPRECATED, + CODEC_ID_8SVX_EXP, + CODEC_ID_8SVX_FIB, +#endif + CODEC_ID_BMV_AUDIO, + CODEC_ID_G729 = 0x15800, + CODEC_ID_G723_1= 0x15801, + CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'), + CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'), /* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= 0x17000, + CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + CODEC_ID_DVD_SUBTITLE = 0x17000, CODEC_ID_DVB_SUBTITLE, CODEC_ID_TEXT, ///< raw UTF-8 text CODEC_ID_XSUB, @@ -333,86 +422,89 @@ enum CodecID { CODEC_ID_MOV_TEXT, CODEC_ID_HDMV_PGS_SUBTITLE, CODEC_ID_DVB_TELETEXT, + CODEC_ID_SRT, + CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), /* other specific kind of codecs (generally used for attachments) */ - CODEC_ID_TTF= 0x18000, + CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + CODEC_ID_TTF = 0x18000, + CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), + CODEC_ID_XBIN = MKBETAG('X','B','I','N'), + CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'), - CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it + CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it - CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS * stream (only used by libavformat) */ + CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. }; -enum CodecType { - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE, - CODEC_TYPE_ATTACHMENT, - CODEC_TYPE_NB -}; +#if FF_API_OLD_SAMPLE_FMT +#define SampleFormat AVSampleFormat -/** - * all in native-endian format - */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float - SAMPLE_FMT_DBL, ///< double - SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec -}; +#define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE +#define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8 +#define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16 +#define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32 +#define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT +#define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL +#define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB +#endif + +#if FF_API_OLD_AUDIOCONVERT +#include "libavutil/audioconvert.h" /* Audio channel masks */ -#define CH_FRONT_LEFT 0x00000001 -#define CH_FRONT_RIGHT 0x00000002 -#define CH_FRONT_CENTER 0x00000004 -#define CH_LOW_FREQUENCY 0x00000008 -#define CH_BACK_LEFT 0x00000010 -#define CH_BACK_RIGHT 0x00000020 -#define CH_FRONT_LEFT_OF_CENTER 0x00000040 -#define CH_FRONT_RIGHT_OF_CENTER 0x00000080 -#define CH_BACK_CENTER 0x00000100 -#define CH_SIDE_LEFT 0x00000200 -#define CH_SIDE_RIGHT 0x00000400 -#define CH_TOP_CENTER 0x00000800 -#define CH_TOP_FRONT_LEFT 0x00001000 -#define CH_TOP_FRONT_CENTER 0x00002000 -#define CH_TOP_FRONT_RIGHT 0x00004000 -#define CH_TOP_BACK_LEFT 0x00008000 -#define CH_TOP_BACK_CENTER 0x00010000 -#define CH_TOP_BACK_RIGHT 0x00020000 -#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. -#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT. +#define CH_FRONT_LEFT AV_CH_FRONT_LEFT +#define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT +#define CH_FRONT_CENTER AV_CH_FRONT_CENTER +#define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY +#define CH_BACK_LEFT AV_CH_BACK_LEFT +#define CH_BACK_RIGHT AV_CH_BACK_RIGHT +#define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER +#define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER +#define CH_BACK_CENTER AV_CH_BACK_CENTER +#define CH_SIDE_LEFT AV_CH_SIDE_LEFT +#define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT +#define CH_TOP_CENTER AV_CH_TOP_CENTER +#define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT +#define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER +#define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT +#define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT +#define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER +#define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT +#define CH_STEREO_LEFT AV_CH_STEREO_LEFT +#define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT /** Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests the channel order of the decoder output to be the native codec channel order. */ -#define CH_LAYOUT_NATIVE 0x8000000000000000LL +#define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE /* Audio channel convenience macros */ -#define CH_LAYOUT_MONO (CH_FRONT_CENTER) -#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT) -#define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER) -#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER) -#define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER) -#define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) -#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) -#define CH_LAYOUT_7POINT0 (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\ - CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) -#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT) +#define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO +#define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO +#define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1 +#define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND +#define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0 +#define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2 +#define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD +#define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0 +#define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1 +#define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK +#define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK +#define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0 +#define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1 +#define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE +#define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX +#endif +#if FF_API_OLD_DECODE_AUDIO /* in bytes */ #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio +#endif /** * Required number of additionally allocated bytes at the end of the input bitstream for decoding. @@ -421,7 +513,7 @@ enum SampleFormat { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define FF_INPUT_BUFFER_PADDING_SIZE 8 +#define FF_INPUT_BUFFER_PADDING_SIZE 16 /** * minimum encoding buffer size @@ -473,6 +565,7 @@ enum AVColorTransferCharacteristic{ AVCOL_TRC_UNSPECIFIED=2, AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE240M =7, AVCOL_TRC_NB , ///< Not part of ABI }; @@ -484,6 +577,7 @@ enum AVColorSpace{ AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above AVCOL_SPC_SMPTE240M =7, + AVCOL_SPC_YCGCO =8, AVCOL_SPC_NB , ///< Not part of ABI }; @@ -510,6 +604,33 @@ enum AVChromaLocation{ AVCHROMA_LOC_NB , ///< Not part of ABI }; +#if FF_API_FLAC_GLOBAL_OPTS +/** + * LPC analysis type + */ +enum AVLPCType { + AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type + AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients + AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients + AV_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion + AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization + AV_LPC_TYPE_NB , ///< Not part of ABI +}; +#endif + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + typedef struct RcOverride{ int start_frame; int end_frame; @@ -529,7 +650,6 @@ typedef struct RcOverride{ #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. #define CODEC_FLAG_GMC 0x0020 ///< Use GMC. #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. -#define CODEC_FLAG_PART 0x0080 ///< Use data partitioning. /** * The parent program guarantees that the input for B-frames containing * streams is not written to for at least s->max_b_frames+1 frames, if @@ -538,7 +658,6 @@ typedef struct RcOverride{ #define CODEC_FLAG_INPUT_PRESERVED 0x0100 #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. -#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG). #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. #define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges. #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. @@ -547,25 +666,43 @@ typedef struct RcOverride{ #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. -#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan. #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). /* Fx : Flag for h263+ extra options */ #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction -#define CODEC_FLAG_H263P_UMV 0x02000000 ///< unlimited motion vector #define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp. #define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon. -#define CODEC_FLAG_H263P_AIV 0x00000008 ///< H.263 alternative inter VLC -#define CODEC_FLAG_OBMC 0x00000001 ///< OBMC #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter -#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation -#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data. #define CODEC_FLAG_CLOSED_GOP 0x80000000 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. #define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. +#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping +#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. +#define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe +/** + * @defgroup deprecated_flags Deprecated codec flags + * Use corresponding private codec options instead. + * @{ + */ +#if FF_API_MPEGVIDEO_GLOBAL_OPTS +#define CODEC_FLAG_OBMC 0x00000001 ///< OBMC +#define CODEC_FLAG_H263P_AIV 0x00000008 ///< H.263 alternative inter VLC +#define CODEC_FLAG_PART 0x0080 ///< Use data partitioning. +#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan. +#define CODEC_FLAG_H263P_UMV 0x02000000 ///< unlimited motion vector +#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 +#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data. +#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table. +#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. +#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer. +#endif +#if FF_API_MJPEG_GLOBAL_OPTS +#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG). +#endif +#if FF_API_X264_GLOBAL_OPTS #define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow B-frames to be used as references. #define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for B-frames #define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock @@ -573,14 +710,20 @@ typedef struct RcOverride{ #define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip #define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters #define CODEC_FLAG2_BRDO 0x00000400 ///< B-frame rate-distortion optimization -#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table. -#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC). -#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. -#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping -#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. -#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer. -#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) +#define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. +#define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. +#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes. +#endif +#if FF_API_SNOW_GLOBAL_OPTS +#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC). +#endif +#if FF_API_LAME_GLOBAL_OPTS +#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible +#endif +/** + * @} + */ /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -591,18 +734,40 @@ typedef struct RcOverride{ #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. /** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. */ #define CODEC_CAP_DR1 0x0002 +#if FF_API_PARSE_FRAME /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */ #define CODEC_CAP_PARSE_ONLY 0x0004 +#endif #define CODEC_CAP_TRUNCATED 0x0008 /* Codec can export data for HW decoding (XvMC). */ #define CODEC_CAP_HWACCEL 0x0010 /** - * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data. - * If this is not set, the codec is guaranteed to never be fed with NULL data. + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. */ #define CODEC_CAP_DELAY 0x0020 /** @@ -616,8 +781,55 @@ typedef struct RcOverride{ #define CODEC_CAP_HWACCEL_VDPAU 0x0080 /** * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. */ #define CODEC_CAP_SUBFRAMES 0x0100 +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 + +/** + * Codec is able to deal with negative linesizes + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 + +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS 0x8000 +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 +/** + * Codec is lossless. + */ +#define CODEC_CAP_LOSSLESS 0x80000000 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -672,256 +884,38 @@ typedef struct AVPanScan{ int16_t position[3][2]; }AVPanScan; -#define FF_COMMON_FRAME \ - /**\ - * pointer to the picture planes.\ - * This might be different from the first allocated byte\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *data[4];\ - int linesize[4];\ - /**\ - * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.\ - * This isn't used by libavcodec unless the default get/release_buffer() is used.\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *base[4];\ - /**\ - * 1 -> keyframe, 0-> not\ - * - encoding: Set by libavcodec.\ - * - decoding: Set by libavcodec.\ - */\ - int key_frame;\ -\ - /**\ - * Picture type of the frame, see ?_TYPE below.\ - * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\ - * - decoding: Set by libavcodec.\ - */\ - int pict_type;\ -\ - /**\ - * presentation timestamp in time_base units (time when frame should be shown to user)\ - * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\ - * - encoding: MUST be set by user.\ - * - decoding: Set by libavcodec.\ - */\ - int64_t pts;\ -\ - /**\ - * picture number in bitstream order\ - * - encoding: set by\ - * - decoding: Set by libavcodec.\ - */\ - int coded_picture_number;\ - /**\ - * picture number in display order\ - * - encoding: set by\ - * - decoding: Set by libavcodec.\ - */\ - int display_picture_number;\ -\ - /**\ - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \ - * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\ - * - decoding: Set by libavcodec.\ - */\ - int quality; \ -\ - /**\ - * buffer age (1->was last buffer and dint change, 2->..., ...).\ - * Set to INT_MAX if the buffer has not been used yet.\ - * - encoding: unused\ - * - decoding: MUST be set by get_buffer().\ - */\ - int age;\ -\ - /**\ - * is this picture used as reference\ - * The values for this are the same as the MpegEncContext.picture_structure\ - * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.\ - * Set to 4 for delayed, non-reference frames.\ - * - encoding: unused\ - * - decoding: Set by libavcodec. (before get_buffer() call)).\ - */\ - int reference;\ -\ - /**\ - * QP table\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - int8_t *qscale_table;\ - /**\ - * QP store stride\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - int qstride;\ -\ - /**\ - * mbskip_table[mb]>=1 if MB didn't change\ - * stride= mb_width = (width+15)>>4\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - uint8_t *mbskip_table;\ -\ - /**\ - * motion vector table\ - * @code\ - * example:\ - * int mv_sample_log2= 4 - motion_subsample_log2;\ - * int mb_width= (width+15)>>4;\ - * int mv_stride= (mb_width << mv_sample_log2) + 1;\ - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\ - * @endcode\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec.\ - */\ - int16_t (*motion_val[2])[2];\ -\ - /**\ - * macroblock type table\ - * mb_type_base + mb_width + 2\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec.\ - */\ - uint32_t *mb_type;\ -\ - /**\ - * log2 of the size of the block which a single vector in motion_val represents: \ - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - uint8_t motion_subsample_log2;\ -\ - /**\ - * for some private data of the user\ - * - encoding: unused\ - * - decoding: Set by user.\ - */\ - void *opaque;\ -\ - /**\ - * error\ - * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.\ - * - decoding: unused\ - */\ - uint64_t error[4];\ -\ - /**\ - * type of the buffer (to keep track of who has to deallocate data[*])\ - * - encoding: Set by the one who allocates it.\ - * - decoding: Set by the one who allocates it.\ - * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.\ - */\ - int type;\ - \ - /**\ - * When decoding, this signals how much the picture must be delayed.\ - * extra_delay = repeat_pict / (2*fps)\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - int repeat_pict;\ - \ - /**\ - * \ - */\ - int qscale_type;\ - \ - /**\ - * The content of the picture is interlaced.\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec. (default 0)\ - */\ - int interlaced_frame;\ - \ - /**\ - * If the content is interlaced, is top field displayed first.\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec.\ - */\ - int top_field_first;\ - \ - /**\ - * Pan scan.\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec.\ - */\ - AVPanScan *pan_scan;\ - \ - /**\ - * Tell user application that palette has changed from previous frame.\ - * - encoding: ??? (no palette-enabled encoder yet)\ - * - decoding: Set by libavcodec. (default 0).\ - */\ - int palette_has_changed;\ - \ - /**\ - * codec suggestion on buffer type if != 0\ - * - encoding: unused\ - * - decoding: Set by libavcodec. (before get_buffer() call)).\ - */\ - int buffer_hints;\ -\ - /**\ - * DCT coefficients\ - * - encoding: unused\ - * - decoding: Set by libavcodec.\ - */\ - short *dct_coeff;\ -\ - /**\ - * motion referece frame index\ - * - encoding: Set by user.\ - * - decoding: Set by libavcodec.\ - */\ - int8_t *ref_index[2];\ -\ - /**\ - * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque\ - * output in AVFrame.reordered_opaque\ - * - encoding: unused\ - * - decoding: Read by user.\ - */\ - int64_t reordered_opaque;\ -\ - /**\ - * hardware accelerator private data (FFmpeg allocated)\ - * - encoding: unused\ - * - decoding: Set by libavcodec\ - */\ - void *hwaccel_picture_private;\ - - #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 #define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 #define FF_BUFFER_TYPE_INTERNAL 1 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. - -#define FF_I_TYPE 1 ///< Intra -#define FF_P_TYPE 2 ///< Predicted -#define FF_B_TYPE 3 ///< Bi-dir predicted -#define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG4 -#define FF_SI_TYPE 5 ///< Switching Intra -#define FF_SP_TYPE 6 ///< Switching Predicted -#define FF_BI_TYPE 7 +#if FF_API_OLD_FF_PICT_TYPES +/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */ +#define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra +#define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted +#define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted +#define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4 +#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra +#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted +#define FF_BI_TYPE AV_PICTURE_TYPE_BI +#endif #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, + AV_PKT_DATA_NEW_EXTRADATA, + AV_PKT_DATA_PARAM_CHANGE, +}; + typedef struct AVPacket { /** * Presentation timestamp in AVStream->time_base units; the time at which @@ -942,7 +936,21 @@ typedef struct AVPacket { uint8_t *data; int size; int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + struct { + uint8_t *data; + int size; + enum AVPacketSideDataType type; + } *side_data; + int side_data_elems; + /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. @@ -960,6 +968,8 @@ typedef struct AVPacket { * the very first frame or from this keyframe. * Is AV_NOPTS_VALUE if unknown. * This field is not the display duration of the current packet. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. * * The purpose of this field is to allow seeking in streams that have no * keyframes in the conventional sense. It corresponds to the @@ -969,35 +979,409 @@ typedef struct AVPacket { */ int64_t convergence_duration; } AVPacket; -#define AV_PKT_FLAG_KEY 0x0001 -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define PKT_FLAG_KEY AV_PKT_FLAG_KEY -#endif +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted + +/** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + */ + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; /** * Audio Video Frame. - * New fields can be added to the end of FF_COMMON_FRAME with minor version - * bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. No fields should be added into AVFrame before or after - * FF_COMMON_FRAME! - * sizeof(AVFrame) must not be used outside libav*. + * New fields can be added to the end of AVFRAME with minor version + * bumps. Similarly fields that are marked as to be only accessed by + * av_opt_ptr() can be reordered. This allows 2 forks to add fields + * without breaking compatibility with each other. + * Removal, reordering and changes in the remaining cases require + * a major version bump. + * sizeof(AVFrame) must not be used outside libavcodec. */ typedef struct AVFrame { - FF_COMMON_FRAME +#if FF_API_DATA_POINTERS +#define AV_NUM_DATA_POINTERS 4 +#else +#define AV_NUM_DATA_POINTERS 8 +#endif + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + * - encoding: Set by user + * - decoding: set by AVCodecContext.get_buffer() + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * Size, in bytes, of the data for each picture/channel plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * - encoding: Set by user (video only) + * - decoding: set by AVCodecContext.get_buffer() + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. + * This isn't used by libavcodec unless the default get/release_buffer() is used. + * - encoding: + * - decoding: + */ + uint8_t *base[AV_NUM_DATA_POINTERS]; + /** + * 1 -> keyframe, 0-> not + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int key_frame; + + /** + * Picture type of the frame, see ?_TYPE below. + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + */ + enum AVPictureType pict_type; + + /** + * presentation timestamp in time_base units (time when frame should be shown to user) + * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + */ + int64_t pts; + + /** + * picture number in bitstream order + * - encoding: set by + * - decoding: Set by libavcodec. + */ + int coded_picture_number; + /** + * picture number in display order + * - encoding: set by + * - decoding: Set by libavcodec. + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + */ + int quality; + +#if FF_API_AVFRAME_AGE + /** + * @deprecated unused + */ + attribute_deprecated int age; +#endif + + /** + * is this picture used as reference + * The values for this are the same as the MpegEncContext.picture_structure + * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. + * Set to 4 for delayed, non-reference frames. + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + */ + int reference; + + /** + * QP table + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int8_t *qscale_table; + /** + * QP store stride + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int qstride; + + /** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + * - encoding: unused + * - decoding: Set by libavcodec. + */ + uint8_t *mbskip_table; + + /** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t (*motion_val[2])[2]; + + /** + * macroblock type table + * mb_type_base + mb_width + 2 + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + uint32_t *mb_type; + + /** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + * - encoding: unused + * - decoding: Set by libavcodec. + */ + uint8_t motion_subsample_log2; + + /** + * for some private data of the user + * - encoding: unused + * - decoding: Set by user. + */ + void *opaque; + + /** + * error + * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * type of the buffer (to keep track of who has to deallocate data[*]) + * - encoding: Set by the one who allocates it. + * - decoding: Set by the one who allocates it. + * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. + */ + int type; + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int repeat_pict; + + /** + * + */ + int qscale_type; + + /** + * The content of the picture is interlaced. + * - encoding: Set by user. + * - decoding: Set by libavcodec. (default 0) + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int top_field_first; + + /** + * Pan scan. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVPanScan *pan_scan; + + /** + * Tell user application that palette has changed from previous frame. + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: Set by libavcodec. (default 0). + */ + int palette_has_changed; + + /** + * codec suggestion on buffer type if != 0 + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + */ + int buffer_hints; + + /** + * DCT coefficients + * - encoding: unused + * - decoding: Set by libavcodec. + */ + short *dct_coeff; + + /** + * motion reference frame index + * the order in which these are stored can depend on the codec. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int8_t *ref_index[2]; + + /** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + * - encoding: unused + * - decoding: Read by user. + */ + int64_t reordered_opaque; + + /** + * hardware accelerator private data (FFmpeg-allocated) + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *hwaccel_picture_private; + + /** + * reordered pts from the last AVPacket that has been input into the decoder + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_pts; + + /** + * dts from the last AVPacket that has been input into the decoder + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_dts; + + /** + * the AVCodecContext which ff_thread_get_buffer() was last called on + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + struct AVCodecContext *owner; + + /** + * used by multithreading to store frame-specific info + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + void *thread_opaque; + + /** + * number of audio samples (per channel) described by this frame + * - encoding: unused + * - decoding: Set by libavcodec + */ + int nb_samples; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set by get_buffer(), + * but for planar audio with more channels that can fit in data, + * extended_data must be used by the decoder in order to access all + * channels. + * + * encoding: unused + * decoding: set by AVCodecContext.get_buffer() + */ + uint8_t **extended_data; + + /** + * sample aspect ratio for the video frame, 0/1 if unknown\unspecified + * - encoding: unused + * - decoding: Read by user. + */ + AVRational sample_aspect_ratio; + + /** + * width and height of the video frame + * - encoding: unused + * - decoding: Read by user. + */ + int width, height; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum PixelFormat for video frames, + * enum AVSampleFormat for audio) + * - encoding: unused + * - decoding: Read by user. + */ + int format; + + /** + * frame timestamp estimated using various heuristics, in stream time base + * Code outside libavcodec should access this field using: + * av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp"); + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int64_t best_effort_timestamp; + + /** + * reordered pos from the last AVPacket that has been input into the decoder + * Code outside libavcodec should access this field using: + * av_opt_ptr(avcodec_get_frame_class(), frame, "pkt_pos"); + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_pos; + } AVFrame; +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + /** * main external API structure. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. + * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user + * applications. * sizeof(AVCodecContext) must not be used outside libav*. */ typedef struct AVCodecContext { /** * information on struct for av_log - * - set by avcodec_alloc_context + * - set by avcodec_alloc_context3 */ const AVClass *av_class; /** @@ -1026,7 +1410,7 @@ typedef struct AVCodecContext { * Some codecs need additional format info. It is stored here. * If any muxer uses this then ALL demuxers/parsers AND encoders for the * specific codec MUST set it correctly otherwise stream copy breaks. - * In general use of this field by muxers is not recommanded. + * In general use of this field by muxers is not recommended. * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. (FIXME: Is this OK?) */ @@ -1086,24 +1470,22 @@ typedef struct AVCodecContext { /** * Pixel format, see PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overriden by the decoder if it knows better. * - encoding: Set by user. - * - decoding: Set by libavcodec. + * - decoding: Set by user if known, overridden by libavcodec if known */ enum PixelFormat pix_fmt; - /** - * Frame rate emulation. If not zero, the lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: Set by user. - * - decoding: unused - */ - int rate_emu; - /** * If non NULL, 'draw_horiz_band' is called by the libavcodec * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. * The function is also used by hardware acceleration APIs. * It is called at least once during frame decoding to pass * the data needed for hardware render. @@ -1119,7 +1501,7 @@ typedef struct AVCodecContext { * @param offset offset into the AVFrame.data from which the slice should be read */ void (*draw_horiz_band)(struct AVCodecContext *s, - const AVFrame *src, int offset[4], + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height); /* audio only */ @@ -1131,7 +1513,7 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by libavcodec. */ - enum SampleFormat sample_fmt; ///< sample format + enum AVSampleFormat sample_fmt; ///< sample format /* The following data should not be initialized. */ /** @@ -1139,15 +1521,14 @@ typedef struct AVCodecContext { */ int frame_size; int frame_number; ///< audio or video frame number -#if LIBAVCODEC_VERSION_MAJOR < 53 - int real_pict_num; ///< Returns the real picture number of previous encoded frame. -#endif /** - * Number of frames the decoded output will be delayed relative to - * the encoded input. + * Encoding: Number of frames delay there will be from the encoder input to + * the decoder output. (we assume the decoder matches the spec) + * Decoding: Number of frames delay in addition to what a standard decoder + * as specified in the spec would produce. * - encoding: Set by libavcodec. - * - decoding: unused + * - decoding: Set by libavcodec. */ int delay; @@ -1199,14 +1580,6 @@ typedef struct AVCodecContext { int b_frame_strategy; - /** - * hurry up amount - * - encoding: unused - * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header - * @deprecated Deprecated in favor of skip_idct and skip_frame. - */ - int hurry_up; - struct AVCodec *codec; void *priv_data; @@ -1252,7 +1625,7 @@ typedef struct AVCodecContext { void *opaque; char codec_name[32]; - enum CodecType codec_type; /* see CODEC_TYPE_xxx */ + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ enum CodecID codec_id; /* see CODEC_ID_xxx */ /** @@ -1261,7 +1634,7 @@ typedef struct AVCodecContext { * A demuxer should set this to what is stored in the field used to identify the codec. * If there are multiple such fields in a container then the demuxer should choose the one * which maximizes the information about the used codec. - * If the codec tag field in a container is larger then 32 bits then the demuxer should + * If the codec tag field in a container is larger than 32 bits then the demuxer should * remap the longer ID to 32 bits with a table or other structure. Alternatively a new * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated * first. @@ -1291,6 +1664,7 @@ typedef struct AVCodecContext { #define FF_BUG_HPEL_CHROMA 2048 #define FF_BUG_DC_CLIP 4096 #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%. /** @@ -1312,18 +1686,18 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by user. * Setting this to STRICT or higher means the encoder and decoder will - * generally do stupid things. While setting it to inofficial or lower - * will mean the encoder might use things that are not supported by all - * spec compliant decoders. Decoders make no difference between normal, - * inofficial and experimental, that is they always try to decode things - * when they can unless they are explicitly asked to behave stupid + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly * (=strictly conform to the specs) */ int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to a older more strict version of the spec or reference software. +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. #define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions. +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. /** @@ -1333,28 +1707,75 @@ typedef struct AVCodecContext { */ float b_quant_offset; +#if FF_API_ER /** - * Error recognization; higher values will detect more errors but may + * Error recognition; higher values will detect more errors but may * misdetect some more or less valid parts as errors. * - encoding: unused * - decoding: Set by user. */ - int error_recognition; + attribute_deprecated int error_recognition; #define FF_ER_CAREFUL 1 #define FF_ER_COMPLIANT 2 #define FF_ER_AGGRESSIVE 3 #define FF_ER_VERY_AGGRESSIVE 4 +#define FF_ER_EXPLODE 5 +#endif /* FF_API_ER */ /** * Called at the beginning of each frame to get a buffer for it. - * If pic.reference is set then the frame will be read later by libavcodec. - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16. + * + * The function will set AVFrame.data[], AVFrame.linesize[]. + * AVFrame.extended_data[] must also be set, but it should be the same as + * AVFrame.data[] except for planar audio with more channels than can fit + * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as + * many data pointers as it can hold. + * * if CODEC_CAP_DR1 is not set then get_buffer() must call * avcodec_default_get_buffer() instead of providing buffers allocated by * some other means. + * + * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't + * need it. avcodec_default_get_buffer() aligns the output buffer properly, + * but if get_buffer() is overridden then alignment considerations should + * be taken into account. + * + * @see avcodec_default_get_buffer() + * + * Video: + * + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at + * once. Does not need to be reentrant. + * + * @see release_buffer(), reget_buffer() + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * Decoders cannot use the buffer after returning from + * avcodec_decode_audio4(), so they will not call release_buffer(), as it + * is assumed to be released immediately upon return. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * * - encoding: unused - * - decoding: Set by libavcodec., user can override. + * - decoding: Set by libavcodec, user can override. */ int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); @@ -1362,8 +1783,10 @@ typedef struct AVCodecContext { * Called to release buffers which were allocated with get_buffer. * A released buffer can be reused in get_buffer(). * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. * - encoding: unused - * - decoding: Set by libavcodec., user can override. + * - decoding: Set by libavcodec, user can override. */ void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); @@ -1381,9 +1804,15 @@ typedef struct AVCodecContext { */ int block_align; - int parse_only; /* - decoding only: If true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. */ +#if FF_API_PARSE_FRAME + /** + * If true, only parsing is done. The frame data is returned. + * Only MPEG audio decoders support this now. + * - encoding: unused + * - decoding: Set by user + */ + attribute_deprecated int parse_only; +#endif /** * 0-> h263 quant 1-> mpeg quant @@ -1557,6 +1986,7 @@ typedef struct AVCodecContext { #define FF_IDCT_EA 21 #define FF_IDCT_SIMPLENEON 22 #define FF_IDCT_SIMPLEALPHA 23 +#define FF_IDCT_BINK 24 /** * slice count @@ -1589,23 +2019,6 @@ typedef struct AVCodecContext { * result into program crash.) */ unsigned dsp_mask; -#define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */ - /* lower 16 bits - CPU features */ -#define FF_MM_MMX 0x0001 ///< standard MMX -#define FF_MM_3DNOW 0x0004 ///< AMD 3DNOW -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define FF_MM_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext -#endif -#define FF_MM_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext -#define FF_MM_SSE 0x0008 ///< SSE functions -#define FF_MM_SSE2 0x0010 ///< PIV SSE2 functions -#define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt -#define FF_MM_SSE3 0x0040 ///< Prescott SSE3 functions -#define FF_MM_SSSE3 0x0080 ///< Conroe SSSE3 functions -#define FF_MM_SSE4 0x0100 ///< Penryn SSE4.1 functions -#define FF_MM_SSE42 0x0200 ///< Nehalem SSE4.2 functions -#define FF_MM_IWMMXT 0x0100 ///< XScale IWMMXT -#define FF_MM_ALTIVEC 0x0001 ///< standard AltiVec /** * bits per sample/pixel from the demuxer (needed for huffyuv). @@ -1662,6 +2075,7 @@ typedef struct AVCodecContext { #define FF_DEBUG_VIS_QP 0x00002000 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 #define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 /** * debug @@ -1678,21 +2092,7 @@ typedef struct AVCodecContext { * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. * - decoding: unused */ - uint64_t error[4]; - - /** - * minimum MB quantizer - * - encoding: unused - * - decoding: unused - */ - int mb_qmin; - - /** - * maximum MB quantizer - * - encoding: unused - * - decoding: unused - */ - int mb_qmax; + uint64_t error[AV_NUM_DATA_POINTERS]; /** * motion estimation comparison function @@ -1837,24 +2237,22 @@ typedef struct AVCodecContext { */ int color_table_id; +#if FF_API_INTERNAL_CONTEXT /** * internal_buffer count * Don't touch, used by libavcodec default_get_buffer(). + * @deprecated this field was moved to an internal context */ - int internal_buffer_count; + attribute_deprecated int internal_buffer_count; /** * internal_buffers * Don't touch, used by libavcodec default_get_buffer(). + * @deprecated this field was moved to an internal context */ - void *internal_buffer; + attribute_deprecated void *internal_buffer; +#endif -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1< of what can be used without an underflow. @@ -2556,6 +3027,7 @@ typedef struct AVCodecContext { */ int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); +#if FF_API_X264_GLOBAL_OPTS /** * explicit P-frame weighted prediction analysis method * 0: off @@ -2564,9 +3036,223 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: unused */ - int weighted_p_pred; + attribute_deprecated int weighted_p_pred; + + /** + * AQ mode + * 0: Disabled + * 1: Variance AQ (complexity mask) + * 2: Auto-variance AQ (experimental) + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated int aq_mode; + + /** + * AQ strength + * Reduces blocking and blurring in flat and textured areas. + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated float aq_strength; + + /** + * PSY RD + * Strength of psychovisual optimization + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated float psy_rd; + + /** + * PSY trellis + * Strength of psychovisual optimization + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated float psy_trellis; + + /** + * RC lookahead + * Number of frames for frametype and ratecontrol lookahead + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated int rc_lookahead; + + /** + * Constant rate factor maximum + * With CRF encoding mode and VBV restrictions enabled, prevents quality from being worse + * than crf_max, even if doing so would violate VBV restrictions. + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated float crf_max; +#endif + + int log_level_offset; + +#if FF_API_FLAC_GLOBAL_OPTS + /** + * Determine which LPC analysis algorithm to use. + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated enum AVLPCType lpc_type; + + /** + * Number of passes to use for Cholesky factorization during LPC analysis + * - encoding: Set by user + * - decoding: unused + */ + attribute_deprecated int lpc_passes; +#endif + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + + /** + * Current packet as passed into the decoder, to avoid having + * to pass the packet into every function. Currently only valid + * inside lavc and get/release_buffer callbacks. + * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts + * - encoding: unused + */ + AVPacket *pkt; + +#if FF_API_INTERNAL_CONTEXT + /** + * Whether this is a copy of the context which had init() called on it. + * This is used by multithreading - shared tables and picture pointers + * should be freed from the original context only. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + * + * @deprecated this field has been moved to an internal context + */ + attribute_deprecated int is_copy; +#endif + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * desired sample format + * - encoding: Not used. + * - decoding: Set by user. + * Decoder will decode to this format if it can. + */ + enum AVSampleFormat request_sample_fmt; + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) +#define AV_EF_BUFFER (1<<2) +#define AV_EF_EXPLODE (1<<3) + +#define AV_EF_CAREFUL (1<<16) +#define AV_EF_COMPLIANT (1<<17) +#define AV_EF_AGGRESSIVE (1<<18) + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by libavcodec + */ + enum AVFieldOrder field_order; + + /** + * Current statistics for PTS correction. + * - decoding: maintained and used by libavcodec, not intended to be used by user apps + * - encoding: unused + */ + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far + int64_t pts_correction_last_pts; /// PTS of the last frame + int64_t pts_correction_last_dts; /// DTS of the last frame + } AVCodecContext; +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +typedef struct AVCodecDefault AVCodecDefault; + /** * AVCodec. */ @@ -2578,7 +3264,7 @@ typedef struct AVCodec { * This is the primary way to find a codec from the user perspective. */ const char *name; - enum CodecType type; + enum AVMediaType type; enum CodecID id; int priv_data_size; int (*init)(AVCodecContext *); @@ -2604,8 +3290,54 @@ typedef struct AVCodec { */ const char *long_name; const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 - const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 - const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + */ + void (*init_static_data)(struct AVCodec *codec); + + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); } AVCodec; /** @@ -2622,9 +3354,9 @@ typedef struct AVHWAccel { /** * Type of codec implemented by the hardware accelerator. * - * See CODEC_TYPE_xxx + * See AVMEDIA_TYPE_xxx */ - enum CodecType type; + enum AVMediaType type; /** * Codec implemented by the hardware accelerator. @@ -2703,11 +3435,13 @@ typedef struct AVHWAccel { * the last component is alpha */ typedef struct AVPicture { - uint8_t *data[4]; - int linesize[4]; ///< number of bytes per line + uint8_t *data[AV_NUM_DATA_POINTERS]; + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line } AVPicture; -#if LIBAVCODEC_VERSION_MAJOR < 53 +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 +#if FF_API_PALETTE_CONTROL /** * AVPaletteControl * This structure defines a method for communicating palette changes @@ -2716,8 +3450,6 @@ typedef struct AVPicture { * @deprecated Use AVPacket to send palette changes instead. * This is totally broken. */ -#define AVPALETTE_SIZE 1024 -#define AVPALETTE_COUNT 256 typedef struct AVPaletteControl { /* Demuxer sets this to 1 to indicate the palette has changed; @@ -2821,6 +3553,14 @@ int av_new_packet(AVPacket *pkt, int size); */ void av_shrink_packet(AVPacket *pkt, int size); +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + /** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. @@ -2834,6 +3574,33 @@ int av_dup_packet(AVPacket *pkt); */ void av_free_packet(AVPacket *pkt); +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +int av_packet_merge_side_data(AVPacket *pkt); + +int av_packet_split_side_data(AVPacket *pkt); + + /* resample.c */ struct ReSampleContext; @@ -2841,15 +3608,8 @@ struct AVResampleContext; typedef struct ReSampleContext ReSampleContext; -#if LIBAVCODEC_VERSION_MAJOR < 53 /** - * @deprecated Use av_audio_resample_init() instead. - */ -attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate); -#endif -/** - * Initializes audio resampling context + * Initialize audio resampling context. * * @param output_channels number of output channels * @param input_channels number of input channels @@ -2857,26 +3617,33 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i * @param input_rate input sample rate * @param sample_fmt_out requested output sample format * @param sample_fmt_in input sample format - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated + * @param linear if 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - * @return allocated ReSampleContext, NULL if error occured + * @return allocated ReSampleContext, NULL if error occurred */ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, - enum SampleFormat sample_fmt_out, - enum SampleFormat sample_fmt_in, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff); int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ void audio_resample_close(ReSampleContext *s); /** - * Initializes an audio resampler. + * Initialize an audio resampler. * Note, if either rate is not an integer then simply scale both rates up so they are. * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq * @param log2_phase_count log2 of the number of entries in the polyphase filterbank @@ -2887,7 +3654,7 @@ void audio_resample_close(ReSampleContext *s); struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); /** - * resamples. + * Resample an array of samples using a previously configured context. * @param src an array of unconsumed samples * @param consumed the number of samples of src which have been consumed are returned here * @param src_size the number of unconsumed samples available @@ -2899,7 +3666,7 @@ int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consum /** - * Compensates samplerate/timestamp drift. The compensation is done by changing + * Compensate samplerate/timestamp drift. The compensation is done by changing * the resampler parameters, so no audible clicks or similar distortions occur * @param compensation_distance distance in output samples over which the compensation should be performed * @param sample_delta number of output samples which should be output less @@ -2914,7 +3681,9 @@ void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int c void av_resample_close(struct AVResampleContext *c); /** - * Allocate memory for a picture. Call avpicture_free to free it. + * Allocate memory for a picture. Call avpicture_free() to free it. + * + * @see avpicture_fill() * * @param picture the picture to be filled in * @param pix_fmt the format of the picture @@ -2926,6 +3695,8 @@ int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int /** * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. * * @param picture the AVPicture to be freed */ @@ -2941,6 +3712,9 @@ void avpicture_free(AVPicture *picture); * will be stored in the lines_sizes array. * Call with ptr == NULL to get the required size for the ptr buffer. * + * To allocate the buffer and fill in the AVPicture fields in one call, + * use avpicture_alloc(). + * * @param picture AVPicture whose fields are to be filled in * @param ptr Buffer which will contain or contains the actual image data * @param pix_fmt The format in which the picture data is stored. @@ -2950,6 +3724,22 @@ void avpicture_free(AVPicture *picture); */ int avpicture_fill(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * The data is stored compactly, without any gaps for alignment or padding + * which may be applied by avpicture_fill(). + * + * @see avpicture_get_size() + * + * @param[in] src AVPicture containing image data + * @param[in] pix_fmt The format in which the picture data is stored. + * @param[in] width the width of the image in pixels. + * @param[in] height the height of the image in pixels. + * @param[out] dest A buffer into which picture data will be copied. + * @param[in] dest_size The size of 'dest'. + * @return The number of bytes written to dest, or a negative value (error code) on error. + */ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size); @@ -2957,8 +3747,8 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, * Calculate the size in bytes that a picture of the given width and height * would occupy if stored in the given picture format. * Note that this returns the size of a compact representation as generated - * by avpicture_layout, which can be smaller than the size required for e.g. - * avpicture_fill. + * by avpicture_layout(), which can be smaller than the size required for e.g. + * avpicture_fill(). * * @param pix_fmt the given picture format * @param width the width of the image @@ -2967,22 +3757,41 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, */ int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height); void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift); + +/** + * Get the name of a codec. + * @return a static string identifying the codec; never NULL + */ +const char *avcodec_get_name(enum CodecID id); + +#if FF_API_GET_PIX_FMT_NAME +/** + * Return the short name for a pixel format. + * + * \see av_get_pix_fmt(), av_get_pix_fmt_string(). + * @deprecated Deprecated in favor of av_get_pix_fmt_name(). + */ +attribute_deprecated const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt); +#endif + void avcodec_set_dimensions(AVCodecContext *s, int width, int height); /** - * Returns the pixel format corresponding to the name name. - * - * If there is no pixel format with name name, then looks for a - * pixel format with the name corresponding to the native endian - * format of name. - * For example in a little-endian system, first looks for "gray16", - * then for "gray16le". - * - * Finally if no pixel format has been found, returns PIX_FMT_NONE. + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. */ -enum PixelFormat avcodec_get_pix_fmt(const char* name); -unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); +unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt); + +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf_size size in bytes of buf + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + */ +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ @@ -2992,7 +3801,7 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ /** - * Computes what kind of losses will occur when converting from one specific + * Compute what kind of losses will occur when converting from one specific * pixel format to another. * When converting from one pixel format to another, information loss may occur. * For example, when converting from RGB24 to GRAY, the color information will @@ -3006,13 +3815,14 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); * @param[in] dst_pix_fmt destination pixel format * @param[in] src_pix_fmt source pixel format * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). */ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, int has_alpha); /** - * Finds the best pixel format to convert to given a certain source pixel + * Find the best pixel format to convert to given a certain source pixel * format. When converting from one pixel format to another, information loss * may occur. For example, when converting from RGB24 to GRAY, the color * information will be lost. Similarly, other losses occur when converting from @@ -3021,9 +3831,11 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ * The pixel formats from which it chooses one, are determined by the * pix_fmt_mask parameter. * + * Note, only the first 64 pixel formats will fit in pix_fmt_mask. + * * @code * src_pix_fmt = PIX_FMT_YUV420P; - * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); + * pix_fmt_mask = (1 << PIX_FMT_YUV422P) | (1 << PIX_FMT_RGB24); * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); * @endcode * @@ -3036,19 +3848,40 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - /** - * Print in buf the string corresponding to the pixel format with - * number pix_fmt, or an header if pix_fmt is negative. + * Find the best pixel format to convert to given a certain source pixel + * format and a selection of two destination pixel formats. When converting from + * one pixel format to another, information loss may occur. For example, when converting + * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when + * converting from some formats to other formats. avcodec_find_best_pix_fmt2() selects which of + * the given pixel formats should be used to suffer the least amount of loss. * - * @param[in] buf the buffer where to write the string - * @param[in] buf_size the size of buf - * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or - * a negative value to print the corresponding header. - * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. + * If one of the destination formats is PIX_FMT_NONE the other pixel format (if valid) will be + * returned. + * + * @code + * src_pix_fmt = PIX_FMT_YUV420P; + * dst_pix_fmt1= PIX_FMT_RGB24; + * dst_pix_fmt2= PIX_FMT_GRAY8; + * dst_pix_fmt3= PIX_FMT_RGB8; + * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored. + * dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); + * dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); + * @endcode + * + * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from + * @param[in] dst_pix_fmt2 The other of the two destination pixel formats to choose from + * @param[in] src_pix_fmt Source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[in, out] loss_ptr Combination of loss flags. In: selects which of the losses to ignore, i.e. + * NULL or value of zero means we care about all losses. Out: the loss + * that occurs when converting from src to selected dst pixel format. + * @return The best pixel format to convert to or -1 if none was found. */ -void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); +enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, + enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); +#if FF_API_GET_ALPHA_INFO #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ @@ -3056,8 +3889,10 @@ void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); * Tell if an image really has transparent alpha values. * @return ored mask of FF_ALPHA_xxx constants */ +attribute_deprecated int img_get_alpha_info(const AVPicture *src, enum PixelFormat pix_fmt, int width, int height); +#endif /* deinterlace a picture */ /* deinterlace - if not supported return -1 */ @@ -3074,44 +3909,41 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, AVCodec *av_codec_next(AVCodec *c); /** - * Returns the LIBAVCODEC_VERSION_INT constant. + * Return the LIBAVCODEC_VERSION_INT constant. */ unsigned avcodec_version(void); /** - * Returns the libavcodec build-time configuration. + * Return the libavcodec build-time configuration. */ -const char * avcodec_configuration(void); +const char *avcodec_configuration(void); /** - * Returns the libavcodec license. + * Return the libavcodec license. */ -const char * avcodec_license(void); +const char *avcodec_license(void); +#if FF_API_AVCODEC_INIT /** - * Initializes libavcodec. - * - * @warning This function must be called before any other libavcodec - * function. + * @deprecated this function is called automatically from avcodec_register() + * and avcodec_register_all(), there is no need to call it manually */ +attribute_deprecated void avcodec_init(void); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Deprecated in favor of avcodec_register(). - */ -attribute_deprecated void register_avcodec(AVCodec *codec); #endif /** * Register the codec codec and initialize libavcodec. * - * @see avcodec_init() + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() */ void avcodec_register(AVCodec *codec); /** - * Finds a registered encoder with a matching codec ID. + * Find a registered encoder with a matching codec ID. * * @param id CodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. @@ -3119,7 +3951,7 @@ void avcodec_register(AVCodec *codec); AVCodec *avcodec_find_encoder(enum CodecID id); /** - * Finds a registered encoder with the specified name. + * Find a registered encoder with the specified name. * * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. @@ -3127,7 +3959,7 @@ AVCodec *avcodec_find_encoder(enum CodecID id); AVCodec *avcodec_find_encoder_by_name(const char *name); /** - * Finds a registered decoder with a matching codec ID. + * Find a registered decoder with a matching codec ID. * * @param id CodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. @@ -3135,7 +3967,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name); AVCodec *avcodec_find_decoder(enum CodecID id); /** - * Finds a registered decoder with the specified name. + * Find a registered decoder with the specified name. * * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. @@ -3144,38 +3976,95 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); /** - * Sets the fields of the given AVCodecContext to default values. + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +#if FF_API_ALLOC_CONTEXT +/** + * Set the fields of the given AVCodecContext to default values. * * @param s The AVCodecContext of which the fields should be set to default values. + * @deprecated use avcodec_get_context_defaults3 */ +attribute_deprecated void avcodec_get_context_defaults(AVCodecContext *s); /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! * we WILL change its arguments and name a few times! */ -void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType); +attribute_deprecated +void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); +#endif /** - * Allocates an AVCodecContext and sets its fields to default values. The + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); + +#if FF_API_ALLOC_CONTEXT +/** + * Allocate an AVCodecContext and set its fields to default values. The * resulting struct can be deallocated by simply calling av_free(). * * @return An AVCodecContext filled with default values or NULL on failure. * @see avcodec_get_context_defaults + * + * @deprecated use avcodec_alloc_context3() */ +attribute_deprecated AVCodecContext *avcodec_alloc_context(void); /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! * we WILL change its arguments and name a few times! */ -AVCodecContext *avcodec_alloc_context2(enum CodecType); +attribute_deprecated +AVCodecContext *avcodec_alloc_context2(enum AVMediaType); +#endif /** - * Sets the fields of the given AVFrame to default values. + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct can be deallocated by simply calling av_free(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + */ +AVCodecContext *avcodec_alloc_context3(AVCodec *codec); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + */ +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); + +/** + * Set the fields of the given AVFrame to default values. * * @param pic The AVFrame of which the fields should be set to default values. */ void avcodec_get_frame_defaults(AVFrame *pic); /** - * Allocates an AVFrame and sets its fields to default values. The resulting + * Allocate an AVFrame and set its fields to default values. The resulting * struct can be deallocated by simply calling av_free(). * * @return An AVFrame filled with default values or NULL on failure. @@ -3186,28 +4075,54 @@ AVFrame *avcodec_alloc_frame(void); int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); /** - * Checks if the given dimension of a picture is valid, meaning that all - * bytes of the picture can be addressed with a signed int. + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. * - * @param[in] w Width of the picture. - * @param[in] h Height of the picture. - * @return Zero if valid, a negative value if invalid. + * @return Required padding in pixels. */ -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); +unsigned avcodec_get_edge_width(void); +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased + * according to avcodec_get_edge_width() before. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased + * according to avcodec_get_edge_width() before. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); +#if FF_API_THREAD_INIT +/** + * @deprecated Set s->thread_count before calling avcodec_open2() instead of calling this. + */ +attribute_deprecated int avcodec_thread_init(AVCodecContext *s, int thread_count); -void avcodec_thread_free(AVCodecContext *s); -int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +#endif + int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef +#if FF_API_AVCODEC_OPEN /** - * Initializes the AVCodecContext to use the given AVCodec. Prior to using this + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this * function the context has to be allocated. * * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), @@ -3222,7 +4137,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, * if (!codec) * exit(1); * - * context = avcodec_alloc_context(); + * context = avcodec_alloc_context3(codec); * * if (avcodec_open(context, codec) < 0) * exit(1); @@ -3231,31 +4146,54 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, * @param avctx The context which will be set up to use the given codec. * @param codec The codec to use within the context. * @return zero on success, a negative value on error - * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder - */ -int avcodec_open(AVCodecContext *avctx, AVCodec *codec); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * Decodes an audio frame from buf into samples. - * Wrapper function which calls avcodec_decode_audio3. + * @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close * - * @deprecated Use avcodec_decode_audio3 instead. - * @param avctx the codec context - * @param[out] samples the output buffer - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] buf the input buffer - * @param[in] buf_size the input buffer size in bytes - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. + * @deprecated use avcodec_open2 */ -attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - const uint8_t *buf, int buf_size); +attribute_deprecated +int avcodec_open(AVCodecContext *avctx, AVCodec *codec); #endif /** - * Decodes the audio frame of size avpkt->size from avpkt->data into samples. + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); + +#if FF_API_OLD_DECODE_AUDIO +/** + * Wrapper function which calls avcodec_decode_audio4. + * + * @deprecated Use avcodec_decode_audio4 instead. + * + * Decode the audio frame of size avpkt->size from avpkt->data into samples. * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. In this case, * avcodec_decode_audio3 has to be called again with an AVPacket that contains @@ -3274,6 +4212,11 @@ attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *s * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * + * @warning You must not provide a custom get_buffer() when using + * avcodec_decode_audio3(). Doing so will override it with + * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, + * which does allow the application to provide a custom get_buffer(). + * * @note You might have to align the input buffer avpkt->data and output buffer * samples. The alignment requirements depend on the CPU: On some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others @@ -3283,8 +4226,14 @@ attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *s * samples should be 16 byte aligned unless the CPU doesn't need it * (AltiVec and SSE do). * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * * @param avctx the codec context * @param[out] samples the output buffer, sample type in avctx->sample_fmt + * If the sample format is planar, each channel plane will + * be the same size, with no padding between channels. * @param[in,out] frame_size_ptr the output buffer size in bytes * @param[in] avpkt The input AVPacket containing the input buffer. * You can create such packet with av_init_packet() and by then setting @@ -3293,31 +4242,49 @@ attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *s * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame data was decompressed (used) from the input AVPacket. */ -int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, +attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * Decodes a video frame from buf into picture. - * Wrapper function which calls avcodec_decode_video2. - * - * @deprecated Use avcodec_decode_video2 instead. - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const uint8_t *buf, int buf_size); #endif /** - * Decodes the video frame of size avpkt->size from avpkt->data into picture. + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame. In this case, + * avcodec_decode_audio4 has to be called again with an AVPacket containing + * the remaining data in order to decode the second frame, etc... + * Even if no frames are returned, the packet needs to be fed to the decoder + * with remaining data until it is completely consumed or an error occurs. + * + * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @note You might have to align the input buffer. The alignment requirements + * depend on the CPU and the decoder. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The + * decoder may, however, only utilize part of the buffer by + * setting AVFrame.nb_samples to a smaller value in the + * output frame. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + */ +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. * @@ -3335,15 +4302,23 @@ attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *pi * * In practice, avpkt->data should have 4 byte alignment at minimum. * - * @note Some codecs have a delay between input and output, these need to be - * feeded with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames. + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. * * @param avctx the codec context * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use avcodec_alloc_frame to get an AVFrame, the codec will + * allocate memory for the actual bitmap. + * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit. + * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder + * decodes and the decoder tells the user once it does not need the data anymore, + * the user app can at this point free/reuse/keep the memory as it sees fit. + * * @param[in] avpkt The input AVpacket containing the input buffer. * You can create such packet with av_init_packet() and by then setting * data and size, some decoders might in addition need other fields like - * flags&PKT_FLAG_KEY. All decoders are designed to use the least + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least * fields possible. * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. * @return On error a negative value is returned, otherwise the number of bytes @@ -3351,42 +4326,45 @@ attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *pi */ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, - AVPacket *avpkt); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/* Decode a subtitle message. Return -1 if error, otherwise return the - * number of bytes used. If no subtitle could be decompressed, - * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ -attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size); -#endif + const AVPacket *avpkt); /** - * Decodes a subtitle message. - * Returns a negative value on error, otherwise returns the number of bytes used. + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. * If no subtitle could be decompressed, got_sub_ptr is zero. * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. * * @param avctx the codec context - * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be + freed with avsubtitle_free if *got_sub_ptr is set. * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. * @param[in] avpkt The input AVPacket containing the input buffer. */ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt); -int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, - int *data_size_ptr, - uint8_t *buf, int buf_size); /** - * Encodes an audio frame from samples into buf. + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +#if FF_API_OLD_ENCODE_AUDIO +/** + * Encode an audio frame from samples into buf. + * + * @deprecated Use avcodec_encode_audio2 instead. * * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. - * However, for PCM audio the user will know how much space is needed - * because it depends on the value passed in buf_size as described - * below. In that case a lower value can be used. + * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user + * will know how much space is needed because it depends on the value passed + * in buf_size as described below. In that case a lower value can be used. * * @param avctx the codec context * @param[out] buf the output buffer @@ -3394,16 +4372,82 @@ int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, * @param[in] samples the input buffer containing the samples * The number of samples read from this buffer is frame_size*channels, * both of which are defined in avctx. - * For PCM audio the number of samples read from samples is equal to - * buf_size * input_sample_size / output_sample_size. + * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of + * samples read from samples is equal to: + * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) + * This also implies that av_get_bits_per_sample() must not return 0 for these + * codecs. * @return On error a negative value is returned, on success zero or the number * of bytes used to encode the data read from the input buffer. */ -int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const short *samples); +int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, + uint8_t *buf, int buf_size, + const short *samples); +#endif /** - * Encodes a video frame from pict into buf. + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * There are 2 codec capabilities that affect the allowed + * values of frame->nb_samples. + * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final + * frame may be smaller than avctx->frame_size, and all other + * frames must be equal to avctx->frame_size. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If neither is set, frame->nb_samples must be equal to + * avctx->frame_size for all frames. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +/** + * Fill audio frame data and linesize. + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment + * @return 0 on success, negative error code on failure + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Encode a video frame from pict into buf. * The input picture should be * stored using a specific format, namely avctx.pix_fmt. * @@ -3442,29 +4486,33 @@ void avcodec_default_free_buffers(AVCodecContext *s); /* misc useful functions */ +#if FF_API_OLD_FF_PICT_TYPES /** - * Returns a single letter to describe the given picture type pict_type. + * Return a single letter to describe the given picture type pict_type. * * @param[in] pict_type the picture type * @return A single character representing the picture type. + * @deprecated Use av_get_picture_type_char() instead. */ +attribute_deprecated char av_get_pict_type_char(int pict_type); +#endif /** - * Returns codec bits per sample. + * Return codec bits per sample. * * @param[in] codec_id the codec * @return Number of bits per sample or zero if unknown for the given codec. */ int av_get_bits_per_sample(enum CodecID codec_id); +#if FF_API_OLD_SAMPLE_FMT /** - * Returns sample format bits per sample. - * - * @param[in] sample_fmt the sample format - * @return Number of bits per sample or zero if unknown for the given sample format. + * @deprecated Use av_get_bytes_per_sample() instead. */ -int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); +attribute_deprecated +int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt); +#endif /* frame parsing */ typedef struct AVCodecParserContext { @@ -3502,14 +4550,17 @@ typedef struct AVCodecParserContext { int flags; #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 int64_t offset; ///< byte offset from starting packet start int64_t cur_frame_end[AV_PARSER_PTS_NB]; - /*! + /** * Set by parser to 1 for key frames and 0 for non-key frames. * It is initialized to -1, so if the parser doesn't set this flag, - * old-style fallback using FF_I_TYPE picture type as key frames + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames * will be used. */ int key_frame; @@ -3522,6 +4573,8 @@ typedef struct AVCodecParserContext { * the very first frame or from this keyframe. * Is AV_NOPTS_VALUE if unknown. * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. * * The purpose of this field is to allow seeking in streams that have no * keyframes in the conventional sense. It corresponds to the @@ -3608,15 +4661,6 @@ AVCodecParser *av_parser_next(AVCodecParser *c); void av_register_codec_parser(AVCodecParser *parser); AVCodecParserContext *av_parser_init(int codec_id); -#if LIBAVCODEC_VERSION_MAJOR < 53 -attribute_deprecated -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts); -#endif - /** * Parse a packet. * @@ -3691,15 +4735,14 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); /* memory */ /** - * Reallocates the given block if it is not large enough, otherwise it - * does nothing. + * Reallocate the given block if it is not large enough, otherwise do nothing. * * @see av_realloc */ -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); /** - * Allocates a buffer, reusing the given one if large enough. + * Allocate a buffer, reusing the given one if large enough. * * Contrary to av_fast_realloc the current buffer contents might not be * preserved and on error the old buffer is freed, thus no special @@ -3710,10 +4753,19 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and * *size 0 if an error occurred. */ -void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size); +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); /** - * Copy image 'src' to 'dst'. + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_PADDING_SIZE at the end which will will always be 0. + * + * In addition the whole buffer will initially and after resizes + * be 0-initialized so that no uninitialized data will ever appear. + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Copy image src to dst. Wraps av_picture_data_copy() above. */ void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height); @@ -3730,54 +4782,17 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src, int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color); +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); /** - * Parses str and put in width_ptr and height_ptr the detected values. - * - * @return 0 in case of a successful parsing, a negative value otherwise - * @param[in] str the string to parse: it has to be a string in the format - * x or a valid video frame size abbreviation. - * @param[in,out] width_ptr pointer to the variable which will contain the detected - * frame width value - * @param[in,out] height_ptr pointer to the variable which will contain the detected - * frame height value - */ -int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Parses str and put in frame_rate the detected values. - * - * @return 0 in case of a successful parsing, a negative value otherwise - * @param[in] str the string to parse: it has to be a string in the format - * /, a float number or a valid video rate abbreviation - * @param[in,out] frame_rate pointer to the AVRational which will contain the detected - * frame rate - */ -int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); - -/* error handling */ -#if EINVAL > 0 -#define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */ -#define AVUNERROR(e) (-(e)) /**< Returns a POSIX error code from a library function error return value. */ -#else -/* Some platforms have E* and errno already negated. */ -#define AVERROR(e) (e) -#define AVUNERROR(e) (e) -#endif -#define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */ -#define AVERROR_IO AVERROR(EIO) /**< I/O error */ -#define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< Number syntax expected in filename. */ -#define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */ -#define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */ -#define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */ -#define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */ -#define AVERROR_NOENT AVERROR(ENOENT) /**< No such file or directory. */ -#define AVERROR_EOF AVERROR(EPIPE) /**< End of file. */ -#define AVERROR_PATCHWELCOME -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */ - -/** - * Logs a generic warning message about a missing feature. This function is + * Log a generic warning message about a missing feature. This function is * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) * only, and would normally not be used by applications. * @param[in] avc a pointer to an arbitrary struct of which the first field is @@ -3791,17 +4806,17 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); void av_log_missing_feature(void *avc, const char *feature, int want_sample); /** - * Logs a generic warning message asking for a sample. This function is + * Log a generic warning message asking for a sample. This function is * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) * only, and would normally not be used by applications. * @param[in] avc a pointer to an arbitrary struct of which the first field is * a pointer to an AVClass struct * @param[in] msg string containing an optional message, or NULL if no message */ -void av_log_ask_for_sample(void *avc, const char *msg); +void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); /** - * Registers the hardware accelerator hwaccel. + * Register the hardware accelerator hwaccel. */ void av_register_hwaccel(AVHWAccel *hwaccel); @@ -3838,4 +4853,25 @@ enum AVLockOp { */ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum CodecID codec_id); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Get the AVClass for AVFrame. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_frame_class(void); + #endif /* AVCODEC_AVCODEC_H */ diff --git a/extern/ffmpeg/include/libavcodec/avfft.h b/extern/ffmpeg/include/libavcodec/avfft.h new file mode 100644 index 0000000000..be2d9c7e10 --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/avfft.h @@ -0,0 +1,99 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); +void av_rdft_calc(RDFTContext *s, FFTSample *data); +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); +void av_dct_calc(DCTContext *s, FFTSample *data); +void av_dct_end (DCTContext *s); + +#endif /* AVCODEC_AVFFT_H */ diff --git a/extern/ffmpeg/include/libavcodec/dxva2.h b/extern/ffmpeg/include/libavcodec/dxva2.h new file mode 100644 index 0000000000..fc99560830 --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/dxva2.h @@ -0,0 +1,71 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA_H +#define AVCODEC_DXVA_H + +#include + +#include +#include + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; +}; + +#endif /* AVCODEC_DXVA_H */ diff --git a/extern/ffmpeg/include/libavcodec/opt.h b/extern/ffmpeg/include/libavcodec/opt.h new file mode 100644 index 0000000000..2380e74332 --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/opt.h @@ -0,0 +1,34 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * This header is provided for compatibility only and will be removed + * on next major bump + */ + +#ifndef AVCODEC_OPT_H +#define AVCODEC_OPT_H + +#include "libavcodec/version.h" + +#if FF_API_OPT_H +#include "libavutil/opt.h" +#endif + +#endif /* AVCODEC_OPT_H */ diff --git a/extern/ffmpeg/include/libavcodec/vaapi.h b/extern/ffmpeg/include/libavcodec/vaapi.h new file mode 100644 index 0000000000..4c3bb9bb52 --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/vaapi.h @@ -0,0 +1,167 @@ +/* + * Video Acceleration API (shared data between FFmpeg and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +#include + +/** + * @defgroup VAAPI_Decoding VA API Decoding + * @ingroup Decoder + * @{ + */ + +/** + * This structure is used to share data between the FFmpeg library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t slice_data_size; +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/extern/ffmpeg/include/libavcodec/vda.h b/extern/ffmpeg/include/libavcodec/vda.h new file mode 100644 index 0000000000..6e9de9cd0a --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/vda.h @@ -0,0 +1,168 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +#include +#include + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture +#include +#undef Picture + +/** + * This structure is used to store a decoded frame information and data. + */ +typedef struct { + /** + * The PTS of the frame. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + int64_t pts; + + /** + * The CoreVideo buffer that contains the decoded data. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + CVPixelBufferRef cv_buffer; + + /** + * A pointer to the next frame. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + struct vda_frame *next_frame; +} vda_frame; + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * VDA frames queue ordered by presentation timestamp. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + vda_frame *queue; + + /** + * Mutex for locking queue operations. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + pthread_mutex_t queue_mutex; + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * The current bitstream buffer. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + uint8_t *bitstream; + + /** + * The current size of the bitstream. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + int bitstream_size; + + /** + * The reference size used for fast reallocation. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + int ref_size; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +/** Return the top frame of the queue. */ +vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx); + +/** Release the given frame. */ +void ff_vda_release_vda_frame(vda_frame *frame); + +#endif /* AVCODEC_VDA_H */ diff --git a/src/ffmpeg/modern_working/include/libavcodec/vdpau.h b/extern/ffmpeg/include/libavcodec/vdpau.h similarity index 89% rename from src/ffmpeg/modern_working/include/libavcodec/vdpau.h rename to extern/ffmpeg/include/libavcodec/vdpau.h index a8fa4d3877..f3a547184d 100644 --- a/src/ffmpeg/modern_working/include/libavcodec/vdpau.h +++ b/extern/ffmpeg/include/libavcodec/vdpau.h @@ -25,7 +25,7 @@ #define AVCODEC_VDPAU_H /** - * \defgroup Decoder VDPAU Decoder and Renderer + * @defgroup Decoder VDPAU Decoder and Renderer * * VDPAU hardware acceleration has two modules * - VDPAU decoding @@ -38,26 +38,25 @@ * and rendering (API calls) are done as part of the VDPAU * presentation (vo_vdpau.c) module. * - * @{ - * \defgroup VDPAU_Decoding VDPAU Decoding - * \ingroup Decoder + * @defgroup VDPAU_Decoding VDPAU Decoding + * @ingroup Decoder * @{ */ #include #include -/** \brief The videoSurface is used for rendering. */ +/** @brief The videoSurface is used for rendering. */ #define FF_VDPAU_STATE_USED_FOR_RENDER 1 /** - * \brief The videoSurface is needed for reference/prediction. + * @brief The videoSurface is needed for reference/prediction. * The codec manipulates this. */ #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 /** - * \brief This structure is used as a callback between the FFmpeg + * @brief This structure is used as a callback between the FFmpeg * decoder (vd_) and presentation (vo_) module. * This is used for defining a video frame containing surface, * picture parameter, bitstream information etc which are passed @@ -68,6 +67,13 @@ struct vdpau_render_state { int state; ///< Holds FF_VDPAU_STATE_* values. + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; + /** picture parameter information for all supported codecs */ union VdpPictureInfo { VdpPictureInfoH264 h264; @@ -75,13 +81,6 @@ struct vdpau_render_state { VdpPictureInfoVC1 vc1; VdpPictureInfoMPEG4Part2 mpeg4; } info; - - /** Describe size/location of the compressed video data. - Set to 0 when freeing bitstream_buffers. */ - int bitstream_buffers_allocated; - int bitstream_buffers_used; - /** The user is responsible for freeing this buffer using av_freep(). */ - VdpBitstreamBuffer *bitstream_buffers; }; /* @}*/ diff --git a/extern/ffmpeg/include/libavcodec/version.h b/extern/ffmpeg/include/libavcodec/version.h new file mode 100644 index 0000000000..d67ad2f5d2 --- /dev/null +++ b/extern/ffmpeg/include/libavcodec/version.h @@ -0,0 +1,130 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +#define LIBAVCODEC_VERSION_MAJOR 53 +#define LIBAVCODEC_VERSION_MINOR 60 +#define LIBAVCODEC_VERSION_MICRO 100 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_PALETTE_CONTROL +#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_SAMPLE_FMT +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_AUDIOCONVERT +#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ANTIALIAS_ALGO +#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OPT_H +#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_THREAD_INIT +#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_FF_PICT_TYPES +#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FLAC_GLOBAL_OPTS +#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_GET_PIX_FMT_NAME +#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ALLOC_CONTEXT +#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AVCODEC_OPEN +#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_DRC_SCALE +#define FF_API_DRC_SCALE (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ER +#define FF_API_ER (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AVCODEC_INIT +#define FF_API_AVCODEC_INIT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_X264_GLOBAL_OPTS +#define FF_API_X264_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_MPEGVIDEO_GLOBAL_OPTS +#define FF_API_MPEGVIDEO_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_LAME_GLOBAL_OPTS +#define FF_API_LAME_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_SNOW_GLOBAL_OPTS +#define FF_API_SNOW_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_MJPEG_GLOBAL_OPTS +#define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_GET_ALPHA_INFO +#define FF_API_GET_ALPHA_INFO (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PARSE_FRAME +#define FF_API_PARSE_FRAME (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_INTERNAL_CONTEXT +#define FF_API_INTERNAL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_TIFFENC_COMPLEVEL +#define FF_API_TIFFENC_COMPLEVEL (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_DATA_POINTERS +#define FF_API_DATA_POINTERS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_DECODE_AUDIO +#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OLD_TIMECODE +#define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 54) +#endif + +#ifndef FF_API_AVFRAME_AGE +#define FF_API_AVFRAME_AGE (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_ENCODE_AUDIO +#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/src/ffmpeg/modern_working/include/libavcodec/xvmc.h b/extern/ffmpeg/include/libavcodec/xvmc.h similarity index 85% rename from src/ffmpeg/modern_working/include/libavcodec/xvmc.h rename to extern/ffmpeg/include/libavcodec/xvmc.h index 01f84b28c5..93ad8bb9a5 100644 --- a/src/ffmpeg/modern_working/include/libavcodec/xvmc.h +++ b/extern/ffmpeg/include/libavcodec/xvmc.h @@ -25,11 +25,6 @@ #include "avcodec.h" -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ -#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ -#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ -#endif #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 speak for the letters IDCT MCo (motion compensation) */ @@ -71,7 +66,7 @@ struct xvmc_pix_fmt { */ int allocated_data_blocks; - /** Indicates that the hardware would interpret data_blocks as IDCT + /** Indicate that the hardware would interpret data_blocks as IDCT coefficients and perform IDCT on them. - application - set during initialization - libavcodec - unchanged @@ -151,22 +146,6 @@ struct xvmc_pix_fmt { of coded blocks it contains. */ int next_free_data_block_num; - -/** extensions may be placed here */ -#if LIBAVCODEC_VERSION_MAJOR < 53 -//@{ - /** State flags used to work around limitations in the MPlayer video system. - 0 - Surface is not used. - 1 - Surface is still held in application to be displayed or is - still visible. - 2 - Surface is still held in libavcodec buffer for prediction. - */ - int state; - - /** pointer to the surface where the subpicture is rendered */ - void* p_osd_target_surface_render; -//}@ -#endif }; #endif /* AVCODEC_XVMC_H */ diff --git a/src/ffmpeg/modern_working/include/libavdevice/avdevice.h b/extern/ffmpeg/include/libavdevice/avdevice.h similarity index 57% rename from src/ffmpeg/modern_working/include/libavdevice/avdevice.h rename to extern/ffmpeg/include/libavdevice/avdevice.h index 124cfa28a0..5abf9f523f 100644 --- a/src/ffmpeg/modern_working/include/libavdevice/avdevice.h +++ b/extern/ffmpeg/include/libavdevice/avdevice.h @@ -19,11 +19,34 @@ #ifndef AVDEVICE_AVDEVICE_H #define AVDEVICE_AVDEVICE_H -#include "libavutil/avutil.h" +/** + * @file + * @ingroup lavd + * Main libavdevice API header + */ -#define LIBAVDEVICE_VERSION_MAJOR 52 -#define LIBAVDEVICE_VERSION_MINOR 2 -#define LIBAVDEVICE_VERSION_MICRO 0 +/** + * @defgroup lavd Special devices muxing/demuxing library + * @{ + * Libavdevice is a complementary library to @ref libavf "libavformat". It + * provides various "special" platform-specific muxers and demuxers, e.g. for + * grabbing devices, audio capture and playback etc. As a consequence, the + * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own + * I/O functions). The filename passed to avformat_open_input() often does not + * refer to an actually existing file, but has some special device-specific + * meaning - e.g. for the x11grab device it is the display name. + * + * To use libavdevice, simply call avdevice_register_all() to register all + * compiled muxers and demuxers. They all use standard libavformat API. + * @} + */ + +#include "libavutil/avutil.h" +#include "libavformat/avformat.h" + +#define LIBAVDEVICE_VERSION_MAJOR 53 +#define LIBAVDEVICE_VERSION_MINOR 4 +#define LIBAVDEVICE_VERSION_MICRO 100 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ @@ -34,19 +57,19 @@ #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT /** - * Returns the LIBAVDEVICE_VERSION_INT constant. + * Return the LIBAVDEVICE_VERSION_INT constant. */ unsigned avdevice_version(void); /** - * Returns the libavdevice build-time configuration. + * Return the libavdevice build-time configuration. */ -const char * avdevice_configuration(void); +const char *avdevice_configuration(void); /** - * Returns the libavdevice license. + * Return the libavdevice license. */ -const char * avdevice_license(void); +const char *avdevice_license(void); /** * Initialize libavdevice and register all the input and output devices. diff --git a/extern/ffmpeg/include/libavfilter/avcodec.h b/extern/ffmpeg/include/libavfilter/avcodec.h new file mode 100644 index 0000000000..22dd1a263e --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/avcodec.h @@ -0,0 +1,71 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVCODEC_H +#define AVFILTER_AVCODEC_H + +/** + * @file + * libavcodec/libavfilter gluing utilities + * + * This should be included in an application ONLY if the installed + * libavfilter has been compiled with libavcodec support, otherwise + * symbols defined below will not be available. + */ + +#include "libavcodec/avcodec.h" // AVFrame +#include "avfilter.h" +#include "vsrc_buffer.h" + +/** + * Copy the frame properties of src to dst, without copying the actual + * image data. + */ +int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); + +/** + * Create and return a picref reference from the data and properties + * contained in frame. + * + * @param perms permissions to assign to the new buffer reference + */ +AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms); + +/** + * Fill an AVFrame with the information stored in picref. + * + * @param frame an already allocated AVFrame + * @param picref a video buffer reference + * @return 0 in case of success, a negative AVERROR code in case of + * failure + */ +int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame, + const AVFilterBufferRef *picref); + +/** + * Add frame data to buffer_src. + * + * @param buffer_src pointer to a buffer source context + * @param flags a combination of AV_VSRC_BUF_FLAG_* flags + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, + const AVFrame *frame, int flags); + +#endif /* AVFILTER_AVCODEC_H */ diff --git a/extern/ffmpeg/include/libavfilter/avfilter.h b/extern/ffmpeg/include/libavfilter/avfilter.h new file mode 100644 index 0000000000..9c7a2e5bbf --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/avfilter.h @@ -0,0 +1,948 @@ +/* + * filter layer + * Copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVFILTER_H +#define AVFILTER_AVFILTER_H + +#include "libavutil/avutil.h" +#include "libavutil/log.h" +#include "libavutil/samplefmt.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "libavcodec/avcodec.h" + + +#ifndef FF_API_OLD_VSINK_API +#define FF_API_OLD_VSINK_API (LIBAVFILTER_VERSION_MAJOR < 3) +#endif +#ifndef FF_API_OLD_ALL_FORMATS_API +#define FF_API_OLD_ALL_FORMATS_API (LIBAVFILTER_VERSION_MAJOR < 3) +#endif + +#include + +#include "libavfilter/version.h" + +/** + * Return the LIBAVFILTER_VERSION_INT constant. + */ +unsigned avfilter_version(void); + +/** + * Return the libavfilter build-time configuration. + */ +const char *avfilter_configuration(void); + +/** + * Return the libavfilter license. + */ +const char *avfilter_license(void); + + +typedef struct AVFilterContext AVFilterContext; +typedef struct AVFilterLink AVFilterLink; +typedef struct AVFilterPad AVFilterPad; + +/** + * A reference-counted buffer data type used by the filter system. Filters + * should not store pointers to this structure directly, but instead use the + * AVFilterBufferRef structure below. + */ +typedef struct AVFilterBuffer { + uint8_t *data[8]; ///< buffer data for each plane/channel + int linesize[8]; ///< number of bytes per line + + unsigned refcount; ///< number of references to this buffer + + /** private data to be used by a custom free function */ + void *priv; + /** + * A pointer to the function to deallocate this buffer if the default + * function is not sufficient. This could, for example, add the memory + * back into a memory pool to be reused later without the overhead of + * reallocating it from scratch. + */ + void (*free)(struct AVFilterBuffer *buf); + + int format; ///< media format + int w, h; ///< width and height of the allocated buffer +} AVFilterBuffer; + +#define AV_PERM_READ 0x01 ///< can read from the buffer +#define AV_PERM_WRITE 0x02 ///< can write to the buffer +#define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer +#define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time +#define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time +#define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes +#define AV_PERM_ALIGN 0x40 ///< the buffer must be aligned + +#define AVFILTER_ALIGN 16 //not part of ABI + +/** + * Audio specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, audio specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefAudioProps { + uint64_t channel_layout; ///< channel layout of audio buffer + int nb_samples; ///< number of audio samples per channel + int sample_rate; ///< audio buffer sample rate + int planar; ///< audio buffer - planar or packed +} AVFilterBufferRefAudioProps; + +/** + * Video specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, video specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefVideoProps { + int w; ///< image width + int h; ///< image height + AVRational sample_aspect_ratio; ///< sample aspect ratio + int interlaced; ///< is frame interlaced + int top_field_first; ///< field order + enum AVPictureType pict_type; ///< picture type of the frame + int key_frame; ///< 1 -> keyframe, 0-> not +} AVFilterBufferRefVideoProps; + +/** + * A reference to an AVFilterBuffer. Since filters can manipulate the origin of + * a buffer to, for example, crop image without any memcpy, the buffer origin + * and dimensions are per-reference properties. Linesize is also useful for + * image flipping, frame to field filters, etc, and so is also per-reference. + * + * TODO: add anything necessary for frame reordering + */ +typedef struct AVFilterBufferRef { + AVFilterBuffer *buf; ///< the buffer that this is a reference to + uint8_t *data[8]; ///< picture/audio data for each plane + int linesize[8]; ///< number of bytes per line + int format; ///< media format + + /** + * presentation timestamp. The time unit may change during + * filtering, as it is specified in the link and the filter code + * may need to rescale the PTS accordingly. + */ + int64_t pts; + int64_t pos; ///< byte position in stream, -1 if unknown + + int perms; ///< permissions, see the AV_PERM_* flags + + enum AVMediaType type; ///< media type of buffer data + AVFilterBufferRefVideoProps *video; ///< video buffer specific properties + AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties +} AVFilterBufferRef; + +/** + * Copy properties of src to dst, without copying the actual data + */ +static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) +{ + // copy common properties + dst->pts = src->pts; + dst->pos = src->pos; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; + case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; + default: break; + } +} + +/** + * Add a new reference to a buffer. + * + * @param ref an existing reference to the buffer + * @param pmask a bitmask containing the allowable permissions in the new + * reference + * @return a new reference to the buffer with the same properties as the + * old, excluding any permissions denied by pmask + */ +AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask); + +/** + * Remove a reference to a buffer. If this is the last reference to the + * buffer, the buffer itself is also automatically freed. + * + * @param ref reference to the buffer, may be NULL + */ +void avfilter_unref_buffer(AVFilterBufferRef *ref); + +/** + * A list of supported formats for one end of a filter link. This is used + * during the format negotiation process to try to pick the best format to + * use to minimize the number of necessary conversions. Each filter gives a + * list of the formats supported by each input and output pad. The list + * given for each pad need not be distinct - they may be references to the + * same list of formats, as is often the case when a filter supports multiple + * formats, but will always output the same format as it is given in input. + * + * In this way, a list of possible input formats and a list of possible + * output formats are associated with each link. When a set of formats is + * negotiated over a link, the input and output lists are merged to form a + * new list containing only the common elements of each list. In the case + * that there were no common elements, a format conversion is necessary. + * Otherwise, the lists are merged, and all other links which reference + * either of the format lists involved in the merge are also affected. + * + * For example, consider the filter chain: + * filter (a) --> (b) filter (b) --> (c) filter + * + * where the letters in parenthesis indicate a list of formats supported on + * the input or output of the link. Suppose the lists are as follows: + * (a) = {A, B} + * (b) = {A, B, C} + * (c) = {B, C} + * + * First, the first link's lists are merged, yielding: + * filter (a) --> (a) filter (a) --> (c) filter + * + * Notice that format list (b) now refers to the same list as filter list (a). + * Next, the lists for the second link are merged, yielding: + * filter (a) --> (a) filter (a) --> (a) filter + * + * where (a) = {B}. + * + * Unfortunately, when the format lists at the two ends of a link are merged, + * we must ensure that all links which reference either pre-merge format list + * get updated as well. Therefore, we have the format list structure store a + * pointer to each of the pointers to itself. + */ +typedef struct AVFilterFormats { + unsigned format_count; ///< number of formats + int64_t *formats; ///< list of media formats + + unsigned refcount; ///< number of references to this list + struct AVFilterFormats ***refs; ///< references to this list +} AVFilterFormats; + +/** + * Create a list of supported formats. This is intended for use in + * AVFilter->query_formats(). + * + * @param fmts list of media formats, terminated by -1. If NULL an + * empty list is created. + * @return the format list, with no existing references + */ +AVFilterFormats *avfilter_make_format_list(const int *fmts); +AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts); + +/** + * Add fmt to the list of media formats contained in *avff. + * If *avff is NULL the function allocates the filter formats struct + * and puts its pointer in *avff. + * + * @return a non negative value in case of success, or a negative + * value corresponding to an AVERROR code in case of error + */ +int avfilter_add_format(AVFilterFormats **avff, int64_t fmt); + +#if FF_API_OLD_ALL_FORMATS_API +/** + * @deprecated Use avfilter_make_all_formats() instead. + */ +attribute_deprecated +AVFilterFormats *avfilter_all_formats(enum AVMediaType type); +#endif + +/** + * Return a list of all formats supported by FFmpeg for the given media type. + */ +AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type); + +/** + * A list of all channel layouts supported by libavfilter. + */ +extern const int64_t avfilter_all_channel_layouts[]; + +/** + * Return a list of all channel layouts supported by FFmpeg. + */ +AVFilterFormats *avfilter_make_all_channel_layouts(void); + +/** + * Return a list of all audio packing formats. + */ +AVFilterFormats *avfilter_make_all_packing_formats(void); + +/** + * Return a format list which contains the intersection of the formats of + * a and b. Also, all the references of a, all the references of b, and + * a and b themselves will be deallocated. + * + * If a and b do not share any common formats, neither is modified, and NULL + * is returned. + */ +AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b); + +/** + * Add *ref as a new reference to formats. + * That is the pointers will point like in the ASCII art below: + * ________ + * |formats |<--------. + * | ____ | ____|___________________ + * | |refs| | | __|_ + * | |* * | | | | | | AVFilterLink + * | |* *--------->|*ref| + * | |____| | | |____| + * |________| |________________________ + */ +void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref); + +/** + * If *ref is non-NULL, remove *ref as a reference to the format list + * it currently points to, deallocates that list if this was the last + * reference, and sets *ref to NULL. + * + * Before After + * ________ ________ NULL + * |formats |<--------. |formats | ^ + * | ____ | ____|________________ | ____ | ____|________________ + * | |refs| | | __|_ | |refs| | | __|_ + * | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink + * | |* *--------->|*ref| | |* | | | |*ref| + * | |____| | | |____| | |____| | | |____| + * |________| |_____________________ |________| |_____________________ + */ +void avfilter_formats_unref(AVFilterFormats **ref); + +/** + * + * Before After + * ________ ________ + * |formats |<---------. |formats |<---------. + * | ____ | ___|___ | ____ | ___|___ + * | |refs| | | | | | |refs| | | | | NULL + * | |* *--------->|*oldref| | |* *--------->|*newref| ^ + * | |* * | | |_______| | |* * | | |_______| ___|___ + * | |____| | | |____| | | | | + * |________| |________| |*oldref| + * |_______| + */ +void avfilter_formats_changeref(AVFilterFormats **oldref, + AVFilterFormats **newref); + +/** + * A filter pad used for either input or output. + */ +struct AVFilterPad { + /** + * Pad name. The name is unique among inputs and among outputs, but an + * input may have the same name as an output. This may be NULL if this + * pad has no need to ever be referenced by name. + */ + const char *name; + + /** + * AVFilterPad type. Can be AVMEDIA_TYPE_VIDEO or AVMEDIA_TYPE_AUDIO. + */ + enum AVMediaType type; + + /** + * Minimum required permissions on incoming buffers. Any buffer with + * insufficient permissions will be automatically copied by the filter + * system to a new buffer which provides the needed access permissions. + * + * Input pads only. + */ + int min_perms; + + /** + * Permissions which are not accepted on incoming buffers. Any buffer + * which has any of these permissions set will be automatically copied + * by the filter system to a new buffer which does not have those + * permissions. This can be used to easily disallow buffers with + * AV_PERM_REUSE. + * + * Input pads only. + */ + int rej_perms; + + /** + * Callback called before passing the first slice of a new frame. If + * NULL, the filter layer will default to storing a reference to the + * picture inside the link structure. + * + * Input video pads only. + */ + void (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref); + + /** + * Callback function to get a video buffer. If NULL, the filter system will + * use avfilter_default_get_video_buffer(). + * + * Input video pads only. + */ + AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h); + + /** + * Callback function to get an audio buffer. If NULL, the filter system will + * use avfilter_default_get_audio_buffer(). + * + * Input audio pads only. + */ + AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, int nb_samples); + + /** + * Callback called after the slices of a frame are completely sent. If + * NULL, the filter layer will default to releasing the reference stored + * in the link structure during start_frame(). + * + * Input video pads only. + */ + void (*end_frame)(AVFilterLink *link); + + /** + * Slice drawing callback. This is where a filter receives video data + * and should do its processing. + * + * Input video pads only. + */ + void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir); + + /** + * Samples filtering callback. This is where a filter receives audio data + * and should do its processing. + * + * Input audio pads only. + */ + void (*filter_samples)(AVFilterLink *link, AVFilterBufferRef *samplesref); + + /** + * Frame poll callback. This returns the number of immediately available + * samples. It should return a positive value if the next request_frame() + * is guaranteed to return one frame (with no delay). + * + * Defaults to just calling the source poll_frame() method. + * + * Output video pads only. + */ + int (*poll_frame)(AVFilterLink *link); + + /** + * Frame request callback. A call to this should result in at least one + * frame being output over the given link. This should return zero on + * success, and another value on error. + * + * Output video pads only. + */ + int (*request_frame)(AVFilterLink *link); + + /** + * Link configuration callback. + * + * For output pads, this should set the following link properties: + * video: width, height, sample_aspect_ratio, time_base + * audio: sample_rate. + * + * This should NOT set properties such as format, channel_layout, etc which + * are negotiated between filters by the filter system using the + * query_formats() callback before this function is called. + * + * For input pads, this should check the properties of the link, and update + * the filter's internal state as necessary. + * + * For both input and output pads, this should return zero on success, + * and another value on error. + */ + int (*config_props)(AVFilterLink *link); +}; + +/** default handler for start_frame() for video inputs */ +void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); + +/** default handler for draw_slice() for video inputs */ +void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); + +/** default handler for end_frame() for video inputs */ +void avfilter_default_end_frame(AVFilterLink *link); + +/** default handler for filter_samples() for audio inputs */ +void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + +/** default handler for get_video_buffer() for video inputs */ +AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, + int perms, int w, int h); + +/** default handler for get_audio_buffer() for audio inputs */ +AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, + int perms, int nb_samples); + +/** + * Helpers for query_formats() which set all links to the same list of + * formats/layouts. If there are no links hooked to this filter, the list + * of formats is freed. + */ +void avfilter_set_common_pixel_formats(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats); + +/** Default handler for query_formats() */ +int avfilter_default_query_formats(AVFilterContext *ctx); + +/** start_frame() handler for filters which simply pass video along */ +void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); + +/** draw_slice() handler for filters which simply pass video along */ +void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); + +/** end_frame() handler for filters which simply pass video along */ +void avfilter_null_end_frame(AVFilterLink *link); + +/** filter_samples() handler for filters which simply pass audio along */ +void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + +/** get_video_buffer() handler for filters which simply pass video along */ +AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, + int perms, int w, int h); + +/** get_audio_buffer() handler for filters which simply pass audio along */ +AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, + int perms, int nb_samples); + +/** + * Filter definition. This defines the pads a filter contains, and all the + * callback functions used to interact with the filter. + */ +typedef struct AVFilter { + const char *name; ///< filter name + + int priv_size; ///< size of private data to allocate for the filter + + /** + * Filter initialization function. Args contains the user-supplied + * parameters. FIXME: maybe an AVOption-based system would be better? + * opaque is data provided by the code requesting creation of the filter, + * and is used to pass data to the filter. + */ + int (*init)(AVFilterContext *ctx, const char *args, void *opaque); + + /** + * Filter uninitialization function. Should deallocate any memory held + * by the filter, release any buffer references, etc. This does not need + * to deallocate the AVFilterContext->priv memory itself. + */ + void (*uninit)(AVFilterContext *ctx); + + /** + * Queries formats/layouts supported by the filter and its pads, and sets + * the in_formats/in_chlayouts for links connected to its output pads, + * and out_formats/out_chlayouts for links connected to its input pads. + * + * @return zero on success, a negative value corresponding to an + * AVERROR code otherwise + */ + int (*query_formats)(AVFilterContext *); + + const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none + const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none + + /** + * A description for the filter. You should use the + * NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *description; + + /** + * Make the filter instance process a command. + * + * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @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. + * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be + * time consuming then a filter should treat it like an unsupported command + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ + int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags); +} AVFilter; + +/** An instance of a filter */ +struct AVFilterContext { + const AVClass *av_class; ///< needed for av_log() + + AVFilter *filter; ///< the AVFilter of which this is an instance + + char *name; ///< name of this filter instance + + unsigned input_count; ///< number of input pads + AVFilterPad *input_pads; ///< array of input pads + AVFilterLink **inputs; ///< array of pointers to input links + + unsigned output_count; ///< number of output pads + AVFilterPad *output_pads; ///< array of output pads + AVFilterLink **outputs; ///< array of pointers to output links + + void *priv; ///< private data for use by the filter + + struct AVFilterCommand *command_queue; +}; + +enum AVFilterPacking { + AVFILTER_PACKED = 0, + AVFILTER_PLANAR, +}; + +/** + * A link between two filters. This contains pointers to the source and + * destination filters between which this link exists, and the indexes of + * the pads involved. In addition, this link also contains the parameters + * which have been negotiated and agreed upon between the filter, such as + * image dimensions, format, etc. + */ +struct AVFilterLink { + AVFilterContext *src; ///< source filter + AVFilterPad *srcpad; ///< output pad on the source filter + + AVFilterContext *dst; ///< dest filter + AVFilterPad *dstpad; ///< input pad on the dest filter + + /** stage of the initialization of the link properties (dimensions, etc) */ + enum { + AVLINK_UNINIT = 0, ///< not started + AVLINK_STARTINIT, ///< started, but incomplete + AVLINK_INIT ///< complete + } init_state; + + enum AVMediaType type; ///< filter media type + + /* These parameters apply only to video */ + int w; ///< agreed upon image width + int h; ///< agreed upon image height + AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio + /* These parameters apply only to audio */ + uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h) +#if LIBAVFILTER_VERSION_MAJOR < 3 + int64_t sample_rate; ///< samples per second +#else + int sample_rate; ///< samples per second +#endif + int planar; ///< agreed upon packing mode of audio buffers. true if planar. + + int format; ///< agreed upon media format + + /** + * Lists of formats and channel layouts supported by the input and output + * filters respectively. These lists are used for negotiating the format + * to actually be used, which will be loaded into the format and + * channel_layout members, above, when chosen. + * + */ + AVFilterFormats *in_formats; + AVFilterFormats *out_formats; + + AVFilterFormats *in_chlayouts; + AVFilterFormats *out_chlayouts; + AVFilterFormats *in_packing; + AVFilterFormats *out_packing; + + /** + * The buffer reference currently being sent across the link by the source + * filter. This is used internally by the filter system to allow + * automatic copying of buffers which do not have sufficient permissions + * for the destination. This should not be accessed directly by the + * filters. + */ + AVFilterBufferRef *src_buf; + + AVFilterBufferRef *cur_buf; + AVFilterBufferRef *out_buf; + + /** + * Define the time base used by the PTS of the frames/samples + * which will pass through this link. + * During the configuration stage, each filter is supposed to + * change only the output timebase, while the timebase of the + * input link is assumed to be an unchangeable property. + */ + AVRational time_base; + + struct AVFilterPool *pool; +}; + +/** + * Link two filters together. + * + * @param src the source filter + * @param srcpad index of the output pad on the source filter + * @param dst the destination filter + * @param dstpad index of the input pad on the destination filter + * @return zero on success + */ +int avfilter_link(AVFilterContext *src, unsigned srcpad, + AVFilterContext *dst, unsigned dstpad); + +/** + * Free the link in *link, and set its pointer to NULL. + */ +void avfilter_link_free(AVFilterLink **link); + +/** + * Negotiate the media format, dimensions, etc of all inputs to a filter. + * + * @param filter the filter to negotiate the properties for its inputs + * @return zero on successful negotiation + */ +int avfilter_config_links(AVFilterContext *filter); + +/** + * Request a picture buffer with a specific set of permissions. + * + * @param link the output link to the filter from which the buffer will + * be requested + * @param perms the required access permissions + * @param w the minimum width of the buffer to allocate + * @param h the minimum height of the buffer to allocate + * @return A reference to the buffer. This must be unreferenced with + * avfilter_unref_buffer when you are finished with it. + */ +AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, + int w, int h); + +/** + * Create a buffer reference wrapped around an already allocated image + * buffer. + * + * @param data pointers to the planes of the image to reference + * @param linesize linesizes for the planes of the image to reference + * @param perms the required access permissions + * @param w the width of the image specified by the data and linesize arrays + * @param h the height of the image specified by the data and linesize arrays + * @param format the pixel format of the image specified by the data and linesize arrays + */ +AVFilterBufferRef * +avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms, + int w, int h, enum PixelFormat format); + +/** + * Request an audio samples buffer with a specific set of permissions. + * + * @param link the output link to the filter from which the buffer will + * be requested + * @param perms the required access permissions + * @param nb_samples the number of samples per channel + * @return A reference to the samples. This must be unreferenced with + * avfilter_unref_buffer when you are finished with it. + */ +AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, + int nb_samples); + +/** + * Create an audio buffer reference wrapped around an already + * allocated samples buffer. + * + * @param data pointers to the samples plane buffers + * @param linesize linesize for the samples plane buffers + * @param perms the required access permissions + * @param nb_samples number of samples per channel + * @param sample_fmt the format of each sample in the buffer to allocate + * @param channel_layout the channel layout of the buffer + * @param planar audio data layout - planar or packed + */ +AVFilterBufferRef * +avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8], int linesize[8], int perms, + int nb_samples, enum AVSampleFormat sample_fmt, + uint64_t channel_layout, int planar); +/** + * Request an input frame from the filter at the other end of the link. + * + * @param link the input link + * @return zero on success + */ +int avfilter_request_frame(AVFilterLink *link); + +/** + * Poll a frame from the filter chain. + * + * @param link the input link + * @return the number of immediately available frames, a negative + * number in case of error + */ +int avfilter_poll_frame(AVFilterLink *link); + +/** + * Notify the next filter of the start of a frame. + * + * @param link the output link the frame will be sent over + * @param picref A reference to the frame about to be sent. The data for this + * frame need only be valid once draw_slice() is called for that + * portion. The receiving filter will free this reference when + * it no longer needs it. + */ +void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); + +/** + * Notify the next filter that the current frame has finished. + * + * @param link the output link the frame was sent over + */ +void avfilter_end_frame(AVFilterLink *link); + +/** + * Send a slice to the next filter. + * + * Slices have to be provided in sequential order, either in + * top-bottom or bottom-top order. If slices are provided in + * non-sequential order the behavior of the function is undefined. + * + * @param link the output link over which the frame is being sent + * @param y offset in pixels from the top of the image for this slice + * @param h height of this slice in pixels + * @param slice_dir the assumed direction for sending slices, + * from the top slice to the bottom slice if the value is 1, + * from the bottom slice to the top slice if the value is -1, + * for other values the behavior of the function is undefined. + */ +void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); + +#define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically +#define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw) + +/** + * Make the filter instance process a command. + * It is recommended to use avfilter_graph_send_command(). + */ +int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags); + +/** + * Send a buffer of audio samples to the next filter. + * + * @param link the output link over which the audio samples are being sent + * @param samplesref a reference to the buffer of audio samples being sent. The + * receiving filter will free this reference when it no longer + * needs it or pass it on to the next filter. + */ +void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + +/** Initialize the filter system. Register all built-in filters. */ +void avfilter_register_all(void); + +/** Uninitialize the filter system. Unregister all filters. */ +void avfilter_uninit(void); + +/** + * Register a filter. This is only needed if you plan to use + * avfilter_get_by_name later to lookup the AVFilter structure by name. A + * filter can still by instantiated with avfilter_open even if it is not + * registered. + * + * @param filter the filter to register + * @return 0 if the registration was successful, a negative value + * otherwise + */ +int avfilter_register(AVFilter *filter); + +/** + * Get a filter definition matching the given name. + * + * @param name the filter name to find + * @return the filter definition, if any matching one is registered. + * NULL if none found. + */ +AVFilter *avfilter_get_by_name(const char *name); + +/** + * If filter is NULL, returns a pointer to the first registered filter pointer, + * if filter is non-NULL, returns the next pointer after filter. + * If the returned pointer points to NULL, the last registered filter + * was already reached. + */ +AVFilter **av_filter_next(AVFilter **filter); + +/** + * Create a filter instance. + * + * @param filter_ctx put here a pointer to the created filter context + * on success, NULL on failure + * @param filter the filter to create an instance of + * @param inst_name Name to give to the new instance. Can be NULL for none. + * @return >= 0 in case of success, a negative error code otherwise + */ +int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); + +/** + * Initialize a filter. + * + * @param filter the filter to initialize + * @param args A string of parameters to use when initializing the filter. + * The format and meaning of this string varies by filter. + * @param opaque Any extra non-string data needed by the filter. The meaning + * of this parameter varies by filter. + * @return zero on success + */ +int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque); + +/** + * Free a filter context. + * + * @param filter the filter to free + */ +void avfilter_free(AVFilterContext *filter); + +/** + * Insert a filter in the middle of an existing link. + * + * @param link the link into which the filter should be inserted + * @param filt the filter to be inserted + * @param filt_srcpad_idx the input pad on the filter to connect + * @param filt_dstpad_idx the output pad on the filter to connect + * @return zero on success + */ +int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, + unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); + +/** + * Insert a new pad. + * + * @param idx Insertion point. Pad is inserted at the end if this point + * is beyond the end of the list of pads. + * @param count Pointer to the number of pads in the list + * @param padidx_off Offset within an AVFilterLink structure to the element + * to increment when inserting a new pad causes link + * numbering to change + * @param pads Pointer to the pointer to the beginning of the list of pads + * @param links Pointer to the pointer to the beginning of the list of links + * @param newpad The new pad to add. A copy is made when adding. + */ +void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, + AVFilterPad **pads, AVFilterLink ***links, + AVFilterPad *newpad); + +/** Insert a new input pad for the filter. */ +static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index, + AVFilterPad *p) +{ + avfilter_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad), + &f->input_pads, &f->inputs, p); +} + +/** Insert a new output pad for the filter. */ +static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, + AVFilterPad *p) +{ + avfilter_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad), + &f->output_pads, &f->outputs, p); +} + +#endif /* AVFILTER_AVFILTER_H */ diff --git a/extern/ffmpeg/include/libavfilter/avfiltergraph.h b/extern/ffmpeg/include/libavfilter/avfiltergraph.h new file mode 100644 index 0000000000..375ab8efbc --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/avfiltergraph.h @@ -0,0 +1,184 @@ +/* + * Filter graphs + * copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVFILTERGRAPH_H +#define AVFILTER_AVFILTERGRAPH_H + +#include "avfilter.h" + +typedef struct AVFilterGraph { + unsigned filter_count; + AVFilterContext **filters; + + char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters +} AVFilterGraph; + +/** + * Allocate a filter graph. + */ +AVFilterGraph *avfilter_graph_alloc(void); + +/** + * Get a filter instance with name name from graph. + * + * @return the pointer to the found filter instance or NULL if it + * cannot be found. + */ +AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name); + +/** + * Add an existing filter instance to a filter graph. + * + * @param graphctx the filter graph + * @param filter the filter to be added + */ +int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter); + +/** + * Create and add a filter instance into an existing graph. + * The filter instance is created from the filter filt and inited + * with the parameters args and opaque. + * + * In case of success put in *filt_ctx the pointer to the created + * filter instance, otherwise set *filt_ctx to NULL. + * + * @param name the instance name to give to the created filter instance + * @param graph_ctx the filter graph + * @return a negative AVERROR error code in case of failure, a non + * negative value otherwise + */ +int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, + const char *name, const char *args, void *opaque, + AVFilterGraph *graph_ctx); + +/** + * Check validity and configure all the links and formats in the graph. + * + * @param graphctx the filter graph + * @param log_ctx context used for logging + * @return 0 in case of success, a negative AVERROR code otherwise + */ +int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); + +/** + * Free a graph, destroy its links, and set *graph to NULL. + * If *graph is NULL, do nothing. + */ +void avfilter_graph_free(AVFilterGraph **graph); + +/** + * A linked-list of the inputs/outputs of the filter chain. + * + * This is mainly useful for avfilter_graph_parse(), since this + * function may accept a description of a graph with not connected + * input/output pads. This struct specifies, per each not connected + * pad contained in the graph, the filter context and the pad index + * required for establishing a link. + */ +typedef struct AVFilterInOut { + /** unique name for this input/output in the list */ + char *name; + + /** filter context associated to this input/output */ + AVFilterContext *filter_ctx; + + /** index of the filt_ctx pad to use for linking */ + int pad_idx; + + /** next input/input in the list, NULL if this is the last */ + struct AVFilterInOut *next; +} AVFilterInOut; + +/** + * Create an AVFilterInOut. + * Must be free with avfilter_inout_free(). + */ +AVFilterInOut *avfilter_inout_alloc(void); + +/** + * Free the AVFilterInOut in *inout, and set its pointer to NULL. + * If *inout is NULL, do nothing. + */ +void avfilter_inout_free(AVFilterInOut **inout); + +/** + * Add a graph described by a string to a graph. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. + * If non-NULL, *inputs is updated to contain the list of open inputs + * after the parsing, should be freed with avfilter_inout_free(). + * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. + * If non-NULL, *outputs is updated to contain the list of open outputs + * after the parsing, should be freed with avfilter_inout_free(). + * @return non negative on success, a negative AVERROR code on error + */ +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx); + +/** + * Send a command to one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param res a buffer with size res_size where the filter(s) can return a response. + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ +int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags); + +/** + * Queue a command for one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to sent, for handling simplicity all commands must be alphanummeric only + * @param arg the argument for the command + * @param ts time at which the command should be sent to the filter + * + * @note As this executes commands after this function returns, no return code + * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported. + */ +int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts); + + +/** + * Dump a graph into a human-readable string representation. + * + * @param graph the graph to dump + * @param options formatting options; currently ignored + * @return a string, or NULL in case of memory allocation failure; + * the string must be freed using av_free + */ +char *avfilter_graph_dump(AVFilterGraph *graph, const char *options); + +#endif /* AVFILTER_AVFILTERGRAPH_H */ diff --git a/extern/ffmpeg/include/libavfilter/buffersink.h b/extern/ffmpeg/include/libavfilter/buffersink.h new file mode 100644 index 0000000000..73926a4539 --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/buffersink.h @@ -0,0 +1,94 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VSINK_BUFFER_H +#define AVFILTER_VSINK_BUFFER_H + +/** + * @file + * memory buffer sink API for audio and video + */ + +#include "avfilter.h" + +/** + * Struct to use for initializing a buffersink context. + */ +typedef struct { + const enum PixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by PIX_FMT_NONE +} AVBufferSinkParams; + +/** + * Create an AVBufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVBufferSinkParams *av_buffersink_params_alloc(void); + +/** + * Struct to use for initializing an abuffersink context. + */ +typedef struct { + const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE + const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 + const int *packing_fmts; ///< list of allowed packing formats +} AVABufferSinkParams; + +/** + * Create an AVABufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVABufferSinkParams *av_abuffersink_params_alloc(void); + +/** + * Tell av_buffersink_get_buffer_ref() to read video/samples buffer + * reference, but not remove it from the buffer. This is useful if you + * need only to read a video/samples buffer, without to fetch it. + */ +#define AV_BUFFERSINK_FLAG_PEEK 1 + +/** + * Get an audio/video buffer data from buffer_sink and put it in bufref. + * + * This function works with both audio and video buffer sinks. + * + * @param buffer_sink pointer to a buffersink or abuffersink context + * @param flags a combination of AV_BUFFERSINK_FLAG_* flags + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, + AVFilterBufferRef **bufref, int flags); + + +/** + * Get the number of immediately available frames. + */ +int av_buffersink_poll_frame(AVFilterContext *ctx); + +#if FF_API_OLD_VSINK_API +/** + * @deprecated Use av_buffersink_get_buffer_ref() instead. + */ +attribute_deprecated +int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *buffer_sink, + AVFilterBufferRef **picref, int flags); +#endif + +#endif /* AVFILTER_VSINK_BUFFER_H */ diff --git a/extern/ffmpeg/include/libavfilter/version.h b/extern/ffmpeg/include/libavfilter/version.h new file mode 100644 index 0000000000..60e496dcc0 --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/version.h @@ -0,0 +1,43 @@ +/* + * Version macros. + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VERSION_H +#define AVFILTER_VERSION_H + +/** + * @file + * Libavfilter version macros + */ + +#include "libavutil/avutil.h" + +#define LIBAVFILTER_VERSION_MAJOR 2 +#define LIBAVFILTER_VERSION_MINOR 60 +#define LIBAVFILTER_VERSION_MICRO 100 + +#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT + +#endif // AVFILTER_VERSION_H diff --git a/extern/ffmpeg/include/libavfilter/vsrc_buffer.h b/extern/ffmpeg/include/libavfilter/vsrc_buffer.h new file mode 100644 index 0000000000..b661d414ea --- /dev/null +++ b/extern/ffmpeg/include/libavfilter/vsrc_buffer.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2008 Vitor Sessak + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VSRC_BUFFER_H +#define AVFILTER_VSRC_BUFFER_H + +/** + * @file + * memory buffer source API for video + */ + +#include "avfilter.h" + +/** + * Tell av_vsrc_buffer_add_video_buffer_ref() to overwrite the already + * cached video buffer with the new added one, otherwise the function + * will complain and exit. + */ +#define AV_VSRC_BUF_FLAG_OVERWRITE 1 + +/** + * Add video buffer data in picref to buffer_src. + * + * @param buffer_src pointer to a buffer source context + * @param flags a combination of AV_VSRC_BUF_FLAG_* flags + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_src, + AVFilterBufferRef *picref, int flags); + +#endif /* AVFILTER_VSRC_BUFFER_H */ diff --git a/extern/ffmpeg/include/libavformat/avformat.h b/extern/ffmpeg/include/libavformat/avformat.h new file mode 100644 index 0000000000..c28d1ddb2b --- /dev/null +++ b/extern/ffmpeg/include/libavformat/avformat.h @@ -0,0 +1,2154 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libav structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more frames which belong a single + * elementary stream. In lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ + +#include +#include /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +struct AVFormatContext; + + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- . + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +#if FF_API_OLD_METADATA2 +/** + * @defgroup old_metadata Old metadata API + * The following functions are deprecated, use + * their equivalents from libavutil/dict.h instead. + * @{ + */ + +#define AV_METADATA_MATCH_CASE AV_DICT_MATCH_CASE +#define AV_METADATA_IGNORE_SUFFIX AV_DICT_IGNORE_SUFFIX +#define AV_METADATA_DONT_STRDUP_KEY AV_DICT_DONT_STRDUP_KEY +#define AV_METADATA_DONT_STRDUP_VAL AV_DICT_DONT_STRDUP_VAL +#define AV_METADATA_DONT_OVERWRITE AV_DICT_DONT_OVERWRITE + +typedef attribute_deprecated AVDictionary AVMetadata; +typedef attribute_deprecated AVDictionaryEntry AVMetadataTag; + +typedef struct AVMetadataConv AVMetadataConv; + +/** + * Get a metadata element with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found tag or NULL, changing key or value leads to undefined behavior. + */ +attribute_deprecated AVDictionaryEntry * +av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); + +/** + * Set the given tag in *pm, overwriting an existing tag. + * + * @param pm pointer to a pointer to a metadata struct. If *pm is NULL + * a metadata struct is allocated and put in *pm. + * @param key tag key to add to *pm (will be av_strduped depending on flags) + * @param value tag value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing tag to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +attribute_deprecated int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * This function is provided for compatibility reason and currently does nothing. + */ +attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); + +/** + * Copy metadata from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting metadata in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +attribute_deprecated void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct. + */ +attribute_deprecated void av_metadata_free(AVDictionary **m); +/** + * @} + */ +#endif + + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +/*************************************************/ +/* fractional numbers for exact pts handling */ + +/** + * The exact value of the fractional number is: 'val + num / den'. + * num is assumed to be 0 <= num < den. + */ +typedef struct AVFrac { + int64_t val, num, den; +} AVFrac; + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ +} AVProbeData; + +#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +typedef struct AVFormatParameters { +#if FF_API_FORMAT_PARAMETERS + attribute_deprecated AVRational time_base; + attribute_deprecated int sample_rate; + attribute_deprecated int channels; + attribute_deprecated int width; + attribute_deprecated int height; + attribute_deprecated enum PixelFormat pix_fmt; + attribute_deprecated int channel; /**< Used to select DV channel. */ + attribute_deprecated const char *standard; /**< deprecated, use demuxer-specific options instead. */ + attribute_deprecated unsigned int mpeg2ts_raw:1; /**< deprecated, use mpegtsraw demuxer */ + /**< deprecated, use mpegtsraw demuxer-specific options instead */ + attribute_deprecated unsigned int mpeg2ts_compute_pcr:1; + attribute_deprecated unsigned int initial_pause:1; /**< Do not begin to play the stream + immediately (RTSP only). */ + attribute_deprecated unsigned int prealloced_context:1; +#endif +} AVFormatParameters; + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for + raw picture data. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#define AVFMT_TS_NONSTRICT 0x8000000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + /* output support */ + enum CodecID audio_codec; /**< default audio codec */ + enum CodecID video_codec; /**< default video codec */ + int (*write_header)(struct AVFormatContext *); + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + int (*write_trailer)(struct AVFormatContext *); + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH + */ + int flags; + + void *dummy; + + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by CODEC_ID_NONE. + */ + const struct AVCodecTag * const *codec_tag; + + enum CodecID subtitle_codec; /**< default subtitle codec */ + +#if FF_API_OLD_METADATA2 + const AVMetadataConv *metadata_conv; +#endif + + const AVClass *priv_class; ///< AVClass for the private context + + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + */ + int (*query_codec)(enum CodecID id, int std_compliance); + + void (*get_output_timestamp)(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + + /* private fields */ + struct AVOutputFormat *next; +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. 'ap' if non-NULL contains + * additional parameters. Only used in raw format right + * now. 'av_new_stream' should be called to create new streams. + */ + int (*read_header)(struct AVFormatContext *, + AVFormatParameters *ap); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'av_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + /** + * General purpose read-only value that the format can use. + */ + int value; + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + const struct AVCodecTag * const *codec_tag; + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +#if FF_API_OLD_METADATA2 + const AVMetadataConv *metadata_conv; +#endif + + const AVClass *priv_class; ///< AVClass for the private context + + /* private fields */ + struct AVInputFormat *next; +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; /**< + * Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are available + * when seeking to this entry. That means preferable PTS on keyframe based formats. + * But demuxers can choose to store a different timestamp, if it is more convenient for the implementation or nothing better + * is known + */ +#define AVINDEX_KEYFRAME 0x0001 + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + int id; /**< format-specific stream ID */ + AVCodecContext *codec; /**< codec context */ + /** + * Real base framerate of the stream. + * This is the lowest framerate with which all timestamps can be + * represented accurately (it is the least common multiple of all + * framerates in the stream). Note, this value is just a guess! + * For example, if the time base is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. + */ + AVRational r_frame_rate; + void *priv_data; + +#if FF_API_REORDER_PRIVATE + /* internal data used in av_find_stream_info() */ + int64_t first_dts; +#endif + + /** + * encoding: pts generation when outputting stream + */ + struct AVFrac pts; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * time base should be 1/framerate and timestamp increments should be 1. + * decoding: set by libavformat + * encoding: set by libavformat in av_write_header + */ + AVRational time_base; +#if FF_API_REORDER_PRIVATE + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ +#endif +#if FF_API_STREAM_COPY + /* ffmpeg.c private use */ + attribute_deprecated int stream_copy; /**< If set, just copy stream. */ +#endif + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + +#if FF_API_AVSTREAM_QUALITY + //FIXME move stuff to a flags field? + /** + * Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. + * MN: dunno if that is the right place for it + */ + attribute_deprecated float quality; +#endif + + /** + * Decoding: pts of the first frame of the stream in presentation order, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + * @note The ASF header does NOT contain a correct start_time the ASF + * demuxer must NOT set this. + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + */ + int64_t duration; + +#if FF_API_REORDER_PRIVATE + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + int64_t cur_dts; + int last_IP_duration; + int64_t last_IP_pts; + /* av_seek_frame() support */ + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; +#endif + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + +#if FF_API_REORDER_PRIVATE + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; +#endif + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + +#if FF_API_REORDER_PRIVATE + /* Intended mostly for av_read_frame() support. Not supposed to be used by */ + /* external applications; try to use something else if at all possible. */ + const uint8_t *cur_ptr; + int cur_len; + AVPacket cur_pkt; + + // Timestamp generation support: + /** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + */ + int64_t reference_dts; + + /** + * Number of packets to buffer for codec probing + * NOT PART OF PUBLIC API + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * last packet in packet_buffer for this stream when muxing. + * Used internally, NOT PART OF PUBLIC API, do not read or + * write from outside of libav* + */ + struct AVPacketList *last_in_packet_buffer; +#endif + + /** + * Average framerate + */ + AVRational avg_frame_rate; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Number of frames that have been demuxed during av_find_stream_info() + */ + int codec_info_nb_frames; + + /** + * Stream Identifier + * This is the MPEG-TS stream identifier +1 + * 0 means unknown + */ + int stream_identifier; + + int64_t interleaver_chunk_size; + int64_t interleaver_chunk_duration; + + /** + * Stream information used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + double duration_error[2][2][MAX_STD_TIMEBASES]; + int64_t codec_info_duration; + int nb_decoded_frames; + } *info; + + /** + * flag to indicate that probing is requested + * NOT PART OF PUBLIC API + */ + int request_probe; +#if !FF_API_REORDER_PRIVATE + const uint8_t *cur_ptr; + int cur_len; + AVPacket cur_pkt; + + // Timestamp generation support: + /** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + */ + int64_t reference_dts; + int64_t first_dts; + int64_t cur_dts; + int last_IP_duration; + int64_t last_IP_pts; + + /** + * Number of packets to buffer for codec probing + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ +#endif +} AVStream; + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; + + int program_num; + int pmt_pid; + int pcr_pid; +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + */ +typedef struct AVFormatContext { + /** + * A class for logging and AVOptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * Can only be iformat or oformat, not both at the same time. + * + * decoding: set by avformat_open_input(). + * encoding: set by the user. + */ + struct AVInputFormat *iformat; + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + */ + void *priv_data; + + /* + * I/O context. + * + * decoding: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * encoding: set by the user. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * decoding: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * encoding: streams are created by the user before avformat_write_header(). + */ + unsigned int nb_streams; + AVStream **streams; + + char filename[1024]; /**< input or output filename */ + /* stream info */ +#if FF_API_TIMESTAMP + /** + * @deprecated use 'creation_time' metadata tag instead + */ + attribute_deprecated int64_t timestamp; +#endif + + int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ +#if FF_API_REORDER_PRIVATE + /* private data for pts handling (do not modify directly). */ + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; +#endif + + /** + * Decoding: position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + */ + int64_t duration; + +#if FF_API_FILESIZE + /** + * decoding: total file size, 0 if unknown + */ + attribute_deprecated int64_t file_size; +#endif + + /** + * Decoding: total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as FFmpeg can compute it automatically. + */ + int bit_rate; + +#if FF_API_REORDER_PRIVATE + /* av_read_frame() support */ + AVStream *cur_st; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ +#endif + +#if FF_API_MUXRATE + /** + * use mpeg muxer private options instead + */ + attribute_deprecated int mux_rate; +#endif + unsigned int packet_size; +#if FF_API_PRELOAD + attribute_deprecated int preload; +#endif + int max_delay; + +#if FF_API_LOOP_OUTPUT +#define AVFMT_NOOUTPUTLOOP -1 +#define AVFMT_INFINITEOUTPUTLOOP 0 + /** + * number of times to loop output in formats that support it + * + * @deprecated use the 'loop' private option in the gif muxer. + */ + attribute_deprecated int loop_output; +#endif + + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#if FF_API_FLAG_RTP_HINT +#define AVFMT_FLAG_RTP_HINT 0x0040 ///< Deprecated, use the -movflags rtphint muxer specific AVOption instead +#endif +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload +#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) +#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) +#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Dont merge side data but keep it seperate. + +#if FF_API_LOOP_INPUT + /** + * @deprecated, use the 'loop' img2 demuxer private option. + */ + attribute_deprecated int loop_input; +#endif + + /** + * decoding: size of data to probe; encoding: unused. + */ + unsigned int probesize; + + /** + * decoding: maximum time (in AV_TIME_BASE units) during which the input should + * be analyzed in avformat_find_stream_info(). + */ + int max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum CodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum CodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum CodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * muxing : unused + * demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + unsigned int nb_chapters; + AVChapter **chapters; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + +#if FF_API_REORDER_PRIVATE + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + + struct AVPacketList *packet_buffer_end; +#endif + + AVDictionary *metadata; + +#if FF_API_REORDER_PRIVATE + /** + * Remaining size available for raw_packet_buffer, in bytes. + * NOT PART OF PUBLIC API + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; +#endif + + /** + * Start time of the stream in real world time, in microseconds + * since the unix epoch (00:00 1st January 1970). That is, pts=0 + * in the stream was captured at this real world time. + * - encoding: Set by user. + * - decoding: Unused. + */ + int64_t start_time_realtime; + + /** + * decoding: number of frames used to probe fps + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * decoding: set by the user before avformat_open_input(). + * encoding: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Transport stream id. + * This will be moved into demuxer private options. Thus no API/ABI compatibility + */ + int ts_id; + + /** + * Audio preload in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int audio_preload; + + /** + * Max chunk time in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int max_chunk_duration; + + /** + * Max chunk size in bytes + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int max_chunk_size; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ +#if !FF_API_REORDER_PRIVATE + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + /** + * Remaining size available for raw_packet_buffer, in bytes. + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; + + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; + struct AVPacketList *packet_buffer_end; + + /* av_read_frame() support */ + AVStream *cur_st; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ +#endif +} AVFormatContext; + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see av_register_protocol() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +AVInputFormat *av_iformat_next(AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +AVOutputFormat *av_oformat_next(AVOutputFormat *f); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +#if FF_API_GUESS_IMG2_CODEC +attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); +#endif + +#if FF_API_PKT_DUMP +attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); +attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, + int dump_payload); +#endif + + +#if FF_API_ALLOC_OUTPUT_CONTEXT +/** + * @deprecated deprecated in favor of avformat_alloc_output_context2() + */ +attribute_deprecated +AVFormatContext *avformat_alloc_output_context(const char *format, + AVOutputFormat *oformat, + const char *filename); +#endif + +/** + * Allocate an AVFormatContext for an output format. + * avformat_free_context() can be used to free the context and + * everything allocated by the framework within it. + * + * @param *ctx is set to the created format context, or to NULL in + * case of failure + * @param oformat format to use for allocating the context, if NULL + * format_name and filename are used instead + * @param format_name the name of output format to use for allocating the + * context, if NULL filename is used instead + * @param filename the name of the filename to use for allocating the + * context, may be NULL + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, + const char *format_name, const char *filename); + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_ret The score of the best detection. + */ +AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +#if FF_API_FORMAT_PARAMETERS +/** + * Allocate all the structures needed to read an input stream. + * This does not open the needed codecs for decoding the stream[s]. + * @deprecated use avformat_open_input instead. + */ +attribute_deprecated int av_open_input_stream(AVFormatContext **ic_ptr, + AVIOContext *pb, const char *filename, + AVInputFormat *fmt, AVFormatParameters *ap); + +/** + * Open a media file as input. The codecs are not opened. Only the file + * header (if present) is read. + * + * @param ic_ptr The opened media file handle is put here. + * @param filename filename to open + * @param fmt If non-NULL, force the file format to use. + * @param buf_size optional buffer size (zero if default is OK) + * @param ap Additional parameters needed when opening the file + * (NULL if default). + * @return 0 if OK, AVERROR_xxx otherwise + * + * @deprecated use avformat_open_input instead. + */ +attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, + AVInputFormat *fmt, + int buf_size, + AVFormatParameters *ap); +#endif + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with av_close_input_file(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); + +int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap); + +#if FF_API_FORMAT_PARAMETERS +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @return >=0 if OK, AVERROR_xxx on error + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + * + * @deprecated use avformat_find_stream_info. + */ +attribute_deprecated +int av_find_stream_info(AVFormatContext *ic); +#endif + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the programs which belong to a given stream. + * + * @param ic media file handle + * @param last the last found program, the search will start after this + * program, or from the beginning if it is NULL + * @param s stream index + * @return the next program which belongs to s, NULL if no program is found or + * the last program is not among the programs of ic. + */ +AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Read a transport packet from a media file. + * + * This function is obsolete and should never be used. + * Use av_read_frame() instead. + * + * @param s media file handle + * @param pkt is filled + * @return 0 if OK, AVERROR_xxx on error + */ +int av_read_packet(AVFormatContext *s, AVPacket *pkt); + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * The returned packet is valid + * until the next av_read_frame() or until av_close_input_file() and + * must be freed with av_free_packet. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of + * frames if each frame has a known fixed size (e.g. PCM or ADPCM + * data). If the audio frames have a variable size (e.g. MPEG audio), + * then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +#if FF_API_FORMAT_PARAMETERS +/** + * Free a AVFormatContext allocated by av_open_input_stream. + * @param s context to free + * @deprecated use av_close_input_file() + */ +attribute_deprecated +void av_close_input_stream(AVFormatContext *s); +#endif + +#if FF_API_CLOSE_INPUT_FILE +/** + * @deprecated use avformat_close_input() + * Close a media file (but not its codecs). + * + * @param s media file handle + */ +attribute_deprecated +void av_close_input_file(AVFormatContext *s); +#endif + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#if FF_API_NEW_STREAM +/** + * Add a new stream to a media file. + * + * Can only be called in the read_header() function. If the flag + * AVFMTCTX_NOHEADER is in the format context, then new streams + * can be added in read_packet too. + * + * @param s media file handle + * @param id file-format-dependent stream ID + */ +attribute_deprecated +AVStream *av_new_stream(AVFormatContext *s, int id); +#endif + +#if FF_API_SET_PTS_INFO +/** + * @deprecated this function is not supposed to be called outside of lavf + */ +attribute_deprecated +void av_set_pts_info(AVStream *s, int pts_wrap_bits, + unsigned int pts_num, unsigned int pts_den); +#endif + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +#if FF_API_SEEK_PUBLIC +attribute_deprecated +int av_seek_frame_binary(AVFormatContext *s, int stream_index, + int64_t target_ts, int flags); +attribute_deprecated +void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); +attribute_deprecated +int64_t av_gen_search(AVFormatContext *s, int stream_index, + int64_t target_ts, int64_t pos_min, + int64_t pos_max, int64_t pos_limit, + int64_t ts_min, int64_t ts_max, + int flags, int64_t *ts_ret, + int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); +#endif + +#if FF_API_FORMAT_PARAMETERS +/** + * @deprecated pass the options to avformat_write_header directly. + */ +attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); +#endif + +/** + * @addtogroup lavf_encoding + * @{ + */ +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already openened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +#if FF_API_FORMAT_PARAMETERS +/** + * Allocate the stream private data and write the stream header to an + * output media file. + * @note: this sets stream time-bases, if possible to stream->codec->time_base + * but for some formats it might also be some other time base + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + * + * @deprecated use avformat_write_header. + */ +attribute_deprecated int av_write_header(AVFormatContext *s); +#endif + +/** + * Write a packet to an output media file. + * + * The packet shall contain one audio or video frame. + * The packet must be correctly interleaved according to the container + * specification, if not then av_interleaved_write_frame must be used. + * + * @param s media file handle + * @param pkt The packet, which contains the stream_index, buf/buf_size, + * dts/pts, ... + * This can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, + * for muxers that buffer up data internally before writing it + * to the output. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * The packet must contain one audio or video frame. + * If the packets are already correctly interleaved, the application should + * call av_write_frame() instead as it is slightly faster. It is also important + * to keep in mind that completely non-interleaved input will need huge amounts + * of memory to interleave with this, so it is preferable to interleave at the + * demuxer level. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Libavformat takes + * ownership of the data and will free it when it sees fit using the packet's + * @ref AVPacket.destruct "destruct" field. The caller must not access the data + * after this function returns, as it may already be freed. + * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the + * index of the corresponding stream in @ref AVFormatContext.streams + * "s.streams". + * It is very strongly recommended that timing information (@ref AVPacket.pts + * "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to + * correct values. + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Interleave a packet per dts in an output media file. + * + * Packets with pkt->destruct == av_destruct_packet will be freed inside this + * function, so they cannot be used after it. Note that calling av_free_packet() + * on them is still safe. + * + * @param s media file handle + * @param out the interleaved packet will be output here + * @param pkt the input packet + * @param flush 1 if no further packets are available as input and all + * remaining packets should be output + * @return 1 if a packet was output, 0 if no packet could be output, + * < 0 if an error occurred + */ +int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush); + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to av_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * Get timing information for the data currently output. + * The exact meaning of "currently output" depends on the format. + * It is mostly relevant for devices that have an internal buffer and/or + * work in real time. + * @param s media file handle + * @param stream stream in the media file + * @param dts[out] DTS of the last packet output for the stream, in stream + * time_base units + * @param wall[out] absolute time when that packet whas output, + * in microsecond + * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it + * Note: some formats or devices may not allow to measure dts and wall + * atomically. + */ +int av_get_output_timestamp(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscelaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +/** + * Get the CodecID for the given codec tag tag. + * If no codec id is found returns CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + +#if FF_API_DUMP_FORMAT +/** + * @deprecated Deprecated in favor of av_dump_format(). + */ +attribute_deprecated void dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); +#endif + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +#if FF_API_PARSE_DATE +/** + * Parse datestr and return a corresponding number of microseconds. + * + * @param datestr String representing a date or a duration. + * See av_parse_time() for the syntax of the provided string. + * @deprecated in favor of av_parse_time() + */ +attribute_deprecated +int64_t parse_date(const char *datestr, int duration); +#endif + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +#if FF_API_FIND_INFO_TAG +/** + * @deprecated use av_find_info_tag in libavutil instead. + */ +attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +#endif + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +#if FF_API_SDP_CREATE +attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +#endif + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance); + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/extern/ffmpeg/include/libavformat/avio.h b/extern/ffmpeg/include/libavformat/avio.h new file mode 100644 index 0000000000..a8698a8419 --- /dev/null +++ b/extern/ffmpeg/include/libavformat/avio.h @@ -0,0 +1,695 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct { + int (*callback)(void*); + void *opaque; +} AVIOInterruptCB; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct { +#if !FF_API_OLD_AVIO + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + AVClass *av_class; +#endif + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ +#if FF_API_OLD_AVIO + attribute_deprecated int is_streamed; +#endif + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; + + /** + * max filesize, used to limit allocations + * This field is internal to libavformat and access from outside is not allowed. + */ + int64_t maxsize; +} AVIOContext; + +/* unbuffered I/O */ + +#if FF_API_OLD_AVIO +/** + * URL Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(URLContext) must not be used outside libav*. + * @deprecated This struct will be made private + */ +typedef struct URLContext { + const AVClass *av_class; ///< information for av_log(). Set by url_open(). + struct URLProtocol *prot; + int flags; + int is_streamed; /**< true if streamed (no seek possible), default = false */ + int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ + void *priv_data; + char *filename; /**< specified URL */ + int is_connected; + AVIOInterruptCB interrupt_callback; +} URLContext; + +#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ +#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */ + +/** + * @deprecated This struct is to be made private. Use the higher-level + * AVIOContext-based API instead. + */ +typedef struct URLProtocol { + const char *name; + int (*url_open)(URLContext *h, const char *url, int flags); + int (*url_read)(URLContext *h, unsigned char *buf, int size); + int (*url_write)(URLContext *h, const unsigned char *buf, int size); + int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); + int (*url_close)(URLContext *h); + struct URLProtocol *next; + int (*url_read_pause)(URLContext *h, int pause); + int64_t (*url_read_seek)(URLContext *h, int stream_index, + int64_t timestamp, int flags); + int (*url_get_file_handle)(URLContext *h); + int priv_data_size; + const AVClass *priv_data_class; + int flags; + int (*url_check)(URLContext *h, int mask); +} URLProtocol; + +typedef struct URLPollEntry { + URLContext *handle; + int events; + int revents; +} URLPollEntry; + +/* not implemented */ +attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); + +/** + * @name URL open modes + * The flags argument to url_open and cosins must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define URL_RDONLY 1 /**< read-only */ +#define URL_WRONLY 2 /**< write-only */ +#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define URL_FLAG_NONBLOCK 8 + +typedef int URLInterruptCB(void); +extern URLInterruptCB *url_interrupt_cb; + +/** + * @defgroup old_url_funcs Old url_* functions + * The following functions are deprecated. Use the buffered API based on #AVIOContext instead. + * @{ + * @ingroup lavf_io + */ +attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, + const char *url, int flags); +attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags); +attribute_deprecated int url_connect(URLContext *h); +attribute_deprecated int url_open(URLContext **h, const char *url, int flags); +attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size); +attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence); +attribute_deprecated int url_close(URLContext *h); +attribute_deprecated int64_t url_filesize(URLContext *h); +attribute_deprecated int url_get_file_handle(URLContext *h); +attribute_deprecated int url_get_max_packet_size(URLContext *h); +attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size); +attribute_deprecated int av_url_read_pause(URLContext *h, int pause); +attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, + int64_t timestamp, int flags); +attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); + +/** + * returns the next registered protocol after the given protocol (the first if + * NULL is given), or NULL if protocol is the last one. + */ +URLProtocol *av_protocol_next(URLProtocol *p); + +/** + * Register the URLProtocol protocol. + * + * @param size the size of the URLProtocol struct referenced + */ +attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size); +/** + * @} + */ + + +typedef attribute_deprecated AVIOContext ByteIOContext; + +attribute_deprecated int init_put_byte(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); +attribute_deprecated AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +/** + * @defgroup old_avio_funcs Old put_/get_*() functions + * The following functions are deprecated. Use the "avio_"-prefixed functions instead. + * @{ + * @ingroup lavf_io + */ +attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_byte(AVIOContext *s); +attribute_deprecated unsigned int get_le16(AVIOContext *s); +attribute_deprecated unsigned int get_le24(AVIOContext *s); +attribute_deprecated unsigned int get_le32(AVIOContext *s); +attribute_deprecated uint64_t get_le64(AVIOContext *s); +attribute_deprecated unsigned int get_be16(AVIOContext *s); +attribute_deprecated unsigned int get_be24(AVIOContext *s); +attribute_deprecated unsigned int get_be32(AVIOContext *s); +attribute_deprecated uint64_t get_be64(AVIOContext *s); + +attribute_deprecated void put_byte(AVIOContext *s, int b); +attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count); +attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); +attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_le32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_tag(AVIOContext *s, const char *tag); +/** + * @} + */ + +attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause); +attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +/** + * @defgroup old_url_f_funcs Old url_f* functions + * The following functions are deprecated, use the "avio_"-prefixed functions instead. + * @{ + * @ingroup lavf_io + */ +attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); +attribute_deprecated int url_fclose(AVIOContext *s); +attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); +attribute_deprecated int64_t url_ftell(AVIOContext *s); +attribute_deprecated int64_t url_fsize(AVIOContext *s); +#define URL_EOF (-1) +attribute_deprecated int url_fgetc(AVIOContext *s); +attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size); +attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); +attribute_deprecated void put_flush_packet(AVIOContext *s); +attribute_deprecated int url_open_dyn_buf(AVIOContext **s); +attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); +attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); +attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h); +/** + * @} + */ + +attribute_deprecated int url_ferror(AVIOContext *s); + +attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri); +attribute_deprecated int udp_get_local_port(URLContext *h); + +attribute_deprecated void init_checksum(AVIOContext *s, + unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), + unsigned long checksum); +attribute_deprecated unsigned long get_checksum(AVIOContext *s); +attribute_deprecated void put_strz(AVIOContext *s, const char *buf); +/** @note unlike fgets, the EOL character is not returned and a whole + line is parsed. return NULL if first char read was EOF */ +attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); +/** + * @deprecated use avio_get_str instead + */ +attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); +/** + * @deprecated Use AVIOContext.seekable field directly. + */ +attribute_deprecated static inline int url_is_streamed(AVIOContext *s) +{ + return !s->seekable; +} +attribute_deprecated URLContext *url_fileno(AVIOContext *s); + +/** + * @deprecated use AVIOContext.max_packet_size directly. + */ +attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); + +attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); + +/** return the written or read size */ +attribute_deprecated int url_close_buf(AVIOContext *s); + +/** + * Return a non-zero value if the resource indicated by url + * exists, 0 otherwise. + * @deprecated Use avio_check instead. + */ +attribute_deprecated int url_exist(const char *url); +#endif // FF_API_OLD_AVIO + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +#if FF_API_OLD_INTERRUPT_CB +/** + * The callback is called in blocking functions to test regulary if + * asynchronous interruption is needed. AVERROR_EXIT is returned + * in this case by the interrupted function. 'NULL' means no interrupt + * callback is given. + * @deprecated Use interrupt_callback in AVFormatContext/avio_open2 + * instead. + */ +attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void)); +#endif + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonble + * means that can be extreemly slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +int64_t avio_skip(AVIOContext *s, int64_t offset); + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** + * feof() equivalent for AVIOContext. + * @return non zero if and only if end of file + */ +int url_feof(AVIOContext *s); + +/** @warning currently size is limited */ +int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); + +void avio_flush(AVIOContext *s); + + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * @return 0 on success, an AVERROR < 0 on error. + */ +int avio_close(AVIOContext *s); + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * @note it is recommanded to use av_protocol_next() instead of this + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +#endif /* AVFORMAT_AVIO_H */ diff --git a/extern/ffmpeg/include/libavformat/version.h b/extern/ffmpeg/include/libavformat/version.h new file mode 100644 index 0000000000..f3848da6bb --- /dev/null +++ b/extern/ffmpeg/include/libavformat/version.h @@ -0,0 +1,129 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/avutil.h" + +#define LIBAVFORMAT_VERSION_MAJOR 53 +#define LIBAVFORMAT_VERSION_MINOR 31 +#define LIBAVFORMAT_VERSION_MICRO 100 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_OLD_METADATA2 +#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_AVIO +#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_DUMP_FORMAT +#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PARSE_DATE +#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FIND_INFO_TAG +#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PKT_DUMP +#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_GUESS_IMG2_CODEC +#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_SDP_CREATE +#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ALLOC_OUTPUT_CONTEXT +#define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FORMAT_PARAMETERS +#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FLAG_RTP_HINT +#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AVSTREAM_QUALITY +#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_LOOP_INPUT +#define FF_API_LOOP_INPUT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_LOOP_OUTPUT +#define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_TIMESTAMP +#define FF_API_TIMESTAMP (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FILESIZE +#define FF_API_FILESIZE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_MUXRATE +#define FF_API_MUXRATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_RTSP_URL_OPTIONS +#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_NEW_STREAM +#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PRELOAD +#define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_STREAM_COPY +#define FF_API_STREAM_COPY (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_SEEK_PUBLIC +#define FF_API_SEEK_PUBLIC (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_REORDER_PRIVATE +#define FF_API_REORDER_PRIVATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_INTERRUPT_CB +#define FF_API_OLD_INTERRUPT_CB (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_SET_PTS_INFO +#define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_CLOSE_INPUT_FILE +#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif + +#endif /* AVFORMAT_VERSION_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/adler32.h b/extern/ffmpeg/include/libavutil/adler32.h similarity index 70% rename from src/ffmpeg/modern_working/include/libavutil/adler32.h rename to extern/ffmpeg/include/libavutil/adler32.h index 34f2b53e7d..e926ef6cc2 100644 --- a/src/ffmpeg/modern_working/include/libavutil/adler32.h +++ b/extern/ffmpeg/include/libavutil/adler32.h @@ -22,8 +22,21 @@ #define AVUTIL_ADLER32_H #include -#include "common.h" +#include "attributes.h" +/** + * @ingroup lavu_crypto + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len) av_pure; diff --git a/extern/ffmpeg/include/libavutil/aes.h b/extern/ffmpeg/include/libavutil/aes.h new file mode 100644 index 0000000000..bafa4cc3c4 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/aes.h @@ -0,0 +1,57 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_aes_size; + +struct AVAES; + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/extern/ffmpeg/include/libavutil/attributes.h b/extern/ffmpeg/include/libavutil/attributes.h new file mode 100644 index 0000000000..0a6fda172b --- /dev/null +++ b/extern/ffmpeg/include/libavutil/attributes.h @@ -0,0 +1,162 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#ifndef av_always_inline +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_always_inline __attribute__((always_inline)) inline +#else +# define av_always_inline inline +#endif +#endif + +#ifndef av_noreturn +#if AV_GCC_VERSION_AT_LEAST(2,5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif +#endif + +#ifndef av_noinline +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_noinline __attribute__((noinline)) +#else +# define av_noinline +#endif +#endif + +#ifndef av_pure +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif +#endif + +#ifndef av_const +#if AV_GCC_VERSION_AT_LEAST(2,6) +# define av_const __attribute__((const)) +#else +# define av_const +#endif +#endif + +#ifndef av_cold +#if AV_GCC_VERSION_AT_LEAST(4,3) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif +#endif + +#ifndef av_flatten +#if AV_GCC_VERSION_AT_LEAST(4,1) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif +#endif + +#ifndef attribute_deprecated +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define attribute_deprecated __attribute__((deprecated)) +#else +# define attribute_deprecated +#endif +#endif + +/** + * Disable warnings about deprecated features + * This is useful for sections of code kept for backward compatibility and + * scheduled for removal. + */ +#ifndef AV_NOWARN_DEPRECATED +#if AV_GCC_VERSION_AT_LEAST(4,6) +# define AV_NOWARN_DEPRECATED(code) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ + code \ + _Pragma("GCC diagnostic pop") +#else +# define AV_NOWARN_DEPRECATED(code) code +#endif +#endif + + +#ifndef av_unused +#if defined(__GNUC__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#ifndef av_used +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif +#endif + +#ifndef av_alias +#if AV_GCC_VERSION_AT_LEAST(3,3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif +#endif + +#ifndef av_uninit +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif +#endif + +#ifdef __GNUC__ +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/extern/ffmpeg/include/libavutil/audioconvert.h b/extern/ffmpeg/include/libavutil/audioconvert.h new file mode 100644 index 0000000000..29ec1cbc0a --- /dev/null +++ b/extern/ffmpeg/include/libavutil/audioconvert.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AUDIOCONVERT_H +#define AVUTIL_AUDIOCONVERT_H + +#include + +/** + * @file + * audio conversion routines + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel convenience macros + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +/** + * @} + */ + +/** + * Return a channel layout id that matches name, 0 if no match. + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionnally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + + Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +int64_t av_get_default_channel_layout(int nb_channels); + +/** + * @} + */ + +#endif /* AVUTIL_AUDIOCONVERT_H */ diff --git a/extern/ffmpeg/include/libavutil/avassert.h b/extern/ffmpeg/include/libavutil/avassert.h new file mode 100644 index 0000000000..e100d0bfdd --- /dev/null +++ b/extern/ffmpeg/include/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/extern/ffmpeg/include/libavutil/avconfig.h b/extern/ffmpeg/include/libavutil/avconfig.h new file mode 100644 index 0000000000..f10aa6186b --- /dev/null +++ b/extern/ffmpeg/include/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/extern/ffmpeg/include/libavutil/avstring.h b/extern/ffmpeg/include/libavutil/avstring.h new file mode 100644 index 0000000000..f73d6e7420 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/avstring.h @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Print arguments following specified format into a large enough auto + * allocated buffer. It is similar to GNU asprintf(). + * @param fmt printf-compatible format string, specifying how the + * following parameters are used. + * @return the allocated string + * @note You have to free the string yourself with av_free(). + */ +char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); + +/** + * Convert a number to a av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Split the string into several tokens which can be accessed by + * successive calls to av_strtok(). + * + * A token is defined as a sequence of characters not belonging to the + * set specified in delim. + * + * On the first call to av_strtok(), s should point to the string to + * parse, and the value of saveptr is ignored. In subsequent calls, s + * should be NULL, and saveptr should be unchanged since the previous + * call. + * + * This function is similar to strtok_r() defined in POSIX.1. + * + * @param s the string to parse, may be NULL + * @param delim 0-terminated list of token delimiters, must be non-NULL + * @param saveptr user-provided pointer which points to stored + * information necessary for av_strtok() to continue scanning the same + * string. saveptr is updated to point to the next character after the + * first delimiter found, or to NULL if the string was terminated + * @return the found token, or NULL when no token is found + */ +char *av_strtok(char *s, const char *delim, char **saveptr); + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline int av_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline int av_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/extern/ffmpeg/include/libavutil/avutil.h b/extern/ffmpeg/include/libavutil/avutil.h new file mode 100644 index 0000000000..3f772621e0 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/avutil.h @@ -0,0 +1,349 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * external API header + */ + +/** + * @mainpage + * + * @section libav_intro Introduction + * + * This document describe the usage of the different libraries + * provided by FFmpeg. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @subpage libavfilter graph based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @subpage libpostproc post processing library + * @li @subpage libswscale color conversion and scaling library + * + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other FFmpeg + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + */ + + +/** + * @defgroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +#define AV_PRAGMA(s) _Pragma(#s) + +/** + * @} + */ + +/** + * @defgroup version_utils Library Version Macros + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * @} + * + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 51 +#define LIBAVUTIL_VERSION_MINOR 34 +#define LIBAVUTIL_VERSION_MICRO 101 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @} + * + * @defgroup depr_guards Deprecation guards + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + * + * They are used mostly internally to mark code that will be removed + * on the next major version. + * + * @{ + */ +#ifndef FF_API_OLD_EVAL_NAMES +#define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT +#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_FIND_OPT +#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_AV_FIFO_PEEK +#define FF_API_AV_FIFO_PEEK (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_OLD_AVOPTIONS +#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 52) +#endif + +/** + * @} + */ + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * Return a string describing the media_type enum, NULL if media_type + * is unknown. + */ +const char *av_get_media_type_string(enum AVMediaType media_type); + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< /** - * Decodes the base64-encoded string in in and puts the decoded - * data in out. + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. * - * @param out_size size in bytes of the out buffer, it should be at - * least 3/4 of the length of in - * @return the number of bytes written, or a negative value in case of - * error + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input */ int av_base64_decode(uint8_t *out, const char *in, int out_size); /** - * Encodes in base64 the data in in and puts the resulting string - * in out. + * Encode data to base64 and null-terminate. * - * @param out_size size in bytes of the out string, it should be at - * least ((in_size + 2) / 3) * 4 + 1 - * @param in_size size in bytes of the in buffer - * @return the string containing the encoded data, or NULL in case of - * error + * @param out buffer for encoded data + * @param out_size size in bytes of the output buffer, must be at + * least AV_BASE64_SIZE(in_size) + * @param in_size size in bytes of the 'in' buffer + * @return 'out' or NULL in case of error */ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); +/** + * Calculate the output size needed to base64-encode x bytes. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + #endif /* AVUTIL_BASE64_H */ diff --git a/extern/ffmpeg/include/libavutil/bswap.h b/extern/ffmpeg/include/libavutil/bswap.h new file mode 100644 index 0000000000..06f654816d --- /dev/null +++ b/extern/ffmpeg/include/libavutil/bswap.h @@ -0,0 +1,109 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_BFIN +# include "bfin/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return AV_BSWAP32C(x); +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/extern/ffmpeg/include/libavutil/common.h b/extern/ffmpeg/include/libavutil/common.h new file mode 100644 index 0000000000..84290c6363 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/common.h @@ -0,0 +1,400 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "attributes.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +/* misc math functions */ +extern const uint8_t ff_log2_tab[256]; + +extern const uint8_t av_reverse[256]; + +static av_always_inline av_const int av_log2_c(unsigned int v) +{ + int n = 0; + if (v & 0xffff0000) { + v >>= 16; + n += 16; + } + if (v & 0xff00) { + v >>= 8; + n += 8; + } + n += ff_log2_tab[v]; + + return n; +} + +static av_always_inline av_const int av_log2_16bit_c(unsigned int v) +{ + int n = 0; + if (v & 0xff00) { + v >>= 8; + n += 8; + } + n += ff_log2_tab[v]; + + return n; +} + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; + else return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<> 31 & ((1< amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount(x) + av_popcount(x >> 32); +} + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + int ones= 7 - av_log2(val ^ 255);\ + if(ones==1)\ + ERROR\ + val&= 127>>ones;\ + while(--ones > 0){\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + }\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_log2 +# define av_log2 av_log2_c +#endif +#ifndef av_log2_16bit +# define av_log2_16bit av_log2_16bit_c +#endif +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif diff --git a/extern/ffmpeg/include/libavutil/cpu.h b/extern/ffmpeg/include/libavutil/cpu.h new file mode 100644 index 0000000000..5f7eed2b60 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/cpu.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + + +/** + * Disables cpu detection and forces the specified flags. + */ +void av_force_cpu_flags(int flags); + + +/* The following CPU-specific functions shall not be called directly. */ +int ff_get_cpu_flags_arm(void); +int ff_get_cpu_flags_ppc(void); +int ff_get_cpu_flags_x86(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/crc.h b/extern/ffmpeg/include/libavutil/crc.h similarity index 98% rename from src/ffmpeg/modern_working/include/libavutil/crc.h rename to extern/ffmpeg/include/libavutil/crc.h index fa34059278..6c0baab5ac 100644 --- a/src/ffmpeg/modern_working/include/libavutil/crc.h +++ b/extern/ffmpeg/include/libavutil/crc.h @@ -23,7 +23,7 @@ #include #include -#include "common.h" +#include "attributes.h" typedef uint32_t AVCRC; diff --git a/extern/ffmpeg/include/libavutil/dict.h b/extern/ffmpeg/include/libavutil/dict.h new file mode 100644 index 0000000000..2adf28c124 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/dict.h @@ -0,0 +1,127 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + * @deprecated + * AVDictionary is provided for compatibility with libav. It is both in + * implementation as well as API inefficient. It does not scale and is + * extremely slow with large dictionaries. + * It is recommended that new code uses our tree container from tree.c/h + * where applicable, which uses AVL trees to achieve O(log n) performance. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + * @code + * AVDictionary *d = NULL; // "create" an empty dictionary + * av_dict_set(&d, "foo", "bar", 0); // add an entry + * + * char *k = av_strdup("key"); // if your strings are already allocated, + * char *v = av_strdup("value"); // you can avoid copying them like this + * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + * + * AVDictionaryEntry *t = NULL; + * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + * <....> // iterate over all entries in d + * } + * + * av_dict_free(&d); + * @endcode + * + */ + +#define AV_DICT_MATCH_CASE 1 +#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() and children. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() and chilren. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + */ +AVDictionaryEntry * +av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing tag to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * @} + */ + +#endif // AVUTIL_DICT_H diff --git a/extern/ffmpeg/include/libavutil/error.h b/extern/ffmpeg/include/libavutil/error.h new file mode 100644 index 0000000000..40e54f1edc --- /dev/null +++ b/extern/ffmpeg/include/libavutil/error.h @@ -0,0 +1,86 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include +#include "avutil.h" + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found +#define AVERROR_BUG (-MKTAG( 'B','U','G','!')) ///< Internal bug, also see AVERROR_BUG2 +#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found +#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file +#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found +#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found +#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found + +/** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + */ +#define AVERROR_BUG2 (-MKTAG( 'B','U','G',' ')) + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/extern/ffmpeg/include/libavutil/eval.h b/extern/ffmpeg/include/libavutil/eval.h new file mode 100644 index 0000000000..22fa121127 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/eval.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +#if FF_API_OLD_EVAL_NAMES +/** + * @deprecated Deprecated in favor of av_expr_parse_and_eval(). + */ +attribute_deprecated +int av_parse_and_eval_expr(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * @deprecated Deprecated in favor of av_expr_parse(). + */ +attribute_deprecated +int av_parse_expr(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); +/** + * @deprecated Deprecated in favor of av_expr_eval(). + */ +attribute_deprecated +double av_eval_expr(AVExpr *e, const double *const_values, void *opaque); + +/** + * @deprecated Deprecated in favor of av_expr_free(). + */ +attribute_deprecated +void av_free_expr(AVExpr *e); +#endif /* FF_API_OLD_EVAL_NAMES */ + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/fifo.h b/extern/ffmpeg/include/libavutil/fifo.h similarity index 54% rename from src/ffmpeg/modern_working/include/libavutil/fifo.h rename to extern/ffmpeg/include/libavutil/fifo.h index a904dfd02e..22a9aa5d18 100644 --- a/src/ffmpeg/modern_working/include/libavutil/fifo.h +++ b/extern/ffmpeg/include/libavutil/fifo.h @@ -17,7 +17,7 @@ */ /** - * @file libavutil/fifo.h + * @file * a very simple circular buffer FIFO implementation */ @@ -26,7 +26,6 @@ #include #include "avutil.h" -#include "common.h" typedef struct AVFifoBuffer { uint8_t *buffer; @@ -35,55 +34,56 @@ typedef struct AVFifoBuffer { } AVFifoBuffer; /** - * Initializes an AVFifoBuffer. + * Initialize an AVFifoBuffer. * @param size of FIFO - * @return AVFifoBuffer or NULL if mem allocation failure + * @return AVFifoBuffer or NULL in case of memory allocation failure */ AVFifoBuffer *av_fifo_alloc(unsigned int size); /** - * Frees an AVFifoBuffer. - * @param *f AVFifoBuffer to free + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free */ void av_fifo_free(AVFifoBuffer *f); /** - * Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. - * @param *f AVFifoBuffer to reset + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset */ void av_fifo_reset(AVFifoBuffer *f); /** - * Returns the amount of data in bytes in the AVFifoBuffer, that is the + * Return the amount of data in bytes in the AVFifoBuffer, that is the * amount of data you can read from it. - * @param *f AVFifoBuffer to read from + * @param f AVFifoBuffer to read from * @return size */ int av_fifo_size(AVFifoBuffer *f); /** - * Returns the amount of space in bytes in the AVFifoBuffer, that is the + * Return the amount of space in bytes in the AVFifoBuffer, that is the * amount of data you can write into it. - * @param *f AVFifoBuffer to write into + * @param f AVFifoBuffer to write into * @return size */ int av_fifo_space(AVFifoBuffer *f); /** - * Feeds data from an AVFifoBuffer to a user-supplied callback. - * @param *f AVFifoBuffer to read from + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from * @param buf_size number of bytes to read - * @param *func generic read function - * @param *dest data destination + * @param func generic read function + * @param dest data destination */ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); /** - * Feeds data from a user-supplied callback to an AVFifoBuffer. - * @param *f AVFifoBuffer to write to - * @param *src data source + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func * @param size number of bytes to write - * @param *func generic write function; the first parameter is src, + * @param func generic write function; the first parameter is src, * the second is dest_buf, the third is dest_buf_size. * func must return the number of bytes written to dest_buf, or <= 0 to * indicate no more data available to write. @@ -93,25 +93,51 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func) int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); /** - * Resizes an AVFifoBuffer. - * @param *f AVFifoBuffer to resize + * Resize an AVFifoBuffer. + * In case of reallocation failure, the old FIFO is kept unchanged. + * + * @param f AVFifoBuffer to resize * @param size new AVFifoBuffer size in bytes * @return <0 for failure, >=0 otherwise */ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); /** - * Reads and discards the specified amount of data from an AVFifoBuffer. - * @param *f AVFifoBuffer to read from + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from * @param size amount of data to read in bytes */ void av_fifo_drain(AVFifoBuffer *f, int size); -static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) { uint8_t *ptr = f->rptr + offs; if (ptr >= f->end) - ptr -= f->end - f->buffer; - return *ptr; + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; } + +#if FF_API_AV_FIFO_PEEK +/** + * @deprecated Use av_fifo_peek2() instead. + */ +attribute_deprecated +static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) +{ + return *av_fifo_peek2(f, offs); +} +#endif + #endif /* AVUTIL_FIFO_H */ diff --git a/extern/ffmpeg/include/libavutil/file.h b/extern/ffmpeg/include/libavutil/file.h new file mode 100644 index 0000000000..f3af9ef7e5 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/file.h @@ -0,0 +1,61 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +/** + * Wrapper to work around the lack of mkstemp() on mingw. + * Also, tries to create file in /tmp first, if possible. + * *prefix can be a character constant; *filename will be allocated internally. + * @return file descriptor of opened file (or -1 on error) + * and opened file name in **filename. + */ +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); + +#endif /* AVUTIL_FILE_H */ diff --git a/extern/ffmpeg/include/libavutil/imgutils.h b/extern/ffmpeg/include/libavutil/imgutils.h new file mode 100644 index 0000000000..9b53815fb6 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/imgutils.h @@ -0,0 +1,138 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum PixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum PixelFormat pix_fmt, int width, int height); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/intfloat_readwrite.h b/extern/ffmpeg/include/libavutil/intfloat_readwrite.h similarity index 73% rename from src/ffmpeg/modern_working/include/libavutil/intfloat_readwrite.h rename to extern/ffmpeg/include/libavutil/intfloat_readwrite.h index e2d5d5be0e..9709f4dae4 100644 --- a/src/ffmpeg/modern_working/include/libavutil/intfloat_readwrite.h +++ b/extern/ffmpeg/include/libavutil/intfloat_readwrite.h @@ -22,7 +22,7 @@ #define AVUTIL_INTFLOAT_READWRITE_H #include -#include "common.h" +#include "attributes.h" /* IEEE 80 bits extended float */ typedef struct AVExtFloat { @@ -30,11 +30,11 @@ typedef struct AVExtFloat { uint8_t mantissa[8]; } AVExtFloat; -double av_int2dbl(int64_t v) av_const; -float av_int2flt(int32_t v) av_const; -double av_ext2dbl(const AVExtFloat ext) av_const; -int64_t av_dbl2int(double d) av_const; -int32_t av_flt2int(float d) av_const; -AVExtFloat av_dbl2ext(double d) av_const; +attribute_deprecated double av_int2dbl(int64_t v) av_const; +attribute_deprecated float av_int2flt(int32_t v) av_const; +attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; +attribute_deprecated int64_t av_dbl2int(double d) av_const; +attribute_deprecated int32_t av_flt2int(float d) av_const; +attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; #endif /* AVUTIL_INTFLOAT_READWRITE_H */ diff --git a/extern/ffmpeg/include/libavutil/intreadwrite.h b/extern/ffmpeg/include/libavutil/intreadwrite.h new file mode 100644 index 0000000000..09d796c8b8 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/intreadwrite.h @@ -0,0 +1,522 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, d) do { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, d) do { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, d) do { \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/extern/ffmpeg/include/libavutil/lfg.h b/extern/ffmpeg/include/libavutil/lfg.h new file mode 100644 index 0000000000..854ffce737 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/log.h b/extern/ffmpeg/include/libavutil/log.h similarity index 53% rename from src/ffmpeg/modern_working/include/libavutil/log.h rename to extern/ffmpeg/include/libavutil/log.h index b0a1493607..02a0e1ac8c 100644 --- a/src/ffmpeg/modern_working/include/libavutil/log.h +++ b/extern/ffmpeg/include/libavutil/log.h @@ -23,13 +23,14 @@ #include #include "avutil.h" +#include "attributes.h" /** - * Describes the class of an AVClass context structure. That is an + * Describe the class of an AVClass context structure. That is an * arbitrary struct of which the first field is a pointer to an * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). */ -typedef struct { +typedef struct AVClass { /** * The name of the class; usually it is the same name as the * context structure type to which the AVClass is associated. @@ -48,6 +49,43 @@ typedef struct { * @see av_set_default_options() */ const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for loging is stored. + * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such + * parent context. And a av_log() implementation could then display the parent context + * can be NULL of course + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); } AVClass; /* av_log API */ @@ -87,7 +125,7 @@ typedef struct { #define AV_LOG_DEBUG 48 /** - * Sends the specified message to the log if the level is less than or equal + * Send the specified message to the log if the level is less than or equal * to the current av_log_level. By default, all logging messages are sent to * stderr. This behavior can be altered by setting a different av_vlog callback * function. @@ -100,16 +138,45 @@ typedef struct { * subsequent arguments are converted to output. * @see av_vlog */ -#ifdef __GNUC__ -void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -#else -void av_log(void*, int level, const char *fmt, ...); -#endif +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); -void av_vlog(void*, int level, const char *fmt, va_list); +void av_vlog(void *avcl, int level, const char *fmt, va_list); int av_log_get_level(void); void av_log_set_level(int); void av_log_set_callback(void (*)(void*, int, const char*, va_list)); void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); +const char* av_default_item_name(void* ctx); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formated line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + */ +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); #endif /* AVUTIL_LOG_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/lzo.h b/extern/ffmpeg/include/libavutil/lzo.h similarity index 63% rename from src/ffmpeg/modern_working/include/libavutil/lzo.h rename to extern/ffmpeg/include/libavutil/lzo.h index 6788054bff..060b5c9d76 100644 --- a/src/ffmpeg/modern_working/include/libavutil/lzo.h +++ b/extern/ffmpeg/include/libavutil/lzo.h @@ -22,30 +22,37 @@ #ifndef AVUTIL_LZO_H #define AVUTIL_LZO_H +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + #include -/** \defgroup errflags Error flags returned by av_lzo1x_decode - * \{ */ -//! end of the input buffer reached before decoding finished +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished #define AV_LZO_INPUT_DEPLETED 1 -//! decoded data did not fit into output buffer +/// decoded data did not fit into output buffer #define AV_LZO_OUTPUT_FULL 2 -//! a reference to previously decoded data was wrong +/// a reference to previously decoded data was wrong #define AV_LZO_INVALID_BACKPTR 4 -//! a non-specific error in the compressed bitstream +/// a non-specific error in the compressed bitstream #define AV_LZO_ERROR 8 -/** \} */ +/** @} */ #define AV_LZO_INPUT_PADDING 8 #define AV_LZO_OUTPUT_PADDING 12 /** - * \brief Decodes LZO 1x compressed data. - * \param out output buffer - * \param outlen size of output buffer, number of bytes left are returned here - * \param in input buffer - * \param inlen size of input buffer, number of bytes left are returned here - * \return 0 on success, otherwise a combination of the error flags above + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above * * Make sure all buffers are appropriately padded, in must provide * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. @@ -53,14 +60,18 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); /** - * \brief deliberately overlapping memcpy implementation - * \param dst destination buffer; must be padded with 12 additional bytes - * \param back how many bytes back we start (the initial size of the overlapping window) - * \param cnt number of bytes to copy, must be >= 0 + * @brief deliberately overlapping memcpy implementation + * @param dst destination buffer; must be padded with 12 additional bytes + * @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 + * @param cnt number of bytes to copy, must be >= 0 * * cnt > back is valid, this will copy the bytes we just copied, * thus creating a repeating pattern with a period length of back. */ void av_memcpy_backptr(uint8_t *dst, int back, int cnt); +/** + * @} + */ + #endif /* AVUTIL_LZO_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/mathematics.h b/extern/ffmpeg/include/libavutil/mathematics.h similarity index 60% rename from src/ffmpeg/modern_working/include/libavutil/mathematics.h rename to extern/ffmpeg/include/libavutil/mathematics.h index cb3591051a..ad39e263ce 100644 --- a/src/ffmpeg/modern_working/include/libavutil/mathematics.h +++ b/extern/ffmpeg/include/libavutil/mathematics.h @@ -23,7 +23,7 @@ #include #include -#include "common.h" +#include "attributes.h" #include "rational.h" #ifndef M_E @@ -35,12 +35,21 @@ #ifndef M_LN10 #define M_LN10 2.30258509299404568402 /* log_e 10 */ #endif +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif #ifndef M_SQRT1_2 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif #ifndef NAN #define NAN (0.0/0.0) #endif @@ -48,6 +57,12 @@ #define INFINITY (1.0/0.0) #endif +/** + * @addtogroup lavu_math + * @{ + */ + + enum AVRounding { AV_ROUND_ZERO = 0, ///< Round toward zero. AV_ROUND_INF = 1, ///< Round away from zero. @@ -56,23 +71,52 @@ enum AVRounding { AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. }; +/** + * Return the greatest common divisor of a and b. + * If both a and b are 0 or either or both are <0 then behavior is + * undefined. + */ int64_t av_const av_gcd(int64_t a, int64_t b); /** - * Rescales a 64-bit integer with rounding to nearest. + * Rescale a 64-bit integer with rounding to nearest. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; /** - * Rescales a 64-bit integer with specified rounding. + * Rescale a 64-bit integer with specified rounding. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; /** - * Rescales a 64-bit integer by 2 rational numbers. + * Rescale a 64-bit integer by 2 rational numbers. */ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; +/** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * @} + */ + #endif /* AVUTIL_MATHEMATICS_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/md5.h b/extern/ffmpeg/include/libavutil/md5.h similarity index 93% rename from src/ffmpeg/modern_working/include/libavutil/md5.h rename to extern/ffmpeg/include/libavutil/md5.h index 969202a807..1333ab2ddf 100644 --- a/src/ffmpeg/modern_working/include/libavutil/md5.h +++ b/extern/ffmpeg/include/libavutil/md5.h @@ -23,6 +23,12 @@ #include +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + extern const int av_md5_size; struct AVMD5; @@ -32,5 +38,9 @@ void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); +/** + * @} + */ + #endif /* AVUTIL_MD5_H */ diff --git a/extern/ffmpeg/include/libavutil/mem.h b/extern/ffmpeg/include/libavutil/mem.h new file mode 100644 index 0000000000..c6c907ea08 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/mem.h @@ -0,0 +1,188 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include "attributes.h" +#include "error.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * @{ + */ + + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__TI_COMPILER_VERSION__) + #define DECLARE_ALIGNED(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + t __attribute__((aligned(n))) v + #define DECLARE_ASM_CONST(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + static const t __attribute__((aligned(n))) v +#elif defined(__GNUC__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(n) __attribute__((alloc_size(n))) +#else + #define av_alloc_size(n) +#endif + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @param size Size in bytes for the memory block to be allocated or + * reallocated. + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @see av_fast_realloc() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate or reallocate a block of memory. + * This function does the same thing as av_realloc, except: + * - It takes two arguments and checks the result of the multiplication for + * integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic "buf = realloc(buf); if (!buf) return -1;". + */ +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of nmemb * size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * The allocation will fail if nmemb * size is greater than or equal + * to INT_MAX. + * @param nmemb + * @param size + * @return Pointer to the allocated block, NULL if it cannot be allocated. + */ +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; + +/** + * Duplicate the string s. + * @param s string to be duplicated + * @return Pointer to a newly allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * Add an element to a dynamic array. + * + * @param tab_ptr Pointer to the array. + * @param nb_ptr Pointer to the number of elements in the array. + * @param elem Element to be added. + */ +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Multiply two size_t values checking for overflow. + * @return 0 if success, AVERROR(EINVAL) if overflow. + */ +static inline int av_size_mult(size_t a, size_t b, size_t *r) +{ + size_t t = a * b; + /* Hack inspired from glibc: only try the division if nelem and elsize + * are both greater than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); + *r = t; + return 0; +} + +/** + * Set the maximum size that may me allocated in one block. + */ +void av_max_alloc(size_t max); + +/** + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/extern/ffmpeg/include/libavutil/opt.h b/extern/ffmpeg/include/libavutil/opt.h new file mode 100644 index 0000000000..0196056d6d --- /dev/null +++ b/extern/ffmpeg/include/libavutil/opt.h @@ -0,0 +1,603 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct must be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() must be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in FFmpeg are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType{ + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, +#if FF_API_OLD_AVOPTIONS + FF_OPT_TYPE_FLAGS = 0, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST=128, +#endif +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + double dbl; + const char *str; + /* TODO those are unused now */ + int64_t i64; + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +#if FF_API_FIND_OPT +/** + * Look for an option in obj. Look only for the options which + * have the flags set as specified in mask and flags (that is, + * for which it is the case that opt->flags & mask == flags). + * + * @param[in] obj a pointer to a struct whose first element is a + * pointer to an AVClass + * @param[in] name the name of the option to look for + * @param[in] unit the unit of the option to look for, or any if NULL + * @return a pointer to the option found, or NULL if no option + * has been found + * + * @deprecated use av_opt_find. + */ +attribute_deprecated +const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); +#endif + +#if FF_API_OLD_AVOPTIONS +/** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc this parameter is currently ignored + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + * @deprecated use av_opt_set() + */ +attribute_deprecated +int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); + +attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); +attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); +attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); + +double av_get_double(void *obj, const char *name, const AVOption **o_out); +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); +attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); +attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); +#endif + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +#if FF_API_OLD_AVOPTIONS +attribute_deprecated +void av_opt_set_defaults2(void *s, int mask, int flags); +#endif + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param opts options string to parse, may be NULL + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all string and binary options in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/* + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double(void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + */ +/** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +/** + * @} + */ +/** + * Gets a pointer to the requested field in a struct. + * This function allows accessing a struct even when its fields are moved or + * renamed since the application making the access has been compiled, + * + * @returns a pointer to the field, it can be cast to the correct type and read + * or written to. + */ +void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); +/** + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/extern/ffmpeg/include/libavutil/parseutils.h b/extern/ffmpeg/include/libavutil/parseutils.h new file mode 100644 index 0000000000..2a74a060f2 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/parseutils.h @@ -0,0 +1,124 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/pixdesc.h b/extern/ffmpeg/include/libavutil/pixdesc.h similarity index 62% rename from src/ffmpeg/modern_working/include/libavutil/pixdesc.h rename to extern/ffmpeg/include/libavutil/pixdesc.h index c8743487c9..2175246785 100644 --- a/src/ffmpeg/modern_working/include/libavutil/pixdesc.h +++ b/extern/ffmpeg/include/libavutil/pixdesc.h @@ -23,8 +23,7 @@ #define AVUTIL_PIXDESC_H #include - -#include "intreadwrite.h" +#include "pixfmt.h" typedef struct AVComponentDescriptor{ uint16_t plane :2; ///< which of the 4 planes contains the component @@ -88,6 +87,8 @@ typedef struct AVPixFmtDescriptor{ #define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. #define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. +#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane +#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale) /** * The array of all the pixel format descriptors. @@ -95,115 +96,76 @@ typedef struct AVPixFmtDescriptor{ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; /** - * Reads a line from an image, and writes to dst the values of the - * pixel format component c. + * Read a line from an image, and write the values of the + * pixel format component c to dst. * * @param data the array containing the pointers to the planes of the image - * @param linesizes the array containing the linesizes of the image + * @param linesize the array containing the linesizes of the image * @param desc the pixel format descriptor for the image * @param x the horizontal coordinate of the first pixel to read * @param y the vertical coordinate of the first pixel to read * @param w the width of the line to read, that is the number of * values to write to dst * @param read_pal_component if not zero and the format is a paletted - * format writes to dst the values corresponding to the palette - * component c in data[1], rather than the palette indexes in + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in * data[0]. The behavior is undefined if the format is not paletted. */ -static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component) -{ - AVComponentDescriptor comp= desc->comp[c]; - int plane= comp.plane; - int depth= comp.depth_minus1+1; - int mask = (1<flags; - - if (flags & PIX_FMT_BITSTREAM){ - int skip = x*step + comp.offset_plus1-1; - const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3); - int shift = 8 - depth - (skip&7); - - while(w--){ - int val = (*p >> shift) & mask; - if(read_pal_component) - val= data[1][4*val + c]; - shift -= step; - p -= shift>>3; - shift &= 7; - *dst++= val; - } - } else { - const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; - - while(w--){ - int val; - if(flags & PIX_FMT_BE) val= AV_RB16(p); - else val= AV_RL16(p); - val = (val>>shift) & mask; - if(read_pal_component) - val= data[1][4*val + c]; - p+= step; - *dst++= val; - } - } -} +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], + const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); /** - * Writes the values from src to the pixel format component c of an + * Write the values from src to the pixel format component c of an * image line. * * @param src array containing the values to write * @param data the array containing the pointers to the planes of the * image to write into. It is supposed to be zeroed. - * @param linesizes the array containing the linesizes of the image + * @param linesize the array containing the linesizes of the image * @param desc the pixel format descriptor for the image * @param x the horizontal coordinate of the first pixel to write * @param y the vertical coordinate of the first pixel to write * @param w the width of the line to write, that is the number of * values to write to the image line */ -static inline void write_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, int x, int y, int c, int w) -{ - AVComponentDescriptor comp = desc->comp[c]; - int plane = comp.plane; - int depth = comp.depth_minus1+1; - int step = comp.step_minus1+1; - int flags = desc->flags; - - if (flags & PIX_FMT_BITSTREAM) { - int skip = x*step + comp.offset_plus1-1; - uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3); - int shift = 8 - depth - (skip&7); - - while (w--) { - *p |= *src++ << shift; - shift -= step; - p -= shift>>3; - shift &= 7; - } - } else { - int shift = comp.shift; - uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; - - while (w--) { - if (flags & PIX_FMT_BE) { - uint16_t val = AV_RB16(p) | (*src++< + * Copyright (c) 2009 Baptiste Coudurier * * This file is part of FFmpeg. * @@ -18,22 +18,26 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INTFLOAT_READWRITE_H -#define INTFLOAT_READWRITE_H +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H -#include "common.h" +#include +/** + * @addtogroup lavu_crypto + * @{ + */ -/* IEEE 80 bits extended float */ -typedef struct AVExtFloat { - uint8_t exponent[2]; - uint8_t mantissa[8]; -} AVExtFloat; +/** + * Get a seed to use in conjunction with random functions. + * This function tries to provide a good seed at a best effort bases. + * Its possible to call this function multiple times if more bits are needed. + * It can be quite slow, which is why it should only be used as seed for a faster + * PRNG. The quality of the seed depends on the platform. + */ +uint32_t av_get_random_seed(void); -double av_int2dbl(int64_t v); -float av_int2flt(int32_t v); -double av_ext2dbl(const AVExtFloat ext); -int64_t av_dbl2int(double d); -int32_t av_flt2int(float d); -AVExtFloat av_dbl2ext(double d); +/** + * @} + */ -#endif /* INTFLOAT_READWRITE_H */ +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/rational.h b/extern/ffmpeg/include/libavutil/rational.h similarity index 79% rename from src/ffmpeg/modern_working/include/libavutil/rational.h rename to extern/ffmpeg/include/libavutil/rational.h index 0f415edf94..8c2bdb5529 100644 --- a/src/ffmpeg/modern_working/include/libavutil/rational.h +++ b/extern/ffmpeg/include/libavutil/rational.h @@ -20,7 +20,7 @@ */ /** - * @file libavutil/rational.h + * @file * rational numbers * @author Michael Niedermayer */ @@ -29,7 +29,13 @@ #define AVUTIL_RATIONAL_H #include -#include "common.h" +#include +#include "attributes.h" + +/** + * @addtogroup lavu_math + * @{ + */ /** * rational number numerator/denominator @@ -40,20 +46,23 @@ typedef struct AVRational{ } AVRational; /** - * Compares two rationals. + * Compare two rationals. * @param a first rational * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if ab, -1 if a>63)|1; - else return 0; + if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; } /** - * Converts rational to double. + * Convert rational to double. * @param a rational to convert * @return (double) a */ @@ -62,7 +71,7 @@ static inline double av_q2d(AVRational a){ } /** - * Reduces a fraction. + * Reduce a fraction. * This is useful for framerate calculations. * @param dst_num destination numerator * @param dst_den destination denominator @@ -74,7 +83,7 @@ static inline double av_q2d(AVRational a){ int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); /** - * Multiplies two rationals. + * Multiply two rationals. * @param b first rational * @param c second rational * @return b*c @@ -82,7 +91,7 @@ int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) AVRational av_mul_q(AVRational b, AVRational c) av_const; /** - * Divides one rational by another. + * Divide one rational by another. * @param b first rational * @param c second rational * @return b/c @@ -90,7 +99,7 @@ AVRational av_mul_q(AVRational b, AVRational c) av_const; AVRational av_div_q(AVRational b, AVRational c) av_const; /** - * Adds two rationals. + * Add two rationals. * @param b first rational * @param c second rational * @return b+c @@ -98,7 +107,7 @@ AVRational av_div_q(AVRational b, AVRational c) av_const; AVRational av_add_q(AVRational b, AVRational c) av_const; /** - * Subtracts one rational from another. + * Subtract one rational from another. * @param b first rational * @param c second rational * @return b-c @@ -106,7 +115,9 @@ AVRational av_add_q(AVRational b, AVRational c) av_const; AVRational av_sub_q(AVRational b, AVRational c) av_const; /** - * Converts a double precision floating point number to a rational. + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * * @param d double to convert * @param max the maximum allowed numerator and denominator * @return (AVRational) d @@ -120,10 +131,14 @@ AVRational av_d2q(double d, int max) av_const; int av_nearer_q(AVRational q, AVRational q1, AVRational q2); /** - * Finds the nearest value in q_list to q. + * Find the nearest value in q_list to q. * @param q_list an array of rationals terminated by {0, 0} * @return the index of the nearest value found in the array */ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); +/** + * @} + */ + #endif /* AVUTIL_RATIONAL_H */ diff --git a/extern/ffmpeg/include/libavutil/samplefmt.h b/extern/ffmpeg/include/libavutil/samplefmt.h new file mode 100644 index 0000000000..855cffd838 --- /dev/null +++ b/extern/ffmpeg/include/libavutil/samplefmt.h @@ -0,0 +1,156 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include "avutil.h" + +/** + * all in native-endian format + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + */ +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +#if FF_API_GET_BITS_PER_SAMPLE_FMT +/** + * @deprecated Use av_get_bytes_per_sample() instead. + */ +attribute_deprecated +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); +#endif + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Fill channel data pointers and linesize for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each channel's data + * buffer for planar layout, or the aligned size of the buffer for all channels + * for packed layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (1 = no alignment required) + * @return 0 on success or a negative error code on failure + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s) + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (1 = no alignment required) + * @return 0 on success or a negative error code on failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/sha1.h b/extern/ffmpeg/include/libavutil/sha.h similarity index 65% rename from src/ffmpeg/modern_working/include/libavutil/sha1.h rename to extern/ffmpeg/include/libavutil/sha.h index cf7c4a656b..d891cae87f 100644 --- a/src/ffmpeg/modern_working/include/libavutil/sha1.h +++ b/extern/ffmpeg/include/libavutil/sha.h @@ -18,40 +18,49 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVUTIL_SHA1_H -#define AVUTIL_SHA1_H +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H #include -extern const int av_sha1_size; +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ -struct AVSHA1; +extern const int av_sha_size; + +struct AVSHA; /** - * Initializes SHA-1 hashing. + * Initialize SHA-1 or SHA-2 hashing. * * @param context pointer to the function context (of size av_sha_size) - * @deprecated use av_sha_init() instead + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise */ -void av_sha1_init(struct AVSHA1* context); +int av_sha_init(struct AVSHA* context, int bits); /** - * Updates hash value. + * Update hash value. * * @param context hash function context * @param data input data to update hash with * @param len input data length - * @deprecated use av_sha_update() instead */ -void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len); +void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); /** - * Finishes hashing and output digest value. + * Finish hashing and output digest value. * * @param context hash function context * @param digest buffer where output digest value is stored - * @deprecated use av_sha_final() instead */ -void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]); +void av_sha_final(struct AVSHA* context, uint8_t *digest); -#endif /* AVUTIL_SHA1_H */ +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/extern/ffmpeg/include/libpostproc/postprocess.h b/extern/ffmpeg/include/libpostproc/postprocess.h new file mode 100644 index 0000000000..c2c5c73240 --- /dev/null +++ b/extern/ffmpeg/include/libpostproc/postprocess.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_POSTPROCESS_H +#define POSTPROC_POSTPROCESS_H + +/** + * @file + * @brief + * external postprocessing API + */ + +#include "libavutil/avutil.h" + +#ifndef LIBPOSTPROC_VERSION_MAJOR +#define LIBPOSTPROC_VERSION_MAJOR 52 +#define LIBPOSTPROC_VERSION_MINOR 0 +#define LIBPOSTPROC_VERSION_MICRO 100 +#endif + +#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT + +#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION) + +/** + * Return the LIBPOSTPROC_VERSION_INT constant. + */ +unsigned postproc_version(void); + +/** + * Return the libpostproc build-time configuration. + */ +const char *postproc_configuration(void); + +/** + * Return the libpostproc license. + */ +const char *postproc_license(void); + +#define PP_QUALITY_MAX 6 + +#define QP_STORE_T int8_t + +#include + +typedef void pp_context; +typedef void pp_mode; + +#if LIBPOSTPROC_VERSION_INT < (52<<16) +typedef pp_context pp_context_t; +typedef pp_mode pp_mode_t; +extern const char *const pp_help; ///< a simple help text +#else +extern const char pp_help[]; ///< a simple help text +#endif + +void pp_postprocess(const uint8_t * src[3], const int srcStride[3], + uint8_t * dst[3], const int dstStride[3], + int horizontalSize, int verticalSize, + const QP_STORE_T *QP_store, int QP_stride, + pp_mode *mode, pp_context *ppContext, int pict_type); + + +/** + * Return a pp_mode or NULL if an error occurred. + * + * @param name the string after "-pp" on the command line + * @param quality a number from 0 to PP_QUALITY_MAX + */ +pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality); +void pp_free_mode(pp_mode *mode); + +pp_context *pp_get_context(int width, int height, int flags); +void pp_free_context(pp_context *ppContext); + +#define PP_CPU_CAPS_MMX 0x80000000 +#define PP_CPU_CAPS_MMX2 0x20000000 +#define PP_CPU_CAPS_3DNOW 0x40000000 +#define PP_CPU_CAPS_ALTIVEC 0x10000000 + +#define PP_FORMAT 0x00000008 +#define PP_FORMAT_420 (0x00000011|PP_FORMAT) +#define PP_FORMAT_422 (0x00000001|PP_FORMAT) +#define PP_FORMAT_411 (0x00000002|PP_FORMAT) +#define PP_FORMAT_444 (0x00000000|PP_FORMAT) + +#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale + +#endif /* POSTPROC_POSTPROCESS_H */ diff --git a/extern/ffmpeg/include/libswresample/swresample.h b/extern/ffmpeg/include/libswresample/swresample.h new file mode 100644 index 0000000000..8dc4e1f348 --- /dev/null +++ b/extern/ffmpeg/include/libswresample/swresample.h @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2011 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libswresample public header + */ + +#ifndef SWR_H +#define SWR_H + +#include +#include "libavutil/samplefmt.h" + +#define LIBSWRESAMPLE_VERSION_MAJOR 0 +#define LIBSWRESAMPLE_VERSION_MINOR 6 +#define LIBSWRESAMPLE_VERSION_MICRO 100 + +#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) + +#define SWR_CH_MAX 16 ///< Maximum number of channels + +#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate +//TODO use int resample ? +//long term TODO can we enable this dynamically? + + +struct SwrContext; + +/** + * Allocate SwrContext. + * + * If you use this function you will need to set the parameters (manually or + * with swr_alloc_set_opts()) before calling swr_init(). + * + * @see swr_alloc_set_opts(), swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc(void); + +/** + * Initialize context after user parameters have been set. + * + * @return AVERROR error code in case of failure. + */ +int swr_init(struct SwrContext *s); + +/** + * Allocate SwrContext if needed and set/reset common parameters. + * + * This function does not require s to be allocated with swr_alloc(). On the + * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters + * on the allocated context. + * + * @param s Swr context, can be NULL + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). + * @param out_sample_rate output sample rate (frequency in Hz) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). + * @param in_sample_rate input sample rate (frequency in Hz) + * @param log_offset logging level offset + * @param log_ctx parent logging context, can be NULL + * + * @see swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, + int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, + int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, + int log_offset, void *log_ctx); + +/** + * Free the given SwrContext and set the pointer to NULL. + */ +void swr_free(struct SwrContext **s); + +/** + * Convert audio. + * + * in and in_count can be set to 0 to flush the last few samples out at the + * end. + * + * @param s allocated Swr context, with parameters set + * @param out output buffers, only the first one need be set in case of packed audio + * @param out_count amount of space available for output in samples per channel + * @param in input buffers, only the first one need to be set in case of packed audio + * @param in_count number of input samples available in one channel + * + * @return number of samples output per channel + */ +int swr_convert(struct SwrContext *s, uint8_t *out[SWR_CH_MAX], int out_count, + const uint8_t *in [SWR_CH_MAX], int in_count); + +/** + * Activate resampling compensation. + */ +int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance); + +/** + * Set a customized input channel mapping. + * + * @param s allocated Swr context, not yet initialized + * @param channel_map customized input channel mapping (array of channel + * indexes, -1 for a muted channel) + * @return AVERROR error code in case of failure. + */ +int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); + +/** + * Return the LIBSWRESAMPLE_VERSION_INT constant. + */ +unsigned swresample_version(void); + +/** + * Return the swr build-time configuration. + */ +const char *swresample_configuration(void); + +/** + * Return the swr license. + */ +const char *swresample_license(void); + +#endif diff --git a/src/ffmpeg/modern_working/include/libswscale/swscale.h b/extern/ffmpeg/include/libswscale/swscale.h similarity index 64% rename from src/ffmpeg/modern_working/include/libswscale/swscale.h rename to extern/ffmpeg/include/libswscale/swscale.h index d940e82271..fa7100c41a 100644 --- a/src/ffmpeg/modern_working/include/libswscale/swscale.h +++ b/extern/ffmpeg/include/libswscale/swscale.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2003 Michael Niedermayer + * Copyright (C) 2001-2011 Michael Niedermayer * * This file is part of FFmpeg. * @@ -22,16 +22,18 @@ #define SWSCALE_SWSCALE_H /** - * @file libswscale/swscale.h + * @file * @brief * external api for the swscale stuff */ #include "libavutil/avutil.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" -#define LIBSWSCALE_VERSION_MAJOR 0 -#define LIBSWSCALE_VERSION_MINOR 7 -#define LIBSWSCALE_VERSION_MICRO 2 +#define LIBSWSCALE_VERSION_MAJOR 2 +#define LIBSWSCALE_VERSION_MINOR 1 +#define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ @@ -44,19 +46,33 @@ #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) /** - * Returns the LIBSWSCALE_VERSION_INT constant. + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_SWS_GETCONTEXT +#define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3) +#endif +#ifndef FF_API_SWS_CPU_CAPS +#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3) +#endif +#ifndef FF_API_SWS_FORMAT_NAME +#define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3) +#endif + +/** + * Return the LIBSWSCALE_VERSION_INT constant. */ unsigned swscale_version(void); /** - * Returns the libswscale build-time configuration. + * Return the libswscale build-time configuration. */ -const char * swscale_configuration(void); +const char *swscale_configuration(void); /** - * Returns the libswscale license. + * Return the libswscale license. */ -const char * swscale_license(void); +const char *swscale_license(void); /* values for the flags, the stuff on the command line is different */ #define SWS_FAST_BILINEAR 1 @@ -87,11 +103,18 @@ const char * swscale_license(void); #define SWS_ACCURATE_RND 0x40000 #define SWS_BITEXACT 0x80000 +#if FF_API_SWS_CPU_CAPS +/** + * CPU caps are autodetected now, those flags + * are only provided for API compatibility. + */ #define SWS_CPU_CAPS_MMX 0x80000000 #define SWS_CPU_CAPS_MMX2 0x20000000 #define SWS_CPU_CAPS_3DNOW 0x40000000 #define SWS_CPU_CAPS_ALTIVEC 0x10000000 #define SWS_CPU_CAPS_BFIN 0x01000000 +#define SWS_CPU_CAPS_SSE2 0x02000000 +#endif #define SWS_MAX_REDUCE_CUTOFF 0.002 @@ -103,7 +126,14 @@ const char * swscale_license(void); #define SWS_CS_SMPTE240M 7 #define SWS_CS_DEFAULT 5 - +/** + * Return a pointer to yuv<->rgb coefficients for the given colorspace + * suitable for sws_setColorspaceDetails(). + * + * @param colorspace One of the SWS_CS_* macros. If invalid, + * SWS_CS_DEFAULT is used. + */ +const int *sws_getCoefficients(int colorspace); // when used for filters they must have an odd number of elements // coeffs cannot be shared between vectors @@ -123,13 +153,41 @@ typedef struct { struct SwsContext; /** - * Frees the swscaler context swsContext. + * Return a positive value if pix_fmt is a supported input format, 0 + * otherwise. + */ +int sws_isSupportedInput(enum PixelFormat pix_fmt); + +/** + * Return a positive value if pix_fmt is a supported output format, 0 + * otherwise. + */ +int sws_isSupportedOutput(enum PixelFormat pix_fmt); + +/** + * Allocate an empty SwsContext. This must be filled and passed to + * sws_init_context(). For filling see AVOptions, options.c and + * sws_setColorspaceDetails(). + */ +struct SwsContext *sws_alloc_context(void); + +/** + * Initialize the swscaler context sws_context. + * + * @return zero or positive value on success, a negative value on + * error + */ +int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); + +/** + * Free the swscaler context swsContext. * If swsContext is NULL, then does nothing. */ void sws_freeContext(struct SwsContext *swsContext); +#if FF_API_SWS_GETCONTEXT /** - * Allocates and returns a SwsContext. You need it to perform + * Allocate and return an SwsContext. You need it to perform * scaling/conversion operations using sws_scale(). * * @param srcW the width of the source image @@ -140,14 +198,18 @@ void sws_freeContext(struct SwsContext *swsContext); * @param dstFormat the destination image format * @param flags specify which algorithm and options to use for rescaling * @return a pointer to an allocated context, or NULL in case of error + * @note this function is to be removed after a saner alternative is + * written + * @deprecated Use sws_getCachedContext() instead. */ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param); +#endif /** - * Scales the image slice in srcSlice and puts the resulting scaled + * Scale the image slice in srcSlice and put the resulting scaled * slice in the image in dst. A slice is a sequence of consecutive * rows in an image. * @@ -155,7 +217,7 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat * top-bottom or bottom-top order. If slices are provided in * non-sequential order the behavior of the function is undefined. * - * @param context the scaling context previously created with + * @param c the scaling context previously created with * sws_getContext() * @param srcSlice the array containing the pointers to the planes of * the source slice @@ -172,20 +234,12 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat * the destination image * @return the height of the output slice */ -int sws_scale(struct SwsContext *context, uint8_t* srcSlice[], int srcStride[], - int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]); -#if LIBSWSCALE_VERSION_MAJOR < 1 -/** - * @deprecated Use sws_scale() instead. - */ -int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], - int srcStride[], int srcSliceY, int srcSliceH, - uint8_t* dst[], int dstStride[]) attribute_deprecated; -#endif +int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], + const int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *const dst[], const int dstStride[]); /** * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x] - * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235 * @return -1 if not supported */ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], @@ -200,35 +254,35 @@ int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *brightness, int *contrast, int *saturation); /** - * Allocates and returns an uninitialized vector with length coefficients. + * Allocate and return an uninitialized vector with length coefficients. */ SwsVector *sws_allocVec(int length); /** - * Returns a normalized Gaussian curve used to filter stuff - * quality=3 is high quality, lower is lower quality. + * Return a normalized Gaussian curve used to filter stuff + * quality = 3 is high quality, lower is lower quality. */ SwsVector *sws_getGaussianVec(double variance, double quality); /** - * Allocates and returns a vector with length coefficients, all + * Allocate and return a vector with length coefficients, all * with the same value c. */ SwsVector *sws_getConstVec(double c, int length); /** - * Allocates and returns a vector with just one coefficient, with + * Allocate and return a vector with just one coefficient, with * value 1.0. */ SwsVector *sws_getIdentityVec(void); /** - * Scales all the coefficients of a by the scalar value. + * Scale all the coefficients of a by the scalar value. */ void sws_scaleVec(SwsVector *a, double scalar); /** - * Scales all the coefficients of a so that their sum equals height. + * Scale all the coefficients of a so that their sum equals height. */ void sws_normalizeVec(SwsVector *a, double height); void sws_convVec(SwsVector *a, SwsVector *b); @@ -237,20 +291,13 @@ void sws_subVec(SwsVector *a, SwsVector *b); void sws_shiftVec(SwsVector *a, int shift); /** - * Allocates and returns a clone of the vector a, that is a vector + * Allocate and return a clone of the vector a, that is a vector * with the same coefficients as a. */ SwsVector *sws_cloneVec(SwsVector *a); -#if LIBSWSCALE_VERSION_MAJOR < 1 /** - * @deprecated Use sws_printVec2() instead. - */ -attribute_deprecated void sws_printVec(SwsVector *a); -#endif - -/** - * Prints with av_log() a textual representation of the vector a + * Print with av_log() a textual representation of the vector a * if log_level <= av_log_level. */ void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); @@ -264,8 +311,7 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, void sws_freeFilter(SwsFilter *filter); /** - * Checks if context can be reused, otherwise reallocates a new - * one. + * Check if context can be reused, otherwise reallocate a new one. * * If context is NULL, just calls sws_getContext() to get a new * context. Otherwise, checks if the parameters are the ones already @@ -282,4 +328,36 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param); +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. + * + * The output frame will have the same packed format as the palette. + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); + +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. + * + * With the palette format "ABCD", the destination frame ends up with the format "ABC". + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); + +/** + * Get the AVClass for swsContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *sws_get_class(void); + #endif /* SWSCALE_SWSCALE_H */ diff --git a/extern/ffmpeg/lib/avcodec.lib b/extern/ffmpeg/lib/avcodec.lib new file mode 100644 index 0000000000..53ecaeb2da Binary files /dev/null and b/extern/ffmpeg/lib/avcodec.lib differ diff --git a/extern/ffmpeg/lib/avdevice.lib b/extern/ffmpeg/lib/avdevice.lib new file mode 100644 index 0000000000..c783238217 Binary files /dev/null and b/extern/ffmpeg/lib/avdevice.lib differ diff --git a/extern/ffmpeg/lib/avfilter.lib b/extern/ffmpeg/lib/avfilter.lib new file mode 100644 index 0000000000..9d6633e319 Binary files /dev/null and b/extern/ffmpeg/lib/avfilter.lib differ diff --git a/extern/ffmpeg/lib/avformat.lib b/extern/ffmpeg/lib/avformat.lib new file mode 100644 index 0000000000..19b2292f44 Binary files /dev/null and b/extern/ffmpeg/lib/avformat.lib differ diff --git a/extern/ffmpeg/lib/avutil.lib b/extern/ffmpeg/lib/avutil.lib new file mode 100644 index 0000000000..2e0854be87 Binary files /dev/null and b/extern/ffmpeg/lib/avutil.lib differ diff --git a/extern/ffmpeg/lib/libavcodec.dll.a b/extern/ffmpeg/lib/libavcodec.dll.a new file mode 100644 index 0000000000..67b584899f Binary files /dev/null and b/extern/ffmpeg/lib/libavcodec.dll.a differ diff --git a/extern/ffmpeg/lib/libavdevice.dll.a b/extern/ffmpeg/lib/libavdevice.dll.a new file mode 100644 index 0000000000..237c5475b9 Binary files /dev/null and b/extern/ffmpeg/lib/libavdevice.dll.a differ diff --git a/extern/ffmpeg/lib/libavfilter.dll.a b/extern/ffmpeg/lib/libavfilter.dll.a new file mode 100644 index 0000000000..8a0625c1ea Binary files /dev/null and b/extern/ffmpeg/lib/libavfilter.dll.a differ diff --git a/extern/ffmpeg/lib/libavformat.dll.a b/extern/ffmpeg/lib/libavformat.dll.a new file mode 100644 index 0000000000..f77bb7e12f Binary files /dev/null and b/extern/ffmpeg/lib/libavformat.dll.a differ diff --git a/extern/ffmpeg/lib/libavutil.dll.a b/extern/ffmpeg/lib/libavutil.dll.a new file mode 100644 index 0000000000..c7dab90d71 Binary files /dev/null and b/extern/ffmpeg/lib/libavutil.dll.a differ diff --git a/extern/ffmpeg/lib/libpostproc.dll.a b/extern/ffmpeg/lib/libpostproc.dll.a new file mode 100644 index 0000000000..6f406bbcb5 Binary files /dev/null and b/extern/ffmpeg/lib/libpostproc.dll.a differ diff --git a/extern/ffmpeg/lib/libswresample.dll.a b/extern/ffmpeg/lib/libswresample.dll.a new file mode 100644 index 0000000000..e3ad0f423a Binary files /dev/null and b/extern/ffmpeg/lib/libswresample.dll.a differ diff --git a/extern/ffmpeg/lib/libswscale.dll.a b/extern/ffmpeg/lib/libswscale.dll.a new file mode 100644 index 0000000000..06ba9d1e6c Binary files /dev/null and b/extern/ffmpeg/lib/libswscale.dll.a differ diff --git a/extern/ffmpeg/lib/postproc.lib b/extern/ffmpeg/lib/postproc.lib new file mode 100644 index 0000000000..4201010902 Binary files /dev/null and b/extern/ffmpeg/lib/postproc.lib differ diff --git a/extern/ffmpeg/lib/swresample.lib b/extern/ffmpeg/lib/swresample.lib new file mode 100644 index 0000000000..e85e552cb4 Binary files /dev/null and b/extern/ffmpeg/lib/swresample.lib differ diff --git a/extern/ffmpeg/lib/swscale.lib b/extern/ffmpeg/lib/swscale.lib new file mode 100644 index 0000000000..7b42d2c213 Binary files /dev/null and b/extern/ffmpeg/lib/swscale.lib differ diff --git a/extern/ffmpeg/licenses/bzip2.txt b/extern/ffmpeg/licenses/bzip2.txt new file mode 100644 index 0000000000..af3a130406 --- /dev/null +++ b/extern/ffmpeg/licenses/bzip2.txt @@ -0,0 +1,42 @@ + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2010 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@bzip.org +bzip2/libbzip2 version 1.0.6 of 6 September 2010 + +-------------------------------------------------------------------------- diff --git a/extern/ffmpeg/licenses/ffmpeg.txt b/extern/ffmpeg/licenses/ffmpeg.txt new file mode 100644 index 0000000000..818433ecc0 --- /dev/null +++ b/extern/ffmpeg/licenses/ffmpeg.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/extern/ffmpeg/licenses/freetype.txt b/extern/ffmpeg/licenses/freetype.txt new file mode 100644 index 0000000000..b6ee268ef7 --- /dev/null +++ b/extern/ffmpeg/licenses/freetype.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/extern/ffmpeg/licenses/frei0r.txt b/extern/ffmpeg/licenses/frei0r.txt new file mode 100644 index 0000000000..0f3bd3d29f --- /dev/null +++ b/extern/ffmpeg/licenses/frei0r.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/gsm.txt b/extern/ffmpeg/licenses/gsm.txt new file mode 100644 index 0000000000..8aec8e1a94 --- /dev/null +++ b/extern/ffmpeg/licenses/gsm.txt @@ -0,0 +1,35 @@ +Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universitaet Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universitaet Berlin +are deemed to have made any representations as to the suitability of this +software for any purpose nor are held responsible for any defects of +this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener +Carsten Bormann + + oOo + +Since the original terms of 15 years ago maybe do not make our +intentions completely clear given today's refined usage of the legal +terms, we append this additional permission: + + Permission to use, copy, modify, and distribute this software + for any purpose with or without fee is hereby granted, + provided that this notice is not removed and that neither + the authors nor the Technische Universitaet Berlin are + deemed to have made any representations as to the suitability + of this software for any purpose nor are held responsible + for any defects of this software. THERE IS ABSOLUTELY NO + WARRANTY FOR THIS SOFTWARE. + +Berkeley/Bremen, 05.04.2009 +Jutta Degener +Carsten Bormann \ No newline at end of file diff --git a/extern/ffmpeg/licenses/lame.txt b/extern/ffmpeg/licenses/lame.txt new file mode 100644 index 0000000000..b240210341 --- /dev/null +++ b/extern/ffmpeg/licenses/lame.txt @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! \ No newline at end of file diff --git a/extern/ffmpeg/licenses/libvpx.txt b/extern/ffmpeg/licenses/libvpx.txt new file mode 100644 index 0000000000..872c1f141b --- /dev/null +++ b/extern/ffmpeg/licenses/libvpx.txt @@ -0,0 +1,29 @@ +Copyright (c) 2010, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/extern/ffmpeg/licenses/opencore-amr.txt b/extern/ffmpeg/licenses/opencore-amr.txt new file mode 100644 index 0000000000..6c40ca52e0 --- /dev/null +++ b/extern/ffmpeg/licenses/opencore-amr.txt @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the +copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other +entities that control, are controlled by, or are under common control with +that entity. For the purposes of this definition, "control" means (i) the +power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty +percent (50%) or more of the outstanding shares, or (iii) beneficial +ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation +or translation of a Source form, including but not limited to compiled +object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice that +is included in or attached to the work (an example is provided in the +Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, as +a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, or +merely link (or bind by name) to the interfaces of, the Work and Derivative +Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor for +inclusion in the Work by the copyright owner or by an individual or Legal +Entity authorized to submit on behalf of the copyright owner. For the +purposes of this definition, "submitted" means any form of electronic, +verbal, or written communication sent to the Licensor or its +representatives, including but not limited to communication on electronic +mailing lists, source code control systems, and issue tracking systems that +are managed by, or on behalf of, the Licensor for the purpose of discussing +and improving the Work, but excluding communication that is conspicuously +marked or otherwise designated in writing by the copyright owner as "Not a +Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on +behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, +sublicense, and distribute the Work and such Derivative Works in Source or +Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable (except as stated in +this section) patent license to make, have made, use, offer to sell, sell, +import, and otherwise transfer the Work, where such license applies only to +those patent claims licensable by such Contributor that are necessarily +infringed by their Contribution(s) alone or by combination of their +Contribution(s) with the Work to which such Contribution(s) was submitted. +If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or +contributory patent infringement, then any patent licenses granted to You +under this License for that Work shall terminate as of the date such +litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and +in Source or Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works a +copy of this License; and + + 2. You must cause any modified files to carry prominent notices stating +that You changed the files; and + + 3. You must retain, in the Source form of any Derivative Works that You +distribute, all copyright, patent, trademark, and attribution notices from +the Source form of the Work, excluding those notices that do not pertain to +any part of the Derivative Works; and + + 4. If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must include a +readable copy of the attribution notices contained within such NOTICE file, +excluding those notices that do not pertain to any part of the Derivative +Works, in at least one of the following places: within a NOTICE text file +distributed as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, within a +display generated by the Derivative Works, if and wherever such third-party +notices normally appear. The contents of the NOTICE file are for +informational purposes only and do not modify the License. You may add Your +own attribution notices within Derivative Works that You distribute, +alongside or as an addendum to the NOTICE text from the Work, provided that +such additional attribution notices cannot be construed as modifying the +License. + +You may add Your own copyright statement to Your modifications and may +provide additional or different license terms and conditions for use, +reproduction, or distribution of Your modifications, or for any such +Derivative Works as a whole, provided Your use, reproduction, and +distribution of the Work otherwise complies with the conditions stated in +this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to +the Licensor shall be under the terms and conditions of this License, +without any additional terms or conditions. Notwithstanding the above, +nothing herein shall supersede or modify the terms of any separate license +agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, except +as required for reasonable and customary use in describing the origin of +the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to +in writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any +warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or +FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for +determining the appropriateness of using or redistributing the Work and +assume any risks associated with Your exercise of permissions under this +License. + +8. Limitation of Liability. In no event and under no legal theory, whether +in tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to +in writing, shall any Contributor be liable to You for damages, including +any direct, indirect, special, incidental, or consequential damages of any +character arising as a result of this License or out of the use or +inability to use the Work (including but not limited to damages for loss of +goodwill, work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor has been +advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the +Work or Derivative Works thereof, You may choose to offer, and charge a fee +for, acceptance of support, warranty, indemnity, or other liability +obligations and/or rights consistent with this License. However, in +accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if +You agree to indemnify, defend, and hold each Contributor harmless for any +liability incurred by, or claims asserted against, such Contributor by +reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included +on the same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain a + copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable + law or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/openjpeg.txt b/extern/ffmpeg/licenses/openjpeg.txt new file mode 100644 index 0000000000..0ad448854e --- /dev/null +++ b/extern/ffmpeg/licenses/openjpeg.txt @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2007, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ \ No newline at end of file diff --git a/extern/ffmpeg/licenses/rtmp.txt b/extern/ffmpeg/licenses/rtmp.txt new file mode 100644 index 0000000000..7ba5aff473 --- /dev/null +++ b/extern/ffmpeg/licenses/rtmp.txt @@ -0,0 +1,503 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/extern/ffmpeg/licenses/schroedinger.txt b/extern/ffmpeg/licenses/schroedinger.txt new file mode 100644 index 0000000000..2b79e5a85b --- /dev/null +++ b/extern/ffmpeg/licenses/schroedinger.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/sdl.txt b/extern/ffmpeg/licenses/sdl.txt new file mode 100644 index 0000000000..8904ea404e --- /dev/null +++ b/extern/ffmpeg/licenses/sdl.txt @@ -0,0 +1,458 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/extern/ffmpeg/licenses/speex.txt b/extern/ffmpeg/licenses/speex.txt new file mode 100644 index 0000000000..e7a3ac7ef3 --- /dev/null +++ b/extern/ffmpeg/licenses/speex.txt @@ -0,0 +1,35 @@ +Copyright 2002-2008 Xiph.org Foundation +Copyright 2002-2008 Jean-Marc Valin +Copyright 2005-2007 Analog Devices Inc. +Copyright 2005-2008 Commonwealth Scientific and Industrial Research + Organisation (CSIRO) +Copyright 1993, 2002, 2006 David Rowe +Copyright 2003 EpicGames +Copyright 1992-1994 Jutta Degener, Carsten Bormann + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/theora.txt b/extern/ffmpeg/licenses/theora.txt new file mode 100644 index 0000000000..0914ccab00 --- /dev/null +++ b/extern/ffmpeg/licenses/theora.txt @@ -0,0 +1,28 @@ +Copyright (C) 2002-2009 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/vo-aacenc.txt b/extern/ffmpeg/licenses/vo-aacenc.txt new file mode 100644 index 0000000000..6f339353e5 --- /dev/null +++ b/extern/ffmpeg/licenses/vo-aacenc.txt @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the +copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other +entities that control, are controlled by, or are under common control with +that entity. For the purposes of this definition, "control" means (i) the +power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty +percent (50%) or more of the outstanding shares, or (iii) beneficial +ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation +or translation of a Source form, including but not limited to compiled +object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice that +is included in or attached to the work (an example is provided in the +Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, as +a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, or +merely link (or bind by name) to the interfaces of, the Work and Derivative +Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor for +inclusion in the Work by the copyright owner or by an individual or Legal +Entity authorized to submit on behalf of the copyright owner. For the +purposes of this definition, "submitted" means any form of electronic, +verbal, or written communication sent to the Licensor or its +representatives, including but not limited to communication on electronic +mailing lists, source code control systems, and issue tracking systems that +are managed by, or on behalf of, the Licensor for the purpose of discussing +and improving the Work, but excluding communication that is conspicuously +marked or otherwise designated in writing by the copyright owner as "Not a +Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on +behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, +sublicense, and distribute the Work and such Derivative Works in Source or +Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable (except as stated in +this section) patent license to make, have made, use, offer to sell, sell, +import, and otherwise transfer the Work, where such license applies only to +those patent claims licensable by such Contributor that are necessarily +infringed by their Contribution(s) alone or by combination of their +Contribution(s) with the Work to which such Contribution(s) was submitted. +If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or +contributory patent infringement, then any patent licenses granted to You +under this License for that Work shall terminate as of the date such +litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and +in Source or Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works a +copy of this License; and + + 2. You must cause any modified files to carry prominent notices stating +that You changed the files; and + + 3. You must retain, in the Source form of any Derivative Works that You +distribute, all copyright, patent, trademark, and attribution notices from +the Source form of the Work, excluding those notices that do not pertain to +any part of the Derivative Works; and + + 4. If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must include a +readable copy of the attribution notices contained within such NOTICE file, +excluding those notices that do not pertain to any part of the Derivative +Works, in at least one of the following places: within a NOTICE text file +distributed as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, within a +display generated by the Derivative Works, if and wherever such third-party +notices normally appear. The contents of the NOTICE file are for +informational purposes only and do not modify the License. You may add Your +own attribution notices within Derivative Works that You distribute, +alongside or as an addendum to the NOTICE text from the Work, provided that +such additional attribution notices cannot be construed as modifying the +License. + +You may add Your own copyright statement to Your modifications and may +provide additional or different license terms and conditions for use, +reproduction, or distribution of Your modifications, or for any such +Derivative Works as a whole, provided Your use, reproduction, and +distribution of the Work otherwise complies with the conditions stated in +this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to +the Licensor shall be under the terms and conditions of this License, +without any additional terms or conditions. Notwithstanding the above, +nothing herein shall supersede or modify the terms of any separate license +agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, except +as required for reasonable and customary use in describing the origin of +the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to +in writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any +warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or +FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for +determining the appropriateness of using or redistributing the Work and +assume any risks associated with Your exercise of permissions under this +License. + +8. Limitation of Liability. In no event and under no legal theory, whether +in tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to +in writing, shall any Contributor be liable to You for damages, including +any direct, indirect, special, incidental, or consequential damages of any +character arising as a result of this License or out of the use or +inability to use the Work (including but not limited to damages for loss of +goodwill, work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor has been +advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the +Work or Derivative Works thereof, You may choose to offer, and charge a fee +for, acceptance of support, warranty, indemnity, or other liability +obligations and/or rights consistent with this License. However, in +accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if +You agree to indemnify, defend, and hold each Contributor harmless for any +liability incurred by, or claims asserted against, such Contributor by +reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included +on the same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain a + copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable + law or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. diff --git a/extern/ffmpeg/licenses/vo-amrwbenc.txt b/extern/ffmpeg/licenses/vo-amrwbenc.txt new file mode 100644 index 0000000000..5ec4bf01e7 --- /dev/null +++ b/extern/ffmpeg/licenses/vo-amrwbenc.txt @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the +copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other +entities that control, are controlled by, or are under common control with +that entity. For the purposes of this definition, "control" means (i) the +power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty +percent (50%) or more of the outstanding shares, or (iii) beneficial +ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation +or translation of a Source form, including but not limited to compiled +object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice that +is included in or attached to the work (an example is provided in the +Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, as +a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, or +merely link (or bind by name) to the interfaces of, the Work and Derivative +Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor for +inclusion in the Work by the copyright owner or by an individual or Legal +Entity authorized to submit on behalf of the copyright owner. For the +purposes of this definition, "submitted" means any form of electronic, +verbal, or written communication sent to the Licensor or its +representatives, including but not limited to communication on electronic +mailing lists, source code control systems, and issue tracking systems that +are managed by, or on behalf of, the Licensor for the purpose of discussing +and improving the Work, but excluding communication that is conspicuously +marked or otherwise designated in writing by the copyright owner as "Not a +Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on +behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, +sublicense, and distribute the Work and such Derivative Works in Source or +Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable (except as stated in +this section) patent license to make, have made, use, offer to sell, sell, +import, and otherwise transfer the Work, where such license applies only to +those patent claims licensable by such Contributor that are necessarily +infringed by their Contribution(s) alone or by combination of their +Contribution(s) with the Work to which such Contribution(s) was submitted. +If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or +contributory patent infringement, then any patent licenses granted to You +under this License for that Work shall terminate as of the date such +litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and +in Source or Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works a +copy of this License; and + + 2. You must cause any modified files to carry prominent notices stating +that You changed the files; and + + 3. You must retain, in the Source form of any Derivative Works that You +distribute, all copyright, patent, trademark, and attribution notices from +the Source form of the Work, excluding those notices that do not pertain to +any part of the Derivative Works; and + + 4. If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must include a +readable copy of the attribution notices contained within such NOTICE file, +excluding those notices that do not pertain to any part of the Derivative +Works, in at least one of the following places: within a NOTICE text file +distributed as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, within a +display generated by the Derivative Works, if and wherever such third-party +notices normally appear. The contents of the NOTICE file are for +informational purposes only and do not modify the License. You may add Your +own attribution notices within Derivative Works that You distribute, +alongside or as an addendum to the NOTICE text from the Work, provided that +such additional attribution notices cannot be construed as modifying the +License. + +You may add Your own copyright statement to Your modifications and may +provide additional or different license terms and conditions for use, +reproduction, or distribution of Your modifications, or for any such +Derivative Works as a whole, provided Your use, reproduction, and +distribution of the Work otherwise complies with the conditions stated in +this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to +the Licensor shall be under the terms and conditions of this License, +without any additional terms or conditions. Notwithstanding the above, +nothing herein shall supersede or modify the terms of any separate license +agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, except +as required for reasonable and customary use in describing the origin of +the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to +in writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any +warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or +FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for +determining the appropriateness of using or redistributing the Work and +assume any risks associated with Your exercise of permissions under this +License. + +8. Limitation of Liability. In no event and under no legal theory, whether +in tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to +in writing, shall any Contributor be liable to You for damages, including +any direct, indirect, special, incidental, or consequential damages of any +character arising as a result of this License or out of the use or +inability to use the Work (including but not limited to damages for loss of +goodwill, work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor has been +advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the +Work or Derivative Works thereof, You may choose to offer, and charge a fee +for, acceptance of support, warranty, indemnity, or other liability +obligations and/or rights consistent with this License. However, in +accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if +You agree to indemnify, defend, and hold each Contributor harmless for any +liability incurred by, or claims asserted against, such Contributor by +reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included +on the same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain a + copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable + law or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. diff --git a/extern/ffmpeg/licenses/vorbis.txt b/extern/ffmpeg/licenses/vorbis.txt new file mode 100644 index 0000000000..9ce60f84a6 --- /dev/null +++ b/extern/ffmpeg/licenses/vorbis.txt @@ -0,0 +1,28 @@ +Copyright (c) 2002-2008 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/x264.txt b/extern/ffmpeg/licenses/x264.txt new file mode 100644 index 0000000000..1e51ded8a6 --- /dev/null +++ b/extern/ffmpeg/licenses/x264.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/xavs.txt b/extern/ffmpeg/licenses/xavs.txt new file mode 100644 index 0000000000..818433ecc0 --- /dev/null +++ b/extern/ffmpeg/licenses/xavs.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/extern/ffmpeg/licenses/xvid.txt b/extern/ffmpeg/licenses/xvid.txt new file mode 100644 index 0000000000..ea9864d071 --- /dev/null +++ b/extern/ffmpeg/licenses/xvid.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. \ No newline at end of file diff --git a/extern/ffmpeg/licenses/zlib.txt b/extern/ffmpeg/licenses/zlib.txt new file mode 100644 index 0000000000..eb9dc58235 --- /dev/null +++ b/extern/ffmpeg/licenses/zlib.txt @@ -0,0 +1,23 @@ + zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.5, April 19th, 2010 + + Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly + Mark Adler diff --git a/src/StepMania-net2010.vcxproj b/src/StepMania-net2010.vcxproj index af09986555..cb427bb92e 100644 --- a/src/StepMania-net2010.vcxproj +++ b/src/StepMania-net2010.vcxproj @@ -120,7 +120,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) Disabled - .;..\extern\lua-5.1\src;ffmpeg\modern_working\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) + .;..\extern\lua-5.1\src;..\extern\ffmpeg\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;WINDOWS;DEBUG;GLEW_STATIC;%(PreprocessorDefinitions) @@ -149,10 +149,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) /MACHINE:I386 "$(IntDir)verstub.obj" %(AdditionalOptions) - shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;ffmpeg/modern_working/lib/avcodec.lib;ffmpeg/modern_working/lib/avformat.lib;ffmpeg/modern_working/lib/avutil.lib;ffmpeg/modern_working/lib/swscale.lib;%(AdditionalDependencies) + shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;swscale.lib;avcodec.lib;avformat.lib;avutil.lib;%(AdditionalDependencies) ../Program/StepMania-debug.exe true - ..\extern\libpng\lib;ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) + ..\extern\libpng\lib;..\extern\ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) wininet.lib;msimg32.lib;libci.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries) true $(IntDir)StepMania.pdb @@ -187,7 +187,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) AnySuitable true Size - .;..\extern\lua-5.1\src;ffmpeg\modern_working\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) + .;..\extern\lua-5.1\src;..\extern\ffmpeg\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;WINDOWS;RELEASE;GLEW_STATIC;%(PreprocessorDefinitions) true false @@ -216,10 +216,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) /MACHINE:I386 "$(IntDir)verstub.obj" %(AdditionalOptions) - shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;ffmpeg/modern_working/lib/avcodec.lib;ffmpeg/modern_working/lib/avformat.lib;ffmpeg/modern_working/lib/avutil.lib;ffmpeg/modern_working/lib/swscale.lib;%(AdditionalDependencies) + shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;swscale.lib;avcodec.lib;avformat.lib;avutil.lib;%(AdditionalDependencies) ../Program/StepMania.exe true - ..\extern\libpng\lib;ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) + ..\extern\libpng\lib;..\extern\ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) wininet.lib;msimg32.lib;libci.lib;%(IgnoreSpecificDefaultLibraries) $(IntDir)StepMania.pdb true @@ -251,7 +251,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) MaxSpeed - .;..\extern\lua-5.1\src;ffmpeg\modern_working\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) + .;..\extern\lua-5.1\src;..\extern\ffmpeg\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;WINDOWS;DEBUG;GLEW_STATIC;%(PreprocessorDefinitions) Sync Default @@ -280,10 +280,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) /MACHINE:I386 "$(IntDir)verstub.obj" %(AdditionalOptions) - shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;avcodec.lib;avformat.lib;avutil.lib;swscale.lib;%(AdditionalDependencies) + shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;swscale.lib;avcodec.lib;avformat.lib;avutil.lib;%(AdditionalDependencies) ../Program/StepMania-fastdebug.exe true - ..\extern\libpng\lib;ffmpeg\modern_working\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\;%(AdditionalLibraryDirectories) + ..\extern\libpng\lib;..\extern\ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\;%(AdditionalLibraryDirectories) wininet.lib;msimg32.lib;libci.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries) true $(IntDir)StepMania.pdb @@ -319,7 +319,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) AnySuitable true Speed - .;..\extern\lua-5.1\src;ffmpeg\modern_working\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) + .;..\extern\lua-5.1\src;..\extern\ffmpeg\include;BaseClasses;..\extern\jsoncpp\include;..\extern\glew-1.5.8\include;..\extern\pcre;..\extern\mad-0.15.1b;..\extern\libpng\lib;..\extern\libpng\include;..\extern\libjpeg;..\extern\zlib;..\extern\vorbis;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;WINDOWS;RELEASE;GLEW_STATIC;%(PreprocessorDefinitions) true false @@ -349,10 +349,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) /MACHINE:I386 "$(IntDir)verstub.obj" %(AdditionalOptions) - shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;ffmpeg/modern_working/lib/avcodec.lib;ffmpeg/modern_working/lib/avformat.lib;ffmpeg/modern_working/lib/avutil.lib;ffmpeg/modern_working/lib/swscale.lib;%(AdditionalDependencies) + shell32.lib;gdi32.lib;user32.lib;ole32.lib;advapi32.lib;Comctl32.lib;swscale.lib;avcodec.lib;avformat.lib;avutil.lib;%(AdditionalDependencies) ..\Program/StepMania-SSE2.exe true - ..\extern\libpng\lib;ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) + ..\extern\libpng\lib;..\extern\ffmpeg\lib;..\extern\libjpeg\;..\extern\zlib\;..\extern\mad-0.15.1b\msvc++\Release\%(AdditionalLibraryDirectories) wininet.lib;msimg32.lib;libci.lib;%(IgnoreSpecificDefaultLibraries) $(IntDir)StepMania-SSE2.pdb true diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index c81318a737..7c727edc01 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -6,41 +6,18 @@ #include "RageUtil.h" #include "RageFile.h" #include "RageSurface.h" -#include "RageFileDriverReadAhead.h" #include namespace avcodec { -#if defined(MACOSX) - // old shit - #include -#else - /* ...shit. this is gonna break building on Linux and Mac, isn't it? - * (the way I have it set to include ffmpeg/crap/header.h instead of - * crap/header.h like in the patch: http://pastie.org/701873 ) - */ extern "C" { #include #include } -#endif }; -/* XXX: FF_B_TYPE was previously a numeric macro, but newer versions define - * it as as a member of the AVPictureType enum in avutil. Bring it under - * our 'avcodec' namespace explicitly. */ - -#if FF_API_OLD_IMAGE_NAMES -#undef FF_B_TYPE -#define FF_B_TYPE avcodec::AV_PICTURE_TYPE_B -#endif - -int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags ); -int URLRageFile_read( avcodec::URLContext *h, unsigned char *buf, int size ); -int URLRageFile_close( avcodec::URLContext *h ); - /* #if defined(_MSC_VER) #pragma comment(lib, "ffmpeg/lib/avcodec.lib") @@ -51,9 +28,7 @@ int URLRageFile_close( avcodec::URLContext *h ); #endif // _MSC_VER */ -#if !defined(MACOSX) - static const int sws_flags = SWS_BICUBIC; // XXX: Reasonable default? -#endif +static const int sws_flags = SWS_BICUBIC; // XXX: Reasonable default? static struct AVPixelFormat_t { @@ -290,9 +265,7 @@ private: avcodec::AVStream *m_pStream; avcodec::AVFrame m_Frame; avcodec::PixelFormat m_AVTexfmt; /* PixelFormat of output surface */ -#if !defined(MACOSX) avcodec::SwsContext *m_swsctx; -#endif float m_fPTS; avcodec::AVFormatContext *m_fctx; @@ -301,7 +274,6 @@ private: float m_fTimestampOffset; float m_fLastFrameDelay; int m_iFrameNumber; - bool m_bHadBframes; avcodec::AVPacket m_Packet; int m_iCurrentPacketOffset; @@ -321,10 +293,6 @@ MovieDecoder_FFMpeg::MovieDecoder_FFMpeg() m_pStream = NULL; m_iCurrentPacketOffset = -1; - /* Until we play the whole movie once without hitting a B-frame, assume - * they exist. */ - m_bHadBframes = true; - m_fLastFrame = 0; Init(); @@ -337,14 +305,11 @@ MovieDecoder_FFMpeg::~MovieDecoder_FFMpeg() avcodec::av_free_packet( &m_Packet ); m_iCurrentPacketOffset = -1; } -#if !defined(MACOSX) if (m_swsctx) { avcodec::sws_freeContext(m_swsctx); m_swsctx = NULL; } -#endif - } void MovieDecoder_FFMpeg::Init() @@ -356,9 +321,7 @@ void MovieDecoder_FFMpeg::Init() m_fPTS = -1; m_iFrameNumber = -1; /* decode one frame and you're on the 0th */ m_fTimestampOffset = 0; -#if !defined(MACOSX) m_swsctx = NULL; -#endif if( m_iCurrentPacketOffset != -1 ) { @@ -487,16 +450,16 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime ) CHECKPOINT; /* Hack: we need to send size = 0 to flush frames at the end, but we have * to give it a buffer to read from since it tries to read anyway. */ - static uint8_t dummy[FF_INPUT_BUFFER_PADDING_SIZE] = { 0 }; - int len = avcodec::avcodec_decode_video( + m_Packet.data = m_Packet.size ? m_Packet.data : NULL; + int len = avcodec::avcodec_decode_video2( m_pStream->codec, &m_Frame, &iGotFrame, - m_Packet.size? m_Packet.data:dummy, m_Packet.size ); + &m_Packet ); CHECKPOINT; if( len < 0 ) { - LOG->Warn("avcodec_decode_video: %i", len); + LOG->Warn("avcodec_decode_video2: %i", len); return -1; // XXX } @@ -528,9 +491,6 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime ) ++m_iFrameNumber; - if( m_Frame.pict_type == FF_B_TYPE ) - m_bHadBframes = true; - if( m_iFrameNumber == 0 ) { /* Some videos start with a timestamp other than 0. I think this is used @@ -560,19 +520,6 @@ void MovieDecoder_FFMpeg::GetFrame( RageSurface *pSurface ) pict.data[0] = (unsigned char *) pSurface->pixels; pict.linesize[0] = pSurface->pitch; - /* Greetings. The code that's commented out below is what is found in the - * current StepMania 4 ("vanilla") codebase, since they use ffmpeg r8448 - * with a patch. When looking at ffmpeg's code recently to see if they've - * accepted the patch, they did, and since various people have decided to - * make StepMania support modern versions of ffmpeg, we are doing so as - * well. This is part of that whole "futures-oriented" thing we have going - * on with sm-ssc. Just thought you'd like to know. :) -aj - */ -#if defined(MACOSX) - avcodec::img_convert( &pict, m_AVTexfmt, - (avcodec::AVPicture *) &m_Frame, m_pStream->codec->pix_fmt, - m_pStream->codec->width, m_pStream->codec->height ); -#else /* XXX 1: Do this in one of the Open() methods instead? * XXX 2: The problem of doing this in Open() is that m_AVTexfmt is not * already initialized with its correct value. @@ -593,22 +540,8 @@ void MovieDecoder_FFMpeg::GetFrame( RageSurface *pSurface ) avcodec::sws_scale( m_swsctx, m_Frame.data, m_Frame.linesize, 0, GetHeight(), pict.data, pict.linesize ); -#endif } -static avcodec::AVStream *FindVideoStream( avcodec::AVFormatContext *m_fctx ) -{ - ASSERT_M( m_fctx->nb_streams <= MAX_STREAMS, ssprintf( "m_fctx->nb_streams = %d", m_fctx->nb_streams) ); - for( unsigned stream = 0; stream < m_fctx->nb_streams; ++stream ) - { - avcodec::AVStream *enc = m_fctx->streams[stream]; - if( enc->codec->codec_type == avcodec::CODEC_TYPE_VIDEO ) - return enc; - } - return NULL; -} - - static RString averr_ssprintf( int err, const char *fmt, ... ) { ASSERT( err < 0 ); @@ -618,16 +551,11 @@ static RString averr_ssprintf( int err, const char *fmt, ... ) RString s = vssprintf( fmt, va ); va_end(va); - RString Error; - switch( err ) - { - case AVERROR_IO: Error = "I/O error"; break; - case AVERROR_NUMEXPECTED: Error = "number syntax expected in filename"; break; - case AVERROR_INVALIDDATA: Error = "invalid data found"; break; - case AVERROR_NOMEM: Error = "not enough memory"; break; - case AVERROR_NOFMT: Error = "unknown format"; break; - default: Error = ssprintf( "unknown error %i", err ); break; - } + size_t errbuf_size = 512; + char* errbuf = new char[errbuf_size]; + avcodec::av_strerror(err, errbuf, errbuf_size); + RString Error = ssprintf("%i: %s", err, errbuf); + delete errbuf; return s + " (" + Error + ")"; } @@ -637,17 +565,17 @@ int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags ) if( strncmp( filename, "rage://", 7 ) ) { LOG->Warn("URLRageFile_open: Unexpected path \"%s\"", filename ); - return -EIO; + return -EIO; } filename += 7; int mode = 0; - switch( flags ) - { - case URL_RDONLY: mode = RageFile::READ; break; - case URL_WRONLY: mode = RageFile::WRITE | RageFile::STREAMED; break; - case URL_RDWR: FAIL_M( "O_RDWR unsupported" ); - } + if ( flags & URL_RDONLY ) + mode = RageFile::READ; + else if ( flags & URL_WRONLY ) + mode = RageFile::WRITE | RageFile::STREAMED; + else + FAIL_M( "O_RDWR unsupported" ); RageFileBasic *pFile = new RageFile; @@ -662,14 +590,6 @@ int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags ) pFile = f; } - // If possible, wrap this file in the read-ahead filter to avoid skips when we rewind. - if( RageFileDriverReadAhead::FileSupported(pFile) ) - { - RageFileDriverReadAhead *pBufferedFile = new RageFileDriverReadAhead( pFile, 1024*128 ); - pBufferedFile->DeleteFileWhenFinished(); - pFile = pBufferedFile; - } - h->is_streamed = false; h->priv_data = pFile; return 0; @@ -687,26 +607,17 @@ int URLRageFile_write( avcodec::URLContext *h, const unsigned char *buf, int siz return f->Write( buf, size ); } -/* Some avcodecs want unsigned char, others want const. Make everyone happy - * by providing a const overload and letting the compiler figure it out. */ -int URLRageFile_write( avcodec::URLContext *h, unsigned char *buf, int size ) -{ - return URLRageFile_write( h, (const unsigned char*)buf, size ); -} - -// sm4svn has it as: -#if defined(MACOSX) - avcodec::offset_t URLRageFile_seek( avcodec::URLContext *h, avcodec::offset_t pos, int whence ) -#else - int64_t URLRageFile_seek( avcodec::URLContext *h, int64_t pos, int whence ) -#endif +int64_t URLRageFile_seek( avcodec::URLContext *h, int64_t pos, int whence ) { RageFileBasic *f = (RageFileBasic *) h->priv_data; if( whence == AVSEEK_SIZE ) return f->GetFileSize(); if( whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END ) + { + LOG->Trace("Error: unsupported seek whence: %d", whence); return -1; + } return f->Seek( (int) pos, whence ); } @@ -718,21 +629,14 @@ int URLRageFile_close( avcodec::URLContext *h ) return 0; } -/* TODO: URLProtocol is deprecated in newer releases. Either pick a - * version of ffmpeg to use statically, or migrate to AVIOContext. */ static avcodec::URLProtocol RageProtocol = { - "rage", /* name */ - URLRageFile_open, /* url_open() */ - URLRageFile_read, /* url_read() */ - URLRageFile_write, /* url_write() */ - URLRageFile_seek, /* url_seek() */ - URLRageFile_close /* url_close() */ - - /* Since we're a static struct, all other struct data is zeroed. - * This is intentional: ffmpeg has several different URLProtocol - * structs floating around, but we don't care about any members - * except the above. Please ignore the compiler warning. -- vyhd */ + "rage", + URLRageFile_open, + URLRageFile_read, + URLRageFile_write, + URLRageFile_seek, + URLRageFile_close }; void MovieTexture_FFMpeg::RegisterProtocols() @@ -742,26 +646,28 @@ void MovieTexture_FFMpeg::RegisterProtocols() return; Done = true; + avcodec::avcodec_register_all(); avcodec::av_register_all(); - avcodec::register_protocol( &RageProtocol ); + avcodec::av_register_protocol2( &RageProtocol, sizeof(RageProtocol) ); } RString MovieDecoder_FFMpeg::Open( RString sFile ) { MovieTexture_FFMpeg::RegisterProtocols(); - int ret = avcodec::av_open_input_file( &m_fctx, "rage://" + sFile, NULL, 0, NULL ); + m_fctx = avcodec::avformat_alloc_context(); + int ret = avcodec::avformat_open_input( &m_fctx, "rage://" + sFile, NULL, NULL ); if( ret < 0 ) return RString( averr_ssprintf(ret, "AVCodec: Couldn't open \"%s\"", sFile.c_str()) ); - ret = avcodec::av_find_stream_info( m_fctx ); + ret = avcodec::avformat_find_stream_info( m_fctx, NULL ); if( ret < 0 ) return RString( averr_ssprintf(ret, "AVCodec (%s): Couldn't find codec parameters", sFile.c_str()) ); - avcodec::AVStream *pStream = FindVideoStream( m_fctx ); - if( pStream == NULL ) + int stream_idx = avcodec::av_find_best_stream( m_fctx, avcodec::AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0 ); + if ( stream_idx < 0 || stream_idx >= m_fctx->nb_streams || m_fctx->streams[stream_idx] == NULL ) return "Couldn't find any video streams"; - m_pStream = pStream; + m_pStream = m_fctx->streams[stream_idx]; if( m_pStream->codec->codec_id == avcodec::CODEC_ID_NONE ) return ssprintf( "Unsupported codec %08x", m_pStream->codec->codec_tag ); @@ -788,22 +694,20 @@ RString MovieDecoder_FFMpeg::OpenCodec() if( pCodec == NULL ) return ssprintf( "Couldn't find decoder %i", m_pStream->codec->codec_id ); + m_pStream->codec->workaround_bugs = 1; + m_pStream->codec->idct_algo = FF_IDCT_AUTO; + m_pStream->codec->error_concealment = 3; + + if( pCodec->capabilities & CODEC_CAP_DR1 ) + m_pStream->codec->flags |= CODEC_FLAG_EMU_EDGE; + LOG->Trace("Opening codec %s", pCodec->name ); - if( !m_bHadBframes ) - { - LOG->Trace("Setting CODEC_FLAG_LOW_DELAY" ); - m_pStream->codec->flags |= CODEC_FLAG_LOW_DELAY; - } - - int ret = avcodec::avcodec_open( m_pStream->codec, pCodec ); + int ret = avcodec::avcodec_open2( m_pStream->codec, pCodec, NULL ); if( ret < 0 ) return RString( averr_ssprintf(ret, "Couldn't open codec \"%s\"", pCodec->name) ); ASSERT( m_pStream->codec->codec ); - /* This is set to true when we find a B-frame, to use on the next loop. */ - m_bHadBframes = false; - return RString(); } diff --git a/src/ffmpeg/000 StepMania README.txt b/src/ffmpeg/000 StepMania README.txt deleted file mode 100644 index 3636af5b0b..0000000000 --- a/src/ffmpeg/000 StepMania README.txt +++ /dev/null @@ -1,43 +0,0 @@ -This directory is only for Windows and Xbox. -For other OS's, install it yourself as usual. - -Windows: -Compile with MingW. -Originally configured with: -./configure --enable-memalign-hack --enable-shared --enable-small --disable-debug - -The last revision of ffmpeg used was r20782. (20091208) - -the old instructions look like this: -svn co -r 8448 svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg - -and this is a nice big config file that I'm not sure will work. -./configure --enable-shared --disable-static --disable-debug --disable-vhook --enable-memalign-hack --disable-network --enable-small \ - --disable-encoders --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-muxers \ - --disable-demuxers --enable-demuxer=avi --enable-demuxer=h261 --enable-demuxer=h263 --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=mpegvideo --enable-demuxer=ogg --enable-demuxer=rawvideo --enable-demuxer=yuv4mpegpipe \ - --disable-decoders --enable-decoder=h261 --enable-decoder=h263 --enable-decoder=h263i --enable-decoder=h264 --enable-decoder=huffyuv --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-decoder=mpeg_xvmc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=mpegvideo --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=rawvideo --enable-decoder=theora \ - --disable-parsers --enable-parser=h261 --enable-parser=h263 --enable-parser=h264 --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=ac3 \ - --target-os=mingw32 -================================================================================ -Xbox: -You should probably compile with MingW. - -arch/MovieTexture/MovieTexture_FFMpeg.cpp says: -/* NOTES: ffmpeg static libraries arent included in SVN. You have to build - *them yourself or remove this file to produce the xbox build. - * - * build ffmpeg with mingw32 ( howto http://ffmpeg.arrozcru.org/wiki/index.php?title=Main_Page ) - * ./configure --enable-memalign-hack --enable-static --disable-mmx --target-os=mingw32 --arch=x86 - * you can use various switches to enable/disable codecs/muxers/etc. - * - * libgcc.a and libmingwex.a comes from mingw installation - * msys\mingw\lib\gcc\mingw32\3.4.5\libgcc.a */ - -note that the xbox version still doesn't exactly run yet. - -During my latest run, I used -./configure --enable-memalign-hack --enable-static --disable-mmx --arch=x86 --enable-small --disable-debug -or something of the sort. - -So for those confused, the .a files are the xbox stuff and the .lib files are the -windows stuff. yay microsoft |: -aj \ No newline at end of file diff --git a/src/ffmpeg/include/ffmpeg/avcodec.h b/src/ffmpeg/include/ffmpeg/avcodec.h deleted file mode 100644 index ead4dc8dfe..0000000000 --- a/src/ffmpeg/include/ffmpeg/avcodec.h +++ /dev/null @@ -1,3073 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_H -#define AVCODEC_H - -/** - * @file avcodec.h - * external api header. - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "avutil.h" -#include /* size_t */ - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBAVCODEC_VERSION_INT ((51<<16)+(40<<8)+0) -#define LIBAVCODEC_VERSION 51.40.0 -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} - -enum CodecID { - CODEC_ID_NONE, - CODEC_ID_MPEG1VIDEO, - CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */ - CODEC_ID_MPEG2VIDEO_XVMC, - CODEC_ID_H261, - CODEC_ID_H263, - CODEC_ID_RV10, - CODEC_ID_RV20, - CODEC_ID_MJPEG, - CODEC_ID_MJPEGB, - CODEC_ID_LJPEG, - CODEC_ID_SP5X, - CODEC_ID_JPEGLS, - CODEC_ID_MPEG4, - CODEC_ID_RAWVIDEO, - CODEC_ID_MSMPEG4V1, - CODEC_ID_MSMPEG4V2, - CODEC_ID_MSMPEG4V3, - CODEC_ID_WMV1, - CODEC_ID_WMV2, - CODEC_ID_H263P, - CODEC_ID_H263I, - CODEC_ID_FLV1, - CODEC_ID_SVQ1, - CODEC_ID_SVQ3, - CODEC_ID_DVVIDEO, - CODEC_ID_HUFFYUV, - CODEC_ID_CYUV, - CODEC_ID_H264, - CODEC_ID_INDEO3, - CODEC_ID_VP3, - CODEC_ID_THEORA, - CODEC_ID_ASV1, - CODEC_ID_ASV2, - CODEC_ID_FFV1, - CODEC_ID_4XM, - CODEC_ID_VCR1, - CODEC_ID_CLJR, - CODEC_ID_MDEC, - CODEC_ID_ROQ, - CODEC_ID_INTERPLAY_VIDEO, - CODEC_ID_XAN_WC3, - CODEC_ID_XAN_WC4, - CODEC_ID_RPZA, - CODEC_ID_CINEPAK, - CODEC_ID_WS_VQA, - CODEC_ID_MSRLE, - CODEC_ID_MSVIDEO1, - CODEC_ID_IDCIN, - CODEC_ID_8BPS, - CODEC_ID_SMC, - CODEC_ID_FLIC, - CODEC_ID_TRUEMOTION1, - CODEC_ID_VMDVIDEO, - CODEC_ID_MSZH, - CODEC_ID_ZLIB, - CODEC_ID_QTRLE, - CODEC_ID_SNOW, - CODEC_ID_TSCC, - CODEC_ID_ULTI, - CODEC_ID_QDRAW, - CODEC_ID_VIXL, - CODEC_ID_QPEG, - CODEC_ID_XVID, - CODEC_ID_PNG, - CODEC_ID_PPM, - CODEC_ID_PBM, - CODEC_ID_PGM, - CODEC_ID_PGMYUV, - CODEC_ID_PAM, - CODEC_ID_FFVHUFF, - CODEC_ID_RV30, - CODEC_ID_RV40, - CODEC_ID_VC1, - CODEC_ID_WMV3, - CODEC_ID_LOCO, - CODEC_ID_WNV1, - CODEC_ID_AASC, - CODEC_ID_INDEO2, - CODEC_ID_FRAPS, - CODEC_ID_TRUEMOTION2, - CODEC_ID_BMP, - CODEC_ID_CSCD, - CODEC_ID_MMVIDEO, - CODEC_ID_ZMBV, - CODEC_ID_AVS, - CODEC_ID_SMACKVIDEO, - CODEC_ID_NUV, - CODEC_ID_KMVC, - CODEC_ID_FLASHSV, - CODEC_ID_CAVS, - CODEC_ID_JPEG2000, - CODEC_ID_VMNC, - CODEC_ID_VP5, - CODEC_ID_VP6, - CODEC_ID_VP6F, - CODEC_ID_TARGA, - CODEC_ID_DSICINVIDEO, - CODEC_ID_TIERTEXSEQVIDEO, - CODEC_ID_TIFF, - CODEC_ID_GIF, - CODEC_ID_FFH264, - CODEC_ID_DXA, - CODEC_ID_DNXHD, - - /* various pcm "codecs" */ - CODEC_ID_PCM_S16LE= 0x10000, - CODEC_ID_PCM_S16BE, - CODEC_ID_PCM_U16LE, - CODEC_ID_PCM_U16BE, - CODEC_ID_PCM_S8, - CODEC_ID_PCM_U8, - CODEC_ID_PCM_MULAW, - CODEC_ID_PCM_ALAW, - CODEC_ID_PCM_S32LE, - CODEC_ID_PCM_S32BE, - CODEC_ID_PCM_U32LE, - CODEC_ID_PCM_U32BE, - CODEC_ID_PCM_S24LE, - CODEC_ID_PCM_S24BE, - CODEC_ID_PCM_U24LE, - CODEC_ID_PCM_U24BE, - CODEC_ID_PCM_S24DAUD, - - /* various adpcm codecs */ - CODEC_ID_ADPCM_IMA_QT= 0x11000, - CODEC_ID_ADPCM_IMA_WAV, - CODEC_ID_ADPCM_IMA_DK3, - CODEC_ID_ADPCM_IMA_DK4, - CODEC_ID_ADPCM_IMA_WS, - CODEC_ID_ADPCM_IMA_SMJPEG, - CODEC_ID_ADPCM_MS, - CODEC_ID_ADPCM_4XM, - CODEC_ID_ADPCM_XA, - CODEC_ID_ADPCM_ADX, - CODEC_ID_ADPCM_EA, - CODEC_ID_ADPCM_G726, - CODEC_ID_ADPCM_CT, - CODEC_ID_ADPCM_SWF, - CODEC_ID_ADPCM_YAMAHA, - CODEC_ID_ADPCM_SBPRO_4, - CODEC_ID_ADPCM_SBPRO_3, - CODEC_ID_ADPCM_SBPRO_2, - - /* AMR */ - CODEC_ID_AMR_NB= 0x12000, - CODEC_ID_AMR_WB, - - /* RealAudio codecs*/ - CODEC_ID_RA_144= 0x13000, - CODEC_ID_RA_288, - - /* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= 0x14000, - CODEC_ID_INTERPLAY_DPCM, - CODEC_ID_XAN_DPCM, - CODEC_ID_SOL_DPCM, - - CODEC_ID_MP2= 0x15000, - CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ - CODEC_ID_AAC, -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) - CODEC_ID_MPEG4AAC, -#endif - CODEC_ID_AC3, - CODEC_ID_DTS, - CODEC_ID_VORBIS, - CODEC_ID_DVAUDIO, - CODEC_ID_WMAV1, - CODEC_ID_WMAV2, - CODEC_ID_MACE3, - CODEC_ID_MACE6, - CODEC_ID_VMDAUDIO, - CODEC_ID_SONIC, - CODEC_ID_SONIC_LS, - CODEC_ID_FLAC, - CODEC_ID_MP3ADU, - CODEC_ID_MP3ON4, - CODEC_ID_SHORTEN, - CODEC_ID_ALAC, - CODEC_ID_WESTWOOD_SND1, - CODEC_ID_GSM, /* As in Berlin toast format */ - CODEC_ID_QDM2, - CODEC_ID_COOK, - CODEC_ID_TRUESPEECH, - CODEC_ID_TTA, - CODEC_ID_SMACKAUDIO, - CODEC_ID_QCELP, - CODEC_ID_WAVPACK, - CODEC_ID_DSICINAUDIO, - CODEC_ID_IMC, - CODEC_ID_MUSEPACK7, - CODEC_ID_MLP, - CODEC_ID_GSM_MS, /* As found in WAV */ - - /* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= 0x17000, - CODEC_ID_DVB_SUBTITLE, - - CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport - stream (only used by libavformat) */ -}; - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* CODEC_ID_MP3LAME is absolete */ -#define CODEC_ID_MP3LAME CODEC_ID_MP3 -#define CODEC_ID_MPEG4AAC CODEC_ID_AAC -#endif - -enum CodecType { - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE, - CODEC_TYPE_NB -}; - -/* currently unused, may be used if 24/32 bits samples ever supported */ -/* all in native endian */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S24, ///< signed 24 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float -}; - -/* in bytes */ -#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio - -/** - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * this is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end
- * Note, if the first 23 bits of the additional bytes are not 0 then damaged - * MPEG bitstreams could cause overread and segfault - */ -#define FF_INPUT_BUFFER_PADDING_SIZE 8 - -/** - * minimum encoding buffer size. - * used to avoid some checks during header writing - */ -#define FF_MIN_BUFFER_SIZE 16384 - -/* motion estimation type, EPZS by default */ -enum Motion_Est_ID { - ME_ZERO = 1, - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, - ME_X1, - ME_HEX, - ME_UMH, - ME_ITER, -}; - -enum AVDiscard{ -//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -typedef struct RcOverride{ - int start_frame; - int end_frame; - int qscale; // if this is 0 then quality_factor will be used instead - float quality_factor; -} RcOverride; - -#define FF_MAX_B_FRAMES 16 - -/* encoding support - these flags can be passed in AVCodecContext.flags before initing - Note: not everything is supported yet. -*/ - -#define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale -#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263 -#define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC -#define CODEC_FLAG_GMC 0x0020 ///< use GMC -#define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> -#define CODEC_FLAG_PART 0x0080 ///< use data partitioning -/* parent program guarantees that the input for b-frame containing streams is not written to - for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ -#define CODEC_FLAG_INPUT_PRESERVED 0x0100 -#define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode -#define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode -#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) -#define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale -#define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges -#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding -#define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead - of only at frame boundaries */ -#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization -#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct -#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay -#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan -#define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization -#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe -#define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) -/* Fx : Flag for h263+ extra options */ -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -#define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) -#endif -#define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction -#define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector -#define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp -#define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon -#define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc -#define CODEC_FLAG_OBMC 0x00000001 ///< OBMC -#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter -#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 -#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation -#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data -#define CODEC_FLAG_CLOSED_GOP ((int)0x80000000) -#define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks -#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size -#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< skip bitstream encoding -#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< place global headers at every keyframe instead of in extradata -#define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow b-frames to be used as references -#define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for b-frames -#define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock -#define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform -#define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip -#define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters -#define CODEC_FLAG2_BRDO 0x00000400 ///< b-frame rate-distortion optimization -#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< use MPEG-2 intra VLC table -#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) -#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format -#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skiping -#define CODEC_FLAG2_CHUNKS 0x00008000 ///< input bitstream might be truncated at a packet boundaries instead of only at frame boundaries -#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< use MPEG-2 non linear quantizer - -/* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independent Segment Decoding */ -/* /Fx */ -/* codec capabilities */ - -#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback -/** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 - */ -#define CODEC_CAP_DR1 0x0002 -/* if 'parse_only' field is true, then avcodec_parse_frame() can be - used */ -#define CODEC_CAP_PARSE_ONLY 0x0004 -#define CODEC_CAP_TRUNCATED 0x0008 -/* codec can export data for HW decoding (XvMC) */ -#define CODEC_CAP_HWACCEL 0x0010 -/** - * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. - * if this is not set, the codec is guaranteed to never be feeded with NULL data - */ -#define CODEC_CAP_DELAY 0x0020 -/** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. - */ -#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 - -//the following defines may change, don't expect compatibility if you use them -#define MB_TYPE_INTRA4x4 0x0001 -#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific -#define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific -#define MB_TYPE_16x16 0x0008 -#define MB_TYPE_16x8 0x0010 -#define MB_TYPE_8x16 0x0020 -#define MB_TYPE_8x8 0x0040 -#define MB_TYPE_INTERLACED 0x0080 -#define MB_TYPE_DIRECT2 0x0100 //FIXME -#define MB_TYPE_ACPRED 0x0200 -#define MB_TYPE_GMC 0x0400 -#define MB_TYPE_SKIP 0x0800 -#define MB_TYPE_P0L0 0x1000 -#define MB_TYPE_P1L0 0x2000 -#define MB_TYPE_P0L1 0x4000 -#define MB_TYPE_P1L1 0x8000 -#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) -#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) -#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) -#define MB_TYPE_QUANT 0x00010000 -#define MB_TYPE_CBP 0x00020000 -//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) - -/** - * Pan Scan area. - * this specifies the area which should be displayed. Note there may be multiple such areas for one frame - */ -typedef struct AVPanScan{ - /** - * id. - * - encoding: set by user. - * - decoding: set by lavc - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: set by user. - * - decoding: set by lavc - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames. - * - encoding: set by user. - * - decoding: set by lavc - */ - int16_t position[3][2]; -}AVPanScan; - -#define FF_COMMON_FRAME \ - /**\ - * pointer to the picture planes.\ - * this might be different from the first allocated byte\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *data[4];\ - int linesize[4];\ - /**\ - * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\ - * this isn't used by lavc unless the default get/release_buffer() is used\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *base[4];\ - /**\ - * 1 -> keyframe, 0-> not\ - * - encoding: set by lavc\ - * - decoding: set by lavc\ - */\ - int key_frame;\ -\ - /**\ - * picture type of the frame, see ?_TYPE below.\ - * - encoding: set by lavc for coded_picture (and set by user for input)\ - * - decoding: set by lavc\ - */\ - int pict_type;\ -\ - /**\ - * presentation timestamp in time_base units (time when frame should be shown to user)\ - * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed\ - * - encoding: MUST be set by user\ - * - decoding: set by lavc\ - */\ - int64_t pts;\ -\ - /**\ - * picture number in bitstream order.\ - * - encoding: set by\ - * - decoding: set by lavc\ - */\ - int coded_picture_number;\ - /**\ - * picture number in display order.\ - * - encoding: set by\ - * - decoding: set by lavc\ - */\ - int display_picture_number;\ -\ - /**\ - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \ - * - encoding: set by lavc for coded_picture (and set by user for input)\ - * - decoding: set by lavc\ - */\ - int quality; \ -\ - /**\ - * buffer age (1->was last buffer and dint change, 2->..., ...).\ - * set to INT_MAX if the buffer has not been used yet \ - * - encoding: unused\ - * - decoding: MUST be set by get_buffer()\ - */\ - int age;\ -\ - /**\ - * is this picture used as reference\ - * - encoding: unused\ - * - decoding: set by lavc (before get_buffer() call))\ - */\ - int reference;\ -\ - /**\ - * QP table\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int8_t *qscale_table;\ - /**\ - * QP store stride\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int qstride;\ -\ - /**\ - * mbskip_table[mb]>=1 if MB didnt change\ - * stride= mb_width = (width+15)>>4\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - uint8_t *mbskip_table;\ -\ - /**\ - * Motion vector table.\ - * @code\ - * example:\ - * int mv_sample_log2= 4 - motion_subsample_log2;\ - * int mb_width= (width+15)>>4;\ - * int mv_stride= (mb_width << mv_sample_log2) + 1;\ - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\ - * @endcode\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int16_t (*motion_val[2])[2];\ -\ - /**\ - * Macroblock type table\ - * mb_type_base + mb_width + 2\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - uint32_t *mb_type;\ -\ - /**\ - * log2 of the size of the block which a single vector in motion_val represents: \ - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - uint8_t motion_subsample_log2;\ -\ - /**\ - * for some private data of the user\ - * - encoding: unused\ - * - decoding: set by user\ - */\ - void *opaque;\ -\ - /**\ - * error\ - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\ - * - decoding: unused\ - */\ - uint64_t error[4];\ -\ - /**\ - * type of the buffer (to keep track of who has to dealloc data[*])\ - * - encoding: set by the one who allocs it\ - * - decoding: set by the one who allocs it\ - * Note: user allocated (direct rendering) & internal buffers can not coexist currently\ - */\ - int type;\ - \ - /**\ - * when decoding, this signal how much the picture must be delayed.\ - * extra_delay = repeat_pict / (2*fps)\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int repeat_pict;\ - \ - /**\ - * \ - */\ - int qscale_type;\ - \ - /**\ - * The content of the picture is interlaced.\ - * - encoding: set by user\ - * - decoding: set by lavc (default 0)\ - */\ - int interlaced_frame;\ - \ - /**\ - * if the content is interlaced, is top field displayed first.\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int top_field_first;\ - \ - /**\ - * Pan scan.\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - AVPanScan *pan_scan;\ - \ - /**\ - * tell user application that palette has changed from previous frame.\ - * - encoding: ??? (no palette-enabled encoder yet)\ - * - decoding: set by lavc (default 0)\ - */\ - int palette_has_changed;\ - \ - /**\ - * Codec suggestion on buffer type if != 0\ - * - encoding: unused\ - * - decoding: set by lavc (before get_buffer() call))\ - */\ - int buffer_hints;\ -\ - /**\ - * DCT coeffitients\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - short *dct_coeff;\ -\ - /**\ - * Motion referece frame index\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int8_t *ref_index[2]; - -#define FF_QSCALE_TYPE_MPEG1 0 -#define FF_QSCALE_TYPE_MPEG2 1 -#define FF_QSCALE_TYPE_H264 2 - -#define FF_BUFFER_TYPE_INTERNAL 1 -#define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user) -#define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared -#define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, don't dealloc anything - - -#define FF_I_TYPE 1 // Intra -#define FF_P_TYPE 2 // Predicted -#define FF_B_TYPE 3 // Bi-dir predicted -#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4 -#define FF_SI_TYPE 5 -#define FF_SP_TYPE 6 - -#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore) -#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer -#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content -#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update) - -/** - * Audio Video Frame. - */ -typedef struct AVFrame { - FF_COMMON_FRAME -} AVFrame; - -#define DEFAULT_FRAME_RATE_BASE 1001000 - -/** - * main external api structure. - */ -typedef struct AVCodecContext { - /** - * Info on struct for av_log - * - set by avcodec_alloc_context - */ - AVClass *av_class; - /** - * the average bitrate. - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream - */ - int bit_rate; - - /** - * number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: unused - */ - int bit_rate_tolerance; - - /** - * CODEC_FLAG_*. - * - encoding: set by user. - * - decoding: set by user. - */ - int flags; - - /** - * some codecs needs additionnal format info. It is stored here - * - encoding: set by user. - * - decoding: set by lavc. (FIXME is this ok?) - */ - int sub_id; - - /** - * motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused - */ - int me_method; - - /** - * some codecs need / can use extra-data like huffman tables. - * mjpeg: huffman tables - * rv10: additional flags - * mpeg4: global headers (they can be in the bitstream or here) - * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger - * then extradata_size to avoid prolems if its read with the bitstream reader - * the bytewise contents of extradata must not depend on the architecture or cpu endianness - * - encoding: set/allocated/freed by lavc. - * - decoding: set/allocated/freed by user. - */ - uint8_t *extradata; - int extradata_size; - - /** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * - encoding: MUST be set by user - * - decoding: set by lavc. - */ - AVRational time_base; - - /* video only */ - /** - * picture width / height. - * - encoding: MUST be set by user. - * - decoding: set by lavc. - * Note, for compatibility its possible to set this instead of - * coded_width/height before decoding - */ - int width, height; - -#define FF_ASPECT_EXTENDED 15 - - /** - * the number of pictures in a group of pitures, or 0 for intra_only. - * - encoding: set by user. - * - decoding: unused - */ - int gop_size; - - /** - * pixel format, see PIX_FMT_xxx. - * - encoding: set by user. - * - decoding: set by lavc. - */ - enum PixelFormat pix_fmt; - - /** - * Frame rate emulation. If not zero lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: set by user. - * - decoding: unused. - */ - int rate_emu; - - /** - * if non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw an horizontal band. It improve cache usage. Not - * all codecs can do that. You must check the codec capabilities - * before - * - encoding: unused - * - decoding: set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read - */ - void (*draw_horiz_band)(struct AVCodecContext *s, - const AVFrame *src, int offset[4], - int y, int type, int height); - - /* audio only */ - int sample_rate; ///< samples per sec - int channels; - - /** - * audio sample format. - * - encoding: set by user. - * - decoding: set by lavc. - */ - enum SampleFormat sample_fmt; ///< sample format, currenly unused - - /* the following data should not be initialized */ - /** - * samples per packet. initialized when calling 'init' - */ - int frame_size; - int frame_number; ///< audio or video frame number - int real_pict_num; ///< returns the real picture number of previous encoded frame - - /** - * number of frames the decoded output will be delayed relative to - * the encoded input. - * - encoding: set by lavc. - * - decoding: unused - */ - int delay; - - /* - encoding parameters */ - float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - float qblur; ///< amount of qscale smoothing over time (0.0-1.0) - - /** - * minimum quantizer. - * - encoding: set by user. - * - decoding: unused - */ - int qmin; - - /** - * maximum quantizer. - * - encoding: set by user. - * - decoding: unused - */ - int qmax; - - /** - * maximum quantizer difference between frames. - * - encoding: set by user. - * - decoding: unused - */ - int max_qdiff; - - /** - * maximum number of b frames between non b frames. - * note: the output will be delayed by max_b_frames+1 relative to the input - * - encoding: set by user. - * - decoding: unused - */ - int max_b_frames; - - /** - * qscale factor between ip and b frames. - * - encoding: set by user. - * - decoding: unused - */ - float b_quant_factor; - - /** obsolete FIXME remove */ - int rc_strategy; -#define FF_RC_STRATEGY_XVID 1 - - int b_frame_strategy; - - /** - * hurry up amount. - * - encoding: unused - * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header - * @deprecated Deprecated in favor of skip_idct and skip_frame. - */ - int hurry_up; - - struct AVCodec *codec; - - void *priv_data; - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) - /* unused, FIXME remove*/ - int rtp_mode; -#endif - - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do it's best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263 */ - /* This doesn't take account of any particular */ - /* headers inside the transmited RTP payload */ - - - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send */ - /* Depends on the encoder if the data starts */ - /* with a Start Code (it should) H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload */ - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); - - /* statistics, used for 2-pass encoding */ - int mv_bits; - int header_bits; - int i_tex_bits; - int p_tex_bits; - int i_count; - int p_count; - int skip_count; - int misc_bits; - - /** - * number of bits used for the previously encoded frame. - * - encoding: set by lavc - * - decoding: unused - */ - int frame_bits; - - /** - * private data of the user, can be used to carry app specific stuff. - * - encoding: set by user - * - decoding: set by user - */ - void *opaque; - - char codec_name[32]; - enum CodecType codec_type; /* see CODEC_TYPE_xxx */ - enum CodecID codec_id; /* see CODEC_ID_xxx */ - - /** - * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: set by user, if not then the default based on codec_id will be used - * - decoding: set by user, will be converted to upper case by lavc during init - */ - unsigned int codec_tag; - - /** - * workaround bugs in encoders which sometimes cannot be detected automatically. - * - encoding: set by user - * - decoding: set by user - */ - int workaround_bugs; -#define FF_BUG_AUTODETECT 1 ///< autodetection -#define FF_BUG_OLD_MSMPEG4 2 -#define FF_BUG_XVID_ILACE 4 -#define FF_BUG_UMP4 8 -#define FF_BUG_NO_PADDING 16 -#define FF_BUG_AMV 32 -#define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default -#define FF_BUG_QPEL_CHROMA 64 -#define FF_BUG_STD_QPEL 128 -#define FF_BUG_QPEL_CHROMA2 256 -#define FF_BUG_DIRECT_BLOCKSIZE 512 -#define FF_BUG_EDGE 1024 -#define FF_BUG_HPEL_CHROMA 2048 -#define FF_BUG_DC_CLIP 4096 -#define FF_BUG_MS 8192 ///< workaround various bugs in microsofts broken decoders -//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100% - - /** - * luma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused - */ - int luma_elim_threshold; - - /** - * chroma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused - */ - int chroma_elim_threshold; - - /** - * strictly follow the std (MPEG4, ...). - * - encoding: set by user - * - decoding: unused - */ - int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< strictly conform to a older more strict version of the spec or reference software -#define FF_COMPLIANCE_STRICT 1 ///< strictly conform to all the things in the spec no matter what consequences -#define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_INOFFICIAL -1 ///< allow inofficial extensions -#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< allow non standarized experimental things - - /** - * qscale offset between ip and b frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused - */ - float b_quant_offset; - - /** - * error resilience higher values will detect more errors but may missdetect - * some more or less valid parts as errors. - * - encoding: unused - * - decoding: set by user - */ - int error_resilience; -#define FF_ER_CAREFUL 1 -#define FF_ER_COMPLIANT 2 -#define FF_ER_AGGRESSIVE 3 -#define FF_ER_VERY_AGGRESSIVE 4 - - /** - * called at the beginning of each frame to get a buffer for it. - * if pic.reference is set then the frame will be read later by lavc - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16 - * - encoding: unused - * - decoding: set by lavc, user can override - */ - int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * called to release buffers which where allocated with get_buffer. - * a released buffer can be reused in get_buffer() - * pic.data[*] must be set to NULL - * - encoding: unused - * - decoding: set by lavc, user can override - */ - void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * if 1 the stream has a 1 frame delay during decoding. - * - encoding: set by lavc - * - decoding: set by lavc - */ - int has_b_frames; - - /** - * number of bytes per packet if constant and known or 0 - * used by some WAV based audio codecs - */ - int block_align; - - int parse_only; /* - decoding only: if true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. */ - - /** - * 0-> h263 quant 1-> mpeg quant. - * - encoding: set by user. - * - decoding: unused - */ - int mpeg_quant; - - /** - * pass1 encoding statistics output buffer. - * - encoding: set by lavc - * - decoding: unused - */ - char *stats_out; - - /** - * pass2 encoding statistics input buffer. - * concatenated stuff from stats_out of pass1 should be placed here - * - encoding: allocated/set/freed by user - * - decoding: unused - */ - char *stats_in; - - /** - * ratecontrol qmin qmax limiting method. - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax - * - encoding: set by user. - * - decoding: unused - */ - float rc_qsquish; - - float rc_qmod_amp; - int rc_qmod_freq; - - /** - * ratecontrol override, see RcOverride. - * - encoding: allocated/set/freed by user. - * - decoding: unused - */ - RcOverride *rc_override; - int rc_override_count; - - /** - * rate control equation. - * - encoding: set by user - * - decoding: unused - */ - char *rc_eq; - - /** - * maximum bitrate. - * - encoding: set by user. - * - decoding: unused - */ - int rc_max_rate; - - /** - * minimum bitrate. - * - encoding: set by user. - * - decoding: unused - */ - int rc_min_rate; - - /** - * decoder bitstream buffer size. - * - encoding: set by user. - * - decoding: unused - */ - int rc_buffer_size; - float rc_buffer_aggressivity; - - /** - * qscale factor between p and i frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused - */ - float i_quant_factor; - - /** - * qscale offset between p and i frames. - * - encoding: set by user. - * - decoding: unused - */ - float i_quant_offset; - - /** - * initial complexity for pass1 ratecontrol. - * - encoding: set by user. - * - decoding: unused - */ - float rc_initial_cplx; - - /** - * dct algorithm, see FF_DCT_* below. - * - encoding: set by user - * - decoding: unused - */ - int dct_algo; -#define FF_DCT_AUTO 0 -#define FF_DCT_FASTINT 1 -#define FF_DCT_INT 2 -#define FF_DCT_MMX 3 -#define FF_DCT_MLIB 4 -#define FF_DCT_ALTIVEC 5 -#define FF_DCT_FAAN 6 - - /** - * luminance masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float lumi_masking; - - /** - * temporary complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float temporal_cplx_masking; - - /** - * spatial complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float spatial_cplx_masking; - - /** - * p block masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float p_masking; - - /** - * darkness masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float dark_masking; - - - /* for binary compatibility */ - int unused; - - /** - * idct algorithm, see FF_IDCT_* below. - * - encoding: set by user - * - decoding: set by user - */ - int idct_algo; -#define FF_IDCT_AUTO 0 -#define FF_IDCT_INT 1 -#define FF_IDCT_SIMPLE 2 -#define FF_IDCT_SIMPLEMMX 3 -#define FF_IDCT_LIBMPEG2MMX 4 -#define FF_IDCT_PS2 5 -#define FF_IDCT_MLIB 6 -#define FF_IDCT_ARM 7 -#define FF_IDCT_ALTIVEC 8 -#define FF_IDCT_SH4 9 -#define FF_IDCT_SIMPLEARM 10 -#define FF_IDCT_H264 11 -#define FF_IDCT_VP3 12 -#define FF_IDCT_IPP 13 -#define FF_IDCT_XVIDMMX 14 -#define FF_IDCT_CAVS 15 -#define FF_IDCT_SIMPLEARMV5TE 16 -#define FF_IDCT_SIMPLEARMV6 17 - - /** - * slice count. - * - encoding: set by lavc - * - decoding: set by user (or 0) - */ - int slice_count; - /** - * slice offsets in the frame in bytes. - * - encoding: set/allocated by lavc - * - decoding: set/allocated by user (or NULL) - */ - int *slice_offset; - - /** - * error concealment flags. - * - encoding: unused - * - decoding: set by user - */ - int error_concealment; -#define FF_EC_GUESS_MVS 1 -#define FF_EC_DEBLOCK 2 - - /** - * dsp_mask could be add used to disable unwanted CPU features - * CPU features (i.e. MMX, SSE. ...) - * - * with FORCE flag you may instead enable given CPU features - * (Dangerous: usable in case of misdetection, improper usage however will - * result into program crash) - */ - unsigned dsp_mask; -#define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */ - /* lower 16 bits - CPU features */ -#ifdef HAVE_MMX -#define FF_MM_MMX 0x0001 /* standard MMX */ -#define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */ -#define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */ -#define FF_MM_SSE 0x0008 /* SSE functions */ -#define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */ -#define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */ -#endif /* HAVE_MMX */ -#ifdef HAVE_IWMMXT -#define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */ -#endif /* HAVE_IWMMXT */ - - /** - * bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: set by lavc - * - decoding: set by user - */ - int bits_per_sample; - - /** - * prediction method (needed for huffyuv). - * - encoding: set by user - * - decoding: unused - */ - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 - - /** - * sample aspect ratio (0 if unknown). - * numerator and denominator must be relative prime and smaller then 256 for some video standards - * - encoding: set by user. - * - decoding: set by lavc. - */ - AVRational sample_aspect_ratio; - - /** - * the picture in the bitstream. - * - encoding: set by lavc - * - decoding: set by lavc - */ - AVFrame *coded_frame; - - /** - * debug. - * - encoding: set by user. - * - decoding: set by user. - */ - int debug; -#define FF_DEBUG_PICT_INFO 1 -#define FF_DEBUG_RC 2 -#define FF_DEBUG_BITSTREAM 4 -#define FF_DEBUG_MB_TYPE 8 -#define FF_DEBUG_QP 16 -#define FF_DEBUG_MV 32 -#define FF_DEBUG_DCT_COEFF 0x00000040 -#define FF_DEBUG_SKIP 0x00000080 -#define FF_DEBUG_STARTCODE 0x00000100 -#define FF_DEBUG_PTS 0x00000200 -#define FF_DEBUG_ER 0x00000400 -#define FF_DEBUG_MMCO 0x00000800 -#define FF_DEBUG_BUGS 0x00001000 -#define FF_DEBUG_VIS_QP 0x00002000 -#define FF_DEBUG_VIS_MB_TYPE 0x00004000 - - /** - * debug. - * - encoding: set by user. - * - decoding: set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames - - /** - * error. - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR - * - decoding: unused - */ - uint64_t error[4]; - - /** - * minimum MB quantizer. - * - encoding: unused - * - decoding: unused - */ - int mb_qmin; - - /** - * maximum MB quantizer. - * - encoding: unused - * - decoding: unused - */ - int mb_qmax; - - /** - * motion estimation compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_cmp; - /** - * subpixel motion estimation compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_sub_cmp; - /** - * macroblock compare function (not supported yet). - * - encoding: set by user. - * - decoding: unused - */ - int mb_cmp; - /** - * interlaced dct compare function - * - encoding: set by user. - * - decoding: unused - */ - int ildct_cmp; -#define FF_CMP_SAD 0 -#define FF_CMP_SSE 1 -#define FF_CMP_SATD 2 -#define FF_CMP_DCT 3 -#define FF_CMP_PSNR 4 -#define FF_CMP_BIT 5 -#define FF_CMP_RD 6 -#define FF_CMP_ZERO 7 -#define FF_CMP_VSAD 8 -#define FF_CMP_VSSE 9 -#define FF_CMP_NSSE 10 -#define FF_CMP_W53 11 -#define FF_CMP_W97 12 -#define FF_CMP_DCTMAX 13 -#define FF_CMP_DCT264 14 -#define FF_CMP_CHROMA 256 - - /** - * ME diamond size & shape. - * - encoding: set by user. - * - decoding: unused - */ - int dia_size; - - /** - * amount of previous MV predictors (2a+1 x 2a+1 square). - * - encoding: set by user. - * - decoding: unused - */ - int last_predictor_count; - - /** - * pre pass for motion estimation. - * - encoding: set by user. - * - decoding: unused - */ - int pre_me; - - /** - * motion estimation pre pass compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_pre_cmp; - - /** - * ME pre pass diamond size & shape. - * - encoding: set by user. - * - decoding: unused - */ - int pre_dia_size; - - /** - * subpel ME quality. - * - encoding: set by user. - * - decoding: unused - */ - int me_subpel_quality; - - /** - * callback to negotiate the pixelFormat. - * @param fmt is the list of formats which are supported by the codec, - * its terminated by -1 as 0 is a valid format, the formats are ordered by quality - * the first is allways the native one - * @return the choosen format - * - encoding: unused - * - decoding: set by user, if not set then the native format will always be choosen - */ - enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt); - - /** - * DTG active format information (additionnal aspect ratio - * information only used in DVB MPEG2 transport streams). 0 if - * not set. - * - * - encoding: unused. - * - decoding: set by decoder - */ - int dtg_active_format; -#define FF_DTG_AFD_SAME 8 -#define FF_DTG_AFD_4_3 9 -#define FF_DTG_AFD_16_9 10 -#define FF_DTG_AFD_14_9 11 -#define FF_DTG_AFD_4_3_SP_14_9 13 -#define FF_DTG_AFD_16_9_SP_14_9 14 -#define FF_DTG_AFD_SP_4_3 15 - - /** - * Maximum motion estimation search range in subpel units. - * if 0 then no limit - * - * - encoding: set by user. - * - decoding: unused. - */ - int me_range; - - /** - * intra quantizer bias. - * - encoding: set by user. - * - decoding: unused - */ - int intra_quant_bias; -#define FF_DEFAULT_QUANT_BIAS 999999 - - /** - * inter quantizer bias. - * - encoding: set by user. - * - decoding: unused - */ - int inter_quant_bias; - - /** - * color table ID. - * - encoding: unused. - * - decoding: which clrtable should be used for 8bit RGB images - * table have to be stored somewhere FIXME - */ - int color_table_id; - - /** - * internal_buffer count. - * Don't touch, used by lavc default_get_buffer() - */ - int internal_buffer_count; - - /** - * internal_buffers. - * Don't touch, used by lavc default_get_buffer() - */ - void *internal_buffer; - -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1< ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: unused - * - decoding: set by user, will be converted to upper case by lavc during init - */ - unsigned int stream_codec_tag; - - /** - * scene change detection threshold. - * 0 is default, larger means fewer detected scene changes - * - encoding: set by user. - * - decoding: unused - */ - int scenechange_threshold; - - /** - * minimum lagrange multipler - * - encoding: set by user. - * - decoding: unused - */ - int lmin; - - /** - * maximum lagrange multipler - * - encoding: set by user. - * - decoding: unused - */ - int lmax; - - /** - * Palette control structure - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: set by user. - */ - struct AVPaletteControl *palctrl; - - /** - * noise reduction strength - * - encoding: set by user. - * - decoding: unused - */ - int noise_reduction; - - /** - * called at the beginning of a frame to get cr buffer for it. - * buffer type (size, hints) must be the same. lavc won't check it. - * lavc will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * if pic.data[0] == NULL must behave like get_buffer(). - * - encoding: unused - * - decoding: set by lavc, user can override - */ - int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * number of bits which should be loaded into the rc buffer before decoding starts - * - encoding: set by user. - * - decoding: unused - */ - int rc_initial_buffer_occupancy; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int inter_threshold; - - /** - * CODEC_FLAG2_*. - * - encoding: set by user. - * - decoding: set by user. - */ - int flags2; - - /** - * simulates errors in the bitstream to test error concealment. - * - encoding: set by user. - * - decoding: unused. - */ - int error_rate; - - /** - * MP3 antialias algorithm, see FF_AA_* below. - * - encoding: unused - * - decoding: set by user - */ - int antialias_algo; -#define FF_AA_AUTO 0 -#define FF_AA_FASTINT 1 //not implemented yet -#define FF_AA_INT 2 -#define FF_AA_FLOAT 3 - /** - * Quantizer noise shaping. - * - encoding: set by user - * - decoding: unused - */ - int quantizer_noise_shaping; - - /** - * Thread count. - * is used to decide how many independent tasks should be passed to execute() - * - encoding: set by user - * - decoding: set by user - */ - int thread_count; - - /** - * the codec may call this to execute several independent things. it will return only after - * finishing all tasks, the user may replace this with some multithreaded implementation, the - * default implementation will execute the parts serially - * @param count the number of things to execute - * - encoding: set by lavc, user can override - * - decoding: set by lavc, user can override - */ - int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); - - /** - * Thread opaque. - * can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() - */ - void *thread_opaque; - - /** - * Motion estimation threshold. under which no motion estimation is - * performed, but instead the user specified motion vectors are used - * - * - encoding: set by user - * - decoding: unused - */ - int me_threshold; - - /** - * Macroblock threshold. under which the user specified macroblock types will be used - * - encoding: set by user - * - decoding: unused - */ - int mb_threshold; - - /** - * precision of the intra dc coefficient - 8. - * - encoding: set by user - * - decoding: unused - */ - int intra_dc_precision; - - /** - * noise vs. sse weight for the nsse comparsion function. - * - encoding: set by user - * - decoding: unused - */ - int nsse_weight; - - /** - * number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: set by user - */ - int skip_top; - - /** - * number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: set by user - */ - int skip_bottom; - - /** - * profile - * - encoding: set by user - * - decoding: set by lavc - */ - int profile; -#define FF_PROFILE_UNKNOWN -99 - - /** - * level - * - encoding: set by user - * - decoding: set by lavc - */ - int level; -#define FF_LEVEL_UNKNOWN -99 - - /** - * low resolution decoding. 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: set by user - */ - int lowres; - - /** - * bitsream width / height. may be different from width/height if lowres - * or other things are used - * - encoding: unused - * - decoding: set by user before init if known, codec should override / dynamically change if needed - */ - int coded_width, coded_height; - - /** - * frame skip threshold - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_threshold; - - /** - * frame skip factor - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_factor; - - /** - * frame skip exponent - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_exp; - - /** - * frame skip comparission function - * - encoding: set by user. - * - decoding: unused - */ - int frame_skip_cmp; - - /** - * border processing masking. raises the quantizer for mbs on the borders - * of the picture. - * - encoding: set by user - * - decoding: unused - */ - float border_masking; - - /** - * minimum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused - */ - int mb_lmin; - - /** - * maximum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused - */ - int mb_lmax; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int me_penalty_compensation; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_loop_filter; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_idct; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_frame; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int bidir_refine; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int brd_scale; - - /** - * constant rate factor - quality-based VBR - values ~correspond to qps - * - encoding: set by user. - * - decoding: unused - */ - float crf; - - /** - * constant quantization parameter rate control method - * - encoding: set by user. - * - decoding: unused - */ - int cqp; - - /** - * minimum gop size - * - encoding: set by user. - * - decoding: unused - */ - int keyint_min; - - /** - * number of reference frames - * - encoding: set by user. - * - decoding: unused - */ - int refs; - - /** - * chroma qp offset from luma - * - encoding: set by user. - * - decoding: unused - */ - int chromaoffset; - - /** - * influences how often b-frames are used - * - encoding: set by user. - * - decoding: unused - */ - int bframebias; - - /** - * trellis RD quantization - * - encoding: set by user. - * - decoding: unused - */ - int trellis; - - /** - * reduce fluctuations in qp (before curve compression) - * - encoding: set by user. - * - decoding: unused - */ - float complexityblur; - - /** - * in-loop deblocking filter alphac0 parameter - * alpha is in the range -6...6 - * - encoding: set by user. - * - decoding: unused - */ - int deblockalpha; - - /** - * in-loop deblocking filter beta parameter - * beta is in the range -6...6 - * - encoding: set by user. - * - decoding: unused - */ - int deblockbeta; - - /** - * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - * - encoding: set by user. - * - decoding: unused - */ - int partitions; -#define X264_PART_I4X4 0x001 /* Analyse i4x4 */ -#define X264_PART_I8X8 0x002 /* Analyse i8x8 (requires 8x8 transform) */ -#define X264_PART_P8X8 0x010 /* Analyse p16x8, p8x16 and p8x8 */ -#define X264_PART_P4X4 0x020 /* Analyse p8x4, p4x8, p4x4 */ -#define X264_PART_B8X8 0x100 /* Analyse b16x8, b8x16 and b8x8 */ - - /** - * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) - * - encoding: set by user. - * - decoding: unused - */ - int directpred; - - /** - * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC - * - encoding: set by user. - * - decoding: unused - */ - int cutoff; - - /** - * multiplied by qscale for each frame and added to scene_change_score - * - encoding: set by user. - * - decoding: unused - */ - int scenechange_factor; - - /** - * - * note: value depends upon the compare functin used for fullpel ME - * - encoding: set by user. - * - decoding: unused - */ - int mv0_threshold; - - /** - * adjusts sensitivity of b_frame_strategy 1 - * - encoding: set by user. - * - decoding: unused - */ - int b_sensitivity; - - /** - * - encoding: set by user. - * - decoding: unused - */ - int compression_level; -#define FF_COMPRESSION_DEFAULT -1 - - /** - * sets whether to use LPC mode - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. - */ - int use_lpc; - - /** - * LPC coefficient precision - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. - */ - int lpc_coeff_precision; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int min_prediction_order; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int max_prediction_order; - - /** - * search method for selecting prediction order - * - encoding: set by user. - * - decoding: unused. - */ - int prediction_order_method; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int min_partition_order; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int max_partition_order; - - /** - * GOP timecode frame start number, in non drop frame format - * - encoding: set by user. - * - decoding: unused. - */ - int64_t timecode_frame_start; -} AVCodecContext; - -/** - * AVCodec. - */ -typedef struct AVCodec { - const char *name; - enum CodecType type; - enum CodecID id; - int priv_data_size; - int (*init)(AVCodecContext *); - int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); - int (*close)(AVCodecContext *); - int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, - uint8_t *buf, int buf_size); - int capabilities; - struct AVCodec *next; - void (*flush)(AVCodecContext *); - const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0} - const enum PixelFormat *pix_fmts; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 -} AVCodec; - -/** - * four components are given, that's all. - * the last component is alpha - */ -typedef struct AVPicture { - uint8_t *data[4]; - int linesize[4]; ///< number of bytes per line -} AVPicture; - -/** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * this is totally broken, palette changes should be sent as AVPackets - */ -#define AVPALETTE_SIZE 1024 -#define AVPALETTE_COUNT 256 -typedef struct AVPaletteControl { - - /* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 */ - int palette_changed; - - /* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled */ - unsigned int palette[AVPALETTE_COUNT]; - -} AVPaletteControl attribute_deprecated; - -typedef struct AVSubtitleRect { - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; - uint16_t nb_colors; - int linesize; - uint32_t *rgba_palette; - uint8_t *bitmap; -} AVSubtitleRect; - -typedef struct AVSubtitle { - uint16_t format; /* 0 = graphics */ - uint32_t start_display_time; /* relative to packet pts, in ms */ - uint32_t end_display_time; /* relative to packet pts, in ms */ - uint32_t num_rects; - AVSubtitleRect *rects; -} AVSubtitle; - -extern AVCodec ac3_encoder; -extern AVCodec amr_nb_encoder; -extern AVCodec amr_wb_encoder; -extern AVCodec asv1_encoder; -extern AVCodec asv2_encoder; -extern AVCodec bmp_encoder; -extern AVCodec dvvideo_encoder; -extern AVCodec faac_encoder; -extern AVCodec ffv1_encoder; -extern AVCodec ffvhuff_encoder; -extern AVCodec flac_encoder; -extern AVCodec flashsv_encoder; -extern AVCodec flv_encoder; -extern AVCodec gif_encoder; -extern AVCodec h261_encoder; -extern AVCodec h263_encoder; -extern AVCodec h263p_encoder; -extern AVCodec h264_encoder; -extern AVCodec huffyuv_encoder; -extern AVCodec jpegls_encoder; -extern AVCodec libgsm_encoder; -extern AVCodec libgsm_ms_encoder; -extern AVCodec libtheora_encoder; -extern AVCodec ljpeg_encoder; -extern AVCodec mdec_encoder; -extern AVCodec mjpeg_encoder; -extern AVCodec mp2_encoder; -extern AVCodec mp3lame_encoder; -extern AVCodec mpeg1video_encoder; -extern AVCodec mpeg2video_encoder; -extern AVCodec mpeg4_encoder; -extern AVCodec msmpeg4v1_encoder; -extern AVCodec msmpeg4v2_encoder; -extern AVCodec msmpeg4v3_encoder; -extern AVCodec oggvorbis_encoder; -extern AVCodec pam_encoder; -extern AVCodec pbm_encoder; -extern AVCodec pgm_encoder; -extern AVCodec pgmyuv_encoder; -extern AVCodec png_encoder; -extern AVCodec ppm_encoder; -extern AVCodec rv10_encoder; -extern AVCodec rv20_encoder; -extern AVCodec snow_encoder; -extern AVCodec sonic_encoder; -extern AVCodec sonic_ls_encoder; -extern AVCodec svq1_encoder; -extern AVCodec targa_encoder; -extern AVCodec vcr1_encoder; -extern AVCodec vorbis_encoder; -extern AVCodec wmav1_encoder; -extern AVCodec wmav2_encoder; -extern AVCodec wmv1_encoder; -extern AVCodec wmv2_encoder; -extern AVCodec x264_encoder; -extern AVCodec xvid_encoder; -extern AVCodec zlib_encoder; -extern AVCodec zmbv_encoder; - -extern AVCodec aac_decoder; -extern AVCodec aasc_decoder; -extern AVCodec alac_decoder; -extern AVCodec amr_nb_decoder; -extern AVCodec amr_wb_decoder; -extern AVCodec asv1_decoder; -extern AVCodec asv2_decoder; -extern AVCodec avs_decoder; -extern AVCodec bmp_decoder; -extern AVCodec cavs_decoder; -extern AVCodec cinepak_decoder; -extern AVCodec cljr_decoder; -extern AVCodec cook_decoder; -extern AVCodec cscd_decoder; -extern AVCodec cyuv_decoder; -extern AVCodec dca_decoder; -extern AVCodec dnxhd_decoder; -extern AVCodec dsicinaudio_decoder; -extern AVCodec dsicinvideo_decoder; -extern AVCodec dvvideo_decoder; -extern AVCodec dxa_decoder; -extern AVCodec eightbps_decoder; -extern AVCodec ffv1_decoder; -extern AVCodec ffvhuff_decoder; -extern AVCodec flac_decoder; -extern AVCodec flashsv_decoder; -extern AVCodec flic_decoder; -extern AVCodec flv_decoder; -extern AVCodec fourxm_decoder; -extern AVCodec fraps_decoder; -extern AVCodec gif_decoder; -extern AVCodec h261_decoder; -extern AVCodec h263_decoder; -extern AVCodec h263i_decoder; -extern AVCodec h264_decoder; -extern AVCodec huffyuv_decoder; -extern AVCodec idcin_decoder; -extern AVCodec imc_decoder; -extern AVCodec indeo2_decoder; -extern AVCodec indeo3_decoder; -extern AVCodec interplay_dpcm_decoder; -extern AVCodec interplay_video_decoder; -extern AVCodec kmvc_decoder; -extern AVCodec libgsm_decoder; -extern AVCodec libgsm_ms_decoder; -extern AVCodec loco_decoder; -extern AVCodec mace3_decoder; -extern AVCodec mace6_decoder; -extern AVCodec mdec_decoder; -extern AVCodec mjpeg_decoder; -extern AVCodec mjpegb_decoder; -extern AVCodec mmvideo_decoder; -extern AVCodec mp2_decoder; -extern AVCodec mp3_decoder; -extern AVCodec mp3adu_decoder; -extern AVCodec mp3on4_decoder; -extern AVCodec mpc7_decoder; -extern AVCodec mpeg1video_decoder; -extern AVCodec mpeg2video_decoder; -extern AVCodec mpeg4_decoder; -extern AVCodec mpeg4aac_decoder; -extern AVCodec mpeg_xvmc_decoder; -extern AVCodec mpegvideo_decoder; -extern AVCodec msmpeg4v1_decoder; -extern AVCodec msmpeg4v2_decoder; -extern AVCodec msmpeg4v3_decoder; -extern AVCodec msrle_decoder; -extern AVCodec msvideo1_decoder; -extern AVCodec mszh_decoder; -extern AVCodec nuv_decoder; -extern AVCodec oggvorbis_decoder; -extern AVCodec png_decoder; -extern AVCodec qdm2_decoder; -extern AVCodec qdraw_decoder; -extern AVCodec qpeg_decoder; -extern AVCodec qtrle_decoder; -extern AVCodec ra_144_decoder; -extern AVCodec ra_288_decoder; -extern AVCodec roq_decoder; -extern AVCodec roq_dpcm_decoder; -extern AVCodec rpza_decoder; -extern AVCodec rv10_decoder; -extern AVCodec rv20_decoder; -extern AVCodec rv30_decoder; -extern AVCodec rv40_decoder; -extern AVCodec shorten_decoder; -extern AVCodec smackaud_decoder; -extern AVCodec smacker_decoder; -extern AVCodec smc_decoder; -extern AVCodec snow_decoder; -extern AVCodec sol_dpcm_decoder; -extern AVCodec sonic_decoder; -extern AVCodec sp5x_decoder; -extern AVCodec svq1_decoder; -extern AVCodec svq3_decoder; -extern AVCodec targa_decoder; -extern AVCodec theora_decoder; -extern AVCodec tiertexseqvideo_decoder; -extern AVCodec tiff_decoder; -extern AVCodec truemotion1_decoder; -extern AVCodec truemotion2_decoder; -extern AVCodec truespeech_decoder; -extern AVCodec tscc_decoder; -extern AVCodec tta_decoder; -extern AVCodec ulti_decoder; -extern AVCodec vc1_decoder; -extern AVCodec vcr1_decoder; -extern AVCodec vmdaudio_decoder; -extern AVCodec vmdvideo_decoder; -extern AVCodec vmnc_decoder; -extern AVCodec vorbis_decoder; -extern AVCodec vp3_decoder; -extern AVCodec vp5_decoder; -extern AVCodec vp6_decoder; -extern AVCodec vp6f_decoder; -extern AVCodec vqa_decoder; -extern AVCodec wavpack_decoder; -extern AVCodec wmav1_decoder; -extern AVCodec wmav2_decoder; -extern AVCodec wmv1_decoder; -extern AVCodec wmv2_decoder; -extern AVCodec wmv3_decoder; -extern AVCodec wnv1_decoder; -extern AVCodec ws_snd1_decoder; -extern AVCodec xan_dpcm_decoder; -extern AVCodec xan_wc3_decoder; -extern AVCodec xl_decoder; -extern AVCodec zlib_decoder; -extern AVCodec zmbv_decoder; - -/* pcm codecs */ -#define PCM_CODEC(id, name) \ -extern AVCodec name ## _decoder; \ -extern AVCodec name ## _encoder - -PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); -PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); -PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8); -PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be); -PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le); -PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be); -PCM_CODEC(CODEC_ID_PCM_S24DAUD, pcm_s24daud); -PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le); -PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be); -PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le); -PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); -PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be); -PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le); -PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); -PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); -PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); -PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); - -/* adpcm codecs */ - -PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); -PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx); -PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct); -PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea); -PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726); -PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3); -PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4); -PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws); -PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4); -PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg); -PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf); -PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa); -PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha); - -#undef PCM_CODEC - -/* dummy raw video codec */ -extern AVCodec rawvideo_decoder; -extern AVCodec rawvideo_encoder; - -/* the following codecs use external GPL libs */ -extern AVCodec dts_decoder; -extern AVCodec liba52_decoder; - -/* subtitles */ -extern AVCodec dvbsub_decoder; -extern AVCodec dvbsub_encoder; -extern AVCodec dvdsub_decoder; -extern AVCodec dvdsub_encoder; - -/* resample.c */ - -struct ReSampleContext; -struct AVResampleContext; - -typedef struct ReSampleContext ReSampleContext; - -ReSampleContext *audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate); -int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); -void audio_resample_close(ReSampleContext *s); - -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); -int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); -void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); -void av_resample_close(struct AVResampleContext *c); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* YUV420 format is assumed ! */ - -struct ImgReSampleContext attribute_deprecated; - -typedef struct ImgReSampleContext ImgReSampleContext attribute_deprecated; - -attribute_deprecated ImgReSampleContext *img_resample_init(int output_width, int output_height, - int input_width, int input_height); - -attribute_deprecated ImgReSampleContext *img_resample_full_init(int owidth, int oheight, - int iwidth, int iheight, - int topBand, int bottomBand, - int leftBand, int rightBand, - int padtop, int padbottom, - int padleft, int padright); - - -attribute_deprecated void img_resample(ImgReSampleContext *s, - AVPicture *output, const AVPicture *input); - -attribute_deprecated void img_resample_close(ImgReSampleContext *s); - -#endif - -/** - * Allocate memory for a picture. Call avpicture_free to free it. - * - * @param picture the picture to be filled in. - * @param pix_fmt the format of the picture. - * @param width the width of the picture. - * @param height the height of the picture. - * @return Zero if successful, a negative value if not. - */ -int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); - -/** - * Free a picture previously allocated by avpicture_alloc(). - * - * @param picture The AVPicture to be freed. - */ -void avpicture_free(AVPicture *picture); - -/** - * Fill in AVPicture's fields. - * The fields of the given AVPicture are filled in by using the 'ptr' address - * which points to the image data buffer. Depending on the specified picture - * format, one or multiple image data pointers and line sizes will be set. - * If a planar format is specified, several pointers will be set pointing to - * the different picture planes and the line sizes of the different planes - * will be stored in the lines_sizes array. - * - * @param picture AVPicture who's fields are to be filled in - * @param ptr Buffer which will contain or contains the actual image data - * @param pix_fmt The format in which the picture data is stored - * @param width The width of the image in pixels - * @param height The height of the image in pixels - * @return Size of the image data in bytes. - */ -int avpicture_fill(AVPicture *picture, uint8_t *ptr, - int pix_fmt, int width, int height); -int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, - unsigned char *dest, int dest_size); - -/** - * Calculate the size in bytes that a picture of the given width and height - * would occupy if stored in the given picture format. - * - * @param pix_fmt The given picture format - * @param width The width of the image - * @param height The height of the image - * @return Image data size in bytes - */ -int avpicture_get_size(int pix_fmt, int width, int height); -void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); -const char *avcodec_get_pix_fmt_name(int pix_fmt); -void avcodec_set_dimensions(AVCodecContext *s, int width, int height); -enum PixelFormat avcodec_get_pix_fmt(const char* name); -unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); - -#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ -#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ -#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ -#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ -#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ -#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ - -/** - * Computes what kind of losses will occur when converting from one specific - * pixel format to another. - * When converting from one pixel format to another, information loss may occur. - * For example, when converting from RGB24 to GRAY, the color information will - * be lost. Similarly, other losses occur when converting from some formats to - * other formats. These losses can involve loss of chroma, but also loss of - * resolution, loss of color depth, loss due to the color space conversion, loss - * of the alpha bits or loss due to color quantization. - * avcodec_get_fix_fmt_loss() informs you on the various types of losses which - * will occur when converting from one pixel format to another. - * - * @param[in] dst_pix_fmt Destination pixel format. - * @param[in] src_pix_fmt Source pixel format. - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur. - */ -int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, - int has_alpha); - -/** - * Finds the best pixel format to convert to given a certain source pixel - * format. When converting from one pixel format to another, information loss - * may occur. For example, when converting from RGB24 to GRAY, the color - * information will be lost. Similarly, other losses occur when converting from - * some formats to other formats. avcodec_find_best_pix_fmt() searches which of - * the given pixel formats should be used to undergo the least amount of losses. - * The pixel formats from which it choses one, are determined by the - * \p pix_fmt_mask parameter. - * - * @code - * src_pix_fmt = PIX_FMT_YUV420P; - * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); - * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); - * @endcode - * - * @param[in] pix_fmt_mask Bitmask determining which pixel format to choose from. - * @param[in] src_pix_fmt Source pixel format. - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. - * @return The best pixel format to convert to or -1 if none was found. - */ -int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt, - int has_alpha, int *loss_ptr); - -#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ -#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ - -/** - * Tell if an image really has transparent alpha values. - * @return ored mask of FF_ALPHA_xxx constants - */ -int img_get_alpha_info(const AVPicture *src, - int pix_fmt, int width, int height); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* convert among pixel formats */ -attribute_deprecated int img_convert(AVPicture *dst, int dst_pix_fmt, - const AVPicture *src, int pix_fmt, - int width, int height); -#endif - -/* deinterlace a picture */ -/* deinterlace - if not supported return -1 */ -int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -/* external high level API */ - -extern AVCodec *first_avcodec; - -/* returns LIBAVCODEC_VERSION_INT constant */ -unsigned avcodec_version(void); -/* returns LIBAVCODEC_BUILD constant */ -unsigned avcodec_build(void); - -/** - * Initializes libavcodec. - * - * @warning This function \e must be called before any other libavcodec - * function. - */ -void avcodec_init(void); - -void register_avcodec(AVCodec *format); - -/** - * Finds an encoder with a matching codec ID. - * - * @param id CodecID of the requested encoder. - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder(enum CodecID id); - -/** - * Finds an encoder with the specified name. - * - * @param name Name of the requested encoder. - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder_by_name(const char *name); - -/** - * Finds a decoder with a matching codec ID. - * - * @param id CodecID of the requested decoder. - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder(enum CodecID id); - -/** - * Finds an decoder with the specified name. - * - * @param name Name of the requested decoder. - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder_by_name(const char *name); -void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); - -/** - * Sets the fields of the given AVCodecContext to default values. - * - * @param s The AVCodecContext of which the fields should be set to default values. - */ -void avcodec_get_context_defaults(AVCodecContext *s); - -/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! - * we WILL change its arguments and name a few times! */ -void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType); - -/** - * Allocates an AVCodecContext and sets its fields to default values. The - * resulting struct can be deallocated by simply calling av_free(). - * - * @return An AVCodecContext filled with default values or NULL on failure. - * @see avcodec_get_context_defaults - */ -AVCodecContext *avcodec_alloc_context(void); - -/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! - * we WILL change its arguments and name a few times! */ -AVCodecContext *avcodec_alloc_context2(enum CodecType); - -/** - * Sets the fields of the given AVFrame to default values. - * - * @param pic The AVFrame of which the fields should be set to default values. - */ -void avcodec_get_frame_defaults(AVFrame *pic); - -/** - * Allocates an AVFrame and sets its fields to default values. The resulting - * struct can be deallocated by simply calling av_free(). - * - * @return An AVFrame filled with default values or NULL on failure. - * @see avcodec_get_frame_defaults - */ -AVFrame *avcodec_alloc_frame(void); - -int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); -int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); - -/** - * Checks if the given dimension of a picture is valid, meaning that all - * bytes of the picture can be addressed with a signed int. - * - * @param[in] w Width of the picture. - * @param[in] h Height of the picture. - * @return Zero if valid, a negative value if invalid. - */ -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); -enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); - -int avcodec_thread_init(AVCodecContext *s, int thread_count); -void avcodec_thread_free(AVCodecContext *s); -int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); -int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); -//FIXME func typedef - -/** - * Initializes the AVCodecContext to use the given AVCodec. Prior to using this - * function the context has to be allocated. - * - * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), - * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for - * retrieving a codec. - * - * @warning This function is not thread save! - * - * @code - * codec = avcodec_find_decoder(CODEC_ID_H264); - * if (!codec) - * exit(1); - * - * context = avcodec_alloc_context(); - * - * if (avcodec_open(context, codec) < 0) - * exit(1); - * @endcode - * - * @param avctx The context which will be setup to use the given codec. - * @param codec The codec to use within the context. - * @return Zero on success, a negative value on error. - * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder - */ -int avcodec_open(AVCodecContext *avctx, AVCodec *codec); - -/** - * @deprecated Use avcodec_decode_audio2() instead. - */ -attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Decodes an audio frame from \p buf into \p samples. - * The avcodec_decode_audio2() function decodes a frame of audio from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * audiocodec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in output buffer \p samples. If no frame - * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in \e bytes. - * - * @warning You \e must set \p frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio2(). - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx The codec context. - * @param[out] samples The output buffer. - * @param[in,out] frame_size_ptr The output buffer size in bytes. - * @param[in] buf The input buffer. - * @param[in] buf_size The input buffer size in bytes. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Decodes a video frame from \p buf into \p picture. - * The avcodec_decode_video() function decodes a frame of video from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * videocodec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in \p picture. - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx The codec context. - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf The input buffer. - * @param[in] buf_size The size of the input buffer in bytes. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is non zero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - uint8_t *buf, int buf_size); - -/* decode a subtitle message. return -1 if error, otherwise return the - *number of bytes used. If no subtitle could be decompressed, - *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ -int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size); -int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, - int *data_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Encodes an audio frame from \p samples into \p buf. - * The avcodec_encode_audio() function encodes a frame of audio from the input - * buffer \p samples. To encode it, it makes use of the audiocodec which was - * coupled with \p avctx using avcodec_open(). The resulting encoded frame is - * stored in output buffer \p buf. - * - * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. - * - * @param avctx The codec context. - * @param[out] buf The output buffer. - * @param[in] buf_size The output buffer size. - * @param[in] samples The input buffer containing the samples. - * @return On error a negative value is returned, on succes zero or the number - * of bytes used from the input buffer. - */ -int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const short *samples); - -/** - * Encodes a video frame from \p pict into \p buf. - * The avcodec_encode_video() function encodes a frame of video from the input - * \p pict. To encode it, it makes use of the videocodec which was coupled with - * \p avctx using avcodec_open(). The resulting encoded bytes representing the - * frame are stored in the output buffer \p buf. The input picture should be - * stored using a specific format, namely \c avctx.pix_fmt. - * - * @param avctx The codec context. - * @param[out] buf The output buffer for the bitstream of encoded frame. - * @param[in] buf_size The size of the outputbuffer in bytes. - * @param[in] pict The input picture to encode. - * @return On error a negative value is returned, on success zero or the number - * of bytes used from the input buffer. - */ -int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict); -int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVSubtitle *sub); - -int avcodec_close(AVCodecContext *avctx); - -void avcodec_register_all(void); - -/** - * Flush buffers, should be called when seeking or when switching to a different stream. - */ -void avcodec_flush_buffers(AVCodecContext *avctx); - -void avcodec_default_free_buffers(AVCodecContext *s); - -/* misc useful functions */ - -/** - * Returns a single letter to describe the given picture type \p pict_type. - * - * @param[in] pict_type The picture type. - * @return A single character representing the picture type. - */ -char av_get_pict_type_char(int pict_type); - -/** - * Returns codec bits per sample. - * - * @param[in] codec_id The codec. - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum CodecID codec_id); - -/* frame parsing */ -typedef struct AVCodecParserContext { - void *priv_data; - struct AVCodecParser *parser; - int64_t frame_offset; /* offset of the current frame */ - int64_t cur_offset; /* current offset - (incremented by each av_parser_parse()) */ - int64_t last_frame_offset; /* offset of the last frame */ - /* video info */ - int pict_type; /* XXX: put it back in AVCodecContext */ - int repeat_pict; /* XXX: put it back in AVCodecContext */ - int64_t pts; /* pts of the current frame */ - int64_t dts; /* dts of the current frame */ - - /* private data */ - int64_t last_pts; - int64_t last_dts; - int fetch_timestamp; - -#define AV_PARSER_PTS_NB 4 - int cur_frame_start_index; - int64_t cur_frame_offset[AV_PARSER_PTS_NB]; - int64_t cur_frame_pts[AV_PARSER_PTS_NB]; - int64_t cur_frame_dts[AV_PARSER_PTS_NB]; - - int flags; -#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 -} AVCodecParserContext; - -typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ - int priv_data_size; - int (*parser_init)(AVCodecParserContext *s); - int (*parser_parse)(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size); - void (*parser_close)(AVCodecParserContext *s); - int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); - struct AVCodecParser *next; -} AVCodecParser; - -extern AVCodecParser *av_first_parser; - -void av_register_codec_parser(AVCodecParser *parser); -AVCodecParserContext *av_parser_init(int codec_id); -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts); -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -void av_parser_close(AVCodecParserContext *s); - -extern AVCodecParser aac_parser; -extern AVCodecParser ac3_parser; -extern AVCodecParser cavsvideo_parser; -extern AVCodecParser dca_parser; -extern AVCodecParser dvbsub_parser; -extern AVCodecParser dvdsub_parser; -extern AVCodecParser h261_parser; -extern AVCodecParser h263_parser; -extern AVCodecParser h264_parser; -extern AVCodecParser mjpeg_parser; -extern AVCodecParser mpeg4video_parser; -extern AVCodecParser mpegaudio_parser; -extern AVCodecParser mpegvideo_parser; -extern AVCodecParser pnm_parser; -extern AVCodecParser vc1_parser; - - -typedef struct AVBitStreamFilterContext { - void *priv_data; - struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; -} AVBitStreamFilterContext; - - -typedef struct AVBitStreamFilter { - const char *name; - int priv_data_size; - int (*filter)(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); - struct AVBitStreamFilter *next; -} AVBitStreamFilter; - -extern AVBitStreamFilter *av_first_bitstream_filter; - -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); - -extern AVBitStreamFilter dump_extradata_bsf; -extern AVBitStreamFilter remove_extradata_bsf; -extern AVBitStreamFilter noise_bsf; -extern AVBitStreamFilter mp3_header_compress_bsf; -extern AVBitStreamFilter mp3_header_decompress_bsf; -extern AVBitStreamFilter mjpega_dump_header_bsf; -extern AVBitStreamFilter imx_dump_header_bsf; - - -/* memory */ - -/** - * Reallocates the given block if it is not large enough, otherwise it - * does nothing. - * - * @see av_realloc - */ -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); - -/* for static data only */ - -/** - * Frees all static arrays and reset their pointers to 0. - * Call this function to release all statically allocated tables. - */ -attribute_deprecated void av_free_static(void); - -/** - * Allocation of static arrays. - * - * @warning Do not use for normal allocation. - * - * @param[in] size The amount of memory you need in bytes. - * @return Block of memory of the requested size. - */ -attribute_deprecated void *av_mallocz_static(unsigned int size); - -/** - * Copy image 'src' to 'dst'. - */ -void av_picture_copy(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -/** - * Crop image top and left side - */ -int av_picture_crop(AVPicture *dst, const AVPicture *src, - int pix_fmt, int top_band, int left_band); - -/** - * Pad image - */ -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -attribute_deprecated void img_copy(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -attribute_deprecated int img_crop(AVPicture *dst, const AVPicture *src, - int pix_fmt, int top_band, int left_band); - -attribute_deprecated int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); -#endif - -extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -/* error handling */ -#if EINVAL > 0 -#define AVERROR(e) (-(e)) /**< returns a negative error code from a POSIX error code, to return from library functions. */ -#define AVUNERROR(e) (-(e)) /**< returns a POSIX error code from a library function error return value. */ -#else -/* some platforms have E* and errno already negated. */ -#define AVERROR(e) (e) -#define AVUNERROR(e) (e) -#endif -#define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */ -#define AVERROR_IO AVERROR(EIO) /**< i/o error */ -#define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< number syntax expected in filename */ -#define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */ -#define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */ -#define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */ -#define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< operation not supported */ - -#ifdef __cplusplus -} -#endif - -#endif /* AVCODEC_H */ diff --git a/src/ffmpeg/include/ffmpeg/avformat.h b/src/ffmpeg/include/ffmpeg/avformat.h deleted file mode 100644 index eb8c4e1534..0000000000 --- a/src/ffmpeg/include/ffmpeg/avformat.h +++ /dev/null @@ -1,888 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_H -#define AVFORMAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LIBAVFORMAT_VERSION_INT ((51<<16)+(11<<8)+0) -#define LIBAVFORMAT_VERSION 51.11.0 -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) - -#include -#include /* FILE */ -#include "avcodec.h" - -#include "avio.h" - -/* packet functions */ - -typedef struct AVPacket { - int64_t pts; ///< presentation time stamp in time_base units - int64_t dts; ///< decompression time stamp in time_base units - uint8_t *data; - int size; - int stream_index; - int flags; - int duration; ///< presentation duration in time_base units (0 if not available) - void (*destruct)(struct AVPacket *); - void *priv; - int64_t pos; ///< byte position in stream, -1 if unknown -} AVPacket; -#define PKT_FLAG_KEY 0x0001 - -void av_destruct_packet_nofree(AVPacket *pkt); - -/** - * Default packet destructor. - */ -void av_destruct_packet(AVPacket *pkt); - -/* initialize optional fields of a packet */ -static inline void av_init_packet(AVPacket *pkt) -{ - pkt->pts = AV_NOPTS_VALUE; - pkt->dts = AV_NOPTS_VALUE; - pkt->pos = -1; - pkt->duration = 0; - pkt->flags = 0; - pkt->stream_index = 0; - pkt->destruct= av_destruct_packet_nofree; -} - -/** - * Allocate the payload of a packet and intialized its fields to default values. - * - * @param pkt packet - * @param size wanted payload size - * @return 0 if OK. AVERROR_xxx otherwise. - */ -int av_new_packet(AVPacket *pkt, int size); - -/** - * Allocate and read the payload of a packet and intialized its fields to default values. - * - * @param pkt packet - * @param size wanted payload size - * @return >0 (read size) if OK. AVERROR_xxx otherwise. - */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); - -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated - */ -int av_dup_packet(AVPacket *pkt); - -/** - * Free a packet - * - * @param pkt packet to free - */ -static inline void av_free_packet(AVPacket *pkt) -{ - if (pkt && pkt->destruct) { - pkt->destruct(pkt); - } -} - -/*************************************************/ -/* fractional numbers for exact pts handling */ - -/* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den */ -typedef struct AVFrac { - int64_t val, num, den; -} AVFrac attribute_deprecated; - -/*************************************************/ -/* input/output formats */ - -struct AVCodecTag; - -struct AVFormatContext; - -/** this structure contains the data a format has to probe a file */ -typedef struct AVProbeData { - const char *filename; - unsigned char *buf; - int buf_size; -} AVProbeData; - -#define AVPROBE_SCORE_MAX 100 ///< max score, half of that is used for file extension based detection - -typedef struct AVFormatParameters { - AVRational time_base; - int sample_rate; - int channels; - int width; - int height; - enum PixelFormat pix_fmt; - int channel; /**< used to select dv channel */ -#if LIBAVFORMAT_VERSION_INT < (52<<16) - const char *device; /**< video, audio or DV device */ -#endif - const char *standard; /**< tv standard, NTSC, PAL, SECAM */ - int mpeg2ts_raw:1; /**< force raw MPEG2 transport stream output, if possible */ - int mpeg2ts_compute_pcr:1; /**< compute exact PCR for each transport - stream packet (only meaningful if - mpeg2ts_raw is TRUE */ - int initial_pause:1; /**< do not begin to play the stream - immediately (RTSP only) */ - int prealloced_context:1; - enum CodecID video_codec_id; - enum CodecID audio_codec_id; -} AVFormatParameters; - -//! demuxer will use url_fopen, no opened file should be provided by the caller -#define AVFMT_NOFILE 0x0001 -#define AVFMT_NEEDNUMBER 0x0002 /**< needs '%d' in filename */ -#define AVFMT_SHOW_IDS 0x0008 /**< show format stream IDs numbers */ -#define AVFMT_RAWPICTURE 0x0020 /**< format wants AVPicture structure for - raw picture data */ -#define AVFMT_GLOBALHEADER 0x0040 /**< format wants global header */ -#define AVFMT_NOTIMESTAMPS 0x0080 /**< format doesnt need / has any timestamps */ -#define AVFMT_GENERIC_INDEX 0x0100 /**< use generic index building code */ - -typedef struct AVOutputFormat { - const char *name; - const char *long_name; - const char *mime_type; - const char *extensions; /**< comma separated filename extensions */ - /** size of private data so that it can be allocated in the wrapper */ - int priv_data_size; - /* output support */ - enum CodecID audio_codec; /**< default audio codec */ - enum CodecID video_codec; /**< default video codec */ - int (*write_header)(struct AVFormatContext *); - int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); - int (*write_trailer)(struct AVFormatContext *); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ - int flags; - /** currently only used to set pixel format if not YUV420P */ - int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); - int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush); - - /** - * list of supported codec_id-codec_tag pairs, ordered by "better choice first" - * the arrays are all CODEC_ID_NONE terminated - */ - const struct AVCodecTag **codec_tag; - - /* private fields */ - struct AVOutputFormat *next; -} AVOutputFormat; - -typedef struct AVInputFormat { - const char *name; - const char *long_name; - /** size of private data so that it can be allocated in the wrapper */ - int priv_data_size; - /** tell if a given file has a chance of being parsing by this format */ - int (*read_probe)(AVProbeData *); - /** read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non NULL contains - additionnal paramters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. */ - int (*read_header)(struct AVFormatContext *, - AVFormatParameters *ap); - /** read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. */ - int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); - /** close the stream. The AVFormatContext and AVStreams are not - freed by this function */ - int (*read_close)(struct AVFormatContext *); - /** - * seek to a given timestamp relative to the frames in - * stream component stream_index - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available - */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); - /** - * gets the next timestamp in AV_TIME_BASE units. - */ - int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, - int64_t *pos, int64_t pos_limit); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */ - int flags; - /** if extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough */ - const char *extensions; - /** general purpose read only value that the format can use */ - int value; - - /** start/resume playing - only meaningful if using a network based format - (RTSP) */ - int (*read_play)(struct AVFormatContext *); - - /** pause playing - only meaningful if using a network based format - (RTSP) */ - int (*read_pause)(struct AVFormatContext *); - - const struct AVCodecTag **codec_tag; - - /* private fields */ - struct AVInputFormat *next; -} AVInputFormat; - -typedef struct AVIndexEntry { - int64_t pos; - int64_t timestamp; -#define AVINDEX_KEYFRAME 0x0001 - int flags:2; - int size:30; //yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align) - int min_distance; /**< min distance between this and the previous keyframe, used to avoid unneeded searching */ -} AVIndexEntry; - -typedef struct AVStream { - int index; /**< stream index in AVFormatContext */ - int id; /**< format specific stream id */ - AVCodecContext *codec; /**< codec context */ - /** - * real base frame rate of the stream. - * this is the lowest framerate with which all timestamps can be - * represented accurately (its the least common multiple of all - * framerates in the stream), Note, this value is just a guess! - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 - */ - AVRational r_frame_rate; - void *priv_data; -#if LIBAVFORMAT_VERSION_INT < (52<<16) - /* internal data used in av_find_stream_info() */ - int64_t codec_info_duration; - int codec_info_nb_frames; -#endif - /** encoding: PTS generation when outputing stream */ - AVFrac pts; - - /** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - */ - AVRational time_base; - int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ - /* ffmpeg.c private use */ - int stream_copy; /**< if set, just copy stream */ - enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed - //FIXME move stuff to a flags field? - /** quality, as it has been removed from AVCodecContext and put in AVVideoFrame - * MN:dunno if thats the right place, for it */ - float quality; - /** decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. */ - int64_t start_time; - /** decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. */ - int64_t duration; - - char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */ - - /* av_read_frame() support */ - int need_parsing; ///< 1->full parsing needed, 2->only parse headers dont repack - struct AVCodecParserContext *parser; - - int64_t cur_dts; - int last_IP_duration; - int64_t last_IP_pts; - /* av_seek_frame() support */ - AVIndexEntry *index_entries; /**< only used if the format does not - support seeking natively */ - int nb_index_entries; - unsigned int index_entries_allocated_size; - - int64_t nb_frames; ///< number of frames in this stream if known or 0 - -#define MAX_REORDER_DELAY 4 - int64_t pts_buffer[MAX_REORDER_DELAY+1]; -} AVStream; - -#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present - (streams are added dynamically) */ - -#define MAX_STREAMS 20 - -/* format I/O context */ -typedef struct AVFormatContext { - const AVClass *av_class; /**< set by av_alloc_format_context */ - /* can only be iformat or oformat, not both at the same time */ - struct AVInputFormat *iformat; - struct AVOutputFormat *oformat; - void *priv_data; - ByteIOContext pb; - unsigned int nb_streams; - AVStream *streams[MAX_STREAMS]; - char filename[1024]; /**< input or output filename */ - /* stream info */ - int64_t timestamp; - char title[512]; - char author[512]; - char copyright[512]; - char comment[512]; - char album[512]; - int year; /**< ID3 year, 0 if none */ - int track; /**< track number, 0 if none */ - char genre[32]; /**< ID3 genre */ - - int ctx_flags; /**< format specific flags, see AVFMTCTX_xx */ - /* private data for pts handling (do not modify directly) */ - /** This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in mpeg - streams */ - struct AVPacketList *packet_buffer; - - /** decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - it is deduced from the AVStream values. */ - int64_t start_time; - /** decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. */ - int64_t duration; - /** decoding: total file size. 0 if unknown */ - int64_t file_size; - /** decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as ffmpeg can compute it automatically. */ - int bit_rate; - - /* av_read_frame() support */ - AVStream *cur_st; - const uint8_t *cur_ptr; - int cur_len; - AVPacket cur_pkt; - - /* av_seek_frame() support */ - int64_t data_offset; /** offset of the first packet */ - int index_built; - - int mux_rate; - int packet_size; - int preload; - int max_delay; - -#define AVFMT_NOOUTPUTLOOP -1 -#define AVFMT_INFINITEOUTPUTLOOP 0 - /** number of times to loop output in formats that support it */ - int loop_output; - - int flags; -#define AVFMT_FLAG_GENPTS 0x0001 ///< generate pts if missing even if it requires parsing future frames -#define AVFMT_FLAG_IGNIDX 0x0002 ///< ignore index - - int loop_input; - /** decoding: size of data to probe; encoding unused */ - unsigned int probesize; - - /** - * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() - */ - int max_analyze_duration; - - const uint8_t *key; - int keylen; -} AVFormatContext; - -typedef struct AVPacketList { - AVPacket pkt; - struct AVPacketList *next; -} AVPacketList; - -extern AVInputFormat *first_iformat; -extern AVOutputFormat *first_oformat; - -enum CodecID av_guess_image2_codec(const char *filename); - -/* XXX: use automatic init with either ELF sections or C file parser */ -/* modules */ - -#include "rtp.h" - -#include "rtsp.h" - -/* utils.c */ -void av_register_input_format(AVInputFormat *format); -void av_register_output_format(AVOutputFormat *format); -AVOutputFormat *guess_stream_format(const char *short_name, - const char *filename, const char *mime_type); -AVOutputFormat *guess_format(const char *short_name, - const char *filename, const char *mime_type); - -/** - * Guesses the codec id based upon muxer and filename. - */ -enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, enum CodecType type); - -/** - * Send a nice hexadecimal dump of a buffer to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump(FILE *f, uint8_t *buf, int size); - -/** - * Send a nice hexadecimal dump of a buffer to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); - -/** - * Send a nice dump of a packet to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param pkt packet to dump - * @param dump_payload true if the payload must be displayed too - */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); - -/** - * Send a nice dump of a packet to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param pkt packet to dump - * @param dump_payload true if the payload must be displayed too - */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); - -void av_register_all(void); - -/** codec tag <-> codec id */ -enum CodecID av_codec_get_id(const struct AVCodecTag **tags, unsigned int tag); -unsigned int av_codec_get_tag(const struct AVCodecTag **tags, enum CodecID id); - -/* media file input */ - -/** - * finds AVInputFormat based on input format's short name. - */ -AVInputFormat *av_find_input_format(const char *short_name); - -/** - * Guess file format. - * - * @param is_opened whether the file is already opened, determines whether - * demuxers with or without AVFMT_NOFILE are probed - */ -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); - -/** - * Allocates all the structures needed to read an input stream. - * This does not open the needed codecs for decoding the stream[s]. - */ -int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, - AVInputFormat *fmt, AVFormatParameters *ap); - -/** - * Open a media file as input. The codec are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr the opened media file handle is put here - * @param filename filename to open. - * @param fmt if non NULL, force the file format to use - * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. - */ -int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, - AVInputFormat *fmt, - int buf_size, - AVFormatParameters *ap); -/** no av_open for output, so applications will need this: */ -AVFormatContext *av_alloc_format_context(void); - -/** - * Read packets of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also computes the real frame rate in case of mpeg2 repeat - * frame mode. - * The logical file position is not changed by this function; - * examined packets may be buffered for later processing. - * - * @param ic media file handle - * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need - */ -int av_find_stream_info(AVFormatContext *ic); - -/** - * Read a transport packet from a media file. - * - * This function is absolete and should never be used. - * Use av_read_frame() instead. - * - * @param s media file handle - * @param pkt is filled - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_read_packet(AVFormatContext *s, AVPacket *pkt); - -/** - * Return the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.timebase units (and guessed if the format cannot - * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 if error or end of file. - */ -int av_read_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Seek to the key frame at timestamp. - * 'timestamp' in 'stream_index'. - * @param stream_index If stream_index is (-1), a default - * stream is selected, and timestamp is automatically converted - * from AV_TIME_BASE units to the stream specific time_base. - * @param timestamp timestamp in AVStream.time_base units - * or if there is no stream specified then in AV_TIME_BASE units - * @param flags flags which select direction and seeking mode - * @return >= 0 on success - */ -int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); - -/** - * start playing a network based stream (e.g. RTSP stream) at the - * current position - */ -int av_read_play(AVFormatContext *s); - -/** - * Pause a network based stream (e.g. RTSP stream). - * - * Use av_read_play() to resume it. - */ -int av_read_pause(AVFormatContext *s); - -/** - * Close a media file (but not its codecs). - * - * @param s media file handle - */ -void av_close_input_file(AVFormatContext *s); - -/** - * Add a new stream to a media file. - * - * Can only be called in the read_header() function. If the flag - * AVFMTCTX_NOHEADER is in the format context, then new streams - * can be added in read_packet too. - * - * @param s media file handle - * @param id file format dependent stream id - */ -AVStream *av_new_stream(AVFormatContext *s, int id); - -/** - * Set the pts for a given stream. - * - * @param s stream - * @param pts_wrap_bits number of bits effectively used by the pts - * (used for wrap control, 33 is the value for MPEG) - * @param pts_num numerator to convert to seconds (MPEG: 1) - * @param pts_den denominator to convert to seconds (MPEG: 90000) - */ -void av_set_pts_info(AVStream *s, int pts_wrap_bits, - int pts_num, int pts_den); - -#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward -#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes -#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non keyframes - -int av_find_default_stream_index(AVFormatContext *s); - -/** - * Gets the index for a specific timestamp. - * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond to - * the timestamp which is <= the requested one, if backward is 0 - * then it will be >= - * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise - * @return < 0 if no such timestamp could be found - */ -int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); - -/** - * Add a index entry into a sorted list updateing if it is already there. - * - * @param timestamp timestamp in the timebase of the given stream - */ -int av_add_index_entry(AVStream *st, - int64_t pos, int64_t timestamp, int size, int distance, int flags); - -/** - * Does a binary search using av_index_search_timestamp() and AVCodec.read_timestamp(). - * this isnt supposed to be called directly by a user application, but by demuxers - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags); - -/** - * Updates cur_dts of all streams based on given timestamp and AVStream. - * - * Stream ref_st unchanged, others set cur_dts in their native timebase - * only needed for timestamp wrapping or if (dts not set and pts!=dts) - * @param timestamp new dts expressed in time_base of param ref_st - * @param ref_st reference stream giving time_base of param timestamp - */ -void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); - -/** - * Does a binary search using read_timestamp(). - * this isnt supposed to be called directly by a user application, but by demuxers - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); - -/** media file output */ -int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); - -/** - * allocate the stream private data and write the stream header to an - * output media file - * - * @param s media file handle - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_write_header(AVFormatContext *s); - -/** - * Write a packet to an output media file. - * - * The packet shall contain one audio or video frame. - * The packet must be correctly interleaved according to the container specification, - * if not then av_interleaved_write_frame must be used - * - * @param s media file handle - * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... - * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. - */ -int av_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Writes a packet to an output media file ensuring correct interleaving. - * - * The packet must contain one audio or video frame. - * If the packets are already correctly interleaved the application should - * call av_write_frame() instead as its slightly faster, its also important - * to keep in mind that completly non interleaved input will need huge amounts - * of memory to interleave with this, so its prefereable to interleave at the - * demuxer level - * - * @param s media file handle - * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... - * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. - */ -int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Interleave a packet per DTS in an output media file. - * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this function, - * so they cannot be used after it, note calling av_free_packet() on them is still safe. - * - * @param s media file handle - * @param out the interleaved packet will be output here - * @param in the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occured - */ -int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); - -/** - * @brief Write the stream trailer to an output media file and - * free the file private data. - * - * @param s media file handle - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_write_trailer(AVFormatContext *s); - -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); - -/** - * parses width and height out of string str. - */ -int parse_image_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Converts frame rate from string to a fraction. - */ -int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg); - -/** - * Converts date string to number of seconds since Jan 1st, 1970. - * - * @code - * Syntax: - * - If not a duration: - * [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]} - * Time is localtime unless Z is suffixed to the end. In this case GMT - * Return the date in micro seconds since 1970 - * - * - If a duration: - * HH[:MM[:SS[.m...]]] - * S+[.m...] - * @endcode - */ -int64_t parse_date(const char *datestr, int duration); - -int64_t av_gettime(void); - -/* ffm specific for ffserver */ -#define FFM_PACKET_SIZE 4096 -offset_t ffm_read_write_index(int fd); -void ffm_write_write_index(int fd, offset_t pos); -void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size); - -/** - * Attempts to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. - */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); - -/** - * Returns in 'buf' the path with '%d' replaced by number. - - * Also handles the '%0nd' format where 'n' is the total number - * of digits and '%%'. - * - * @param buf destination buffer - * @param buf_size destination buffer size - * @param path numbered sequence string - * @number frame number - * @return 0 if OK, -1 if format error. - */ -int av_get_frame_filename(char *buf, int buf_size, - const char *path, int number); - -/** - * Check whether filename actually is a numbered sequence generator. - * - * @param filename possible numbered sequence string - * @return 1 if a valid numbered sequence string, 0 otherwise. - */ -int av_filename_number_test(const char *filename); - -/* grab specific */ -int video_grab_init(void); -int audio_init(void); - -/* DV1394 */ -int dv1394_init(void); -int dc1394_init(void); - -#ifdef HAVE_AV_CONFIG_H - -#include "os_support.h" - -int strstart(const char *str, const char *val, const char **ptr); -int stristart(const char *str, const char *val, const char **ptr); -void pstrcpy(char *buf, int buf_size, const char *str); -char *pstrcat(char *buf, int buf_size, const char *s); - -void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem); - -#ifdef __GNUC__ -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - typeof(tab) _tab = (tab);\ - typeof(elem) _elem = (elem);\ - (void)sizeof(**_tab == _elem); /* check that types are compatible */\ - __dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\ -} while(0) -#else -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - __dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\ -} while(0) -#endif - -time_t mktimegm(struct tm *tm); -struct tm *brktimegm(time_t secs, struct tm *tm); -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt); - -struct in_addr; -int resolve_host(struct in_addr *sin_addr, const char *hostname); - -void url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); - -int match_ext(const char *filename, const char *extensions); - -#endif /* HAVE_AV_CONFIG_H */ - -#ifdef __cplusplus -} -#endif - -#endif /* AVFORMAT_H */ - diff --git a/src/ffmpeg/include/ffmpeg/avio.h b/src/ffmpeg/include/ffmpeg/avio.h deleted file mode 100644 index be78c9a7b4..0000000000 --- a/src/ffmpeg/include/ffmpeg/avio.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * unbuffered io for ffmpeg system - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVIO_H -#define AVIO_H - -/* output byte stream handling */ - -typedef int64_t offset_t; - -/* unbuffered I/O */ - -struct URLContext { - struct URLProtocol *prot; - int flags; - int is_streamed; /**< true if streamed (no seek possible), default = false */ - int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ - void *priv_data; -#if LIBAVFORMAT_VERSION_INT >= (52<<16) - char *filename; /**< specified filename */ -#else - char filename[1]; /**< specified filename */ -#endif -}; - -typedef struct URLContext URLContext; - -typedef struct URLPollEntry { - URLContext *handle; - int events; - int revents; -} URLPollEntry; - -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 - -typedef int URLInterruptCB(void); - -int url_open(URLContext **h, const char *filename, int flags); -int url_read(URLContext *h, unsigned char *buf, int size); -int url_write(URLContext *h, unsigned char *buf, int size); -offset_t url_seek(URLContext *h, offset_t pos, int whence); -int url_close(URLContext *h); -int url_exist(const char *filename); -offset_t url_filesize(URLContext *h); - -/** - * Return the maximum packet size associated to packetized file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param h file handle - * @return maximum packet size in bytes - */ -int url_get_max_packet_size(URLContext *h); -void url_get_filename(URLContext *h, char *buf, int buf_size); - -/** - * the callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned - * in this case by the interrupted function. 'NULL' means no interrupt - * callback is given. i - */ -void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); - -/* not implemented */ -int url_poll(URLPollEntry *poll_table, int n, int timeout); - -/** - * passing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere, supporting this is optional - * if its not supprted then the seek function will return <0 - */ -#define AVSEEK_SIZE 0x10000 - -typedef struct URLProtocol { - const char *name; - int (*url_open)(URLContext *h, const char *filename, int flags); - int (*url_read)(URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, unsigned char *buf, int size); - offset_t (*url_seek)(URLContext *h, offset_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; -} URLProtocol; - -extern URLProtocol *first_protocol; -extern URLInterruptCB *url_interrupt_cb; - -int register_protocol(URLProtocol *protocol); - -typedef struct { - unsigned char *buffer; - int buffer_size; - unsigned char *buf_ptr, *buf_end; - void *opaque; - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - offset_t (*seek)(void *opaque, offset_t offset, int whence); - offset_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ - int is_streamed; - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; ///< contains the error code or 0 if no error happened -} ByteIOContext; - -int init_put_byte(ByteIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - offset_t (*seek)(void *opaque, offset_t offset, int whence)); - -void put_byte(ByteIOContext *s, int b); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); - -void put_strz(ByteIOContext *s, const char *buf); - -offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence); -void url_fskip(ByteIOContext *s, offset_t offset); -offset_t url_ftell(ByteIOContext *s); -offset_t url_fsize(ByteIOContext *s); -int url_feof(ByteIOContext *s); -int url_ferror(ByteIOContext *s); - -#define URL_EOF (-1) -/** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); - -/** @warning currently size is limited */ -#ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -#else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); -#endif - -/** @note unlike fgets, the EOL character is not returned and a whole - line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); - -void put_flush_packet(ByteIOContext *s); - -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** @note return 0 if EOF, so you cannot use it if EOF handling is - necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); - -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); - -static inline int url_is_streamed(ByteIOContext *s) -{ - return s->is_streamed; -} - -int url_fdopen(ByteIOContext *s, URLContext *h); - -/** @warning must be called before any I/O */ -int url_setbufsize(ByteIOContext *s, int buf_size); - -/** @note when opened as read/write, the buffers are only used for - reading */ -int url_fopen(ByteIOContext *s, const char *filename, int flags); -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); - -/** - * Return the maximum packet size associated to packetized buffered file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param h buffered file handle - * @return maximum packet size in bytes - */ -int url_fget_max_packet_size(ByteIOContext *s); - -int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags); - -/** return the written or read size */ -int url_close_buf(ByteIOContext *s); - -/** - * Open a write only memory stream. - * - * @param s new IO context - * @return zero if no error. - */ -int url_open_dyn_buf(ByteIOContext *s); - -/** - * Open a write only packetized memory stream with a maximum packet - * size of 'max_packet_size'. The stream is stored in a memory buffer - * with a big endian 4 byte header giving the packet size in bytes. - * - * @param s new IO context - * @param max_packet_size maximum packet size (must be > 0) - * @return zero if no error. - */ -int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size); - -/** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * @param s IO context - * @param pointer to a byte buffer - * @return the length of the byte buffer - */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); - -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); - -/* file.c */ -extern URLProtocol file_protocol; -extern URLProtocol pipe_protocol; - -/* udp.c */ -extern URLProtocol udp_protocol; -int udp_set_remote_url(URLContext *h, const char *uri); -int udp_get_local_port(URLContext *h); -int udp_get_file_handle(URLContext *h); - -/* tcp.c */ -extern URLProtocol tcp_protocol; - -/* http.c */ -extern URLProtocol http_protocol; - -#endif - diff --git a/src/ffmpeg/include/ffmpeg/avutil.h b/src/ffmpeg/include/ffmpeg/avutil.h deleted file mode 100644 index 32bc40bfbf..0000000000 --- a/src/ffmpeg/include/ffmpeg/avutil.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_H -#define AVUTIL_H - -/** - * @file avutil.h - * external api header. - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBAVUTIL_VERSION_INT ((49<<16)+(4<<8)+0) -#define LIBAVUTIL_VERSION 49.4.0 -#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT - -#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) - - -#include "common.h" -#include "mathematics.h" -#include "rational.h" -#include "integer.h" -#include "intfloat_readwrite.h" -#include "log.h" - -/** - * Pixel format. Notes: - * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - */ -enum PixelFormat { - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 0 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian - PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions -}; - -#ifdef WORDS_BIGENDIAN -#define PIX_FMT_RGBA PIX_FMT_RGB32_1 -#define PIX_FMT_BGRA PIX_FMT_BGR32_1 -#define PIX_FMT_ARGB PIX_FMT_RGB32 -#define PIX_FMT_ABGR PIX_FMT_BGR32 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE -#else -#define PIX_FMT_RGBA PIX_FMT_BGR32 -#define PIX_FMT_BGRA PIX_FMT_RGB32 -#define PIX_FMT_ARGB PIX_FMT_BGR32_1 -#define PIX_FMT_ABGR PIX_FMT_RGB32_1 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 -#define PIX_FMT_RGBA32 PIX_FMT_RGB32 -#define PIX_FMT_YUV422 PIX_FMT_YUYV422 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* AVUTIL_H */ diff --git a/src/ffmpeg/include/ffmpeg/common.h b/src/ffmpeg/include/ffmpeg/common.h deleted file mode 100644 index 07c4276faf..0000000000 --- a/src/ffmpeg/include/ffmpeg/common.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file common.h - * common internal and external api header. - */ - -#ifndef COMMON_H -#define COMMON_H - -#if 0 -#include -#endif - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "config.h" - -# include -# include -# include -# include -# include -# include -# include -#endif /* HAVE_AV_CONFIG_H */ - -#ifndef av_always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define av_always_inline __attribute__((always_inline)) inline -# define av_noinline __attribute__((noinline)) -#else -# define av_always_inline inline -# define av_noinline -#endif -#endif - -#ifdef HAVE_AV_CONFIG_H -# include "internal.h" -#endif /* HAVE_AV_CONFIG_H */ - -#ifndef attribute_deprecated -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_deprecated __attribute__((deprecated)) -#else -# define attribute_deprecated -#endif -#endif - -#include "mem.h" - -//rounded divison & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) -/* assume b>0 */ -#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) - -/* misc math functions */ -extern const uint8_t ff_log2_tab[256]; - -static inline int av_log2(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xffff0000) { - v >>= 16; - n += 16; - } - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -static inline int av_log2_16bit(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -/* median of 3 */ -static inline int mid_pred(int a, int b, int c) -{ -#ifdef HAVE_CMOV - int i=b; - asm volatile( - "cmp %2, %1 \n\t" - "cmovg %1, %0 \n\t" - "cmovg %2, %1 \n\t" - "cmp %3, %1 \n\t" - "cmovl %3, %1 \n\t" - "cmp %1, %0 \n\t" - "cmovg %1, %0 \n\t" - :"+&r"(i), "+&r"(a) - :"r"(b), "r"(c) - ); - return i; -#elif 0 - int t= (a-b)&((a-b)>>31); - a-=t; - b+=t; - b-= (b-c)&((b-c)>>31); - b+= (a-b)&((a-b)>>31); - - return b; -#else - if(a>b){ - if(c>b){ - if(c>a) b=a; - else b=c; - } - }else{ - if(b>c){ - if(c>a) b=c; - else b=a; - } - } - return b; -#endif -} - -/** - * clip a signed integer value into the amin-amax range - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static inline int av_clip(int a, int amin, int amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * clip a signed integer value into the 0-255 range - * @param a value to clip - * @return clipped value - */ -static inline uint8_t av_clip_uint8(int a) -{ - if (a&(~255)) return (-a)>>31; - else return a; -} - -/* math */ -int64_t ff_gcd(int64_t a, int64_t b); - -/** - * converts fourcc string to int - */ -static inline int ff_get_fourcc(const char *s){ -#ifdef HAVE_AV_CONFIG_H - assert( strlen(s)==4 ); -#endif - - return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); -} - -#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) -#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) - -/*! - * \def GET_UTF8(val, GET_BYTE, ERROR) - * converts a utf-8 character (up to 4 bytes long) to its 32-bit ucs-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * ucs-4 character and should be a left value. - * \param GET_BYTE gets utf-8 encoded bytes from any proper source. It can be - * a function or a statement whose return value or evaluated value is of type - * uint8_t. It will be executed up to 4 times for values in the valid utf-8 range, - * and up to 7 times in the general case. - * \param ERROR action that should be taken when an invalid utf-8 byte is returned - * from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. - */ -#define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ - {\ - int ones= 7 - av_log2(val ^ 255);\ - if(ones==1)\ - ERROR\ - val&= 127>>ones;\ - while(--ones > 0){\ - int tmp= GET_BYTE - 128;\ - if(tmp>>6)\ - ERROR\ - val= (val<<6) + tmp;\ - }\ - } - -/*! - * \def PUT_UTF8(val, tmp, PUT_BYTE) - * converts a 32-bit unicode character to its utf-8 encoded form (up to 4 bytes long). - * \param val is an input only argument and should be of type uint32_t. It holds - * a ucs4 encoded unicode character that is to be converted to utf-8. If - * val is given as a function it's executed only once. - * \param tmp is a temporary variable and should be of type uint8_t. It - * represents an intermediate value during conversion that is to be - * outputted by PUT_BYTE. - * \param PUT_BYTE writes the converted utf-8 bytes to any proper destination. - * It could be a function or a statement, and uses tmp as the input byte. - * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be - * executed up to 4 times for values in the valid utf-8 range and up to - * 7 times in the general case, depending on the length of the converted - * unicode character. - */ -#define PUT_UTF8(val, tmp, PUT_BYTE)\ - {\ - int bytes, shift;\ - uint32_t in = val;\ - if (in < 0x80) {\ - tmp = in;\ - PUT_BYTE\ - } else {\ - bytes = (av_log2(in) + 4) / 5;\ - shift = (bytes - 1) * 6;\ - tmp = (256 - (256 >> bytes)) | (in >> shift);\ - PUT_BYTE\ - while (shift >= 6) {\ - shift -= 6;\ - tmp = 0x80 | ((in >> shift) & 0x3f);\ - PUT_BYTE\ - }\ - }\ - } - -#if defined(ARCH_X86) || defined(ARCH_POWERPC) -#if defined(ARCH_X86_64) -static inline uint64_t read_time(void) -{ - uint64_t a, d; - asm volatile( "rdtsc\n\t" - : "=a" (a), "=d" (d) - ); - return (d << 32) | (a & 0xffffffff); -} -#elif defined(ARCH_X86_32) -static inline long long read_time(void) -{ - long long l; - asm volatile( "rdtsc\n\t" - : "=A" (l) - ); - return l; -} -#else //FIXME check ppc64 -static inline uint64_t read_time(void) -{ - uint32_t tbu, tbl, temp; - - /* from section 2.2.1 of the 32-bit PowerPC PEM */ - __asm__ __volatile__( - "1:\n" - "mftbu %2\n" - "mftb %0\n" - "mftbu %1\n" - "cmpw %2,%1\n" - "bne 1b\n" - : "=r"(tbl), "=r"(tbu), "=r"(temp) - : - : "cc"); - - return (((uint64_t)tbu)<<32) | (uint64_t)tbl; -} -#endif - -#define START_TIMER \ -uint64_t tend;\ -uint64_t tstart= read_time();\ - -#define STOP_TIMER(id) \ -tend= read_time();\ -{\ - static uint64_t tsum=0;\ - static int tcount=0;\ - static int tskip_count=0;\ - if(tcount<2 || tend - tstart < FFMAX(8*tsum/tcount, 2000)){\ - tsum+= tend - tstart;\ - tcount++;\ - }else\ - tskip_count++;\ - if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ - av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ - }\ -} -#else -#define START_TIMER -#define STOP_TIMER(id) {} -#endif - -#endif /* COMMON_H */ diff --git a/src/ffmpeg/include/ffmpeg/integer.h b/src/ffmpeg/include/ffmpeg/integer.h deleted file mode 100644 index 2a4d703166..0000000000 --- a/src/ffmpeg/include/ffmpeg/integer.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file integer.h - * arbitrary precision integers - * @author Michael Niedermayer - */ - -#ifndef INTEGER_H -#define INTEGER_H - -#define AV_INTEGER_SIZE 8 - -typedef struct AVInteger{ - uint16_t v[AV_INTEGER_SIZE]; -} AVInteger; - -AVInteger av_add_i(AVInteger a, AVInteger b); -AVInteger av_sub_i(AVInteger a, AVInteger b); - -/** - * returns the rounded down value of the logarithm of base 2 of the given AVInteger. - * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0 - */ -int av_log2_i(AVInteger a); -AVInteger av_mul_i(AVInteger a, AVInteger b); - -/** - * returns 0 if a==b, 1 if a>b and -1 if a - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INTFLOAT_READWRITE_H -#define INTFLOAT_READWRITE_H - -#include "common.h" - -/* IEEE 80 bits extended float */ -typedef struct AVExtFloat { - uint8_t exponent[2]; - uint8_t mantissa[8]; -} AVExtFloat; - -double av_int2dbl(int64_t v); -float av_int2flt(int32_t v); -double av_ext2dbl(const AVExtFloat ext); -int64_t av_dbl2int(double d); -int32_t av_flt2int(float d); -AVExtFloat av_dbl2ext(double d); - -#endif /* INTFLOAT_READWRITE_H */ diff --git a/src/ffmpeg/include/ffmpeg/log.h b/src/ffmpeg/include/ffmpeg/log.h deleted file mode 100644 index fa88f5fb25..0000000000 --- a/src/ffmpeg/include/ffmpeg/log.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOG_H -#define LOG_H - -#include - -/** - * Used by av_log - */ -typedef struct AVCLASS AVClass; -struct AVCLASS { - const char* class_name; - const char* (*item_name)(void*); /* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat */ - const struct AVOption *option; -}; - -/* av_log API */ - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define AV_LOG_QUIET -1 -#define AV_LOG_FATAL 0 -#define AV_LOG_ERROR 0 -#define AV_LOG_WARNING 1 -#define AV_LOG_INFO 1 -#define AV_LOG_VERBOSE 1 -#define AV_LOG_DEBUG 2 -#else -#define AV_LOG_QUIET -8 - -/** - * something went really wrong and we will crash now - */ -#define AV_LOG_PANIC 0 - -/** - * something went wrong and recovery is not possible - * like no header in a format which depends on it or a combination - * of parameters which are not allowed - */ -#define AV_LOG_FATAL 8 - -/** - * something went wrong and cannot losslessly be recovered - * but not all future data is affected - */ -#define AV_LOG_ERROR 16 - -/** - * something somehow does not look correct / something which may or may not - * lead to some problems like use of -vstrict -2 - */ -#define AV_LOG_WARNING 24 - -#define AV_LOG_INFO 32 -#define AV_LOG_VERBOSE 40 - -/** - * stuff which is only useful for libav* developers - */ -#define AV_LOG_DEBUG 48 -#endif -extern int av_log_level; - -/** - * Send the specified message to the log if the level is less than or equal to - * the current av_log_level. By default, all logging messages are sent to - * stderr. This behavior can be altered by setting a different av_vlog callback - * function. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param fmt The format string (printf-compatible) that specifies how - * subsequent arguments are converted to output. - * @see av_vlog - */ -#ifdef __GNUC__ -extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -#else -extern void av_log(void*, int level, const char *fmt, ...); -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -extern void av_vlog(void*, int level, const char *fmt, va_list); -extern int av_log_get_level(void); -extern void av_log_set_level(int); -extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); -extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); -#else -extern void (*av_vlog)(void*, int, const char*, va_list); -#endif - -#endif /* LOG_H */ diff --git a/src/ffmpeg/include/ffmpeg/mathematics.h b/src/ffmpeg/include/ffmpeg/mathematics.h deleted file mode 100644 index 0b74b254b9..0000000000 --- a/src/ffmpeg/include/ffmpeg/mathematics.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MATHEMATICS_H -#define MATHEMATICS_H - -#include "rational.h" - -enum AVRounding { - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero -}; - -/** - * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale(int64_t a, int64_t b, int64_t c); - -/** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding); - -/** - * rescale a 64bit integer by 2 rational numbers. - */ -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq); - -#endif /* MATHEMATICS_H */ diff --git a/src/ffmpeg/include/ffmpeg/mem.h b/src/ffmpeg/include/ffmpeg/mem.h deleted file mode 100644 index 4ebdad8f57..0000000000 --- a/src/ffmpeg/include/ffmpeg/mem.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file mem.h - * Memory handling functions. - */ - -#ifndef AV_MEM_H -#define AV_MEM_H - -#ifdef __GNUC__ - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) -#else - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v -#endif - -/** - * Memory allocation of size byte with alignment suitable for all - * memory accesses (including vectors if available on the - * CPU). av_malloc(0) must return a non NULL pointer. - */ -void *av_malloc(unsigned int size); - -/** - * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, - * identical to malloc(size). If size is zero, it is identical to - * free(ptr) and NULL is returned. - */ -void *av_realloc(void *ptr, unsigned int size); - -/** - * Free memory which has been allocated with av_malloc(z)() or av_realloc(). - * NOTE: ptr = NULL is explicetly allowed - * Note2: it is recommended that you use av_freep() instead - */ -void av_free(void *ptr); - -void *av_mallocz(unsigned int size); -char *av_strdup(const char *s); - -/** - * Frees memory and sets the pointer to NULL. - * @param ptr pointer to the pointer which should be freed - */ -void av_freep(void *ptr); - -#endif /* AV_MEM_H */ diff --git a/src/ffmpeg/include/ffmpeg/rational.h b/src/ffmpeg/include/ffmpeg/rational.h deleted file mode 100644 index 23da2e2421..0000000000 --- a/src/ffmpeg/include/ffmpeg/rational.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file rational.h - * Rational numbers. - * @author Michael Niedermayer - */ - -#ifndef RATIONAL_H -#define RATIONAL_H - -/** - * Rational number num/den. - */ -typedef struct AVRational{ - int num; ///< numerator - int den; ///< denominator -} AVRational; - -/** - * Compare two rationals. - * @param a first rational - * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if a>63)|1); - else return 0; -} - -/** - * Rational to double conversion. - * @param a rational to convert - * @return (double) a - */ -static inline double av_q2d(AVRational a){ - return a.num / (double) a.den; -} - -/** - * Reduce a fraction. - * This is useful for framerate calculations. - * @param dst_nom destination numerator - * @param dst_den destination denominator - * @param nom source numerator - * @param den source denominator - * @param max the maximum allowed for dst_nom & dst_den - * @return 1 if exact, 0 otherwise - */ -int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max); - -/** - * Multiplies two rationals. - * @param b first rational. - * @param c second rational. - * @return b*c. - */ -AVRational av_mul_q(AVRational b, AVRational c); - -/** - * Divides one rational by another. - * @param b first rational. - * @param c second rational. - * @return b/c. - */ -AVRational av_div_q(AVRational b, AVRational c); - -/** - * Adds two rationals. - * @param b first rational. - * @param c second rational. - * @return b+c. - */ -AVRational av_add_q(AVRational b, AVRational c); - -/** - * Subtracts one rational from another. - * @param b first rational. - * @param c second rational. - * returns b-c. - */ -AVRational av_sub_q(AVRational b, AVRational c); - -/** - * Converts a double precision floating point number to a rational. - * @param d double to convert - * @param max the maximum allowed numerator and denominator - * @return (AVRational) d. - */ -AVRational av_d2q(double d, int max); - -#endif // RATIONAL_H diff --git a/src/ffmpeg/include/ffmpeg/rtp.h b/src/ffmpeg/include/ffmpeg/rtp.h deleted file mode 100644 index fec7630517..0000000000 --- a/src/ffmpeg/include/ffmpeg/rtp.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * RTP definitions - * Copyright (c) 2002 Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef RTP_H -#define RTP_H - -#define RTP_MIN_PACKET_LENGTH 12 -#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */ - -int rtp_init(void); -int rtp_get_codec_info(AVCodecContext *codec, int payload_type); - -/** return < 0 if unknown payload type */ -int rtp_get_payload_type(AVCodecContext *codec); - -typedef struct RTPDemuxContext RTPDemuxContext; -typedef struct rtp_payload_data_s rtp_payload_data_s; -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data); -int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); -void rtp_parse_close(RTPDemuxContext *s); - -extern AVOutputFormat rtp_muxer; -extern AVInputFormat rtp_demuxer; - -int rtp_get_local_port(URLContext *h); -int rtp_set_remote_url(URLContext *h, const char *uri); -void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd); - -/** - * some rtp servers assume client is dead if they don't hear from them... - * so we send a Receiver Report to the provided ByteIO context - * (we don't have access to the rtcp handle from here) - */ -int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); - -extern URLProtocol rtp_protocol; - -#define RTP_PT_PRIVATE 96 -#define RTP_VERSION 2 -#define RTP_MAX_SDES 256 /**< maximum text length for SDES */ - -/* RTCP paquets use 0.5 % of the bandwidth */ -#define RTCP_TX_RATIO_NUM 5 -#define RTCP_TX_RATIO_DEN 1000 - -/** Structure listing useful vars to parse RTP packet payload*/ -typedef struct rtp_payload_data_s -{ - int sizelength; - int indexlength; - int indexdeltalength; - int profile_level_id; - int streamtype; - int objecttype; - char *mode; - - /** mpeg 4 AU headers */ - struct AUHeaders { - int size; - int index; - int cts_flag; - int cts; - int dts_flag; - int dts; - int rap_flag; - int streamstate; - } *au_headers; - int nb_au_headers; - int au_headers_length_bytes; - int cur_au_index; -} rtp_payload_data_t; - -typedef struct AVRtpPayloadType_s -{ - int pt; - const char enc_name[50]; /* XXX: why 50 ? */ - enum CodecType codec_type; - enum CodecID codec_id; - int clock_rate; - int audio_channels; -} AVRtpPayloadType_t; - -#if 0 -typedef enum { - RTCP_SR = 200, - RTCP_RR = 201, - RTCP_SDES = 202, - RTCP_BYE = 203, - RTCP_APP = 204 -} rtcp_type_t; - -typedef enum { - RTCP_SDES_END = 0, - RTCP_SDES_CNAME = 1, - RTCP_SDES_NAME = 2, - RTCP_SDES_EMAIL = 3, - RTCP_SDES_PHONE = 4, - RTCP_SDES_LOC = 5, - RTCP_SDES_TOOL = 6, - RTCP_SDES_NOTE = 7, - RTCP_SDES_PRIV = 8, - RTCP_SDES_IMG = 9, - RTCP_SDES_DOOR = 10, - RTCP_SDES_SOURCE = 11 -} rtcp_sdes_type_t; -#endif - -extern AVRtpPayloadType_t AVRtpPayloadTypes[]; -#endif /* RTP_H */ diff --git a/src/ffmpeg/include/ffmpeg/rtsp.h b/src/ffmpeg/include/ffmpeg/rtsp.h deleted file mode 100644 index 481e2ba499..0000000000 --- a/src/ffmpeg/include/ffmpeg/rtsp.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RTSP definitions - * Copyright (c) 2002 Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef RTSP_H -#define RTSP_H - -#include "rtspcodes.h" - -enum RTSPProtocol { - RTSP_PROTOCOL_RTP_UDP = 0, - RTSP_PROTOCOL_RTP_TCP = 1, - RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2, -}; - -#define RTSP_DEFAULT_PORT 554 -#define RTSP_MAX_TRANSPORTS 8 -#define RTSP_TCP_MAX_PACKET_SIZE 1472 -#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2 -#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 -#define RTSP_RTP_PORT_MIN 5000 -#define RTSP_RTP_PORT_MAX 10000 - -typedef struct RTSPTransportField { - int interleaved_min, interleaved_max; /**< interleave ids, if TCP transport */ - int port_min, port_max; /**< RTP ports */ - int client_port_min, client_port_max; /**< RTP ports */ - int server_port_min, server_port_max; /**< RTP ports */ - int ttl; /**< ttl value */ - uint32_t destination; /**< destination IP address */ - enum RTSPProtocol protocol; -} RTSPTransportField; - -typedef struct RTSPHeader { - int content_length; - enum RTSPStatusCode status_code; /**< response code from server */ - int nb_transports; - /** in AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ - int64_t range_start, range_end; - RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; - int seq; /**< sequence number */ - char session_id[512]; -} RTSPHeader; - -/** the callback can be used to extend the connection setup/teardown step */ -enum RTSPCallbackAction { - RTSP_ACTION_SERVER_SETUP, - RTSP_ACTION_SERVER_TEARDOWN, - RTSP_ACTION_CLIENT_SETUP, - RTSP_ACTION_CLIENT_TEARDOWN, -}; - -typedef struct RTSPActionServerSetup { - uint32_t ipaddr; - char transport_option[512]; -} RTSPActionServerSetup; - -typedef int FFRTSPCallback(enum RTSPCallbackAction action, - const char *session_id, - char *buf, int buf_size, - void *arg); - -/** useful for modules: set RTSP callback function */ -void rtsp_set_callback(FFRTSPCallback *rtsp_cb); - -int rtsp_init(void); -void rtsp_parse_line(RTSPHeader *reply, const char *buf); - -extern int rtsp_default_protocols; -extern int rtsp_rtp_port_min; -extern int rtsp_rtp_port_max; -extern FFRTSPCallback *ff_rtsp_callback; -extern AVInputFormat rtsp_demuxer; - -int rtsp_pause(AVFormatContext *s); -int rtsp_resume(AVFormatContext *s); - -#endif /* RTSP_H */ diff --git a/src/ffmpeg/include/ffmpeg/rtspcodes.h b/src/ffmpeg/include/ffmpeg/rtspcodes.h deleted file mode 100644 index 74cfb5d5b9..0000000000 --- a/src/ffmpeg/include/ffmpeg/rtspcodes.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RTSP definitions - * copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** RTSP handling */ -enum RTSPStatusCode { -RTSP_STATUS_OK =200, /**< OK */ -RTSP_STATUS_METHOD =405, /**< Method Not Allowed */ -RTSP_STATUS_BANDWIDTH =453, /**< Not Enough Bandwidth */ -RTSP_STATUS_SESSION =454, /**< Session Not Found */ -RTSP_STATUS_STATE =455, /**< Method Not Valid in This State */ -RTSP_STATUS_AGGREGATE =459, /**< Aggregate operation not allowed */ -RTSP_STATUS_ONLY_AGGREGATE =460, /**< Only aggregate operation allowed */ -RTSP_STATUS_TRANSPORT =461, /**< Unsupported transport */ -RTSP_STATUS_INTERNAL =500, /**< Internal Server Error */ -RTSP_STATUS_SERVICE =503, /**< Service Unavailable */ -RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */ -}; - diff --git a/src/ffmpeg/lib/avcodec.lib b/src/ffmpeg/lib/avcodec.lib deleted file mode 100644 index ec51531a81..0000000000 Binary files a/src/ffmpeg/lib/avcodec.lib and /dev/null differ diff --git a/src/ffmpeg/lib/avformat.lib b/src/ffmpeg/lib/avformat.lib deleted file mode 100644 index 7d158c85d0..0000000000 Binary files a/src/ffmpeg/lib/avformat.lib and /dev/null differ diff --git a/src/ffmpeg/lib/avutil.lib b/src/ffmpeg/lib/avutil.lib deleted file mode 100644 index 520a1e183a..0000000000 Binary files a/src/ffmpeg/lib/avutil.lib and /dev/null differ diff --git a/src/ffmpeg/modern_working/include/libavcodec/opt.h b/src/ffmpeg/modern_working/include/libavcodec/opt.h deleted file mode 100644 index cb1d7d78a2..0000000000 --- a/src/ffmpeg/modern_working/include/libavcodec/opt.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * AVOptions - * copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_OPT_H -#define AVCODEC_OPT_H - -/** - * @file libavcodec/opt.h - * AVOptions - */ - -#include "libavutil/rational.h" -#include "avcodec.h" - -enum AVOptionType{ - FF_OPT_TYPE_FLAGS, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - FF_OPT_TYPE_CONST=128, -}; - -/** - * AVOption - */ -typedef struct AVOption { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - double default_val; - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption; - -/** - * AVOption2. - * THIS IS NOT PART OF THE API/ABI YET! - * This is identical to AVOption except that default_val was replaced by - * an union, it should be compatible with AVOption on normal platforms. - */ -typedef struct AVOption2 { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - union { - double dbl; - const char *str; - } default_val; - - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -/* -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -*/ -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption2; - - -/** - * Looks for an option in obj. Looks only for the options which - * have the flags set as specified in mask and flags (that is, - * for which it is the case that opt->flags & mask == flags). - * - * @param[in] obj a pointer to a struct whose first element is a - * pointer to an AVClass - * @param[in] name the name of the option to look for - * @param[in] unit the unit of the option to look for, or any if NULL - * @return a pointer to the option found, or NULL if no option - * has been found - */ -const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @see av_set_string2() - */ -attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); - -/** - * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value val is not - * valid - * @see av_set_string3() - */ -attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); -#endif - -/** - * Sets the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an - * AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. If the field is not of a string - * type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param[out] o_out if non-NULL put here a pointer to the AVOption - * found - * @param alloc when 1 then the old value will be av_freed() and the - * new av_strduped() - * when 0 then no av_free() nor av_strdup() will be used - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR(ENOENT) if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - */ -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); - -const AVOption *av_set_double(void *obj, const char *name, double n); -const AVOption *av_set_q(void *obj, const char *name, AVRational n); -const AVOption *av_set_int(void *obj, const char *name, int64_t n); -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -const AVOption *av_next_option(void *obj, const AVOption *last); -int av_opt_show(void *obj, void *av_log_obj); -void av_opt_set_defaults(void *s); -void av_opt_set_defaults2(void *s, int mask, int flags); - -#endif /* AVCODEC_OPT_H */ diff --git a/src/ffmpeg/modern_working/include/libavformat/avformat.h b/src/ffmpeg/modern_working/include/libavformat/avformat.h deleted file mode 100644 index 507a491104..0000000000 --- a/src/ffmpeg/modern_working/include/libavformat/avformat.h +++ /dev/null @@ -1,1275 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AVFORMAT_H -#define AVFORMAT_AVFORMAT_H - -#define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 41 -#define LIBAVFORMAT_VERSION_MICRO 0 - -#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) - -/** - * Returns the LIBAVFORMAT_VERSION_INT constant. - */ -unsigned avformat_version(void); - -/** - * Returns the libavformat build-time configuration. - */ -const char * avformat_configuration(void); - -/** - * Returns the libavformat license. - */ -const char * avformat_license(void); - -#include -#include /* FILE */ -#include "libavcodec/avcodec.h" - -#include "avio.h" - -struct AVFormatContext; - - -/* - * Public Metadata API. - * The metadata API allows libavformat to export metadata tags to a client - * application using a sequence of key/value pairs. - * Important concepts to keep in mind: - * 1. Keys are unique; there can never be 2 tags with the same key. This is - * also meant semantically, i.e., a demuxer should not knowingly produce - * several keys that are literally different but semantically identical. - * E.g., key=Author5, key=Author6. In this example, all authors must be - * placed in the same tag. - * 2. Metadata is flat, not hierarchical; there are no subtags. If you - * want to store, e.g., the email address of the child of producer Alice - * and actor Bob, that could have key=alice_and_bobs_childs_email_address. - * 3. A tag whose value is localized for a particular language is appended - * with a dash character ('-') and the ISO 639-2/B 3-letter language code. - * For example: Author-ger=Michael, Author-eng=Mike - * The original/default language is in the unqualified "Author" tag. - * A demuxer should set a default if it sets any translated tag. - */ - -#define AV_METADATA_MATCH_CASE 1 -#define AV_METADATA_IGNORE_SUFFIX 2 - -typedef struct { - char *key; - char *value; -}AVMetadataTag; - -typedef struct AVMetadata AVMetadata; -typedef struct AVMetadataConv AVMetadataConv; - -/** - * Gets a metadata element with matching key. - * @param prev Set to the previous matching element to find the next. - * @param flags Allows case as well as suffix-insensitive comparisons. - * @return Found tag or NULL, changing key or value leads to undefined behavior. - */ -AVMetadataTag * -av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags); - -/** - * Sets the given tag in m, overwriting an existing tag. - * @param key tag key to add to m (will be av_strduped) - * @param value tag value to add to m (will be av_strduped) - * @return >= 0 on success otherwise an error code <0 - */ -int av_metadata_set(AVMetadata **pm, const char *key, const char *value); - -/** - * Converts all the metadata sets from ctx according to the source and - * destination conversion tables. - * @param d_conv destination tags format conversion table - * @param s_conv source tags format conversion table - */ -void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); - -/** - * Frees all the memory allocated for an AVMetadata struct. - */ -void av_metadata_free(AVMetadata **m); - - -/* packet functions */ - - -/** - * Allocates and reads the payload of a packet and initializes its - * fields with default values. - * - * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise - */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); - - -/*************************************************/ -/* fractional numbers for exact pts handling */ - -/** - * The exact value of the fractional number is: 'val + num / den'. - * num is assumed to be 0 <= num < den. - */ -typedef struct AVFrac { - int64_t val, num, den; -} AVFrac; - -/*************************************************/ -/* input/output formats */ - -struct AVCodecTag; - -/** This structure contains the data a format has to probe a file. */ -typedef struct AVProbeData { - const char *filename; - unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ - int buf_size; /**< Size of buf except extra allocated bytes */ -} AVProbeData; - -#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection -#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer - -typedef struct AVFormatParameters { - AVRational time_base; - int sample_rate; - int channels; - int width; - int height; - enum PixelFormat pix_fmt; - int channel; /**< Used to select DV channel. */ - const char *standard; /**< TV standard, NTSC, PAL, SECAM */ - unsigned int mpeg2ts_raw:1; /**< Force raw MPEG-2 transport stream output, if possible. */ - unsigned int mpeg2ts_compute_pcr:1; /**< Compute exact PCR for each transport - stream packet (only meaningful if - mpeg2ts_raw is TRUE). */ - unsigned int initial_pause:1; /**< Do not begin to play the stream - immediately (RTSP only). */ - unsigned int prealloced_context:1; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - enum CodecID video_codec_id; - enum CodecID audio_codec_id; -#endif -} AVFormatParameters; - -//! Demuxer will use url_fopen, no opened file should be provided by the caller. -#define AVFMT_NOFILE 0x0001 -#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ -#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ -#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for - raw picture data. */ -#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ -#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ -#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ -#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. */ -#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ - -typedef struct AVOutputFormat { - const char *name; - /** - * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro - * to define it. - */ - const char *long_name; - const char *mime_type; - const char *extensions; /**< comma-separated filename extensions */ - /** size of private data so that it can be allocated in the wrapper */ - int priv_data_size; - /* output support */ - enum CodecID audio_codec; /**< default audio codec */ - enum CodecID video_codec; /**< default video codec */ - int (*write_header)(struct AVFormatContext *); - int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); - int (*write_trailer)(struct AVFormatContext *); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ - int flags; - /** Currently only used to set pixel format if not YUV420P. */ - int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); - int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, - AVPacket *in, int flush); - - /** - * List of supported codec_id-codec_tag pairs, ordered by "better - * choice first". The arrays are all terminated by CODEC_ID_NONE. - */ - const struct AVCodecTag * const *codec_tag; - - enum CodecID subtitle_codec; /**< default subtitle codec */ - - const AVMetadataConv *metadata_conv; - - /* private fields */ - struct AVOutputFormat *next; -} AVOutputFormat; - -typedef struct AVInputFormat { - const char *name; - /** - * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro - * to define it. - */ - const char *long_name; - /** Size of private data so that it can be allocated in the wrapper. */ - int priv_data_size; - /** - * Tell if a given file has a chance of being parsed as this format. - * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes - * big so you do not have to check for that unless you need more. - */ - int (*read_probe)(AVProbeData *); - /** Read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non-NULL contains - additional parameters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. */ - int (*read_header)(struct AVFormatContext *, - AVFormatParameters *ap); - /** Read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. - @return 0 on success, < 0 on error. - When returning an error, pkt must not have been allocated - or must be freed before returning */ - int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); - /** Close the stream. The AVFormatContext and AVStreams are not - freed by this function */ - int (*read_close)(struct AVFormatContext *); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 - /** - * Seek to a given timestamp relative to the frames in - * stream component stream_index. - * @param stream_index Must not be -1. - * @param flags Selects which direction should be preferred if no exact - * match is available. - * @return >= 0 on success (but not necessarily the new offset) - */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); -#endif - /** - * Gets the next timestamp in stream[stream_index].time_base units. - * @return the timestamp or AV_NOPTS_VALUE if an error occurred - */ - int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, - int64_t *pos, int64_t pos_limit); - /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */ - int flags; - /** If extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough */ - const char *extensions; - /** General purpose read-only value that the format can use. */ - int value; - - /** Starts/resumes playing - only meaningful if using a network-based format - (RTSP). */ - int (*read_play)(struct AVFormatContext *); - - /** Pauses playing - only meaningful if using a network-based format - (RTSP). */ - int (*read_pause)(struct AVFormatContext *); - - const struct AVCodecTag * const *codec_tag; - - /** - * Seeks to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - */ - int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); - - const AVMetadataConv *metadata_conv; - - /* private fields */ - struct AVInputFormat *next; -} AVInputFormat; - -enum AVStreamParseType { - AVSTREAM_PARSE_NONE, - AVSTREAM_PARSE_FULL, /**< full parsing and repack */ - AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ - AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ -}; - -typedef struct AVIndexEntry { - int64_t pos; - int64_t timestamp; -#define AVINDEX_KEYFRAME 0x0001 - int flags:2; - int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). - int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ -} AVIndexEntry; - -#define AV_DISPOSITION_DEFAULT 0x0001 -#define AV_DISPOSITION_DUB 0x0002 -#define AV_DISPOSITION_ORIGINAL 0x0004 -#define AV_DISPOSITION_COMMENT 0x0008 -#define AV_DISPOSITION_LYRICS 0x0010 -#define AV_DISPOSITION_KARAOKE 0x0020 - -/** - * Stream structure. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVStream) must not be used outside libav*. - */ -typedef struct AVStream { - int index; /**< stream index in AVFormatContext */ - int id; /**< format-specific stream ID */ - AVCodecContext *codec; /**< codec context */ - /** - * Real base framerate of the stream. - * This is the lowest framerate with which all timestamps can be - * represented accurately (it is the least common multiple of all - * framerates in the stream). Note, this value is just a guess! - * For example, if the time base is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. - */ - AVRational r_frame_rate; - void *priv_data; - - /* internal data used in av_find_stream_info() */ - int64_t first_dts; - /** encoding: pts generation when outputting stream */ - struct AVFrac pts; - - /** - * This is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. For fixed-fps content, - * time base should be 1/framerate and timestamp increments should be 1. - */ - AVRational time_base; - int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ - /* ffmpeg.c private use */ - int stream_copy; /**< If set, just copy stream. */ - enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. - //FIXME move stuff to a flags field? - /** Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. - * MN: dunno if that is the right place for it */ - float quality; - /** - * Decoding: pts of the first frame of the stream, in stream time base. - * Only set this if you are absolutely 100% sure that the value you set - * it to really is the pts of the first frame. - * This may be undefined (AV_NOPTS_VALUE). - * @note The ASF header does NOT contain a correct start_time the ASF - * demuxer must NOT set this. - */ - int64_t start_time; - /** - * Decoding: duration of the stream, in stream time base. - * If a source file does not specify a duration, but does specify - * a bitrate, this value will be estimated from bitrate and file size. - */ - int64_t duration; - -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */ -#endif - - /* av_read_frame() support */ - enum AVStreamParseType need_parsing; - struct AVCodecParserContext *parser; - - int64_t cur_dts; - int last_IP_duration; - int64_t last_IP_pts; - /* av_seek_frame() support */ - AVIndexEntry *index_entries; /**< Only used if the format does not - support seeking natively. */ - int nb_index_entries; - unsigned int index_entries_allocated_size; - - int64_t nb_frames; ///< number of frames in this stream if known or 0 - -#if LIBAVFORMAT_VERSION_INT < (53<<16) - int64_t unused[4+1]; - - char *filename; /**< source filename of the stream */ -#endif - - int disposition; /**< AV_DISPOSITION_* bit field */ - - AVProbeData probe_data; -#define MAX_REORDER_DELAY 16 - int64_t pts_buffer[MAX_REORDER_DELAY+1]; - - /** - * sample aspect ratio (0 if unknown) - * - encoding: Set by user. - * - decoding: Set by libavformat. - */ - AVRational sample_aspect_ratio; - - AVMetadata *metadata; - - /* av_read_frame() support */ - const uint8_t *cur_ptr; - int cur_len; - AVPacket cur_pkt; - - // Timestamp generation support: - /** - * Timestamp corresponding to the last dts sync point. - * - * Initialized when AVCodecParserContext.dts_sync_point >= 0 and - * a DTS is received from the underlying container. Otherwise set to - * AV_NOPTS_VALUE by default. - */ - int64_t reference_dts; - - /** - * Number of packets to buffer for codec probing - * NOT PART OF PUBLIC API - */ -#define MAX_PROBE_PACKETS 2500 - int probe_packets; - - /** - * last packet in packet_buffer for this stream when muxing. - * used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav* - */ - struct AVPacketList *last_in_packet_buffer; -} AVStream; - -#define AV_PROGRAM_RUNNING 1 - -/** - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVProgram) must not be used outside libav*. - */ -typedef struct AVProgram { - int id; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *provider_name; ///< network name for DVB streams - char *name; ///< service name for DVB streams -#endif - int flags; - enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller - unsigned int *stream_index; - unsigned int nb_stream_indexes; - AVMetadata *metadata; -} AVProgram; - -#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present - (streams are added dynamically) */ - -typedef struct AVChapter { - int id; ///< unique ID to identify the chapter - AVRational time_base; ///< time base in which the start/end timestamps are specified - int64_t start, end; ///< chapter start/end time in time_base units -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *title; ///< chapter title -#endif - AVMetadata *metadata; -} AVChapter; - -#define MAX_STREAMS 20 - -/** - * Format I/O context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVFormatContext) must not be used outside libav*. - */ -typedef struct AVFormatContext { - const AVClass *av_class; /**< Set by avformat_alloc_context. */ - /* Can only be iformat or oformat, not both at the same time. */ - struct AVInputFormat *iformat; - struct AVOutputFormat *oformat; - void *priv_data; - ByteIOContext *pb; - unsigned int nb_streams; - AVStream *streams[MAX_STREAMS]; - char filename[1024]; /**< input or output filename */ - /* stream info */ - int64_t timestamp; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char title[512]; - char author[512]; - char copyright[512]; - char comment[512]; - char album[512]; - int year; /**< ID3 year, 0 if none */ - int track; /**< track number, 0 if none */ - char genre[32]; /**< ID3 genre */ -#endif - - int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ - /* private data for pts handling (do not modify directly). */ - /** This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in MPEG - streams. */ - struct AVPacketList *packet_buffer; - - /** Decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - It is deduced from the AVStream values. */ - int64_t start_time; - /** Decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. */ - int64_t duration; - /** decoding: total file size, 0 if unknown */ - int64_t file_size; - /** Decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as FFmpeg can compute it automatically. */ - int bit_rate; - - /* av_read_frame() support */ - AVStream *cur_st; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - const uint8_t *cur_ptr_deprecated; - int cur_len_deprecated; - AVPacket cur_pkt_deprecated; -#endif - - /* av_seek_frame() support */ - int64_t data_offset; /** offset of the first packet */ - int index_built; - - int mux_rate; - unsigned int packet_size; - int preload; - int max_delay; - -#define AVFMT_NOOUTPUTLOOP -1 -#define AVFMT_INFINITEOUTPUTLOOP 0 - /** number of times to loop output in formats that support it */ - int loop_output; - - int flags; -#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. -#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. -#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. - - int loop_input; - /** decoding: size of data to probe; encoding: unused. */ - unsigned int probesize; - - /** - * Maximum time (in AV_TIME_BASE units) during which the input should - * be analyzed in av_find_stream_info(). - */ - int max_analyze_duration; - - const uint8_t *key; - int keylen; - - unsigned int nb_programs; - AVProgram **programs; - - /** - * Forced video codec_id. - * Demuxing: Set by user. - */ - enum CodecID video_codec_id; - /** - * Forced audio codec_id. - * Demuxing: Set by user. - */ - enum CodecID audio_codec_id; - /** - * Forced subtitle codec_id. - * Demuxing: Set by user. - */ - enum CodecID subtitle_codec_id; - - /** - * Maximum amount of memory in bytes to use for the index of each stream. - * If the index exceeds this size, entries will be discarded as - * needed to maintain a smaller size. This can lead to slower or less - * accurate seeking (depends on demuxer). - * Demuxers for which a full in-memory index is mandatory will ignore - * this. - * muxing : unused - * demuxing: set by user - */ - unsigned int max_index_size; - - /** - * Maximum amount of memory in bytes to use for buffering frames - * obtained from realtime capture devices. - */ - unsigned int max_picture_buffer; - - unsigned int nb_chapters; - AVChapter **chapters; - - /** - * Flags to enable debugging. - */ - int debug; -#define FF_FDEBUG_TS 0x0001 - - /** - * Raw packets from the demuxer, prior to parsing and decoding. - * This buffer is used for buffering packets until the codec can - * be identified, as parsing cannot be done without knowing the - * codec. - */ - struct AVPacketList *raw_packet_buffer; - struct AVPacketList *raw_packet_buffer_end; - - struct AVPacketList *packet_buffer_end; - - AVMetadata *metadata; - - /** - * Remaining size available for raw_packet_buffer, in bytes. - * NOT PART OF PUBLIC API - */ -#define RAW_PACKET_BUFFER_SIZE 2500000 - int raw_packet_buffer_remaining_size; -} AVFormatContext; - -typedef struct AVPacketList { - AVPacket pkt; - struct AVPacketList *next; -} AVPacketList; - -#if LIBAVFORMAT_VERSION_INT < (53<<16) -extern AVInputFormat *first_iformat; -extern AVOutputFormat *first_oformat; -#endif - -/** - * If f is NULL, returns the first registered input format, - * if f is non-NULL, returns the next registered input format after f - * or NULL if f is the last one. - */ -AVInputFormat *av_iformat_next(AVInputFormat *f); - -/** - * If f is NULL, returns the first registered output format, - * if f is non-NULL, returns the next registered output format after f - * or NULL if f is the last one. - */ -AVOutputFormat *av_oformat_next(AVOutputFormat *f); - -enum CodecID av_guess_image2_codec(const char *filename); - -/* XXX: Use automatic init with either ELF sections or C file parser */ -/* modules. */ - -/* utils.c */ -void av_register_input_format(AVInputFormat *format); -void av_register_output_format(AVOutputFormat *format); -AVOutputFormat *guess_stream_format(const char *short_name, - const char *filename, - const char *mime_type); -AVOutputFormat *guess_format(const char *short_name, - const char *filename, - const char *mime_type); - -/** - * Guesses the codec ID based upon muxer and filename. - */ -enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, - enum CodecType type); - -/** - * Sends a nice hexadecimal dump of a buffer to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump(FILE *f, uint8_t *buf, int size); - -/** - * Sends a nice hexadecimal dump of a buffer to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); - -/** - * Sends a nice dump of a packet to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); - -/** - * Sends a nice dump of a packet to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); - -/** - * Initializes libavformat and registers all the muxers, demuxers and - * protocols. If you do not call this function, then you can select - * exactly which formats you want to support. - * - * @see av_register_input_format() - * @see av_register_output_format() - * @see av_register_protocol() - */ -void av_register_all(void); - -/** codec tag <-> codec id */ -enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); -unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); - -/* media file input */ - -/** - * Finds AVInputFormat based on the short name of the input format. - */ -AVInputFormat *av_find_input_format(const char *short_name); - -/** - * Guesses the file format. - * - * @param is_opened Whether the file is already opened; determines whether - * demuxers with or without AVFMT_NOFILE are probed. - */ -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); - -/** - * Allocates all the structures needed to read an input stream. - * This does not open the needed codecs for decoding the stream[s]. - */ -int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, - AVInputFormat *fmt, AVFormatParameters *ap); - -/** - * Opens a media file as input. The codecs are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr The opened media file handle is put here. - * @param filename filename to open - * @param fmt If non-NULL, force the file format to use. - * @param buf_size optional buffer size (zero if default is OK) - * @param ap Additional parameters needed when opening the file - * (NULL if default). - * @return 0 if OK, AVERROR_xxx otherwise - */ -int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, - AVInputFormat *fmt, - int buf_size, - AVFormatParameters *ap); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** - * @deprecated Use avformat_alloc_context() instead. - */ -attribute_deprecated AVFormatContext *av_alloc_format_context(void); -#endif - -/** - * Allocates an AVFormatContext. - * Can be freed with av_free() but do not forget to free everything you - * explicitly allocated as well! - */ -AVFormatContext *avformat_alloc_context(void); - -/** - * Reads packets of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also computes the real framerate in case of MPEG-2 repeat - * frame mode. - * The logical file position is not changed by this function; - * examined packets may be buffered for later processing. - * - * @param ic media file handle - * @return >=0 if OK, AVERROR_xxx on error - * @todo Let the user decide somehow what information is needed so that - * we do not waste time getting stuff the user does not need. - */ -int av_find_stream_info(AVFormatContext *ic); - -/** - * Reads a transport packet from a media file. - * - * This function is obsolete and should never be used. - * Use av_read_frame() instead. - * - * @param s media file handle - * @param pkt is filled - * @return 0 if OK, AVERROR_xxx on error - */ -int av_read_packet(AVFormatContext *s, AVPacket *pkt); - -/** - * Returns the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.time_base units (and guessed if the format cannot - * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B-frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 on error or end of file - */ -int av_read_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Seeks to the keyframe at timestamp. - * 'timestamp' in 'stream_index'. - * @param stream_index If stream_index is (-1), a default - * stream is selected, and timestamp is automatically converted - * from AV_TIME_BASE units to the stream specific time_base. - * @param timestamp Timestamp in AVStream.time_base units - * or, if no stream is specified, in AV_TIME_BASE units. - * @param flags flags which select direction and seeking mode - * @return >= 0 on success - */ -int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, - int flags); - -/** - * Seeks to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - * - * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and - * are the file position (this may not be supported by all demuxers). - * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames - * in the stream with stream_index (this may not be supported by all demuxers). - * Otherwise all timestamps are in units of the stream selected by stream_index - * or if stream_index is -1, in AV_TIME_BASE units. - * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as - * keyframes (this may not be supported by all demuxers). - * - * @param stream_index index of the stream which is used as time base reference - * @param min_ts smallest acceptable timestamp - * @param ts target timestamp - * @param max_ts largest acceptable timestamp - * @param flags flags - * @returns >=0 on success, error code otherwise - * - * @NOTE This is part of the new seek API which is still under construction. - * Thus do not use this yet. It may change at any time, do not expect - * ABI compatibility yet! - */ -int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); - -/** - * Starts playing a network-based stream (e.g. RTSP stream) at the - * current position. - */ -int av_read_play(AVFormatContext *s); - -/** - * Pauses a network-based stream (e.g. RTSP stream). - * - * Use av_read_play() to resume it. - */ -int av_read_pause(AVFormatContext *s); - -/** - * Frees a AVFormatContext allocated by av_open_input_stream. - * @param s context to free - */ -void av_close_input_stream(AVFormatContext *s); - -/** - * Closes a media file (but not its codecs). - * - * @param s media file handle - */ -void av_close_input_file(AVFormatContext *s); - -/** - * Adds a new stream to a media file. - * - * Can only be called in the read_header() function. If the flag - * AVFMTCTX_NOHEADER is in the format context, then new streams - * can be added in read_packet too. - * - * @param s media file handle - * @param id file-format-dependent stream ID - */ -AVStream *av_new_stream(AVFormatContext *s, int id); -AVProgram *av_new_program(AVFormatContext *s, int id); - -/** - * Adds a new chapter. - * This function is NOT part of the public API - * and should ONLY be used by demuxers. - * - * @param s media file handle - * @param id unique ID for this chapter - * @param start chapter start time in time_base units - * @param end chapter end time in time_base units - * @param title chapter title - * - * @return AVChapter or NULL on error - */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); - -/** - * Sets the pts for a given stream. - * - * @param s stream - * @param pts_wrap_bits number of bits effectively used by the pts - * (used for wrap control, 33 is the value for MPEG) - * @param pts_num numerator to convert to seconds (MPEG: 1) - * @param pts_den denominator to convert to seconds (MPEG: 90000) - */ -void av_set_pts_info(AVStream *s, int pts_wrap_bits, - unsigned int pts_num, unsigned int pts_den); - -#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward -#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes -#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes -#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number - -int av_find_default_stream_index(AVFormatContext *s); - -/** - * Gets the index for a specific timestamp. - * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond - * to the timestamp which is <= the requested one, if backward - * is 0, then it will be >= - * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise - * @return < 0 if no such timestamp could be found - */ -int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); - -/** - * Ensures the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows - * too large. - * This function is not part of the public API and should only be called - * by demuxers. - */ -void ff_reduce_index(AVFormatContext *s, int stream_index); - -/** - * Adds an index entry into a sorted list. Updates the entry if the list - * already contains it. - * - * @param timestamp timestamp in the time base of the given stream - */ -int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, - int size, int distance, int flags); - -/** - * Does a binary search using av_index_search_timestamp() and - * AVCodec.read_timestamp(). - * This is not supposed to be called directly by a user application, - * but by demuxers. - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int av_seek_frame_binary(AVFormatContext *s, int stream_index, - int64_t target_ts, int flags); - -/** - * Updates cur_dts of all streams based on the given timestamp and AVStream. - * - * Stream ref_st unchanged, others set cur_dts in their native time base. - * Only needed for timestamp wrapping or if (dts not set and pts!=dts). - * @param timestamp new dts expressed in time_base of param ref_st - * @param ref_st reference stream giving time_base of param timestamp - */ -void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); - -/** - * Does a binary search using read_timestamp(). - * This is not supposed to be called directly by a user application, - * but by demuxers. - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int64_t av_gen_search(AVFormatContext *s, int stream_index, - int64_t target_ts, int64_t pos_min, - int64_t pos_max, int64_t pos_limit, - int64_t ts_min, int64_t ts_max, - int flags, int64_t *ts_ret, - int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); - -/** media file output */ -int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); - -/** - * Allocates the stream private data and writes the stream header to an - * output media file. - * - * @param s media file handle - * @return 0 if OK, AVERROR_xxx on error - */ -int av_write_header(AVFormatContext *s); - -/** - * Writes a packet to an output media file. - * - * The packet shall contain one audio or video frame. - * The packet must be correctly interleaved according to the container - * specification, if not then av_interleaved_write_frame must be used. - * - * @param s media file handle - * @param pkt The packet, which contains the stream_index, buf/buf_size, - dts/pts, ... - * @return < 0 on error, = 0 if OK, 1 if end of stream wanted - */ -int av_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Writes a packet to an output media file ensuring correct interleaving. - * - * The packet must contain one audio or video frame. - * If the packets are already correctly interleaved, the application should - * call av_write_frame() instead as it is slightly faster. It is also important - * to keep in mind that completely non-interleaved input will need huge amounts - * of memory to interleave with this, so it is preferable to interleave at the - * demuxer level. - * - * @param s media file handle - * @param pkt The packet, which contains the stream_index, buf/buf_size, - dts/pts, ... - * @return < 0 on error, = 0 if OK, 1 if end of stream wanted - */ -int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Interleaves a packet per dts in an output media file. - * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it. Note that calling av_free_packet() - * on them is still safe. - * - * @param s media file handle - * @param out the interleaved packet will be output here - * @param in the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occurred - */ -int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, - AVPacket *pkt, int flush); - -/** - * Writes the stream trailer to an output media file and frees the - * file private data. - * - * May only be called after a successful call to av_write_header. - * - * @param s media file handle - * @return 0 if OK, AVERROR_xxx on error - */ -int av_write_trailer(AVFormatContext *s); - -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** - * Parses width and height out of string str. - * @deprecated Use av_parse_video_frame_size instead. - */ -attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, - const char *str); - -/** - * Converts framerate from a string to a fraction. - * @deprecated Use av_parse_video_frame_rate instead. - */ -attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, - const char *arg); -#endif - -/** - * Parses datestr and returns a corresponding number of microseconds. - * @param datestr String representing a date or a duration. - * - If a date the syntax is: - * @code - * [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]} - * @endcode - * Time is local time unless Z is appended, in which case it is - * interpreted as UTC. - * If the year-month-day part is not specified it takes the current - * year-month-day. - * Returns the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if datestr cannot be - * successfully parsed. - * - If a duration the syntax is: - * @code - * [-]HH[:MM[:SS[.m...]]] - * [-]S+[.m...] - * @endcode - * Returns the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if datestr cannot be - * successfully parsed. - * @param duration Flag which tells how to interpret datestr, if - * not zero datestr is interpreted as a duration, otherwise as a - * date. - */ -int64_t parse_date(const char *datestr, int duration); - -/** Gets the current time in microseconds. */ -int64_t av_gettime(void); - -/* ffm-specific for ffserver */ -#define FFM_PACKET_SIZE 4096 -int64_t ffm_read_write_index(int fd); -int ffm_write_write_index(int fd, int64_t pos); -void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); - -/** - * Attempts to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. - */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); - -/** - * Returns in 'buf' the path with '%d' replaced by a number. - * - * Also handles the '%0nd' format where 'n' is the total number - * of digits and '%%'. - * - * @param buf destination buffer - * @param buf_size destination buffer size - * @param path numbered sequence string - * @param number frame number - * @return 0 if OK, -1 on format error - */ -int av_get_frame_filename(char *buf, int buf_size, - const char *path, int number); - -/** - * Checks whether filename actually is a numbered sequence generator. - * - * @param filename possible numbered sequence string - * @return 1 if a valid numbered sequence string, 0 otherwise - */ -int av_filename_number_test(const char *filename); - -/** - * Generates an SDP for an RTP session. - * - * @param ac array of AVFormatContexts describing the RTP streams. If the - * array is composed by only one context, such context can contain - * multiple AVStreams (one AVStream per RTP stream). Otherwise, - * all the contexts in the array (an AVCodecContext per RTP stream) - * must contain only one AVStream. - * @param n_files number of AVCodecContexts contained in ac - * @param buff buffer where the SDP will be stored (must be allocated by - * the caller) - * @param size the size of the buffer - * @return 0 if OK, AVERROR_xxx on error - */ -int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); - -#ifdef HAVE_AV_CONFIG_H - -void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); - -#ifdef __GNUC__ -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - __typeof__(tab) _tab = (tab);\ - __typeof__(elem) _elem = (elem);\ - (void)sizeof(**_tab == _elem); /* check that types are compatible */\ - ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\ -} while(0) -#else -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\ -} while(0) -#endif - -time_t mktimegm(struct tm *tm); -struct tm *brktimegm(time_t secs, struct tm *tm); -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt); - -struct in_addr; -int resolve_host(struct in_addr *sin_addr, const char *hostname); - -void url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); - -/** - * Returns a positive value if the given filename has one of the given - * extensions, 0 otherwise. - * - * @param extensions a comma-separated list of filename extensions - */ -int match_ext(const char *filename, const char *extensions); - -#endif /* HAVE_AV_CONFIG_H */ - -#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/src/ffmpeg/modern_working/include/libavformat/avio.h b/src/ffmpeg/modern_working/include/libavformat/avio.h deleted file mode 100644 index 5aa24ca0a7..0000000000 --- a/src/ffmpeg/modern_working/include/libavformat/avio.h +++ /dev/null @@ -1,407 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVFORMAT_AVIO_H -#define AVFORMAT_AVIO_H - -/** - * @file libavformat/avio.h - * unbuffered I/O operations - * - * @warning This file has to be considered an internal but installed - * header, so it should not be directly included in your projects. - */ - -#include - -#include "libavutil/common.h" - -/* unbuffered I/O */ - -/** - * URL Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(URLContext) must not be used outside libav*. - */ -typedef struct URLContext { -#if LIBAVFORMAT_VERSION_MAJOR >= 53 - const AVClass *av_class; ///< information for av_log(). Set by url_open(). -#endif - struct URLProtocol *prot; - int flags; - int is_streamed; /**< true if streamed (no seek possible), default = false */ - int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ - void *priv_data; - char *filename; /**< specified filename */ -} URLContext; - -typedef struct URLPollEntry { - URLContext *handle; - int events; - int revents; -} URLPollEntry; - -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 - -typedef int URLInterruptCB(void); - -int url_open_protocol (URLContext **puc, struct URLProtocol *up, - const char *filename, int flags); -int url_open(URLContext **h, const char *filename, int flags); -int url_read(URLContext *h, unsigned char *buf, int size); -int url_read_complete(URLContext *h, unsigned char *buf, int size); -int url_write(URLContext *h, unsigned char *buf, int size); -int64_t url_seek(URLContext *h, int64_t pos, int whence); -int url_close(URLContext *h); -int url_exist(const char *filename); -int64_t url_filesize(URLContext *h); - -/** - * Return the file descriptor associated with this URL. For RTP, this - * will return only the RTP file descriptor, not the RTCP file descriptor. - * To get both, use rtp_get_file_handles(). - * - * @return the file descriptor associated with this URL, or <0 on error. - */ -int url_get_file_handle(URLContext *h); - -/** - * Return the maximum packet size associated to packetized file - * handle. If the file is not packetized (stream like HTTP or file on - * disk), then 0 is returned. - * - * @param h file handle - * @return maximum packet size in bytes - */ -int url_get_max_packet_size(URLContext *h); -void url_get_filename(URLContext *h, char *buf, int buf_size); - -/** - * The callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned - * in this case by the interrupted function. 'NULL' means no interrupt - * callback is given. - */ -void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); - -/* not implemented */ -int url_poll(URLPollEntry *poll_table, int n, int timeout); - -/** - * Pause and resume playing - only meaningful if using a network streaming - * protocol (e.g. MMS). - * @param pause 1 for pause, 0 for resume - */ -int av_url_read_pause(URLContext *h, int pause); - -/** - * Seek to a given timestamp relative to some component stream. - * Only meaningful if using a network streaming protocol (e.g. MMS.). - * @param stream_index The stream index that the timestamp is relative to. - * If stream_index is (-1) the timestamp should be in AV_TIME_BASE - * units from the beginning of the presentation. - * If a stream_index >= 0 is used and the protocol does not support - * seeking based on component streams, the call will fail with ENOTSUP. - * @param timestamp timestamp in AVStream.time_base units - * or if there is no stream specified then in AV_TIME_BASE units. - * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE - * and AVSEEK_FLAG_ANY. The protocol may silently ignore - * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will - * fail with ENOTSUP if used and not supported. - * @return >= 0 on success - * @see AVInputFormat::read_seek - */ -int64_t av_url_read_seek(URLContext *h, int stream_index, - int64_t timestamp, int flags); - -/** - * Passing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere. Supporting this is optional. - * If it is not supported then the seek function will return <0. - */ -#define AVSEEK_SIZE 0x10000 - -typedef struct URLProtocol { - const char *name; - int (*url_open)(URLContext *h, const char *filename, int flags); - int (*url_read)(URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, unsigned char *buf, int size); - int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; - int (*url_read_pause)(URLContext *h, int pause); - int64_t (*url_read_seek)(URLContext *h, int stream_index, - int64_t timestamp, int flags); - int (*url_get_file_handle)(URLContext *h); -} URLProtocol; - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -extern URLProtocol *first_protocol; -#endif - -extern URLInterruptCB *url_interrupt_cb; - -/** - * If protocol is NULL, returns the first registered protocol, - * if protocol is non-NULL, returns the next registered protocol after protocol, - * or NULL if protocol is the last one. - */ -URLProtocol *av_protocol_next(URLProtocol *p); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** - * @deprecated Use av_register_protocol() instead. - */ -attribute_deprecated int register_protocol(URLProtocol *protocol); -#endif - -int av_register_protocol(URLProtocol *protocol); - -/** - * Bytestream IO Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(ByteIOContext) must not be used outside libav*. - */ -typedef struct { - unsigned char *buffer; - int buffer_size; - unsigned char *buf_ptr, *buf_end; - void *opaque; - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - int64_t (*seek)(void *opaque, int64_t offset, int whence); - int64_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ - int is_streamed; - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; ///< contains the error code or 0 if no error happened - int (*read_pause)(void *opaque, int pause); - int64_t (*read_seek)(void *opaque, int stream_index, - int64_t timestamp, int flags); -} ByteIOContext; - -int init_put_byte(ByteIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); -ByteIOContext *av_alloc_put_byte( - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); - -void put_byte(ByteIOContext *s, int b); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); - -void put_strz(ByteIOContext *s, const char *buf); - -/** - * fseek() equivalent for ByteIOContext. - * @return new position or AVERROR. - */ -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); - -/** - * Skip given number of bytes forward. - * @param offset number of bytes - */ -void url_fskip(ByteIOContext *s, int64_t offset); - -/** - * ftell() equivalent for ByteIOContext. - * @return position or AVERROR. - */ -int64_t url_ftell(ByteIOContext *s); - -/** - * Gets the filesize. - * @return filesize or AVERROR - */ -int64_t url_fsize(ByteIOContext *s); - -/** - * feof() equivalent for ByteIOContext. - * @return non zero if and only if end of file - */ -int url_feof(ByteIOContext *s); - -int url_ferror(ByteIOContext *s); - -int av_url_read_fpause(ByteIOContext *h, int pause); -int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, - int64_t timestamp, int flags); - -#define URL_EOF (-1) -/** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); - -/** @warning currently size is limited */ -#ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -#else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); -#endif - -/** @note unlike fgets, the EOL character is not returned and a whole - line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); - -void put_flush_packet(ByteIOContext *s); - - -/** - * Reads size bytes from ByteIOContext into buf. - * @returns number of bytes read or AVERROR - */ -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** - * Reads size bytes from ByteIOContext into buf. - * This reads at most 1 packet. If that is not enough fewer bytes will be - * returned. - * @returns number of bytes read or AVERROR - */ -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** @note return 0 if EOF, so you cannot use it if EOF handling is - necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); - -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); - -uint64_t ff_get_v(ByteIOContext *bc); - -static inline int url_is_streamed(ByteIOContext *s) -{ - return s->is_streamed; -} - -/** @note when opened as read/write, the buffers are only used for - writing */ -int url_fdopen(ByteIOContext **s, URLContext *h); - -/** @warning must be called before any I/O */ -int url_setbufsize(ByteIOContext *s, int buf_size); -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** Reset the buffer for reading or writing. - * @note Will drop any data currently in the buffer without transmitting it. - * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY - * to set up the buffer for writing. */ -int url_resetbuf(ByteIOContext *s, int flags); -#endif - -/** @note when opened as read/write, the buffers are only used for - writing */ -int url_fopen(ByteIOContext **s, const char *filename, int flags); -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); - -/** - * Return the maximum packet size associated to packetized buffered file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param s buffered file handle - * @return maximum packet size in bytes - */ -int url_fget_max_packet_size(ByteIOContext *s); - -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); - -/** return the written or read size */ -int url_close_buf(ByteIOContext *s); - -/** - * Open a write only memory stream. - * - * @param s new IO context - * @return zero if no error. - */ -int url_open_dyn_buf(ByteIOContext **s); - -/** - * Open a write only packetized memory stream with a maximum packet - * size of 'max_packet_size'. The stream is stored in a memory buffer - * with a big endian 4 byte header giving the packet size in bytes. - * - * @param s new IO context - * @param max_packet_size maximum packet size (must be > 0) - * @return zero if no error. - */ -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); - -/** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * @param s IO context - * @param pbuffer pointer to a byte buffer - * @return the length of the byte buffer - */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); - -unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, - unsigned int len); -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, - unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), - unsigned long checksum); - -/* udp.c */ -int udp_set_remote_url(URLContext *h, const char *uri); -int udp_get_local_port(URLContext *h); -#if (LIBAVFORMAT_VERSION_MAJOR <= 52) -int udp_get_file_handle(URLContext *h); -#endif - -#endif /* AVFORMAT_AVIO_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/avstring.h b/src/ffmpeg/modern_working/include/libavutil/avstring.h deleted file mode 100644 index d716c3a282..0000000000 --- a/src/ffmpeg/modern_working/include/libavutil/avstring.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2007 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AVSTRING_H -#define AVUTIL_AVSTRING_H - -#include - -/** - * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to - * the address of the first character in str after the prefix. - * - * @param str input string - * @param pfx prefix to test - * @param ptr updated if the prefix is matched inside str - * @return non-zero if the prefix matches, zero otherwise - */ -int av_strstart(const char *str, const char *pfx, const char **ptr); - -/** - * Return non-zero if pfx is a prefix of str independent of case. If - * it is, *ptr is set to the address of the first character in str - * after the prefix. - * - * @param str input string - * @param pfx prefix to test - * @param ptr updated if the prefix is matched inside str - * @return non-zero if the prefix matches, zero otherwise - */ -int av_stristart(const char *str, const char *pfx, const char **ptr); - -/** - * Copy the string src to dst, but no more than size - 1 bytes, and - * null-terminate dst. - * - * This function is the same as BSD strlcpy(). - * - * @param dst destination buffer - * @param src source string - * @param size size of destination buffer - * @return the length of src - * - * WARNING: since the return value is the length of src, src absolutely - * _must_ be a properly 0-terminated string, otherwise this will read beyond - * the end of the buffer and possibly crash. - */ -size_t av_strlcpy(char *dst, const char *src, size_t size); - -/** - * Append the string src to the string dst, but to a total length of - * no more than size - 1 bytes, and null-terminate dst. - * - * This function is similar to BSD strlcat(), but differs when - * size <= strlen(dst). - * - * @param dst destination buffer - * @param src source string - * @param size size of destination buffer - * @return the total length of src and dst - * - * WARNING: since the return value use the length of src and dst, these absolutely - * _must_ be a properly 0-terminated strings, otherwise this will read beyond - * the end of the buffer and possibly crash. - */ -size_t av_strlcat(char *dst, const char *src, size_t size); - -/** - * Append output to a string, according to a format. Never write out of - * the destination buffer, and and always put a terminating 0 within - * the buffer. - * @param dst destination buffer (string to which the output is - * appended) - * @param size total size of the destination buffer - * @param fmt printf-compatible format string, specifying how the - * following parameters are used - * @return the length of the string that would have been generated - * if enough space had been available - */ -size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...); - -#endif /* AVUTIL_AVSTRING_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/avutil.h b/src/ffmpeg/modern_working/include/libavutil/avutil.h deleted file mode 100644 index d799211ffc..0000000000 --- a/src/ffmpeg/modern_working/include/libavutil/avutil.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AVUTIL_H -#define AVUTIL_AVUTIL_H - -/** - * @file libavutil/avutil.h - * external API header - */ - - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) -#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c -#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) - -#define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 5 -#define LIBAVUTIL_VERSION_MICRO 1 - -#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ - LIBAVUTIL_VERSION_MINOR, \ - LIBAVUTIL_VERSION_MICRO) -#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ - LIBAVUTIL_VERSION_MINOR, \ - LIBAVUTIL_VERSION_MICRO) -#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT - -#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) - -/** - * Returns the LIBAVUTIL_VERSION_INT constant. - */ -unsigned avutil_version(void); - -/** - * Returns the libavutil build-time configuration. - */ -const char * avutil_configuration(void); - -/** - * Returns the libavutil license. - */ -const char * avutil_license(void); - -#include "common.h" -#include "mathematics.h" -#include "rational.h" -#include "intfloat_readwrite.h" -#include "log.h" -#include "pixfmt.h" - -#endif /* AVUTIL_AVUTIL_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/common.h b/src/ffmpeg/modern_working/include/libavutil/common.h deleted file mode 100644 index a8a9bd39e6..0000000000 --- a/src/ffmpeg/modern_working/include/libavutil/common.h +++ /dev/null @@ -1,336 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file libavutil/common.h - * common internal and external API header - */ - -#ifndef AVUTIL_COMMON_H -#define AVUTIL_COMMON_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_AV_CONFIG_H -#include "config.h" -#endif - -#ifdef __GNUC__ -# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) -#else -# define AV_GCC_VERSION_AT_LEAST(x,y) 0 -#endif - -#ifndef av_always_inline -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_always_inline __attribute__((always_inline)) inline -#else -# define av_always_inline inline -#endif -#endif - -#ifndef av_noinline -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_noinline __attribute__((noinline)) -#else -# define av_noinline -#endif -#endif - -#ifndef av_pure -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_pure __attribute__((pure)) -#else -# define av_pure -#endif -#endif - -#ifndef av_const -#if AV_GCC_VERSION_AT_LEAST(2,6) -# define av_const __attribute__((const)) -#else -# define av_const -#endif -#endif - -#ifndef av_cold -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) -# define av_cold __attribute__((cold)) -#else -# define av_cold -#endif -#endif - -#ifndef av_flatten -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1) -# define av_flatten __attribute__((flatten)) -#else -# define av_flatten -#endif -#endif - -#ifndef attribute_deprecated -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define attribute_deprecated __attribute__((deprecated)) -#else -# define attribute_deprecated -#endif -#endif - -#ifndef av_unused -#if defined(__GNUC__) -# define av_unused __attribute__((unused)) -#else -# define av_unused -#endif -#endif - -#ifndef av_uninit -#if defined(__GNUC__) && !defined(__ICC) -# define av_uninit(x) x=x -#else -# define av_uninit(x) x -#endif -#endif - -//rounded division & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) -/* assume b>0 */ -#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) -#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) - -/* misc math functions */ -extern const uint8_t ff_log2_tab[256]; - -extern const uint8_t av_reverse[256]; - -static inline av_const int av_log2(unsigned int v) -{ - int n = 0; - if (v & 0xffff0000) { - v >>= 16; - n += 16; - } - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -static inline av_const int av_log2_16bit(unsigned int v) -{ - int n = 0; - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -/** - * Clips a signed integer value into the amin-amax range. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static inline av_const int av_clip(int a, int amin, int amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * Clips a signed integer value into the 0-255 range. - * @param a value to clip - * @return clipped value - */ -static inline av_const uint8_t av_clip_uint8(int a) -{ - if (a&(~255)) return (-a)>>31; - else return a; -} - -/** - * Clips a signed integer value into the 0-65535 range. - * @param a value to clip - * @return clipped value - */ -static inline av_const uint16_t av_clip_uint16(int a) -{ - if (a&(~65535)) return (-a)>>31; - else return a; -} - -/** - * Clips a signed integer value into the -32768,32767 range. - * @param a value to clip - * @return clipped value - */ -static inline av_const int16_t av_clip_int16(int a) -{ - if ((a+32768) & ~65535) return (a>>31) ^ 32767; - else return a; -} - -/** - * Clips a float value into the amin-amax range. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static inline av_const float av_clipf(float a, float amin, float amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** Computes ceil(log2(x)). - * @param x value used to compute ceil(log2(x)) - * @return computed ceiling of log2(x) - */ -static inline av_const int av_ceil_log2(int x) -{ - return av_log2((x - 1) << 1); -} - -#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) -#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) - -/*! - * \def GET_UTF8(val, GET_BYTE, ERROR) - * Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * UCS-4 character and should be a left value. - * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be - * a function or a statement whose return value or evaluated value is of type - * uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range, - * and up to 7 times in the general case. - * \param ERROR action that should be taken when an invalid UTF-8 byte is returned - * from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. - */ -#define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ - {\ - int ones= 7 - av_log2(val ^ 255);\ - if(ones==1)\ - ERROR\ - val&= 127>>ones;\ - while(--ones > 0){\ - int tmp= GET_BYTE - 128;\ - if(tmp>>6)\ - ERROR\ - val= (val<<6) + tmp;\ - }\ - } - -/*! - * \def GET_UTF16(val, GET_16BIT, ERROR) - * Converts a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * UCS-4 character and should be a left value. - * \param GET_16BIT gets two bytes of UTF-16 encoded data converted to native endianness. - * It can be a function or a statement whose return value or evaluated value is of type - * uint16_t. It will be executed up to 2 times. - * \param ERROR action that should be taken when an invalid UTF-16 surrogate is - * returned from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. - */ -#define GET_UTF16(val, GET_16BIT, ERROR)\ - val = GET_16BIT;\ - {\ - unsigned int hi = val - 0xD800;\ - if (hi < 0x800) {\ - val = GET_16BIT - 0xDC00;\ - if (val > 0x3FFU || hi > 0x3FFU)\ - ERROR\ - val += (hi<<10) + 0x10000;\ - }\ - }\ - -/*! - * \def PUT_UTF8(val, tmp, PUT_BYTE) - * Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). - * \param val is an input-only argument and should be of type uint32_t. It holds - * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If - * val is given as a function it is executed only once. - * \param tmp is a temporary variable and should be of type uint8_t. It - * represents an intermediate value during conversion that is to be - * output by PUT_BYTE. - * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. - * It could be a function or a statement, and uses tmp as the input byte. - * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be - * executed up to 4 times for values in the valid UTF-8 range and up to - * 7 times in the general case, depending on the length of the converted - * Unicode character. - */ -#define PUT_UTF8(val, tmp, PUT_BYTE)\ - {\ - int bytes, shift;\ - uint32_t in = val;\ - if (in < 0x80) {\ - tmp = in;\ - PUT_BYTE\ - } else {\ - bytes = (av_log2(in) + 4) / 5;\ - shift = (bytes - 1) * 6;\ - tmp = (256 - (256 >> bytes)) | (in >> shift);\ - PUT_BYTE\ - while (shift >= 6) {\ - shift -= 6;\ - tmp = 0x80 | ((in >> shift) & 0x3f);\ - PUT_BYTE\ - }\ - }\ - } - -#include "mem.h" - -#ifdef HAVE_AV_CONFIG_H -# include "internal.h" -#endif /* HAVE_AV_CONFIG_H */ - -#endif /* AVUTIL_COMMON_H */ diff --git a/src/ffmpeg/modern_working/include/libavutil/mem.h b/src/ffmpeg/modern_working/include/libavutil/mem.h deleted file mode 100644 index 37ba276d08..0000000000 --- a/src/ffmpeg/modern_working/include/libavutil/mem.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file libavutil/mem.h - * memory handling functions - */ - -#ifndef AVUTIL_MEM_H -#define AVUTIL_MEM_H - -#include "common.h" - -#if defined(__ICC) || defined(__SUNPRO_C) - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) - #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v -#elif defined(__GNUC__) - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) - #define DECLARE_ASM_CONST(n,t,v) static const t v attribute_used __attribute__ ((aligned (n))) -#elif defined(_MSC_VER) - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v - #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v -#else - #define DECLARE_ALIGNED(n,t,v) t v - #define DECLARE_ASM_CONST(n,t,v) static const t v -#endif - - -#if AV_GCC_VERSION_AT_LEAST(3,1) - #define av_malloc_attrib __attribute__((__malloc__)) -#else - #define av_malloc_attrib -#endif - -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) - #define av_alloc_size(n) __attribute__((alloc_size(n))) -#else - #define av_alloc_size(n) -#endif - -/** - * Allocates a block of size bytes with alignment suitable for all - * memory accesses (including vectors if available on the CPU). - * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if the block cannot - * be allocated. - * @see av_mallocz() - */ -void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); - -/** - * Allocates or reallocates a block of memory. - * If ptr is NULL and size > 0, allocates a new block. If \p - * size is zero, frees the memory block pointed to by ptr. - * @param size Size in bytes for the memory block to be allocated or - * reallocated. - * @param ptr Pointer to a memory block already allocated with - * av_malloc(z)() or av_realloc() or NULL. - * @return Pointer to a newly reallocated block or NULL if the block - * cannot be reallocated or the function is used to free the memory block. - * @see av_fast_realloc() - */ -void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); - -/** - * Frees a memory block which has been allocated with av_malloc(z)() or - * av_realloc(). - * @param ptr Pointer to the memory block which should be freed. - * @note ptr = NULL is explicitly allowed. - * @note It is recommended that you use av_freep() instead. - * @see av_freep() - */ -void av_free(void *ptr); - -/** - * Allocates a block of size bytes with alignment suitable for all - * memory accesses (including vectors if available on the CPU) and - * zeroes all the bytes of the block. - * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if it cannot be allocated. - * @see av_malloc() - */ -void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); - -/** - * Duplicates the string s. - * @param s string to be duplicated - * @return Pointer to a newly allocated string containing a - * copy of s or NULL if the string cannot be allocated. - */ -char *av_strdup(const char *s) av_malloc_attrib; - -/** - * Frees a memory block which has been allocated with av_malloc(z)() or - * av_realloc() and set the pointer pointing to it to NULL. - * @param ptr Pointer to the pointer to the memory block which should - * be freed. - * @see av_free() - */ -void av_freep(void *ptr); - -#endif /* AVUTIL_MEM_H */ diff --git a/src/ffmpeg/modern_working/include/stdint.h b/src/ffmpeg/modern_working/include/stdint.h deleted file mode 100644 index e236bb0001..0000000000 --- a/src/ffmpeg/modern_working/include/stdint.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef char int8_t; - typedef short int16_t; - typedef int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/src/ffmpeg/modern_working/lib/avcodec.lib b/src/ffmpeg/modern_working/lib/avcodec.lib deleted file mode 100644 index b3e632f056..0000000000 Binary files a/src/ffmpeg/modern_working/lib/avcodec.lib and /dev/null differ diff --git a/src/ffmpeg/modern_working/lib/avdevice.lib b/src/ffmpeg/modern_working/lib/avdevice.lib deleted file mode 100644 index 9ddc0839bb..0000000000 Binary files a/src/ffmpeg/modern_working/lib/avdevice.lib and /dev/null differ diff --git a/src/ffmpeg/modern_working/lib/avformat.lib b/src/ffmpeg/modern_working/lib/avformat.lib deleted file mode 100644 index d5d14cd339..0000000000 Binary files a/src/ffmpeg/modern_working/lib/avformat.lib and /dev/null differ diff --git a/src/ffmpeg/modern_working/lib/avutil.lib b/src/ffmpeg/modern_working/lib/avutil.lib deleted file mode 100644 index 6ff3056250..0000000000 Binary files a/src/ffmpeg/modern_working/lib/avutil.lib and /dev/null differ diff --git a/src/ffmpeg/modern_working/lib/swscale.lib b/src/ffmpeg/modern_working/lib/swscale.lib deleted file mode 100644 index c6c4e40d26..0000000000 Binary files a/src/ffmpeg/modern_working/lib/swscale.lib and /dev/null differ diff --git a/src/ffmpeg/r8448/include/ffmpeg/avcodec.h b/src/ffmpeg/r8448/include/ffmpeg/avcodec.h deleted file mode 100644 index ead4dc8dfe..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/avcodec.h +++ /dev/null @@ -1,3073 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_H -#define AVCODEC_H - -/** - * @file avcodec.h - * external api header. - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "avutil.h" -#include /* size_t */ - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBAVCODEC_VERSION_INT ((51<<16)+(40<<8)+0) -#define LIBAVCODEC_VERSION 51.40.0 -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} - -enum CodecID { - CODEC_ID_NONE, - CODEC_ID_MPEG1VIDEO, - CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */ - CODEC_ID_MPEG2VIDEO_XVMC, - CODEC_ID_H261, - CODEC_ID_H263, - CODEC_ID_RV10, - CODEC_ID_RV20, - CODEC_ID_MJPEG, - CODEC_ID_MJPEGB, - CODEC_ID_LJPEG, - CODEC_ID_SP5X, - CODEC_ID_JPEGLS, - CODEC_ID_MPEG4, - CODEC_ID_RAWVIDEO, - CODEC_ID_MSMPEG4V1, - CODEC_ID_MSMPEG4V2, - CODEC_ID_MSMPEG4V3, - CODEC_ID_WMV1, - CODEC_ID_WMV2, - CODEC_ID_H263P, - CODEC_ID_H263I, - CODEC_ID_FLV1, - CODEC_ID_SVQ1, - CODEC_ID_SVQ3, - CODEC_ID_DVVIDEO, - CODEC_ID_HUFFYUV, - CODEC_ID_CYUV, - CODEC_ID_H264, - CODEC_ID_INDEO3, - CODEC_ID_VP3, - CODEC_ID_THEORA, - CODEC_ID_ASV1, - CODEC_ID_ASV2, - CODEC_ID_FFV1, - CODEC_ID_4XM, - CODEC_ID_VCR1, - CODEC_ID_CLJR, - CODEC_ID_MDEC, - CODEC_ID_ROQ, - CODEC_ID_INTERPLAY_VIDEO, - CODEC_ID_XAN_WC3, - CODEC_ID_XAN_WC4, - CODEC_ID_RPZA, - CODEC_ID_CINEPAK, - CODEC_ID_WS_VQA, - CODEC_ID_MSRLE, - CODEC_ID_MSVIDEO1, - CODEC_ID_IDCIN, - CODEC_ID_8BPS, - CODEC_ID_SMC, - CODEC_ID_FLIC, - CODEC_ID_TRUEMOTION1, - CODEC_ID_VMDVIDEO, - CODEC_ID_MSZH, - CODEC_ID_ZLIB, - CODEC_ID_QTRLE, - CODEC_ID_SNOW, - CODEC_ID_TSCC, - CODEC_ID_ULTI, - CODEC_ID_QDRAW, - CODEC_ID_VIXL, - CODEC_ID_QPEG, - CODEC_ID_XVID, - CODEC_ID_PNG, - CODEC_ID_PPM, - CODEC_ID_PBM, - CODEC_ID_PGM, - CODEC_ID_PGMYUV, - CODEC_ID_PAM, - CODEC_ID_FFVHUFF, - CODEC_ID_RV30, - CODEC_ID_RV40, - CODEC_ID_VC1, - CODEC_ID_WMV3, - CODEC_ID_LOCO, - CODEC_ID_WNV1, - CODEC_ID_AASC, - CODEC_ID_INDEO2, - CODEC_ID_FRAPS, - CODEC_ID_TRUEMOTION2, - CODEC_ID_BMP, - CODEC_ID_CSCD, - CODEC_ID_MMVIDEO, - CODEC_ID_ZMBV, - CODEC_ID_AVS, - CODEC_ID_SMACKVIDEO, - CODEC_ID_NUV, - CODEC_ID_KMVC, - CODEC_ID_FLASHSV, - CODEC_ID_CAVS, - CODEC_ID_JPEG2000, - CODEC_ID_VMNC, - CODEC_ID_VP5, - CODEC_ID_VP6, - CODEC_ID_VP6F, - CODEC_ID_TARGA, - CODEC_ID_DSICINVIDEO, - CODEC_ID_TIERTEXSEQVIDEO, - CODEC_ID_TIFF, - CODEC_ID_GIF, - CODEC_ID_FFH264, - CODEC_ID_DXA, - CODEC_ID_DNXHD, - - /* various pcm "codecs" */ - CODEC_ID_PCM_S16LE= 0x10000, - CODEC_ID_PCM_S16BE, - CODEC_ID_PCM_U16LE, - CODEC_ID_PCM_U16BE, - CODEC_ID_PCM_S8, - CODEC_ID_PCM_U8, - CODEC_ID_PCM_MULAW, - CODEC_ID_PCM_ALAW, - CODEC_ID_PCM_S32LE, - CODEC_ID_PCM_S32BE, - CODEC_ID_PCM_U32LE, - CODEC_ID_PCM_U32BE, - CODEC_ID_PCM_S24LE, - CODEC_ID_PCM_S24BE, - CODEC_ID_PCM_U24LE, - CODEC_ID_PCM_U24BE, - CODEC_ID_PCM_S24DAUD, - - /* various adpcm codecs */ - CODEC_ID_ADPCM_IMA_QT= 0x11000, - CODEC_ID_ADPCM_IMA_WAV, - CODEC_ID_ADPCM_IMA_DK3, - CODEC_ID_ADPCM_IMA_DK4, - CODEC_ID_ADPCM_IMA_WS, - CODEC_ID_ADPCM_IMA_SMJPEG, - CODEC_ID_ADPCM_MS, - CODEC_ID_ADPCM_4XM, - CODEC_ID_ADPCM_XA, - CODEC_ID_ADPCM_ADX, - CODEC_ID_ADPCM_EA, - CODEC_ID_ADPCM_G726, - CODEC_ID_ADPCM_CT, - CODEC_ID_ADPCM_SWF, - CODEC_ID_ADPCM_YAMAHA, - CODEC_ID_ADPCM_SBPRO_4, - CODEC_ID_ADPCM_SBPRO_3, - CODEC_ID_ADPCM_SBPRO_2, - - /* AMR */ - CODEC_ID_AMR_NB= 0x12000, - CODEC_ID_AMR_WB, - - /* RealAudio codecs*/ - CODEC_ID_RA_144= 0x13000, - CODEC_ID_RA_288, - - /* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= 0x14000, - CODEC_ID_INTERPLAY_DPCM, - CODEC_ID_XAN_DPCM, - CODEC_ID_SOL_DPCM, - - CODEC_ID_MP2= 0x15000, - CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ - CODEC_ID_AAC, -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) - CODEC_ID_MPEG4AAC, -#endif - CODEC_ID_AC3, - CODEC_ID_DTS, - CODEC_ID_VORBIS, - CODEC_ID_DVAUDIO, - CODEC_ID_WMAV1, - CODEC_ID_WMAV2, - CODEC_ID_MACE3, - CODEC_ID_MACE6, - CODEC_ID_VMDAUDIO, - CODEC_ID_SONIC, - CODEC_ID_SONIC_LS, - CODEC_ID_FLAC, - CODEC_ID_MP3ADU, - CODEC_ID_MP3ON4, - CODEC_ID_SHORTEN, - CODEC_ID_ALAC, - CODEC_ID_WESTWOOD_SND1, - CODEC_ID_GSM, /* As in Berlin toast format */ - CODEC_ID_QDM2, - CODEC_ID_COOK, - CODEC_ID_TRUESPEECH, - CODEC_ID_TTA, - CODEC_ID_SMACKAUDIO, - CODEC_ID_QCELP, - CODEC_ID_WAVPACK, - CODEC_ID_DSICINAUDIO, - CODEC_ID_IMC, - CODEC_ID_MUSEPACK7, - CODEC_ID_MLP, - CODEC_ID_GSM_MS, /* As found in WAV */ - - /* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= 0x17000, - CODEC_ID_DVB_SUBTITLE, - - CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport - stream (only used by libavformat) */ -}; - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* CODEC_ID_MP3LAME is absolete */ -#define CODEC_ID_MP3LAME CODEC_ID_MP3 -#define CODEC_ID_MPEG4AAC CODEC_ID_AAC -#endif - -enum CodecType { - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE, - CODEC_TYPE_NB -}; - -/* currently unused, may be used if 24/32 bits samples ever supported */ -/* all in native endian */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S24, ///< signed 24 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float -}; - -/* in bytes */ -#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio - -/** - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * this is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end
- * Note, if the first 23 bits of the additional bytes are not 0 then damaged - * MPEG bitstreams could cause overread and segfault - */ -#define FF_INPUT_BUFFER_PADDING_SIZE 8 - -/** - * minimum encoding buffer size. - * used to avoid some checks during header writing - */ -#define FF_MIN_BUFFER_SIZE 16384 - -/* motion estimation type, EPZS by default */ -enum Motion_Est_ID { - ME_ZERO = 1, - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, - ME_X1, - ME_HEX, - ME_UMH, - ME_ITER, -}; - -enum AVDiscard{ -//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -typedef struct RcOverride{ - int start_frame; - int end_frame; - int qscale; // if this is 0 then quality_factor will be used instead - float quality_factor; -} RcOverride; - -#define FF_MAX_B_FRAMES 16 - -/* encoding support - these flags can be passed in AVCodecContext.flags before initing - Note: not everything is supported yet. -*/ - -#define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale -#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263 -#define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC -#define CODEC_FLAG_GMC 0x0020 ///< use GMC -#define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> -#define CODEC_FLAG_PART 0x0080 ///< use data partitioning -/* parent program guarantees that the input for b-frame containing streams is not written to - for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ -#define CODEC_FLAG_INPUT_PRESERVED 0x0100 -#define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode -#define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode -#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) -#define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale -#define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges -#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding -#define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead - of only at frame boundaries */ -#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization -#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct -#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay -#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan -#define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization -#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe -#define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) -/* Fx : Flag for h263+ extra options */ -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -#define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) -#endif -#define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction -#define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector -#define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp -#define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon -#define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc -#define CODEC_FLAG_OBMC 0x00000001 ///< OBMC -#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter -#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 -#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation -#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data -#define CODEC_FLAG_CLOSED_GOP ((int)0x80000000) -#define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks -#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size -#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< skip bitstream encoding -#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< place global headers at every keyframe instead of in extradata -#define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow b-frames to be used as references -#define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for b-frames -#define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock -#define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform -#define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip -#define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters -#define CODEC_FLAG2_BRDO 0x00000400 ///< b-frame rate-distortion optimization -#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< use MPEG-2 intra VLC table -#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) -#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format -#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skiping -#define CODEC_FLAG2_CHUNKS 0x00008000 ///< input bitstream might be truncated at a packet boundaries instead of only at frame boundaries -#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< use MPEG-2 non linear quantizer - -/* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independent Segment Decoding */ -/* /Fx */ -/* codec capabilities */ - -#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback -/** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 - */ -#define CODEC_CAP_DR1 0x0002 -/* if 'parse_only' field is true, then avcodec_parse_frame() can be - used */ -#define CODEC_CAP_PARSE_ONLY 0x0004 -#define CODEC_CAP_TRUNCATED 0x0008 -/* codec can export data for HW decoding (XvMC) */ -#define CODEC_CAP_HWACCEL 0x0010 -/** - * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. - * if this is not set, the codec is guaranteed to never be feeded with NULL data - */ -#define CODEC_CAP_DELAY 0x0020 -/** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. - */ -#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 - -//the following defines may change, don't expect compatibility if you use them -#define MB_TYPE_INTRA4x4 0x0001 -#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific -#define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific -#define MB_TYPE_16x16 0x0008 -#define MB_TYPE_16x8 0x0010 -#define MB_TYPE_8x16 0x0020 -#define MB_TYPE_8x8 0x0040 -#define MB_TYPE_INTERLACED 0x0080 -#define MB_TYPE_DIRECT2 0x0100 //FIXME -#define MB_TYPE_ACPRED 0x0200 -#define MB_TYPE_GMC 0x0400 -#define MB_TYPE_SKIP 0x0800 -#define MB_TYPE_P0L0 0x1000 -#define MB_TYPE_P1L0 0x2000 -#define MB_TYPE_P0L1 0x4000 -#define MB_TYPE_P1L1 0x8000 -#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) -#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) -#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) -#define MB_TYPE_QUANT 0x00010000 -#define MB_TYPE_CBP 0x00020000 -//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) - -/** - * Pan Scan area. - * this specifies the area which should be displayed. Note there may be multiple such areas for one frame - */ -typedef struct AVPanScan{ - /** - * id. - * - encoding: set by user. - * - decoding: set by lavc - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: set by user. - * - decoding: set by lavc - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames. - * - encoding: set by user. - * - decoding: set by lavc - */ - int16_t position[3][2]; -}AVPanScan; - -#define FF_COMMON_FRAME \ - /**\ - * pointer to the picture planes.\ - * this might be different from the first allocated byte\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *data[4];\ - int linesize[4];\ - /**\ - * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\ - * this isn't used by lavc unless the default get/release_buffer() is used\ - * - encoding: \ - * - decoding: \ - */\ - uint8_t *base[4];\ - /**\ - * 1 -> keyframe, 0-> not\ - * - encoding: set by lavc\ - * - decoding: set by lavc\ - */\ - int key_frame;\ -\ - /**\ - * picture type of the frame, see ?_TYPE below.\ - * - encoding: set by lavc for coded_picture (and set by user for input)\ - * - decoding: set by lavc\ - */\ - int pict_type;\ -\ - /**\ - * presentation timestamp in time_base units (time when frame should be shown to user)\ - * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed\ - * - encoding: MUST be set by user\ - * - decoding: set by lavc\ - */\ - int64_t pts;\ -\ - /**\ - * picture number in bitstream order.\ - * - encoding: set by\ - * - decoding: set by lavc\ - */\ - int coded_picture_number;\ - /**\ - * picture number in display order.\ - * - encoding: set by\ - * - decoding: set by lavc\ - */\ - int display_picture_number;\ -\ - /**\ - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \ - * - encoding: set by lavc for coded_picture (and set by user for input)\ - * - decoding: set by lavc\ - */\ - int quality; \ -\ - /**\ - * buffer age (1->was last buffer and dint change, 2->..., ...).\ - * set to INT_MAX if the buffer has not been used yet \ - * - encoding: unused\ - * - decoding: MUST be set by get_buffer()\ - */\ - int age;\ -\ - /**\ - * is this picture used as reference\ - * - encoding: unused\ - * - decoding: set by lavc (before get_buffer() call))\ - */\ - int reference;\ -\ - /**\ - * QP table\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int8_t *qscale_table;\ - /**\ - * QP store stride\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int qstride;\ -\ - /**\ - * mbskip_table[mb]>=1 if MB didnt change\ - * stride= mb_width = (width+15)>>4\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - uint8_t *mbskip_table;\ -\ - /**\ - * Motion vector table.\ - * @code\ - * example:\ - * int mv_sample_log2= 4 - motion_subsample_log2;\ - * int mb_width= (width+15)>>4;\ - * int mv_stride= (mb_width << mv_sample_log2) + 1;\ - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\ - * @endcode\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int16_t (*motion_val[2])[2];\ -\ - /**\ - * Macroblock type table\ - * mb_type_base + mb_width + 2\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - uint32_t *mb_type;\ -\ - /**\ - * log2 of the size of the block which a single vector in motion_val represents: \ - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - uint8_t motion_subsample_log2;\ -\ - /**\ - * for some private data of the user\ - * - encoding: unused\ - * - decoding: set by user\ - */\ - void *opaque;\ -\ - /**\ - * error\ - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\ - * - decoding: unused\ - */\ - uint64_t error[4];\ -\ - /**\ - * type of the buffer (to keep track of who has to dealloc data[*])\ - * - encoding: set by the one who allocs it\ - * - decoding: set by the one who allocs it\ - * Note: user allocated (direct rendering) & internal buffers can not coexist currently\ - */\ - int type;\ - \ - /**\ - * when decoding, this signal how much the picture must be delayed.\ - * extra_delay = repeat_pict / (2*fps)\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - int repeat_pict;\ - \ - /**\ - * \ - */\ - int qscale_type;\ - \ - /**\ - * The content of the picture is interlaced.\ - * - encoding: set by user\ - * - decoding: set by lavc (default 0)\ - */\ - int interlaced_frame;\ - \ - /**\ - * if the content is interlaced, is top field displayed first.\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int top_field_first;\ - \ - /**\ - * Pan scan.\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - AVPanScan *pan_scan;\ - \ - /**\ - * tell user application that palette has changed from previous frame.\ - * - encoding: ??? (no palette-enabled encoder yet)\ - * - decoding: set by lavc (default 0)\ - */\ - int palette_has_changed;\ - \ - /**\ - * Codec suggestion on buffer type if != 0\ - * - encoding: unused\ - * - decoding: set by lavc (before get_buffer() call))\ - */\ - int buffer_hints;\ -\ - /**\ - * DCT coeffitients\ - * - encoding: unused\ - * - decoding: set by lavc\ - */\ - short *dct_coeff;\ -\ - /**\ - * Motion referece frame index\ - * - encoding: set by user\ - * - decoding: set by lavc\ - */\ - int8_t *ref_index[2]; - -#define FF_QSCALE_TYPE_MPEG1 0 -#define FF_QSCALE_TYPE_MPEG2 1 -#define FF_QSCALE_TYPE_H264 2 - -#define FF_BUFFER_TYPE_INTERNAL 1 -#define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user) -#define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared -#define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, don't dealloc anything - - -#define FF_I_TYPE 1 // Intra -#define FF_P_TYPE 2 // Predicted -#define FF_B_TYPE 3 // Bi-dir predicted -#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4 -#define FF_SI_TYPE 5 -#define FF_SP_TYPE 6 - -#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore) -#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer -#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content -#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update) - -/** - * Audio Video Frame. - */ -typedef struct AVFrame { - FF_COMMON_FRAME -} AVFrame; - -#define DEFAULT_FRAME_RATE_BASE 1001000 - -/** - * main external api structure. - */ -typedef struct AVCodecContext { - /** - * Info on struct for av_log - * - set by avcodec_alloc_context - */ - AVClass *av_class; - /** - * the average bitrate. - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream - */ - int bit_rate; - - /** - * number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: unused - */ - int bit_rate_tolerance; - - /** - * CODEC_FLAG_*. - * - encoding: set by user. - * - decoding: set by user. - */ - int flags; - - /** - * some codecs needs additionnal format info. It is stored here - * - encoding: set by user. - * - decoding: set by lavc. (FIXME is this ok?) - */ - int sub_id; - - /** - * motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused - */ - int me_method; - - /** - * some codecs need / can use extra-data like huffman tables. - * mjpeg: huffman tables - * rv10: additional flags - * mpeg4: global headers (they can be in the bitstream or here) - * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger - * then extradata_size to avoid prolems if its read with the bitstream reader - * the bytewise contents of extradata must not depend on the architecture or cpu endianness - * - encoding: set/allocated/freed by lavc. - * - decoding: set/allocated/freed by user. - */ - uint8_t *extradata; - int extradata_size; - - /** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * - encoding: MUST be set by user - * - decoding: set by lavc. - */ - AVRational time_base; - - /* video only */ - /** - * picture width / height. - * - encoding: MUST be set by user. - * - decoding: set by lavc. - * Note, for compatibility its possible to set this instead of - * coded_width/height before decoding - */ - int width, height; - -#define FF_ASPECT_EXTENDED 15 - - /** - * the number of pictures in a group of pitures, or 0 for intra_only. - * - encoding: set by user. - * - decoding: unused - */ - int gop_size; - - /** - * pixel format, see PIX_FMT_xxx. - * - encoding: set by user. - * - decoding: set by lavc. - */ - enum PixelFormat pix_fmt; - - /** - * Frame rate emulation. If not zero lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: set by user. - * - decoding: unused. - */ - int rate_emu; - - /** - * if non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw an horizontal band. It improve cache usage. Not - * all codecs can do that. You must check the codec capabilities - * before - * - encoding: unused - * - decoding: set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read - */ - void (*draw_horiz_band)(struct AVCodecContext *s, - const AVFrame *src, int offset[4], - int y, int type, int height); - - /* audio only */ - int sample_rate; ///< samples per sec - int channels; - - /** - * audio sample format. - * - encoding: set by user. - * - decoding: set by lavc. - */ - enum SampleFormat sample_fmt; ///< sample format, currenly unused - - /* the following data should not be initialized */ - /** - * samples per packet. initialized when calling 'init' - */ - int frame_size; - int frame_number; ///< audio or video frame number - int real_pict_num; ///< returns the real picture number of previous encoded frame - - /** - * number of frames the decoded output will be delayed relative to - * the encoded input. - * - encoding: set by lavc. - * - decoding: unused - */ - int delay; - - /* - encoding parameters */ - float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - float qblur; ///< amount of qscale smoothing over time (0.0-1.0) - - /** - * minimum quantizer. - * - encoding: set by user. - * - decoding: unused - */ - int qmin; - - /** - * maximum quantizer. - * - encoding: set by user. - * - decoding: unused - */ - int qmax; - - /** - * maximum quantizer difference between frames. - * - encoding: set by user. - * - decoding: unused - */ - int max_qdiff; - - /** - * maximum number of b frames between non b frames. - * note: the output will be delayed by max_b_frames+1 relative to the input - * - encoding: set by user. - * - decoding: unused - */ - int max_b_frames; - - /** - * qscale factor between ip and b frames. - * - encoding: set by user. - * - decoding: unused - */ - float b_quant_factor; - - /** obsolete FIXME remove */ - int rc_strategy; -#define FF_RC_STRATEGY_XVID 1 - - int b_frame_strategy; - - /** - * hurry up amount. - * - encoding: unused - * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header - * @deprecated Deprecated in favor of skip_idct and skip_frame. - */ - int hurry_up; - - struct AVCodec *codec; - - void *priv_data; - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) - /* unused, FIXME remove*/ - int rtp_mode; -#endif - - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do it's best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263 */ - /* This doesn't take account of any particular */ - /* headers inside the transmited RTP payload */ - - - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send */ - /* Depends on the encoder if the data starts */ - /* with a Start Code (it should) H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload */ - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); - - /* statistics, used for 2-pass encoding */ - int mv_bits; - int header_bits; - int i_tex_bits; - int p_tex_bits; - int i_count; - int p_count; - int skip_count; - int misc_bits; - - /** - * number of bits used for the previously encoded frame. - * - encoding: set by lavc - * - decoding: unused - */ - int frame_bits; - - /** - * private data of the user, can be used to carry app specific stuff. - * - encoding: set by user - * - decoding: set by user - */ - void *opaque; - - char codec_name[32]; - enum CodecType codec_type; /* see CODEC_TYPE_xxx */ - enum CodecID codec_id; /* see CODEC_ID_xxx */ - - /** - * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: set by user, if not then the default based on codec_id will be used - * - decoding: set by user, will be converted to upper case by lavc during init - */ - unsigned int codec_tag; - - /** - * workaround bugs in encoders which sometimes cannot be detected automatically. - * - encoding: set by user - * - decoding: set by user - */ - int workaround_bugs; -#define FF_BUG_AUTODETECT 1 ///< autodetection -#define FF_BUG_OLD_MSMPEG4 2 -#define FF_BUG_XVID_ILACE 4 -#define FF_BUG_UMP4 8 -#define FF_BUG_NO_PADDING 16 -#define FF_BUG_AMV 32 -#define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default -#define FF_BUG_QPEL_CHROMA 64 -#define FF_BUG_STD_QPEL 128 -#define FF_BUG_QPEL_CHROMA2 256 -#define FF_BUG_DIRECT_BLOCKSIZE 512 -#define FF_BUG_EDGE 1024 -#define FF_BUG_HPEL_CHROMA 2048 -#define FF_BUG_DC_CLIP 4096 -#define FF_BUG_MS 8192 ///< workaround various bugs in microsofts broken decoders -//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100% - - /** - * luma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused - */ - int luma_elim_threshold; - - /** - * chroma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused - */ - int chroma_elim_threshold; - - /** - * strictly follow the std (MPEG4, ...). - * - encoding: set by user - * - decoding: unused - */ - int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< strictly conform to a older more strict version of the spec or reference software -#define FF_COMPLIANCE_STRICT 1 ///< strictly conform to all the things in the spec no matter what consequences -#define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_INOFFICIAL -1 ///< allow inofficial extensions -#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< allow non standarized experimental things - - /** - * qscale offset between ip and b frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused - */ - float b_quant_offset; - - /** - * error resilience higher values will detect more errors but may missdetect - * some more or less valid parts as errors. - * - encoding: unused - * - decoding: set by user - */ - int error_resilience; -#define FF_ER_CAREFUL 1 -#define FF_ER_COMPLIANT 2 -#define FF_ER_AGGRESSIVE 3 -#define FF_ER_VERY_AGGRESSIVE 4 - - /** - * called at the beginning of each frame to get a buffer for it. - * if pic.reference is set then the frame will be read later by lavc - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16 - * - encoding: unused - * - decoding: set by lavc, user can override - */ - int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * called to release buffers which where allocated with get_buffer. - * a released buffer can be reused in get_buffer() - * pic.data[*] must be set to NULL - * - encoding: unused - * - decoding: set by lavc, user can override - */ - void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * if 1 the stream has a 1 frame delay during decoding. - * - encoding: set by lavc - * - decoding: set by lavc - */ - int has_b_frames; - - /** - * number of bytes per packet if constant and known or 0 - * used by some WAV based audio codecs - */ - int block_align; - - int parse_only; /* - decoding only: if true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. */ - - /** - * 0-> h263 quant 1-> mpeg quant. - * - encoding: set by user. - * - decoding: unused - */ - int mpeg_quant; - - /** - * pass1 encoding statistics output buffer. - * - encoding: set by lavc - * - decoding: unused - */ - char *stats_out; - - /** - * pass2 encoding statistics input buffer. - * concatenated stuff from stats_out of pass1 should be placed here - * - encoding: allocated/set/freed by user - * - decoding: unused - */ - char *stats_in; - - /** - * ratecontrol qmin qmax limiting method. - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax - * - encoding: set by user. - * - decoding: unused - */ - float rc_qsquish; - - float rc_qmod_amp; - int rc_qmod_freq; - - /** - * ratecontrol override, see RcOverride. - * - encoding: allocated/set/freed by user. - * - decoding: unused - */ - RcOverride *rc_override; - int rc_override_count; - - /** - * rate control equation. - * - encoding: set by user - * - decoding: unused - */ - char *rc_eq; - - /** - * maximum bitrate. - * - encoding: set by user. - * - decoding: unused - */ - int rc_max_rate; - - /** - * minimum bitrate. - * - encoding: set by user. - * - decoding: unused - */ - int rc_min_rate; - - /** - * decoder bitstream buffer size. - * - encoding: set by user. - * - decoding: unused - */ - int rc_buffer_size; - float rc_buffer_aggressivity; - - /** - * qscale factor between p and i frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused - */ - float i_quant_factor; - - /** - * qscale offset between p and i frames. - * - encoding: set by user. - * - decoding: unused - */ - float i_quant_offset; - - /** - * initial complexity for pass1 ratecontrol. - * - encoding: set by user. - * - decoding: unused - */ - float rc_initial_cplx; - - /** - * dct algorithm, see FF_DCT_* below. - * - encoding: set by user - * - decoding: unused - */ - int dct_algo; -#define FF_DCT_AUTO 0 -#define FF_DCT_FASTINT 1 -#define FF_DCT_INT 2 -#define FF_DCT_MMX 3 -#define FF_DCT_MLIB 4 -#define FF_DCT_ALTIVEC 5 -#define FF_DCT_FAAN 6 - - /** - * luminance masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float lumi_masking; - - /** - * temporary complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float temporal_cplx_masking; - - /** - * spatial complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float spatial_cplx_masking; - - /** - * p block masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float p_masking; - - /** - * darkness masking (0-> disabled). - * - encoding: set by user - * - decoding: unused - */ - float dark_masking; - - - /* for binary compatibility */ - int unused; - - /** - * idct algorithm, see FF_IDCT_* below. - * - encoding: set by user - * - decoding: set by user - */ - int idct_algo; -#define FF_IDCT_AUTO 0 -#define FF_IDCT_INT 1 -#define FF_IDCT_SIMPLE 2 -#define FF_IDCT_SIMPLEMMX 3 -#define FF_IDCT_LIBMPEG2MMX 4 -#define FF_IDCT_PS2 5 -#define FF_IDCT_MLIB 6 -#define FF_IDCT_ARM 7 -#define FF_IDCT_ALTIVEC 8 -#define FF_IDCT_SH4 9 -#define FF_IDCT_SIMPLEARM 10 -#define FF_IDCT_H264 11 -#define FF_IDCT_VP3 12 -#define FF_IDCT_IPP 13 -#define FF_IDCT_XVIDMMX 14 -#define FF_IDCT_CAVS 15 -#define FF_IDCT_SIMPLEARMV5TE 16 -#define FF_IDCT_SIMPLEARMV6 17 - - /** - * slice count. - * - encoding: set by lavc - * - decoding: set by user (or 0) - */ - int slice_count; - /** - * slice offsets in the frame in bytes. - * - encoding: set/allocated by lavc - * - decoding: set/allocated by user (or NULL) - */ - int *slice_offset; - - /** - * error concealment flags. - * - encoding: unused - * - decoding: set by user - */ - int error_concealment; -#define FF_EC_GUESS_MVS 1 -#define FF_EC_DEBLOCK 2 - - /** - * dsp_mask could be add used to disable unwanted CPU features - * CPU features (i.e. MMX, SSE. ...) - * - * with FORCE flag you may instead enable given CPU features - * (Dangerous: usable in case of misdetection, improper usage however will - * result into program crash) - */ - unsigned dsp_mask; -#define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */ - /* lower 16 bits - CPU features */ -#ifdef HAVE_MMX -#define FF_MM_MMX 0x0001 /* standard MMX */ -#define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */ -#define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */ -#define FF_MM_SSE 0x0008 /* SSE functions */ -#define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */ -#define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */ -#endif /* HAVE_MMX */ -#ifdef HAVE_IWMMXT -#define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */ -#endif /* HAVE_IWMMXT */ - - /** - * bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: set by lavc - * - decoding: set by user - */ - int bits_per_sample; - - /** - * prediction method (needed for huffyuv). - * - encoding: set by user - * - decoding: unused - */ - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 - - /** - * sample aspect ratio (0 if unknown). - * numerator and denominator must be relative prime and smaller then 256 for some video standards - * - encoding: set by user. - * - decoding: set by lavc. - */ - AVRational sample_aspect_ratio; - - /** - * the picture in the bitstream. - * - encoding: set by lavc - * - decoding: set by lavc - */ - AVFrame *coded_frame; - - /** - * debug. - * - encoding: set by user. - * - decoding: set by user. - */ - int debug; -#define FF_DEBUG_PICT_INFO 1 -#define FF_DEBUG_RC 2 -#define FF_DEBUG_BITSTREAM 4 -#define FF_DEBUG_MB_TYPE 8 -#define FF_DEBUG_QP 16 -#define FF_DEBUG_MV 32 -#define FF_DEBUG_DCT_COEFF 0x00000040 -#define FF_DEBUG_SKIP 0x00000080 -#define FF_DEBUG_STARTCODE 0x00000100 -#define FF_DEBUG_PTS 0x00000200 -#define FF_DEBUG_ER 0x00000400 -#define FF_DEBUG_MMCO 0x00000800 -#define FF_DEBUG_BUGS 0x00001000 -#define FF_DEBUG_VIS_QP 0x00002000 -#define FF_DEBUG_VIS_MB_TYPE 0x00004000 - - /** - * debug. - * - encoding: set by user. - * - decoding: set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames - - /** - * error. - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR - * - decoding: unused - */ - uint64_t error[4]; - - /** - * minimum MB quantizer. - * - encoding: unused - * - decoding: unused - */ - int mb_qmin; - - /** - * maximum MB quantizer. - * - encoding: unused - * - decoding: unused - */ - int mb_qmax; - - /** - * motion estimation compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_cmp; - /** - * subpixel motion estimation compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_sub_cmp; - /** - * macroblock compare function (not supported yet). - * - encoding: set by user. - * - decoding: unused - */ - int mb_cmp; - /** - * interlaced dct compare function - * - encoding: set by user. - * - decoding: unused - */ - int ildct_cmp; -#define FF_CMP_SAD 0 -#define FF_CMP_SSE 1 -#define FF_CMP_SATD 2 -#define FF_CMP_DCT 3 -#define FF_CMP_PSNR 4 -#define FF_CMP_BIT 5 -#define FF_CMP_RD 6 -#define FF_CMP_ZERO 7 -#define FF_CMP_VSAD 8 -#define FF_CMP_VSSE 9 -#define FF_CMP_NSSE 10 -#define FF_CMP_W53 11 -#define FF_CMP_W97 12 -#define FF_CMP_DCTMAX 13 -#define FF_CMP_DCT264 14 -#define FF_CMP_CHROMA 256 - - /** - * ME diamond size & shape. - * - encoding: set by user. - * - decoding: unused - */ - int dia_size; - - /** - * amount of previous MV predictors (2a+1 x 2a+1 square). - * - encoding: set by user. - * - decoding: unused - */ - int last_predictor_count; - - /** - * pre pass for motion estimation. - * - encoding: set by user. - * - decoding: unused - */ - int pre_me; - - /** - * motion estimation pre pass compare function. - * - encoding: set by user. - * - decoding: unused - */ - int me_pre_cmp; - - /** - * ME pre pass diamond size & shape. - * - encoding: set by user. - * - decoding: unused - */ - int pre_dia_size; - - /** - * subpel ME quality. - * - encoding: set by user. - * - decoding: unused - */ - int me_subpel_quality; - - /** - * callback to negotiate the pixelFormat. - * @param fmt is the list of formats which are supported by the codec, - * its terminated by -1 as 0 is a valid format, the formats are ordered by quality - * the first is allways the native one - * @return the choosen format - * - encoding: unused - * - decoding: set by user, if not set then the native format will always be choosen - */ - enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt); - - /** - * DTG active format information (additionnal aspect ratio - * information only used in DVB MPEG2 transport streams). 0 if - * not set. - * - * - encoding: unused. - * - decoding: set by decoder - */ - int dtg_active_format; -#define FF_DTG_AFD_SAME 8 -#define FF_DTG_AFD_4_3 9 -#define FF_DTG_AFD_16_9 10 -#define FF_DTG_AFD_14_9 11 -#define FF_DTG_AFD_4_3_SP_14_9 13 -#define FF_DTG_AFD_16_9_SP_14_9 14 -#define FF_DTG_AFD_SP_4_3 15 - - /** - * Maximum motion estimation search range in subpel units. - * if 0 then no limit - * - * - encoding: set by user. - * - decoding: unused. - */ - int me_range; - - /** - * intra quantizer bias. - * - encoding: set by user. - * - decoding: unused - */ - int intra_quant_bias; -#define FF_DEFAULT_QUANT_BIAS 999999 - - /** - * inter quantizer bias. - * - encoding: set by user. - * - decoding: unused - */ - int inter_quant_bias; - - /** - * color table ID. - * - encoding: unused. - * - decoding: which clrtable should be used for 8bit RGB images - * table have to be stored somewhere FIXME - */ - int color_table_id; - - /** - * internal_buffer count. - * Don't touch, used by lavc default_get_buffer() - */ - int internal_buffer_count; - - /** - * internal_buffers. - * Don't touch, used by lavc default_get_buffer() - */ - void *internal_buffer; - -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1< ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: unused - * - decoding: set by user, will be converted to upper case by lavc during init - */ - unsigned int stream_codec_tag; - - /** - * scene change detection threshold. - * 0 is default, larger means fewer detected scene changes - * - encoding: set by user. - * - decoding: unused - */ - int scenechange_threshold; - - /** - * minimum lagrange multipler - * - encoding: set by user. - * - decoding: unused - */ - int lmin; - - /** - * maximum lagrange multipler - * - encoding: set by user. - * - decoding: unused - */ - int lmax; - - /** - * Palette control structure - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: set by user. - */ - struct AVPaletteControl *palctrl; - - /** - * noise reduction strength - * - encoding: set by user. - * - decoding: unused - */ - int noise_reduction; - - /** - * called at the beginning of a frame to get cr buffer for it. - * buffer type (size, hints) must be the same. lavc won't check it. - * lavc will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * if pic.data[0] == NULL must behave like get_buffer(). - * - encoding: unused - * - decoding: set by lavc, user can override - */ - int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * number of bits which should be loaded into the rc buffer before decoding starts - * - encoding: set by user. - * - decoding: unused - */ - int rc_initial_buffer_occupancy; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int inter_threshold; - - /** - * CODEC_FLAG2_*. - * - encoding: set by user. - * - decoding: set by user. - */ - int flags2; - - /** - * simulates errors in the bitstream to test error concealment. - * - encoding: set by user. - * - decoding: unused. - */ - int error_rate; - - /** - * MP3 antialias algorithm, see FF_AA_* below. - * - encoding: unused - * - decoding: set by user - */ - int antialias_algo; -#define FF_AA_AUTO 0 -#define FF_AA_FASTINT 1 //not implemented yet -#define FF_AA_INT 2 -#define FF_AA_FLOAT 3 - /** - * Quantizer noise shaping. - * - encoding: set by user - * - decoding: unused - */ - int quantizer_noise_shaping; - - /** - * Thread count. - * is used to decide how many independent tasks should be passed to execute() - * - encoding: set by user - * - decoding: set by user - */ - int thread_count; - - /** - * the codec may call this to execute several independent things. it will return only after - * finishing all tasks, the user may replace this with some multithreaded implementation, the - * default implementation will execute the parts serially - * @param count the number of things to execute - * - encoding: set by lavc, user can override - * - decoding: set by lavc, user can override - */ - int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); - - /** - * Thread opaque. - * can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() - */ - void *thread_opaque; - - /** - * Motion estimation threshold. under which no motion estimation is - * performed, but instead the user specified motion vectors are used - * - * - encoding: set by user - * - decoding: unused - */ - int me_threshold; - - /** - * Macroblock threshold. under which the user specified macroblock types will be used - * - encoding: set by user - * - decoding: unused - */ - int mb_threshold; - - /** - * precision of the intra dc coefficient - 8. - * - encoding: set by user - * - decoding: unused - */ - int intra_dc_precision; - - /** - * noise vs. sse weight for the nsse comparsion function. - * - encoding: set by user - * - decoding: unused - */ - int nsse_weight; - - /** - * number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: set by user - */ - int skip_top; - - /** - * number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: set by user - */ - int skip_bottom; - - /** - * profile - * - encoding: set by user - * - decoding: set by lavc - */ - int profile; -#define FF_PROFILE_UNKNOWN -99 - - /** - * level - * - encoding: set by user - * - decoding: set by lavc - */ - int level; -#define FF_LEVEL_UNKNOWN -99 - - /** - * low resolution decoding. 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: set by user - */ - int lowres; - - /** - * bitsream width / height. may be different from width/height if lowres - * or other things are used - * - encoding: unused - * - decoding: set by user before init if known, codec should override / dynamically change if needed - */ - int coded_width, coded_height; - - /** - * frame skip threshold - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_threshold; - - /** - * frame skip factor - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_factor; - - /** - * frame skip exponent - * - encoding: set by user - * - decoding: unused - */ - int frame_skip_exp; - - /** - * frame skip comparission function - * - encoding: set by user. - * - decoding: unused - */ - int frame_skip_cmp; - - /** - * border processing masking. raises the quantizer for mbs on the borders - * of the picture. - * - encoding: set by user - * - decoding: unused - */ - float border_masking; - - /** - * minimum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused - */ - int mb_lmin; - - /** - * maximum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused - */ - int mb_lmax; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int me_penalty_compensation; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_loop_filter; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_idct; - - /** - * - * - encoding: unused - * - decoding: set by user. - */ - enum AVDiscard skip_frame; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int bidir_refine; - - /** - * - * - encoding: set by user. - * - decoding: unused - */ - int brd_scale; - - /** - * constant rate factor - quality-based VBR - values ~correspond to qps - * - encoding: set by user. - * - decoding: unused - */ - float crf; - - /** - * constant quantization parameter rate control method - * - encoding: set by user. - * - decoding: unused - */ - int cqp; - - /** - * minimum gop size - * - encoding: set by user. - * - decoding: unused - */ - int keyint_min; - - /** - * number of reference frames - * - encoding: set by user. - * - decoding: unused - */ - int refs; - - /** - * chroma qp offset from luma - * - encoding: set by user. - * - decoding: unused - */ - int chromaoffset; - - /** - * influences how often b-frames are used - * - encoding: set by user. - * - decoding: unused - */ - int bframebias; - - /** - * trellis RD quantization - * - encoding: set by user. - * - decoding: unused - */ - int trellis; - - /** - * reduce fluctuations in qp (before curve compression) - * - encoding: set by user. - * - decoding: unused - */ - float complexityblur; - - /** - * in-loop deblocking filter alphac0 parameter - * alpha is in the range -6...6 - * - encoding: set by user. - * - decoding: unused - */ - int deblockalpha; - - /** - * in-loop deblocking filter beta parameter - * beta is in the range -6...6 - * - encoding: set by user. - * - decoding: unused - */ - int deblockbeta; - - /** - * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - * - encoding: set by user. - * - decoding: unused - */ - int partitions; -#define X264_PART_I4X4 0x001 /* Analyse i4x4 */ -#define X264_PART_I8X8 0x002 /* Analyse i8x8 (requires 8x8 transform) */ -#define X264_PART_P8X8 0x010 /* Analyse p16x8, p8x16 and p8x8 */ -#define X264_PART_P4X4 0x020 /* Analyse p8x4, p4x8, p4x4 */ -#define X264_PART_B8X8 0x100 /* Analyse b16x8, b8x16 and b8x8 */ - - /** - * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) - * - encoding: set by user. - * - decoding: unused - */ - int directpred; - - /** - * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC - * - encoding: set by user. - * - decoding: unused - */ - int cutoff; - - /** - * multiplied by qscale for each frame and added to scene_change_score - * - encoding: set by user. - * - decoding: unused - */ - int scenechange_factor; - - /** - * - * note: value depends upon the compare functin used for fullpel ME - * - encoding: set by user. - * - decoding: unused - */ - int mv0_threshold; - - /** - * adjusts sensitivity of b_frame_strategy 1 - * - encoding: set by user. - * - decoding: unused - */ - int b_sensitivity; - - /** - * - encoding: set by user. - * - decoding: unused - */ - int compression_level; -#define FF_COMPRESSION_DEFAULT -1 - - /** - * sets whether to use LPC mode - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. - */ - int use_lpc; - - /** - * LPC coefficient precision - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. - */ - int lpc_coeff_precision; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int min_prediction_order; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int max_prediction_order; - - /** - * search method for selecting prediction order - * - encoding: set by user. - * - decoding: unused. - */ - int prediction_order_method; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int min_partition_order; - - /** - * - encoding: set by user. - * - decoding: unused. - */ - int max_partition_order; - - /** - * GOP timecode frame start number, in non drop frame format - * - encoding: set by user. - * - decoding: unused. - */ - int64_t timecode_frame_start; -} AVCodecContext; - -/** - * AVCodec. - */ -typedef struct AVCodec { - const char *name; - enum CodecType type; - enum CodecID id; - int priv_data_size; - int (*init)(AVCodecContext *); - int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); - int (*close)(AVCodecContext *); - int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, - uint8_t *buf, int buf_size); - int capabilities; - struct AVCodec *next; - void (*flush)(AVCodecContext *); - const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0} - const enum PixelFormat *pix_fmts; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 -} AVCodec; - -/** - * four components are given, that's all. - * the last component is alpha - */ -typedef struct AVPicture { - uint8_t *data[4]; - int linesize[4]; ///< number of bytes per line -} AVPicture; - -/** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * this is totally broken, palette changes should be sent as AVPackets - */ -#define AVPALETTE_SIZE 1024 -#define AVPALETTE_COUNT 256 -typedef struct AVPaletteControl { - - /* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 */ - int palette_changed; - - /* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled */ - unsigned int palette[AVPALETTE_COUNT]; - -} AVPaletteControl attribute_deprecated; - -typedef struct AVSubtitleRect { - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; - uint16_t nb_colors; - int linesize; - uint32_t *rgba_palette; - uint8_t *bitmap; -} AVSubtitleRect; - -typedef struct AVSubtitle { - uint16_t format; /* 0 = graphics */ - uint32_t start_display_time; /* relative to packet pts, in ms */ - uint32_t end_display_time; /* relative to packet pts, in ms */ - uint32_t num_rects; - AVSubtitleRect *rects; -} AVSubtitle; - -extern AVCodec ac3_encoder; -extern AVCodec amr_nb_encoder; -extern AVCodec amr_wb_encoder; -extern AVCodec asv1_encoder; -extern AVCodec asv2_encoder; -extern AVCodec bmp_encoder; -extern AVCodec dvvideo_encoder; -extern AVCodec faac_encoder; -extern AVCodec ffv1_encoder; -extern AVCodec ffvhuff_encoder; -extern AVCodec flac_encoder; -extern AVCodec flashsv_encoder; -extern AVCodec flv_encoder; -extern AVCodec gif_encoder; -extern AVCodec h261_encoder; -extern AVCodec h263_encoder; -extern AVCodec h263p_encoder; -extern AVCodec h264_encoder; -extern AVCodec huffyuv_encoder; -extern AVCodec jpegls_encoder; -extern AVCodec libgsm_encoder; -extern AVCodec libgsm_ms_encoder; -extern AVCodec libtheora_encoder; -extern AVCodec ljpeg_encoder; -extern AVCodec mdec_encoder; -extern AVCodec mjpeg_encoder; -extern AVCodec mp2_encoder; -extern AVCodec mp3lame_encoder; -extern AVCodec mpeg1video_encoder; -extern AVCodec mpeg2video_encoder; -extern AVCodec mpeg4_encoder; -extern AVCodec msmpeg4v1_encoder; -extern AVCodec msmpeg4v2_encoder; -extern AVCodec msmpeg4v3_encoder; -extern AVCodec oggvorbis_encoder; -extern AVCodec pam_encoder; -extern AVCodec pbm_encoder; -extern AVCodec pgm_encoder; -extern AVCodec pgmyuv_encoder; -extern AVCodec png_encoder; -extern AVCodec ppm_encoder; -extern AVCodec rv10_encoder; -extern AVCodec rv20_encoder; -extern AVCodec snow_encoder; -extern AVCodec sonic_encoder; -extern AVCodec sonic_ls_encoder; -extern AVCodec svq1_encoder; -extern AVCodec targa_encoder; -extern AVCodec vcr1_encoder; -extern AVCodec vorbis_encoder; -extern AVCodec wmav1_encoder; -extern AVCodec wmav2_encoder; -extern AVCodec wmv1_encoder; -extern AVCodec wmv2_encoder; -extern AVCodec x264_encoder; -extern AVCodec xvid_encoder; -extern AVCodec zlib_encoder; -extern AVCodec zmbv_encoder; - -extern AVCodec aac_decoder; -extern AVCodec aasc_decoder; -extern AVCodec alac_decoder; -extern AVCodec amr_nb_decoder; -extern AVCodec amr_wb_decoder; -extern AVCodec asv1_decoder; -extern AVCodec asv2_decoder; -extern AVCodec avs_decoder; -extern AVCodec bmp_decoder; -extern AVCodec cavs_decoder; -extern AVCodec cinepak_decoder; -extern AVCodec cljr_decoder; -extern AVCodec cook_decoder; -extern AVCodec cscd_decoder; -extern AVCodec cyuv_decoder; -extern AVCodec dca_decoder; -extern AVCodec dnxhd_decoder; -extern AVCodec dsicinaudio_decoder; -extern AVCodec dsicinvideo_decoder; -extern AVCodec dvvideo_decoder; -extern AVCodec dxa_decoder; -extern AVCodec eightbps_decoder; -extern AVCodec ffv1_decoder; -extern AVCodec ffvhuff_decoder; -extern AVCodec flac_decoder; -extern AVCodec flashsv_decoder; -extern AVCodec flic_decoder; -extern AVCodec flv_decoder; -extern AVCodec fourxm_decoder; -extern AVCodec fraps_decoder; -extern AVCodec gif_decoder; -extern AVCodec h261_decoder; -extern AVCodec h263_decoder; -extern AVCodec h263i_decoder; -extern AVCodec h264_decoder; -extern AVCodec huffyuv_decoder; -extern AVCodec idcin_decoder; -extern AVCodec imc_decoder; -extern AVCodec indeo2_decoder; -extern AVCodec indeo3_decoder; -extern AVCodec interplay_dpcm_decoder; -extern AVCodec interplay_video_decoder; -extern AVCodec kmvc_decoder; -extern AVCodec libgsm_decoder; -extern AVCodec libgsm_ms_decoder; -extern AVCodec loco_decoder; -extern AVCodec mace3_decoder; -extern AVCodec mace6_decoder; -extern AVCodec mdec_decoder; -extern AVCodec mjpeg_decoder; -extern AVCodec mjpegb_decoder; -extern AVCodec mmvideo_decoder; -extern AVCodec mp2_decoder; -extern AVCodec mp3_decoder; -extern AVCodec mp3adu_decoder; -extern AVCodec mp3on4_decoder; -extern AVCodec mpc7_decoder; -extern AVCodec mpeg1video_decoder; -extern AVCodec mpeg2video_decoder; -extern AVCodec mpeg4_decoder; -extern AVCodec mpeg4aac_decoder; -extern AVCodec mpeg_xvmc_decoder; -extern AVCodec mpegvideo_decoder; -extern AVCodec msmpeg4v1_decoder; -extern AVCodec msmpeg4v2_decoder; -extern AVCodec msmpeg4v3_decoder; -extern AVCodec msrle_decoder; -extern AVCodec msvideo1_decoder; -extern AVCodec mszh_decoder; -extern AVCodec nuv_decoder; -extern AVCodec oggvorbis_decoder; -extern AVCodec png_decoder; -extern AVCodec qdm2_decoder; -extern AVCodec qdraw_decoder; -extern AVCodec qpeg_decoder; -extern AVCodec qtrle_decoder; -extern AVCodec ra_144_decoder; -extern AVCodec ra_288_decoder; -extern AVCodec roq_decoder; -extern AVCodec roq_dpcm_decoder; -extern AVCodec rpza_decoder; -extern AVCodec rv10_decoder; -extern AVCodec rv20_decoder; -extern AVCodec rv30_decoder; -extern AVCodec rv40_decoder; -extern AVCodec shorten_decoder; -extern AVCodec smackaud_decoder; -extern AVCodec smacker_decoder; -extern AVCodec smc_decoder; -extern AVCodec snow_decoder; -extern AVCodec sol_dpcm_decoder; -extern AVCodec sonic_decoder; -extern AVCodec sp5x_decoder; -extern AVCodec svq1_decoder; -extern AVCodec svq3_decoder; -extern AVCodec targa_decoder; -extern AVCodec theora_decoder; -extern AVCodec tiertexseqvideo_decoder; -extern AVCodec tiff_decoder; -extern AVCodec truemotion1_decoder; -extern AVCodec truemotion2_decoder; -extern AVCodec truespeech_decoder; -extern AVCodec tscc_decoder; -extern AVCodec tta_decoder; -extern AVCodec ulti_decoder; -extern AVCodec vc1_decoder; -extern AVCodec vcr1_decoder; -extern AVCodec vmdaudio_decoder; -extern AVCodec vmdvideo_decoder; -extern AVCodec vmnc_decoder; -extern AVCodec vorbis_decoder; -extern AVCodec vp3_decoder; -extern AVCodec vp5_decoder; -extern AVCodec vp6_decoder; -extern AVCodec vp6f_decoder; -extern AVCodec vqa_decoder; -extern AVCodec wavpack_decoder; -extern AVCodec wmav1_decoder; -extern AVCodec wmav2_decoder; -extern AVCodec wmv1_decoder; -extern AVCodec wmv2_decoder; -extern AVCodec wmv3_decoder; -extern AVCodec wnv1_decoder; -extern AVCodec ws_snd1_decoder; -extern AVCodec xan_dpcm_decoder; -extern AVCodec xan_wc3_decoder; -extern AVCodec xl_decoder; -extern AVCodec zlib_decoder; -extern AVCodec zmbv_decoder; - -/* pcm codecs */ -#define PCM_CODEC(id, name) \ -extern AVCodec name ## _decoder; \ -extern AVCodec name ## _encoder - -PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); -PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); -PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8); -PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be); -PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le); -PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be); -PCM_CODEC(CODEC_ID_PCM_S24DAUD, pcm_s24daud); -PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le); -PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be); -PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le); -PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); -PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be); -PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le); -PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); -PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); -PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); -PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); - -/* adpcm codecs */ - -PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); -PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx); -PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct); -PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea); -PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726); -PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3); -PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4); -PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws); -PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4); -PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg); -PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf); -PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa); -PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha); - -#undef PCM_CODEC - -/* dummy raw video codec */ -extern AVCodec rawvideo_decoder; -extern AVCodec rawvideo_encoder; - -/* the following codecs use external GPL libs */ -extern AVCodec dts_decoder; -extern AVCodec liba52_decoder; - -/* subtitles */ -extern AVCodec dvbsub_decoder; -extern AVCodec dvbsub_encoder; -extern AVCodec dvdsub_decoder; -extern AVCodec dvdsub_encoder; - -/* resample.c */ - -struct ReSampleContext; -struct AVResampleContext; - -typedef struct ReSampleContext ReSampleContext; - -ReSampleContext *audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate); -int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); -void audio_resample_close(ReSampleContext *s); - -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); -int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); -void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); -void av_resample_close(struct AVResampleContext *c); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* YUV420 format is assumed ! */ - -struct ImgReSampleContext attribute_deprecated; - -typedef struct ImgReSampleContext ImgReSampleContext attribute_deprecated; - -attribute_deprecated ImgReSampleContext *img_resample_init(int output_width, int output_height, - int input_width, int input_height); - -attribute_deprecated ImgReSampleContext *img_resample_full_init(int owidth, int oheight, - int iwidth, int iheight, - int topBand, int bottomBand, - int leftBand, int rightBand, - int padtop, int padbottom, - int padleft, int padright); - - -attribute_deprecated void img_resample(ImgReSampleContext *s, - AVPicture *output, const AVPicture *input); - -attribute_deprecated void img_resample_close(ImgReSampleContext *s); - -#endif - -/** - * Allocate memory for a picture. Call avpicture_free to free it. - * - * @param picture the picture to be filled in. - * @param pix_fmt the format of the picture. - * @param width the width of the picture. - * @param height the height of the picture. - * @return Zero if successful, a negative value if not. - */ -int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); - -/** - * Free a picture previously allocated by avpicture_alloc(). - * - * @param picture The AVPicture to be freed. - */ -void avpicture_free(AVPicture *picture); - -/** - * Fill in AVPicture's fields. - * The fields of the given AVPicture are filled in by using the 'ptr' address - * which points to the image data buffer. Depending on the specified picture - * format, one or multiple image data pointers and line sizes will be set. - * If a planar format is specified, several pointers will be set pointing to - * the different picture planes and the line sizes of the different planes - * will be stored in the lines_sizes array. - * - * @param picture AVPicture who's fields are to be filled in - * @param ptr Buffer which will contain or contains the actual image data - * @param pix_fmt The format in which the picture data is stored - * @param width The width of the image in pixels - * @param height The height of the image in pixels - * @return Size of the image data in bytes. - */ -int avpicture_fill(AVPicture *picture, uint8_t *ptr, - int pix_fmt, int width, int height); -int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, - unsigned char *dest, int dest_size); - -/** - * Calculate the size in bytes that a picture of the given width and height - * would occupy if stored in the given picture format. - * - * @param pix_fmt The given picture format - * @param width The width of the image - * @param height The height of the image - * @return Image data size in bytes - */ -int avpicture_get_size(int pix_fmt, int width, int height); -void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); -const char *avcodec_get_pix_fmt_name(int pix_fmt); -void avcodec_set_dimensions(AVCodecContext *s, int width, int height); -enum PixelFormat avcodec_get_pix_fmt(const char* name); -unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); - -#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ -#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ -#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ -#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ -#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ -#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ - -/** - * Computes what kind of losses will occur when converting from one specific - * pixel format to another. - * When converting from one pixel format to another, information loss may occur. - * For example, when converting from RGB24 to GRAY, the color information will - * be lost. Similarly, other losses occur when converting from some formats to - * other formats. These losses can involve loss of chroma, but also loss of - * resolution, loss of color depth, loss due to the color space conversion, loss - * of the alpha bits or loss due to color quantization. - * avcodec_get_fix_fmt_loss() informs you on the various types of losses which - * will occur when converting from one pixel format to another. - * - * @param[in] dst_pix_fmt Destination pixel format. - * @param[in] src_pix_fmt Source pixel format. - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur. - */ -int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, - int has_alpha); - -/** - * Finds the best pixel format to convert to given a certain source pixel - * format. When converting from one pixel format to another, information loss - * may occur. For example, when converting from RGB24 to GRAY, the color - * information will be lost. Similarly, other losses occur when converting from - * some formats to other formats. avcodec_find_best_pix_fmt() searches which of - * the given pixel formats should be used to undergo the least amount of losses. - * The pixel formats from which it choses one, are determined by the - * \p pix_fmt_mask parameter. - * - * @code - * src_pix_fmt = PIX_FMT_YUV420P; - * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); - * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); - * @endcode - * - * @param[in] pix_fmt_mask Bitmask determining which pixel format to choose from. - * @param[in] src_pix_fmt Source pixel format. - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. - * @return The best pixel format to convert to or -1 if none was found. - */ -int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt, - int has_alpha, int *loss_ptr); - -#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ -#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ - -/** - * Tell if an image really has transparent alpha values. - * @return ored mask of FF_ALPHA_xxx constants - */ -int img_get_alpha_info(const AVPicture *src, - int pix_fmt, int width, int height); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -/* convert among pixel formats */ -attribute_deprecated int img_convert(AVPicture *dst, int dst_pix_fmt, - const AVPicture *src, int pix_fmt, - int width, int height); -#endif - -/* deinterlace a picture */ -/* deinterlace - if not supported return -1 */ -int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -/* external high level API */ - -extern AVCodec *first_avcodec; - -/* returns LIBAVCODEC_VERSION_INT constant */ -unsigned avcodec_version(void); -/* returns LIBAVCODEC_BUILD constant */ -unsigned avcodec_build(void); - -/** - * Initializes libavcodec. - * - * @warning This function \e must be called before any other libavcodec - * function. - */ -void avcodec_init(void); - -void register_avcodec(AVCodec *format); - -/** - * Finds an encoder with a matching codec ID. - * - * @param id CodecID of the requested encoder. - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder(enum CodecID id); - -/** - * Finds an encoder with the specified name. - * - * @param name Name of the requested encoder. - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder_by_name(const char *name); - -/** - * Finds a decoder with a matching codec ID. - * - * @param id CodecID of the requested decoder. - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder(enum CodecID id); - -/** - * Finds an decoder with the specified name. - * - * @param name Name of the requested decoder. - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder_by_name(const char *name); -void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); - -/** - * Sets the fields of the given AVCodecContext to default values. - * - * @param s The AVCodecContext of which the fields should be set to default values. - */ -void avcodec_get_context_defaults(AVCodecContext *s); - -/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! - * we WILL change its arguments and name a few times! */ -void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType); - -/** - * Allocates an AVCodecContext and sets its fields to default values. The - * resulting struct can be deallocated by simply calling av_free(). - * - * @return An AVCodecContext filled with default values or NULL on failure. - * @see avcodec_get_context_defaults - */ -AVCodecContext *avcodec_alloc_context(void); - -/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! - * we WILL change its arguments and name a few times! */ -AVCodecContext *avcodec_alloc_context2(enum CodecType); - -/** - * Sets the fields of the given AVFrame to default values. - * - * @param pic The AVFrame of which the fields should be set to default values. - */ -void avcodec_get_frame_defaults(AVFrame *pic); - -/** - * Allocates an AVFrame and sets its fields to default values. The resulting - * struct can be deallocated by simply calling av_free(). - * - * @return An AVFrame filled with default values or NULL on failure. - * @see avcodec_get_frame_defaults - */ -AVFrame *avcodec_alloc_frame(void); - -int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); -int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); - -/** - * Checks if the given dimension of a picture is valid, meaning that all - * bytes of the picture can be addressed with a signed int. - * - * @param[in] w Width of the picture. - * @param[in] h Height of the picture. - * @return Zero if valid, a negative value if invalid. - */ -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); -enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); - -int avcodec_thread_init(AVCodecContext *s, int thread_count); -void avcodec_thread_free(AVCodecContext *s); -int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); -int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); -//FIXME func typedef - -/** - * Initializes the AVCodecContext to use the given AVCodec. Prior to using this - * function the context has to be allocated. - * - * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), - * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for - * retrieving a codec. - * - * @warning This function is not thread save! - * - * @code - * codec = avcodec_find_decoder(CODEC_ID_H264); - * if (!codec) - * exit(1); - * - * context = avcodec_alloc_context(); - * - * if (avcodec_open(context, codec) < 0) - * exit(1); - * @endcode - * - * @param avctx The context which will be setup to use the given codec. - * @param codec The codec to use within the context. - * @return Zero on success, a negative value on error. - * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder - */ -int avcodec_open(AVCodecContext *avctx, AVCodec *codec); - -/** - * @deprecated Use avcodec_decode_audio2() instead. - */ -attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Decodes an audio frame from \p buf into \p samples. - * The avcodec_decode_audio2() function decodes a frame of audio from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * audiocodec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in output buffer \p samples. If no frame - * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in \e bytes. - * - * @warning You \e must set \p frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio2(). - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx The codec context. - * @param[out] samples The output buffer. - * @param[in,out] frame_size_ptr The output buffer size in bytes. - * @param[in] buf The input buffer. - * @param[in] buf_size The input buffer size in bytes. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Decodes a video frame from \p buf into \p picture. - * The avcodec_decode_video() function decodes a frame of video from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * videocodec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in \p picture. - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx The codec context. - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf The input buffer. - * @param[in] buf_size The size of the input buffer in bytes. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is non zero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - uint8_t *buf, int buf_size); - -/* decode a subtitle message. return -1 if error, otherwise return the - *number of bytes used. If no subtitle could be decompressed, - *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ -int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size); -int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, - int *data_size_ptr, - uint8_t *buf, int buf_size); - -/** - * Encodes an audio frame from \p samples into \p buf. - * The avcodec_encode_audio() function encodes a frame of audio from the input - * buffer \p samples. To encode it, it makes use of the audiocodec which was - * coupled with \p avctx using avcodec_open(). The resulting encoded frame is - * stored in output buffer \p buf. - * - * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. - * - * @param avctx The codec context. - * @param[out] buf The output buffer. - * @param[in] buf_size The output buffer size. - * @param[in] samples The input buffer containing the samples. - * @return On error a negative value is returned, on succes zero or the number - * of bytes used from the input buffer. - */ -int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const short *samples); - -/** - * Encodes a video frame from \p pict into \p buf. - * The avcodec_encode_video() function encodes a frame of video from the input - * \p pict. To encode it, it makes use of the videocodec which was coupled with - * \p avctx using avcodec_open(). The resulting encoded bytes representing the - * frame are stored in the output buffer \p buf. The input picture should be - * stored using a specific format, namely \c avctx.pix_fmt. - * - * @param avctx The codec context. - * @param[out] buf The output buffer for the bitstream of encoded frame. - * @param[in] buf_size The size of the outputbuffer in bytes. - * @param[in] pict The input picture to encode. - * @return On error a negative value is returned, on success zero or the number - * of bytes used from the input buffer. - */ -int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict); -int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVSubtitle *sub); - -int avcodec_close(AVCodecContext *avctx); - -void avcodec_register_all(void); - -/** - * Flush buffers, should be called when seeking or when switching to a different stream. - */ -void avcodec_flush_buffers(AVCodecContext *avctx); - -void avcodec_default_free_buffers(AVCodecContext *s); - -/* misc useful functions */ - -/** - * Returns a single letter to describe the given picture type \p pict_type. - * - * @param[in] pict_type The picture type. - * @return A single character representing the picture type. - */ -char av_get_pict_type_char(int pict_type); - -/** - * Returns codec bits per sample. - * - * @param[in] codec_id The codec. - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum CodecID codec_id); - -/* frame parsing */ -typedef struct AVCodecParserContext { - void *priv_data; - struct AVCodecParser *parser; - int64_t frame_offset; /* offset of the current frame */ - int64_t cur_offset; /* current offset - (incremented by each av_parser_parse()) */ - int64_t last_frame_offset; /* offset of the last frame */ - /* video info */ - int pict_type; /* XXX: put it back in AVCodecContext */ - int repeat_pict; /* XXX: put it back in AVCodecContext */ - int64_t pts; /* pts of the current frame */ - int64_t dts; /* dts of the current frame */ - - /* private data */ - int64_t last_pts; - int64_t last_dts; - int fetch_timestamp; - -#define AV_PARSER_PTS_NB 4 - int cur_frame_start_index; - int64_t cur_frame_offset[AV_PARSER_PTS_NB]; - int64_t cur_frame_pts[AV_PARSER_PTS_NB]; - int64_t cur_frame_dts[AV_PARSER_PTS_NB]; - - int flags; -#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 -} AVCodecParserContext; - -typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ - int priv_data_size; - int (*parser_init)(AVCodecParserContext *s); - int (*parser_parse)(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size); - void (*parser_close)(AVCodecParserContext *s); - int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); - struct AVCodecParser *next; -} AVCodecParser; - -extern AVCodecParser *av_first_parser; - -void av_register_codec_parser(AVCodecParser *parser); -AVCodecParserContext *av_parser_init(int codec_id); -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts); -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -void av_parser_close(AVCodecParserContext *s); - -extern AVCodecParser aac_parser; -extern AVCodecParser ac3_parser; -extern AVCodecParser cavsvideo_parser; -extern AVCodecParser dca_parser; -extern AVCodecParser dvbsub_parser; -extern AVCodecParser dvdsub_parser; -extern AVCodecParser h261_parser; -extern AVCodecParser h263_parser; -extern AVCodecParser h264_parser; -extern AVCodecParser mjpeg_parser; -extern AVCodecParser mpeg4video_parser; -extern AVCodecParser mpegaudio_parser; -extern AVCodecParser mpegvideo_parser; -extern AVCodecParser pnm_parser; -extern AVCodecParser vc1_parser; - - -typedef struct AVBitStreamFilterContext { - void *priv_data; - struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; -} AVBitStreamFilterContext; - - -typedef struct AVBitStreamFilter { - const char *name; - int priv_data_size; - int (*filter)(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); - struct AVBitStreamFilter *next; -} AVBitStreamFilter; - -extern AVBitStreamFilter *av_first_bitstream_filter; - -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); - -extern AVBitStreamFilter dump_extradata_bsf; -extern AVBitStreamFilter remove_extradata_bsf; -extern AVBitStreamFilter noise_bsf; -extern AVBitStreamFilter mp3_header_compress_bsf; -extern AVBitStreamFilter mp3_header_decompress_bsf; -extern AVBitStreamFilter mjpega_dump_header_bsf; -extern AVBitStreamFilter imx_dump_header_bsf; - - -/* memory */ - -/** - * Reallocates the given block if it is not large enough, otherwise it - * does nothing. - * - * @see av_realloc - */ -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); - -/* for static data only */ - -/** - * Frees all static arrays and reset their pointers to 0. - * Call this function to release all statically allocated tables. - */ -attribute_deprecated void av_free_static(void); - -/** - * Allocation of static arrays. - * - * @warning Do not use for normal allocation. - * - * @param[in] size The amount of memory you need in bytes. - * @return Block of memory of the requested size. - */ -attribute_deprecated void *av_mallocz_static(unsigned int size); - -/** - * Copy image 'src' to 'dst'. - */ -void av_picture_copy(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -/** - * Crop image top and left side - */ -int av_picture_crop(AVPicture *dst, const AVPicture *src, - int pix_fmt, int top_band, int left_band); - -/** - * Pad image - */ -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -attribute_deprecated void img_copy(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height); - -attribute_deprecated int img_crop(AVPicture *dst, const AVPicture *src, - int pix_fmt, int top_band, int left_band); - -attribute_deprecated int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); -#endif - -extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -/* error handling */ -#if EINVAL > 0 -#define AVERROR(e) (-(e)) /**< returns a negative error code from a POSIX error code, to return from library functions. */ -#define AVUNERROR(e) (-(e)) /**< returns a POSIX error code from a library function error return value. */ -#else -/* some platforms have E* and errno already negated. */ -#define AVERROR(e) (e) -#define AVUNERROR(e) (e) -#endif -#define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */ -#define AVERROR_IO AVERROR(EIO) /**< i/o error */ -#define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< number syntax expected in filename */ -#define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */ -#define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */ -#define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */ -#define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< operation not supported */ - -#ifdef __cplusplus -} -#endif - -#endif /* AVCODEC_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/avformat.h b/src/ffmpeg/r8448/include/ffmpeg/avformat.h deleted file mode 100644 index eb8c4e1534..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/avformat.h +++ /dev/null @@ -1,888 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_H -#define AVFORMAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LIBAVFORMAT_VERSION_INT ((51<<16)+(11<<8)+0) -#define LIBAVFORMAT_VERSION 51.11.0 -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) - -#include -#include /* FILE */ -#include "avcodec.h" - -#include "avio.h" - -/* packet functions */ - -typedef struct AVPacket { - int64_t pts; ///< presentation time stamp in time_base units - int64_t dts; ///< decompression time stamp in time_base units - uint8_t *data; - int size; - int stream_index; - int flags; - int duration; ///< presentation duration in time_base units (0 if not available) - void (*destruct)(struct AVPacket *); - void *priv; - int64_t pos; ///< byte position in stream, -1 if unknown -} AVPacket; -#define PKT_FLAG_KEY 0x0001 - -void av_destruct_packet_nofree(AVPacket *pkt); - -/** - * Default packet destructor. - */ -void av_destruct_packet(AVPacket *pkt); - -/* initialize optional fields of a packet */ -static inline void av_init_packet(AVPacket *pkt) -{ - pkt->pts = AV_NOPTS_VALUE; - pkt->dts = AV_NOPTS_VALUE; - pkt->pos = -1; - pkt->duration = 0; - pkt->flags = 0; - pkt->stream_index = 0; - pkt->destruct= av_destruct_packet_nofree; -} - -/** - * Allocate the payload of a packet and intialized its fields to default values. - * - * @param pkt packet - * @param size wanted payload size - * @return 0 if OK. AVERROR_xxx otherwise. - */ -int av_new_packet(AVPacket *pkt, int size); - -/** - * Allocate and read the payload of a packet and intialized its fields to default values. - * - * @param pkt packet - * @param size wanted payload size - * @return >0 (read size) if OK. AVERROR_xxx otherwise. - */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); - -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated - */ -int av_dup_packet(AVPacket *pkt); - -/** - * Free a packet - * - * @param pkt packet to free - */ -static inline void av_free_packet(AVPacket *pkt) -{ - if (pkt && pkt->destruct) { - pkt->destruct(pkt); - } -} - -/*************************************************/ -/* fractional numbers for exact pts handling */ - -/* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den */ -typedef struct AVFrac { - int64_t val, num, den; -} AVFrac attribute_deprecated; - -/*************************************************/ -/* input/output formats */ - -struct AVCodecTag; - -struct AVFormatContext; - -/** this structure contains the data a format has to probe a file */ -typedef struct AVProbeData { - const char *filename; - unsigned char *buf; - int buf_size; -} AVProbeData; - -#define AVPROBE_SCORE_MAX 100 ///< max score, half of that is used for file extension based detection - -typedef struct AVFormatParameters { - AVRational time_base; - int sample_rate; - int channels; - int width; - int height; - enum PixelFormat pix_fmt; - int channel; /**< used to select dv channel */ -#if LIBAVFORMAT_VERSION_INT < (52<<16) - const char *device; /**< video, audio or DV device */ -#endif - const char *standard; /**< tv standard, NTSC, PAL, SECAM */ - int mpeg2ts_raw:1; /**< force raw MPEG2 transport stream output, if possible */ - int mpeg2ts_compute_pcr:1; /**< compute exact PCR for each transport - stream packet (only meaningful if - mpeg2ts_raw is TRUE */ - int initial_pause:1; /**< do not begin to play the stream - immediately (RTSP only) */ - int prealloced_context:1; - enum CodecID video_codec_id; - enum CodecID audio_codec_id; -} AVFormatParameters; - -//! demuxer will use url_fopen, no opened file should be provided by the caller -#define AVFMT_NOFILE 0x0001 -#define AVFMT_NEEDNUMBER 0x0002 /**< needs '%d' in filename */ -#define AVFMT_SHOW_IDS 0x0008 /**< show format stream IDs numbers */ -#define AVFMT_RAWPICTURE 0x0020 /**< format wants AVPicture structure for - raw picture data */ -#define AVFMT_GLOBALHEADER 0x0040 /**< format wants global header */ -#define AVFMT_NOTIMESTAMPS 0x0080 /**< format doesnt need / has any timestamps */ -#define AVFMT_GENERIC_INDEX 0x0100 /**< use generic index building code */ - -typedef struct AVOutputFormat { - const char *name; - const char *long_name; - const char *mime_type; - const char *extensions; /**< comma separated filename extensions */ - /** size of private data so that it can be allocated in the wrapper */ - int priv_data_size; - /* output support */ - enum CodecID audio_codec; /**< default audio codec */ - enum CodecID video_codec; /**< default video codec */ - int (*write_header)(struct AVFormatContext *); - int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); - int (*write_trailer)(struct AVFormatContext *); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ - int flags; - /** currently only used to set pixel format if not YUV420P */ - int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); - int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush); - - /** - * list of supported codec_id-codec_tag pairs, ordered by "better choice first" - * the arrays are all CODEC_ID_NONE terminated - */ - const struct AVCodecTag **codec_tag; - - /* private fields */ - struct AVOutputFormat *next; -} AVOutputFormat; - -typedef struct AVInputFormat { - const char *name; - const char *long_name; - /** size of private data so that it can be allocated in the wrapper */ - int priv_data_size; - /** tell if a given file has a chance of being parsing by this format */ - int (*read_probe)(AVProbeData *); - /** read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non NULL contains - additionnal paramters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. */ - int (*read_header)(struct AVFormatContext *, - AVFormatParameters *ap); - /** read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. */ - int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); - /** close the stream. The AVFormatContext and AVStreams are not - freed by this function */ - int (*read_close)(struct AVFormatContext *); - /** - * seek to a given timestamp relative to the frames in - * stream component stream_index - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available - */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); - /** - * gets the next timestamp in AV_TIME_BASE units. - */ - int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, - int64_t *pos, int64_t pos_limit); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */ - int flags; - /** if extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough */ - const char *extensions; - /** general purpose read only value that the format can use */ - int value; - - /** start/resume playing - only meaningful if using a network based format - (RTSP) */ - int (*read_play)(struct AVFormatContext *); - - /** pause playing - only meaningful if using a network based format - (RTSP) */ - int (*read_pause)(struct AVFormatContext *); - - const struct AVCodecTag **codec_tag; - - /* private fields */ - struct AVInputFormat *next; -} AVInputFormat; - -typedef struct AVIndexEntry { - int64_t pos; - int64_t timestamp; -#define AVINDEX_KEYFRAME 0x0001 - int flags:2; - int size:30; //yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align) - int min_distance; /**< min distance between this and the previous keyframe, used to avoid unneeded searching */ -} AVIndexEntry; - -typedef struct AVStream { - int index; /**< stream index in AVFormatContext */ - int id; /**< format specific stream id */ - AVCodecContext *codec; /**< codec context */ - /** - * real base frame rate of the stream. - * this is the lowest framerate with which all timestamps can be - * represented accurately (its the least common multiple of all - * framerates in the stream), Note, this value is just a guess! - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 - */ - AVRational r_frame_rate; - void *priv_data; -#if LIBAVFORMAT_VERSION_INT < (52<<16) - /* internal data used in av_find_stream_info() */ - int64_t codec_info_duration; - int codec_info_nb_frames; -#endif - /** encoding: PTS generation when outputing stream */ - AVFrac pts; - - /** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - */ - AVRational time_base; - int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ - /* ffmpeg.c private use */ - int stream_copy; /**< if set, just copy stream */ - enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed - //FIXME move stuff to a flags field? - /** quality, as it has been removed from AVCodecContext and put in AVVideoFrame - * MN:dunno if thats the right place, for it */ - float quality; - /** decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. */ - int64_t start_time; - /** decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. */ - int64_t duration; - - char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */ - - /* av_read_frame() support */ - int need_parsing; ///< 1->full parsing needed, 2->only parse headers dont repack - struct AVCodecParserContext *parser; - - int64_t cur_dts; - int last_IP_duration; - int64_t last_IP_pts; - /* av_seek_frame() support */ - AVIndexEntry *index_entries; /**< only used if the format does not - support seeking natively */ - int nb_index_entries; - unsigned int index_entries_allocated_size; - - int64_t nb_frames; ///< number of frames in this stream if known or 0 - -#define MAX_REORDER_DELAY 4 - int64_t pts_buffer[MAX_REORDER_DELAY+1]; -} AVStream; - -#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present - (streams are added dynamically) */ - -#define MAX_STREAMS 20 - -/* format I/O context */ -typedef struct AVFormatContext { - const AVClass *av_class; /**< set by av_alloc_format_context */ - /* can only be iformat or oformat, not both at the same time */ - struct AVInputFormat *iformat; - struct AVOutputFormat *oformat; - void *priv_data; - ByteIOContext pb; - unsigned int nb_streams; - AVStream *streams[MAX_STREAMS]; - char filename[1024]; /**< input or output filename */ - /* stream info */ - int64_t timestamp; - char title[512]; - char author[512]; - char copyright[512]; - char comment[512]; - char album[512]; - int year; /**< ID3 year, 0 if none */ - int track; /**< track number, 0 if none */ - char genre[32]; /**< ID3 genre */ - - int ctx_flags; /**< format specific flags, see AVFMTCTX_xx */ - /* private data for pts handling (do not modify directly) */ - /** This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in mpeg - streams */ - struct AVPacketList *packet_buffer; - - /** decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - it is deduced from the AVStream values. */ - int64_t start_time; - /** decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. */ - int64_t duration; - /** decoding: total file size. 0 if unknown */ - int64_t file_size; - /** decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as ffmpeg can compute it automatically. */ - int bit_rate; - - /* av_read_frame() support */ - AVStream *cur_st; - const uint8_t *cur_ptr; - int cur_len; - AVPacket cur_pkt; - - /* av_seek_frame() support */ - int64_t data_offset; /** offset of the first packet */ - int index_built; - - int mux_rate; - int packet_size; - int preload; - int max_delay; - -#define AVFMT_NOOUTPUTLOOP -1 -#define AVFMT_INFINITEOUTPUTLOOP 0 - /** number of times to loop output in formats that support it */ - int loop_output; - - int flags; -#define AVFMT_FLAG_GENPTS 0x0001 ///< generate pts if missing even if it requires parsing future frames -#define AVFMT_FLAG_IGNIDX 0x0002 ///< ignore index - - int loop_input; - /** decoding: size of data to probe; encoding unused */ - unsigned int probesize; - - /** - * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() - */ - int max_analyze_duration; - - const uint8_t *key; - int keylen; -} AVFormatContext; - -typedef struct AVPacketList { - AVPacket pkt; - struct AVPacketList *next; -} AVPacketList; - -extern AVInputFormat *first_iformat; -extern AVOutputFormat *first_oformat; - -enum CodecID av_guess_image2_codec(const char *filename); - -/* XXX: use automatic init with either ELF sections or C file parser */ -/* modules */ - -#include "rtp.h" - -#include "rtsp.h" - -/* utils.c */ -void av_register_input_format(AVInputFormat *format); -void av_register_output_format(AVOutputFormat *format); -AVOutputFormat *guess_stream_format(const char *short_name, - const char *filename, const char *mime_type); -AVOutputFormat *guess_format(const char *short_name, - const char *filename, const char *mime_type); - -/** - * Guesses the codec id based upon muxer and filename. - */ -enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, enum CodecType type); - -/** - * Send a nice hexadecimal dump of a buffer to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump(FILE *f, uint8_t *buf, int size); - -/** - * Send a nice hexadecimal dump of a buffer to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log - */ -void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); - -/** - * Send a nice dump of a packet to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param pkt packet to dump - * @param dump_payload true if the payload must be displayed too - */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); - -/** - * Send a nice dump of a packet to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param pkt packet to dump - * @param dump_payload true if the payload must be displayed too - */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); - -void av_register_all(void); - -/** codec tag <-> codec id */ -enum CodecID av_codec_get_id(const struct AVCodecTag **tags, unsigned int tag); -unsigned int av_codec_get_tag(const struct AVCodecTag **tags, enum CodecID id); - -/* media file input */ - -/** - * finds AVInputFormat based on input format's short name. - */ -AVInputFormat *av_find_input_format(const char *short_name); - -/** - * Guess file format. - * - * @param is_opened whether the file is already opened, determines whether - * demuxers with or without AVFMT_NOFILE are probed - */ -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); - -/** - * Allocates all the structures needed to read an input stream. - * This does not open the needed codecs for decoding the stream[s]. - */ -int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, - AVInputFormat *fmt, AVFormatParameters *ap); - -/** - * Open a media file as input. The codec are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr the opened media file handle is put here - * @param filename filename to open. - * @param fmt if non NULL, force the file format to use - * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. - */ -int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, - AVInputFormat *fmt, - int buf_size, - AVFormatParameters *ap); -/** no av_open for output, so applications will need this: */ -AVFormatContext *av_alloc_format_context(void); - -/** - * Read packets of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also computes the real frame rate in case of mpeg2 repeat - * frame mode. - * The logical file position is not changed by this function; - * examined packets may be buffered for later processing. - * - * @param ic media file handle - * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need - */ -int av_find_stream_info(AVFormatContext *ic); - -/** - * Read a transport packet from a media file. - * - * This function is absolete and should never be used. - * Use av_read_frame() instead. - * - * @param s media file handle - * @param pkt is filled - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_read_packet(AVFormatContext *s, AVPacket *pkt); - -/** - * Return the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.timebase units (and guessed if the format cannot - * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 if error or end of file. - */ -int av_read_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Seek to the key frame at timestamp. - * 'timestamp' in 'stream_index'. - * @param stream_index If stream_index is (-1), a default - * stream is selected, and timestamp is automatically converted - * from AV_TIME_BASE units to the stream specific time_base. - * @param timestamp timestamp in AVStream.time_base units - * or if there is no stream specified then in AV_TIME_BASE units - * @param flags flags which select direction and seeking mode - * @return >= 0 on success - */ -int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); - -/** - * start playing a network based stream (e.g. RTSP stream) at the - * current position - */ -int av_read_play(AVFormatContext *s); - -/** - * Pause a network based stream (e.g. RTSP stream). - * - * Use av_read_play() to resume it. - */ -int av_read_pause(AVFormatContext *s); - -/** - * Close a media file (but not its codecs). - * - * @param s media file handle - */ -void av_close_input_file(AVFormatContext *s); - -/** - * Add a new stream to a media file. - * - * Can only be called in the read_header() function. If the flag - * AVFMTCTX_NOHEADER is in the format context, then new streams - * can be added in read_packet too. - * - * @param s media file handle - * @param id file format dependent stream id - */ -AVStream *av_new_stream(AVFormatContext *s, int id); - -/** - * Set the pts for a given stream. - * - * @param s stream - * @param pts_wrap_bits number of bits effectively used by the pts - * (used for wrap control, 33 is the value for MPEG) - * @param pts_num numerator to convert to seconds (MPEG: 1) - * @param pts_den denominator to convert to seconds (MPEG: 90000) - */ -void av_set_pts_info(AVStream *s, int pts_wrap_bits, - int pts_num, int pts_den); - -#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward -#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes -#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non keyframes - -int av_find_default_stream_index(AVFormatContext *s); - -/** - * Gets the index for a specific timestamp. - * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond to - * the timestamp which is <= the requested one, if backward is 0 - * then it will be >= - * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise - * @return < 0 if no such timestamp could be found - */ -int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); - -/** - * Add a index entry into a sorted list updateing if it is already there. - * - * @param timestamp timestamp in the timebase of the given stream - */ -int av_add_index_entry(AVStream *st, - int64_t pos, int64_t timestamp, int size, int distance, int flags); - -/** - * Does a binary search using av_index_search_timestamp() and AVCodec.read_timestamp(). - * this isnt supposed to be called directly by a user application, but by demuxers - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags); - -/** - * Updates cur_dts of all streams based on given timestamp and AVStream. - * - * Stream ref_st unchanged, others set cur_dts in their native timebase - * only needed for timestamp wrapping or if (dts not set and pts!=dts) - * @param timestamp new dts expressed in time_base of param ref_st - * @param ref_st reference stream giving time_base of param timestamp - */ -void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); - -/** - * Does a binary search using read_timestamp(). - * this isnt supposed to be called directly by a user application, but by demuxers - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); - -/** media file output */ -int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); - -/** - * allocate the stream private data and write the stream header to an - * output media file - * - * @param s media file handle - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_write_header(AVFormatContext *s); - -/** - * Write a packet to an output media file. - * - * The packet shall contain one audio or video frame. - * The packet must be correctly interleaved according to the container specification, - * if not then av_interleaved_write_frame must be used - * - * @param s media file handle - * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... - * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. - */ -int av_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Writes a packet to an output media file ensuring correct interleaving. - * - * The packet must contain one audio or video frame. - * If the packets are already correctly interleaved the application should - * call av_write_frame() instead as its slightly faster, its also important - * to keep in mind that completly non interleaved input will need huge amounts - * of memory to interleave with this, so its prefereable to interleave at the - * demuxer level - * - * @param s media file handle - * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... - * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. - */ -int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Interleave a packet per DTS in an output media file. - * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this function, - * so they cannot be used after it, note calling av_free_packet() on them is still safe. - * - * @param s media file handle - * @param out the interleaved packet will be output here - * @param in the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occured - */ -int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); - -/** - * @brief Write the stream trailer to an output media file and - * free the file private data. - * - * @param s media file handle - * @return 0 if OK. AVERROR_xxx if error. - */ -int av_write_trailer(AVFormatContext *s); - -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); - -/** - * parses width and height out of string str. - */ -int parse_image_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Converts frame rate from string to a fraction. - */ -int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg); - -/** - * Converts date string to number of seconds since Jan 1st, 1970. - * - * @code - * Syntax: - * - If not a duration: - * [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]} - * Time is localtime unless Z is suffixed to the end. In this case GMT - * Return the date in micro seconds since 1970 - * - * - If a duration: - * HH[:MM[:SS[.m...]]] - * S+[.m...] - * @endcode - */ -int64_t parse_date(const char *datestr, int duration); - -int64_t av_gettime(void); - -/* ffm specific for ffserver */ -#define FFM_PACKET_SIZE 4096 -offset_t ffm_read_write_index(int fd); -void ffm_write_write_index(int fd, offset_t pos); -void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size); - -/** - * Attempts to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. - */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); - -/** - * Returns in 'buf' the path with '%d' replaced by number. - - * Also handles the '%0nd' format where 'n' is the total number - * of digits and '%%'. - * - * @param buf destination buffer - * @param buf_size destination buffer size - * @param path numbered sequence string - * @number frame number - * @return 0 if OK, -1 if format error. - */ -int av_get_frame_filename(char *buf, int buf_size, - const char *path, int number); - -/** - * Check whether filename actually is a numbered sequence generator. - * - * @param filename possible numbered sequence string - * @return 1 if a valid numbered sequence string, 0 otherwise. - */ -int av_filename_number_test(const char *filename); - -/* grab specific */ -int video_grab_init(void); -int audio_init(void); - -/* DV1394 */ -int dv1394_init(void); -int dc1394_init(void); - -#ifdef HAVE_AV_CONFIG_H - -#include "os_support.h" - -int strstart(const char *str, const char *val, const char **ptr); -int stristart(const char *str, const char *val, const char **ptr); -void pstrcpy(char *buf, int buf_size, const char *str); -char *pstrcat(char *buf, int buf_size, const char *s); - -void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem); - -#ifdef __GNUC__ -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - typeof(tab) _tab = (tab);\ - typeof(elem) _elem = (elem);\ - (void)sizeof(**_tab == _elem); /* check that types are compatible */\ - __dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\ -} while(0) -#else -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - __dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\ -} while(0) -#endif - -time_t mktimegm(struct tm *tm); -struct tm *brktimegm(time_t secs, struct tm *tm); -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt); - -struct in_addr; -int resolve_host(struct in_addr *sin_addr, const char *hostname); - -void url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); - -int match_ext(const char *filename, const char *extensions); - -#endif /* HAVE_AV_CONFIG_H */ - -#ifdef __cplusplus -} -#endif - -#endif /* AVFORMAT_H */ - diff --git a/src/ffmpeg/r8448/include/ffmpeg/avio.h b/src/ffmpeg/r8448/include/ffmpeg/avio.h deleted file mode 100644 index be78c9a7b4..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/avio.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * unbuffered io for ffmpeg system - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVIO_H -#define AVIO_H - -/* output byte stream handling */ - -typedef int64_t offset_t; - -/* unbuffered I/O */ - -struct URLContext { - struct URLProtocol *prot; - int flags; - int is_streamed; /**< true if streamed (no seek possible), default = false */ - int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ - void *priv_data; -#if LIBAVFORMAT_VERSION_INT >= (52<<16) - char *filename; /**< specified filename */ -#else - char filename[1]; /**< specified filename */ -#endif -}; - -typedef struct URLContext URLContext; - -typedef struct URLPollEntry { - URLContext *handle; - int events; - int revents; -} URLPollEntry; - -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 - -typedef int URLInterruptCB(void); - -int url_open(URLContext **h, const char *filename, int flags); -int url_read(URLContext *h, unsigned char *buf, int size); -int url_write(URLContext *h, unsigned char *buf, int size); -offset_t url_seek(URLContext *h, offset_t pos, int whence); -int url_close(URLContext *h); -int url_exist(const char *filename); -offset_t url_filesize(URLContext *h); - -/** - * Return the maximum packet size associated to packetized file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param h file handle - * @return maximum packet size in bytes - */ -int url_get_max_packet_size(URLContext *h); -void url_get_filename(URLContext *h, char *buf, int buf_size); - -/** - * the callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned - * in this case by the interrupted function. 'NULL' means no interrupt - * callback is given. i - */ -void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); - -/* not implemented */ -int url_poll(URLPollEntry *poll_table, int n, int timeout); - -/** - * passing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere, supporting this is optional - * if its not supprted then the seek function will return <0 - */ -#define AVSEEK_SIZE 0x10000 - -typedef struct URLProtocol { - const char *name; - int (*url_open)(URLContext *h, const char *filename, int flags); - int (*url_read)(URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, unsigned char *buf, int size); - offset_t (*url_seek)(URLContext *h, offset_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; -} URLProtocol; - -extern URLProtocol *first_protocol; -extern URLInterruptCB *url_interrupt_cb; - -int register_protocol(URLProtocol *protocol); - -typedef struct { - unsigned char *buffer; - int buffer_size; - unsigned char *buf_ptr, *buf_end; - void *opaque; - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - offset_t (*seek)(void *opaque, offset_t offset, int whence); - offset_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ - int is_streamed; - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; ///< contains the error code or 0 if no error happened -} ByteIOContext; - -int init_put_byte(ByteIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - offset_t (*seek)(void *opaque, offset_t offset, int whence)); - -void put_byte(ByteIOContext *s, int b); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); - -void put_strz(ByteIOContext *s, const char *buf); - -offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence); -void url_fskip(ByteIOContext *s, offset_t offset); -offset_t url_ftell(ByteIOContext *s); -offset_t url_fsize(ByteIOContext *s); -int url_feof(ByteIOContext *s); -int url_ferror(ByteIOContext *s); - -#define URL_EOF (-1) -/** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); - -/** @warning currently size is limited */ -#ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -#else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); -#endif - -/** @note unlike fgets, the EOL character is not returned and a whole - line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); - -void put_flush_packet(ByteIOContext *s); - -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** @note return 0 if EOF, so you cannot use it if EOF handling is - necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); - -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); - -static inline int url_is_streamed(ByteIOContext *s) -{ - return s->is_streamed; -} - -int url_fdopen(ByteIOContext *s, URLContext *h); - -/** @warning must be called before any I/O */ -int url_setbufsize(ByteIOContext *s, int buf_size); - -/** @note when opened as read/write, the buffers are only used for - reading */ -int url_fopen(ByteIOContext *s, const char *filename, int flags); -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); - -/** - * Return the maximum packet size associated to packetized buffered file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param h buffered file handle - * @return maximum packet size in bytes - */ -int url_fget_max_packet_size(ByteIOContext *s); - -int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags); - -/** return the written or read size */ -int url_close_buf(ByteIOContext *s); - -/** - * Open a write only memory stream. - * - * @param s new IO context - * @return zero if no error. - */ -int url_open_dyn_buf(ByteIOContext *s); - -/** - * Open a write only packetized memory stream with a maximum packet - * size of 'max_packet_size'. The stream is stored in a memory buffer - * with a big endian 4 byte header giving the packet size in bytes. - * - * @param s new IO context - * @param max_packet_size maximum packet size (must be > 0) - * @return zero if no error. - */ -int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size); - -/** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * @param s IO context - * @param pointer to a byte buffer - * @return the length of the byte buffer - */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); - -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); - -/* file.c */ -extern URLProtocol file_protocol; -extern URLProtocol pipe_protocol; - -/* udp.c */ -extern URLProtocol udp_protocol; -int udp_set_remote_url(URLContext *h, const char *uri); -int udp_get_local_port(URLContext *h); -int udp_get_file_handle(URLContext *h); - -/* tcp.c */ -extern URLProtocol tcp_protocol; - -/* http.c */ -extern URLProtocol http_protocol; - -#endif - diff --git a/src/ffmpeg/r8448/include/ffmpeg/avutil.h b/src/ffmpeg/r8448/include/ffmpeg/avutil.h deleted file mode 100644 index 32bc40bfbf..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/avutil.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_H -#define AVUTIL_H - -/** - * @file avutil.h - * external api header. - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBAVUTIL_VERSION_INT ((49<<16)+(4<<8)+0) -#define LIBAVUTIL_VERSION 49.4.0 -#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT - -#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) - - -#include "common.h" -#include "mathematics.h" -#include "rational.h" -#include "integer.h" -#include "intfloat_readwrite.h" -#include "log.h" - -/** - * Pixel format. Notes: - * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - */ -enum PixelFormat { - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 0 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian - PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions -}; - -#ifdef WORDS_BIGENDIAN -#define PIX_FMT_RGBA PIX_FMT_RGB32_1 -#define PIX_FMT_BGRA PIX_FMT_BGR32_1 -#define PIX_FMT_ARGB PIX_FMT_RGB32 -#define PIX_FMT_ABGR PIX_FMT_BGR32 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE -#else -#define PIX_FMT_RGBA PIX_FMT_BGR32 -#define PIX_FMT_BGRA PIX_FMT_RGB32 -#define PIX_FMT_ARGB PIX_FMT_BGR32_1 -#define PIX_FMT_ABGR PIX_FMT_RGB32_1 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 -#define PIX_FMT_RGBA32 PIX_FMT_RGB32 -#define PIX_FMT_YUV422 PIX_FMT_YUYV422 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* AVUTIL_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/common.h b/src/ffmpeg/r8448/include/ffmpeg/common.h deleted file mode 100644 index 07c4276faf..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/common.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file common.h - * common internal and external api header. - */ - -#ifndef COMMON_H -#define COMMON_H - -#if 0 -#include -#endif - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "config.h" - -# include -# include -# include -# include -# include -# include -# include -#endif /* HAVE_AV_CONFIG_H */ - -#ifndef av_always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define av_always_inline __attribute__((always_inline)) inline -# define av_noinline __attribute__((noinline)) -#else -# define av_always_inline inline -# define av_noinline -#endif -#endif - -#ifdef HAVE_AV_CONFIG_H -# include "internal.h" -#endif /* HAVE_AV_CONFIG_H */ - -#ifndef attribute_deprecated -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_deprecated __attribute__((deprecated)) -#else -# define attribute_deprecated -#endif -#endif - -#include "mem.h" - -//rounded divison & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) -/* assume b>0 */ -#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) - -/* misc math functions */ -extern const uint8_t ff_log2_tab[256]; - -static inline int av_log2(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xffff0000) { - v >>= 16; - n += 16; - } - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -static inline int av_log2_16bit(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -/* median of 3 */ -static inline int mid_pred(int a, int b, int c) -{ -#ifdef HAVE_CMOV - int i=b; - asm volatile( - "cmp %2, %1 \n\t" - "cmovg %1, %0 \n\t" - "cmovg %2, %1 \n\t" - "cmp %3, %1 \n\t" - "cmovl %3, %1 \n\t" - "cmp %1, %0 \n\t" - "cmovg %1, %0 \n\t" - :"+&r"(i), "+&r"(a) - :"r"(b), "r"(c) - ); - return i; -#elif 0 - int t= (a-b)&((a-b)>>31); - a-=t; - b+=t; - b-= (b-c)&((b-c)>>31); - b+= (a-b)&((a-b)>>31); - - return b; -#else - if(a>b){ - if(c>b){ - if(c>a) b=a; - else b=c; - } - }else{ - if(b>c){ - if(c>a) b=c; - else b=a; - } - } - return b; -#endif -} - -/** - * clip a signed integer value into the amin-amax range - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static inline int av_clip(int a, int amin, int amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * clip a signed integer value into the 0-255 range - * @param a value to clip - * @return clipped value - */ -static inline uint8_t av_clip_uint8(int a) -{ - if (a&(~255)) return (-a)>>31; - else return a; -} - -/* math */ -int64_t ff_gcd(int64_t a, int64_t b); - -/** - * converts fourcc string to int - */ -static inline int ff_get_fourcc(const char *s){ -#ifdef HAVE_AV_CONFIG_H - assert( strlen(s)==4 ); -#endif - - return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); -} - -#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) -#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) - -/*! - * \def GET_UTF8(val, GET_BYTE, ERROR) - * converts a utf-8 character (up to 4 bytes long) to its 32-bit ucs-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * ucs-4 character and should be a left value. - * \param GET_BYTE gets utf-8 encoded bytes from any proper source. It can be - * a function or a statement whose return value or evaluated value is of type - * uint8_t. It will be executed up to 4 times for values in the valid utf-8 range, - * and up to 7 times in the general case. - * \param ERROR action that should be taken when an invalid utf-8 byte is returned - * from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. - */ -#define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ - {\ - int ones= 7 - av_log2(val ^ 255);\ - if(ones==1)\ - ERROR\ - val&= 127>>ones;\ - while(--ones > 0){\ - int tmp= GET_BYTE - 128;\ - if(tmp>>6)\ - ERROR\ - val= (val<<6) + tmp;\ - }\ - } - -/*! - * \def PUT_UTF8(val, tmp, PUT_BYTE) - * converts a 32-bit unicode character to its utf-8 encoded form (up to 4 bytes long). - * \param val is an input only argument and should be of type uint32_t. It holds - * a ucs4 encoded unicode character that is to be converted to utf-8. If - * val is given as a function it's executed only once. - * \param tmp is a temporary variable and should be of type uint8_t. It - * represents an intermediate value during conversion that is to be - * outputted by PUT_BYTE. - * \param PUT_BYTE writes the converted utf-8 bytes to any proper destination. - * It could be a function or a statement, and uses tmp as the input byte. - * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be - * executed up to 4 times for values in the valid utf-8 range and up to - * 7 times in the general case, depending on the length of the converted - * unicode character. - */ -#define PUT_UTF8(val, tmp, PUT_BYTE)\ - {\ - int bytes, shift;\ - uint32_t in = val;\ - if (in < 0x80) {\ - tmp = in;\ - PUT_BYTE\ - } else {\ - bytes = (av_log2(in) + 4) / 5;\ - shift = (bytes - 1) * 6;\ - tmp = (256 - (256 >> bytes)) | (in >> shift);\ - PUT_BYTE\ - while (shift >= 6) {\ - shift -= 6;\ - tmp = 0x80 | ((in >> shift) & 0x3f);\ - PUT_BYTE\ - }\ - }\ - } - -#if defined(ARCH_X86) || defined(ARCH_POWERPC) -#if defined(ARCH_X86_64) -static inline uint64_t read_time(void) -{ - uint64_t a, d; - asm volatile( "rdtsc\n\t" - : "=a" (a), "=d" (d) - ); - return (d << 32) | (a & 0xffffffff); -} -#elif defined(ARCH_X86_32) -static inline long long read_time(void) -{ - long long l; - asm volatile( "rdtsc\n\t" - : "=A" (l) - ); - return l; -} -#else //FIXME check ppc64 -static inline uint64_t read_time(void) -{ - uint32_t tbu, tbl, temp; - - /* from section 2.2.1 of the 32-bit PowerPC PEM */ - __asm__ __volatile__( - "1:\n" - "mftbu %2\n" - "mftb %0\n" - "mftbu %1\n" - "cmpw %2,%1\n" - "bne 1b\n" - : "=r"(tbl), "=r"(tbu), "=r"(temp) - : - : "cc"); - - return (((uint64_t)tbu)<<32) | (uint64_t)tbl; -} -#endif - -#define START_TIMER \ -uint64_t tend;\ -uint64_t tstart= read_time();\ - -#define STOP_TIMER(id) \ -tend= read_time();\ -{\ - static uint64_t tsum=0;\ - static int tcount=0;\ - static int tskip_count=0;\ - if(tcount<2 || tend - tstart < FFMAX(8*tsum/tcount, 2000)){\ - tsum+= tend - tstart;\ - tcount++;\ - }else\ - tskip_count++;\ - if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ - av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ - }\ -} -#else -#define START_TIMER -#define STOP_TIMER(id) {} -#endif - -#endif /* COMMON_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/integer.h b/src/ffmpeg/r8448/include/ffmpeg/integer.h deleted file mode 100644 index 2a4d703166..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/integer.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file integer.h - * arbitrary precision integers - * @author Michael Niedermayer - */ - -#ifndef INTEGER_H -#define INTEGER_H - -#define AV_INTEGER_SIZE 8 - -typedef struct AVInteger{ - uint16_t v[AV_INTEGER_SIZE]; -} AVInteger; - -AVInteger av_add_i(AVInteger a, AVInteger b); -AVInteger av_sub_i(AVInteger a, AVInteger b); - -/** - * returns the rounded down value of the logarithm of base 2 of the given AVInteger. - * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0 - */ -int av_log2_i(AVInteger a); -AVInteger av_mul_i(AVInteger a, AVInteger b); - -/** - * returns 0 if a==b, 1 if a>b and -1 if a - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOG_H -#define LOG_H - -#include - -/** - * Used by av_log - */ -typedef struct AVCLASS AVClass; -struct AVCLASS { - const char* class_name; - const char* (*item_name)(void*); /* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat */ - const struct AVOption *option; -}; - -/* av_log API */ - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define AV_LOG_QUIET -1 -#define AV_LOG_FATAL 0 -#define AV_LOG_ERROR 0 -#define AV_LOG_WARNING 1 -#define AV_LOG_INFO 1 -#define AV_LOG_VERBOSE 1 -#define AV_LOG_DEBUG 2 -#else -#define AV_LOG_QUIET -8 - -/** - * something went really wrong and we will crash now - */ -#define AV_LOG_PANIC 0 - -/** - * something went wrong and recovery is not possible - * like no header in a format which depends on it or a combination - * of parameters which are not allowed - */ -#define AV_LOG_FATAL 8 - -/** - * something went wrong and cannot losslessly be recovered - * but not all future data is affected - */ -#define AV_LOG_ERROR 16 - -/** - * something somehow does not look correct / something which may or may not - * lead to some problems like use of -vstrict -2 - */ -#define AV_LOG_WARNING 24 - -#define AV_LOG_INFO 32 -#define AV_LOG_VERBOSE 40 - -/** - * stuff which is only useful for libav* developers - */ -#define AV_LOG_DEBUG 48 -#endif -extern int av_log_level; - -/** - * Send the specified message to the log if the level is less than or equal to - * the current av_log_level. By default, all logging messages are sent to - * stderr. This behavior can be altered by setting a different av_vlog callback - * function. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param fmt The format string (printf-compatible) that specifies how - * subsequent arguments are converted to output. - * @see av_vlog - */ -#ifdef __GNUC__ -extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -#else -extern void av_log(void*, int level, const char *fmt, ...); -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -extern void av_vlog(void*, int level, const char *fmt, va_list); -extern int av_log_get_level(void); -extern void av_log_set_level(int); -extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); -extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); -#else -extern void (*av_vlog)(void*, int, const char*, va_list); -#endif - -#endif /* LOG_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/mathematics.h b/src/ffmpeg/r8448/include/ffmpeg/mathematics.h deleted file mode 100644 index 0b74b254b9..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/mathematics.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MATHEMATICS_H -#define MATHEMATICS_H - -#include "rational.h" - -enum AVRounding { - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero -}; - -/** - * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale(int64_t a, int64_t b, int64_t c); - -/** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding); - -/** - * rescale a 64bit integer by 2 rational numbers. - */ -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq); - -#endif /* MATHEMATICS_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/mem.h b/src/ffmpeg/r8448/include/ffmpeg/mem.h deleted file mode 100644 index 4ebdad8f57..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/mem.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file mem.h - * Memory handling functions. - */ - -#ifndef AV_MEM_H -#define AV_MEM_H - -#ifdef __GNUC__ - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) -#else - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v -#endif - -/** - * Memory allocation of size byte with alignment suitable for all - * memory accesses (including vectors if available on the - * CPU). av_malloc(0) must return a non NULL pointer. - */ -void *av_malloc(unsigned int size); - -/** - * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, - * identical to malloc(size). If size is zero, it is identical to - * free(ptr) and NULL is returned. - */ -void *av_realloc(void *ptr, unsigned int size); - -/** - * Free memory which has been allocated with av_malloc(z)() or av_realloc(). - * NOTE: ptr = NULL is explicetly allowed - * Note2: it is recommended that you use av_freep() instead - */ -void av_free(void *ptr); - -void *av_mallocz(unsigned int size); -char *av_strdup(const char *s); - -/** - * Frees memory and sets the pointer to NULL. - * @param ptr pointer to the pointer which should be freed - */ -void av_freep(void *ptr); - -#endif /* AV_MEM_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/rational.h b/src/ffmpeg/r8448/include/ffmpeg/rational.h deleted file mode 100644 index 63c0b150f2..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/rational.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file rational.h - * Rational numbers. - * @author Michael Niedermayer - */ - -#ifndef RATIONAL_H -#define RATIONAL_H - -/** - * Rational number num/den. - */ -typedef struct AVRational{ - int num; ///< numerator - int den; ///< denominator -} AVRational; - -/** - * Compare two rationals. - * @param a first rational - * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if a>63)|1; - else return 0; -} - -/** - * Rational to double conversion. - * @param a rational to convert - * @return (double) a - */ -static inline double av_q2d(AVRational a){ - return a.num / (double) a.den; -} - -/** - * Reduce a fraction. - * This is useful for framerate calculations. - * @param dst_nom destination numerator - * @param dst_den destination denominator - * @param nom source numerator - * @param den source denominator - * @param max the maximum allowed for dst_nom & dst_den - * @return 1 if exact, 0 otherwise - */ -int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max); - -/** - * Multiplies two rationals. - * @param b first rational. - * @param c second rational. - * @return b*c. - */ -AVRational av_mul_q(AVRational b, AVRational c); - -/** - * Divides one rational by another. - * @param b first rational. - * @param c second rational. - * @return b/c. - */ -AVRational av_div_q(AVRational b, AVRational c); - -/** - * Adds two rationals. - * @param b first rational. - * @param c second rational. - * @return b+c. - */ -AVRational av_add_q(AVRational b, AVRational c); - -/** - * Subtracts one rational from another. - * @param b first rational. - * @param c second rational. - * returns b-c. - */ -AVRational av_sub_q(AVRational b, AVRational c); - -/** - * Converts a double precision floating point number to a rational. - * @param d double to convert - * @param max the maximum allowed numerator and denominator - * @return (AVRational) d. - */ -AVRational av_d2q(double d, int max); - -#endif // RATIONAL_H diff --git a/src/ffmpeg/r8448/include/ffmpeg/rtp.h b/src/ffmpeg/r8448/include/ffmpeg/rtp.h deleted file mode 100644 index fec7630517..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/rtp.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * RTP definitions - * Copyright (c) 2002 Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef RTP_H -#define RTP_H - -#define RTP_MIN_PACKET_LENGTH 12 -#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */ - -int rtp_init(void); -int rtp_get_codec_info(AVCodecContext *codec, int payload_type); - -/** return < 0 if unknown payload type */ -int rtp_get_payload_type(AVCodecContext *codec); - -typedef struct RTPDemuxContext RTPDemuxContext; -typedef struct rtp_payload_data_s rtp_payload_data_s; -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data); -int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); -void rtp_parse_close(RTPDemuxContext *s); - -extern AVOutputFormat rtp_muxer; -extern AVInputFormat rtp_demuxer; - -int rtp_get_local_port(URLContext *h); -int rtp_set_remote_url(URLContext *h, const char *uri); -void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd); - -/** - * some rtp servers assume client is dead if they don't hear from them... - * so we send a Receiver Report to the provided ByteIO context - * (we don't have access to the rtcp handle from here) - */ -int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); - -extern URLProtocol rtp_protocol; - -#define RTP_PT_PRIVATE 96 -#define RTP_VERSION 2 -#define RTP_MAX_SDES 256 /**< maximum text length for SDES */ - -/* RTCP paquets use 0.5 % of the bandwidth */ -#define RTCP_TX_RATIO_NUM 5 -#define RTCP_TX_RATIO_DEN 1000 - -/** Structure listing useful vars to parse RTP packet payload*/ -typedef struct rtp_payload_data_s -{ - int sizelength; - int indexlength; - int indexdeltalength; - int profile_level_id; - int streamtype; - int objecttype; - char *mode; - - /** mpeg 4 AU headers */ - struct AUHeaders { - int size; - int index; - int cts_flag; - int cts; - int dts_flag; - int dts; - int rap_flag; - int streamstate; - } *au_headers; - int nb_au_headers; - int au_headers_length_bytes; - int cur_au_index; -} rtp_payload_data_t; - -typedef struct AVRtpPayloadType_s -{ - int pt; - const char enc_name[50]; /* XXX: why 50 ? */ - enum CodecType codec_type; - enum CodecID codec_id; - int clock_rate; - int audio_channels; -} AVRtpPayloadType_t; - -#if 0 -typedef enum { - RTCP_SR = 200, - RTCP_RR = 201, - RTCP_SDES = 202, - RTCP_BYE = 203, - RTCP_APP = 204 -} rtcp_type_t; - -typedef enum { - RTCP_SDES_END = 0, - RTCP_SDES_CNAME = 1, - RTCP_SDES_NAME = 2, - RTCP_SDES_EMAIL = 3, - RTCP_SDES_PHONE = 4, - RTCP_SDES_LOC = 5, - RTCP_SDES_TOOL = 6, - RTCP_SDES_NOTE = 7, - RTCP_SDES_PRIV = 8, - RTCP_SDES_IMG = 9, - RTCP_SDES_DOOR = 10, - RTCP_SDES_SOURCE = 11 -} rtcp_sdes_type_t; -#endif - -extern AVRtpPayloadType_t AVRtpPayloadTypes[]; -#endif /* RTP_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/rtsp.h b/src/ffmpeg/r8448/include/ffmpeg/rtsp.h deleted file mode 100644 index 481e2ba499..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/rtsp.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RTSP definitions - * Copyright (c) 2002 Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef RTSP_H -#define RTSP_H - -#include "rtspcodes.h" - -enum RTSPProtocol { - RTSP_PROTOCOL_RTP_UDP = 0, - RTSP_PROTOCOL_RTP_TCP = 1, - RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2, -}; - -#define RTSP_DEFAULT_PORT 554 -#define RTSP_MAX_TRANSPORTS 8 -#define RTSP_TCP_MAX_PACKET_SIZE 1472 -#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2 -#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 -#define RTSP_RTP_PORT_MIN 5000 -#define RTSP_RTP_PORT_MAX 10000 - -typedef struct RTSPTransportField { - int interleaved_min, interleaved_max; /**< interleave ids, if TCP transport */ - int port_min, port_max; /**< RTP ports */ - int client_port_min, client_port_max; /**< RTP ports */ - int server_port_min, server_port_max; /**< RTP ports */ - int ttl; /**< ttl value */ - uint32_t destination; /**< destination IP address */ - enum RTSPProtocol protocol; -} RTSPTransportField; - -typedef struct RTSPHeader { - int content_length; - enum RTSPStatusCode status_code; /**< response code from server */ - int nb_transports; - /** in AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ - int64_t range_start, range_end; - RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; - int seq; /**< sequence number */ - char session_id[512]; -} RTSPHeader; - -/** the callback can be used to extend the connection setup/teardown step */ -enum RTSPCallbackAction { - RTSP_ACTION_SERVER_SETUP, - RTSP_ACTION_SERVER_TEARDOWN, - RTSP_ACTION_CLIENT_SETUP, - RTSP_ACTION_CLIENT_TEARDOWN, -}; - -typedef struct RTSPActionServerSetup { - uint32_t ipaddr; - char transport_option[512]; -} RTSPActionServerSetup; - -typedef int FFRTSPCallback(enum RTSPCallbackAction action, - const char *session_id, - char *buf, int buf_size, - void *arg); - -/** useful for modules: set RTSP callback function */ -void rtsp_set_callback(FFRTSPCallback *rtsp_cb); - -int rtsp_init(void); -void rtsp_parse_line(RTSPHeader *reply, const char *buf); - -extern int rtsp_default_protocols; -extern int rtsp_rtp_port_min; -extern int rtsp_rtp_port_max; -extern FFRTSPCallback *ff_rtsp_callback; -extern AVInputFormat rtsp_demuxer; - -int rtsp_pause(AVFormatContext *s); -int rtsp_resume(AVFormatContext *s); - -#endif /* RTSP_H */ diff --git a/src/ffmpeg/r8448/include/ffmpeg/rtspcodes.h b/src/ffmpeg/r8448/include/ffmpeg/rtspcodes.h deleted file mode 100644 index 74cfb5d5b9..0000000000 --- a/src/ffmpeg/r8448/include/ffmpeg/rtspcodes.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RTSP definitions - * copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** RTSP handling */ -enum RTSPStatusCode { -RTSP_STATUS_OK =200, /**< OK */ -RTSP_STATUS_METHOD =405, /**< Method Not Allowed */ -RTSP_STATUS_BANDWIDTH =453, /**< Not Enough Bandwidth */ -RTSP_STATUS_SESSION =454, /**< Session Not Found */ -RTSP_STATUS_STATE =455, /**< Method Not Valid in This State */ -RTSP_STATUS_AGGREGATE =459, /**< Aggregate operation not allowed */ -RTSP_STATUS_ONLY_AGGREGATE =460, /**< Only aggregate operation allowed */ -RTSP_STATUS_TRANSPORT =461, /**< Unsupported transport */ -RTSP_STATUS_INTERNAL =500, /**< Internal Server Error */ -RTSP_STATUS_SERVICE =503, /**< Service Unavailable */ -RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */ -}; - diff --git a/src/ffmpeg/r8448/lib/avcodec.lib b/src/ffmpeg/r8448/lib/avcodec.lib deleted file mode 100644 index ec51531a81..0000000000 Binary files a/src/ffmpeg/r8448/lib/avcodec.lib and /dev/null differ diff --git a/src/ffmpeg/r8448/lib/avformat.lib b/src/ffmpeg/r8448/lib/avformat.lib deleted file mode 100644 index 7d158c85d0..0000000000 Binary files a/src/ffmpeg/r8448/lib/avformat.lib and /dev/null differ diff --git a/src/ffmpeg/r8448/lib/avutil.lib b/src/ffmpeg/r8448/lib/avutil.lib deleted file mode 100644 index 520a1e183a..0000000000 Binary files a/src/ffmpeg/r8448/lib/avutil.lib and /dev/null differ diff --git a/src/ffmpeg/r8448/lib/swscale.lib b/src/ffmpeg/r8448/lib/swscale.lib deleted file mode 100644 index 145792915d..0000000000 Binary files a/src/ffmpeg/r8448/lib/swscale.lib and /dev/null differ