Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
commit 1e9caf9c92903bf25bd343353694b0170c92cc40 2 parents 1191915 + e4fe4d0
Panagiotis H.M. Issaris authored
Showing with 16,377 additions and 18,661 deletions.
  1. +54 −48 .gitignore
  2. +0 −2  COPYING.LGPLv2.1
  3. +122 −3 Changelog
  4. +2 −3 Doxyfile
  5. +50 −15 LICENSE
  6. +31 −4 MAINTAINERS
  7. +38 −21 Makefile
  8. +7 −1 README
  9. +1 −1  RELEASE
  10. +17 −0 arch.mak
  11. +0 −4,641 avconv.c
  12. +611 −190 cmdutils.c
  13. +142 −26 cmdutils.h
  14. +22 −17 cmdutils_common_opts.h
  15. +28 −21 common.mak
  16. +85 −0 compat/getopt.c
  17. +63 −0 compat/msvcrt/snprintf.c
  18. +94 −0 compat/strtod.c
  19. +1,176 −556 configure
  20. +436 −158 doc/APIchanges
  21. +28 −15 doc/Makefile
  22. +1 −29 doc/RELEASE_NOTES
  23. +0 −1,063 doc/avconv.texi
  24. +54 −22 doc/avtools-common-opts.texi
  25. +15 −1 doc/bitstream_filters.texi
  26. +96 −17 doc/demuxers.texi
  27. +35 −8 doc/developer.texi
  28. +6 −0 doc/encoders.texi
  29. +72 −3 doc/eval.texi
  30. +28 −13 doc/examples/Makefile
  31. +228 −73 doc/examples/decoding_encoding.c
  32. +193 −0 doc/examples/demuxing.c
  33. +0 −229 doc/examples/filtering.c
  34. +240 −0 doc/examples/filtering_audio.c
  35. +247 −0 doc/examples/filtering_video.c
  36. +1 −1  doc/examples/metadata.c
  37. +159 −182 doc/examples/muxing.c
  38. +142 −0 doc/examples/scaling_video.c
  39. +134 −16 doc/faq.texi
  40. +27 −7 doc/fate.texi
  41. +0 −4,561 doc/ffmpeg-mt-authorship.txt
  42. +402 −331 doc/ffmpeg.texi
  43. +1 −1  doc/ffmpeg.txt
  44. +1 −0  doc/ffplay.texi
  45. +136 −6 doc/ffprobe.texi
  46. +20 −0 doc/ffprobe.xsd
  47. +0 −2  doc/ffserver.conf
  48. +269 −0 doc/filter_design.txt
  49. +1,733 −464 doc/filters.texi
  50. +131 −24 doc/general.texi
  51. +71 −0 doc/git-howto.texi
  52. +114 −42 doc/indevs.texi
  53. +0 −92 doc/libavfilter.texi
  54. +65 −0 doc/mips.txt
  55. +326 −22 doc/muxers.texi
  56. +84 −1 doc/outdevs.texi
  57. +17 −42 doc/platform.texi
  58. +125 −0 doc/print_options.c
  59. +252 −25 doc/protocols.texi
  60. +1 −1  doc/swresample.txt
  61. +0 −1  doc/swscale.txt
  62. +158 −0 doc/syntax.texi
  63. +3 −0  doc/t2h.init
  64. +14 −9 doc/texi2pod.pl
  65. +0 −1  doc/viterbi.txt
  66. +1,696 −3,639 ffmpeg.c
  67. +407 −0 ffmpeg.h
  68. +774 −0 ffmpeg_filter.c
  69. +2,478 −0 ffmpeg_opt.c
  70. +525 −580 ffplay.c
  71. +0 −17 ffpresets/libvpx-1080p.ffpreset
  72. +0 −17 ffpresets/libvpx-1080p50_60.ffpreset
  73. +0 −16 ffpresets/libvpx-360p.ffpreset
  74. +0 −17 ffpresets/libvpx-720p.ffpreset
  75. +0 −17 ffpresets/libvpx-720p50_60.ffpreset
  76. +825 −433 ffprobe.c
  77. +85 −81 ffserver.c
  78. +491 −438 libavcodec/4xm.c
  79. +130 −125 libavcodec/8bps.c
  80. +41 −24 libavcodec/8svx.c
  81. +238 −192 libavcodec/Makefile
  82. +3 −0  libavcodec/a64enc.h
  83. +33 −21 libavcodec/a64multienc.c
  84. +12 −6 libavcodec/aac.h
  85. +5 −4 libavcodec/aac_ac3_parser.c
  86. +1 −1  libavcodec/aac_ac3_parser.h
  87. +1 −1  libavcodec/aac_parser.c
  88. +24 −21 libavcodec/aaccoder.c
Sorry, we could not display the entire diff because too many files (2,947) changed.
View
102 .gitignore
@@ -1,54 +1,60 @@
-.config
-.version
+*.a
*.o
*.d
+*.def
+*.dll
*.exe
-*.ho
+*.h.c
+*.lib
+*.pc
+*.so
+*.so.*
+*.ver
*-example
*-test
*_g
-*.def
-*.dll
-*.lib
-*.exp
-config.*
-doc/*.1
-doc/*.html
-doc/*.pod
-doc/fate.txt
-doxy
-ffmpeg
-ffplay
-ffprobe
-ffserver
-avconv
-libavcodec/*_tablegen
-libavcodec/*_tables.c
-libavcodec/*_tables.h
-libavcodec/codec_names.h
-libavcodec/libavcodec*
-libavcore/libavcore*
-libavdevice/libavdevice*
-libavfilter/libavfilter*
-libavformat/libavformat*
-libavutil/avconfig.h
-libavutil/libavutil*
-libpostproc/libpostproc*
-libswresample/libswresample*
-libswscale/libswscale*
-tests/audiogen
-tests/base64
-tests/data
-tests/rotozoom
-tests/tiny_psnr
-tests/videogen
-tests/vsynth1
-tests/vsynth2
-tools/cws2fws
-tools/graph2dot
-tools/lavfi-showfiltfmts
-tools/pktdumper
-tools/probetest
-tools/qt-faststart
-tools/trasher
-version.h
+/.config
+/.version
+/ffmpeg
+/ffplay
+/ffprobe
+/ffserver
+/config.*
+/version.h
+/doc/*.1
+/doc/*.html
+/doc/*.pod
+/doc/avoptions_codec.texi
+/doc/avoptions_format.texi
+/doc/examples/decoding_encoding
+/doc/examples/demuxing
+/doc/examples/filtering_audio
+/doc/examples/filtering_video
+/doc/examples/metadata
+/doc/examples/muxing
+/doc/examples/scaling_video
+/doc/fate.txt
+/doc/print_options
+/doxy/
+/libavcodec/*_tablegen
+/libavcodec/*_tables.c
+/libavcodec/*_tables.h
+/libavutil/avconfig.h
+/tests/audiogen
+/tests/base64
+/tests/data/
+/tests/rotozoom
+/tests/tiny_psnr
+/tests/videogen
+/tests/vsynth1/
+/tools/aviocat
+/tools/ffbisect
+/tools/bisect.need
+/tools/cws2fws
+/tools/ffeval
+/tools/graph2dot
+/tools/ismindex
+/tools/pktdumper
+/tools/probetest
+/tools/qt-faststart
+/tools/trasher
View
2  COPYING.LGPLv2.1
@@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice
That's all there is to it!
-
-
View
125 Changelog
@@ -1,8 +1,115 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
-
version next:
+- INI and flat output in ffprobe
+- Scene detection in libavfilter
+- Indeo Audio decoder
+- channelsplit audio filter
+- setnsamples audio filter
+- atempo filter
+- ffprobe -show_data option
+- RTMPT protocol support
+- iLBC encoding/decoding via libilbc
+- Microsoft Screen 1 decoder
+- join audio filter
+- audio channel mapping filter
+- Microsoft ATC Screen decoder
+- RTSP listen mode
+- TechSmith Screen Codec 2 decoder
+- AAC encoding via libfdk-aac
+- Microsoft Expression Encoder Screen decoder
+- RTMPS protocol support
+- RTMPTS protocol support
+- RTMPE protocol support
+- RTMPTE protocol support
+- showwaves and showspectrum filter
+- LucasArts SMUSH playback support
+- SAMI, RealText and SubViewer demuxers and decoders
+- Heart Of Darkness PAF playback support
+- iec61883 device
+- asettb filter
+- new option: -progress
+- 3GPP Timed Text encoder/decoder
+- GeoTIFF decoder support
+- ffmpeg -(no)stdin option
+- Opus decoder using libopus
+- caca output device using libcaca
+- alphaextract and alphamerge filters
+- concat filter
+- flite filter
+- Canopus Lossless Codec decoder
+- bitmap subtitles in filters (experimental and temporary)
+- MP2 encoding via TwoLAME
+- bmp parser
+- smptebars source
+- asetpts filter
+- hue filter
+- ICO muxer
+- SubRip encoder and decoder without embedded timing
+- edge detection filter
+- framestep filter
+- ffmpeg -shortest option is now per-output file
+ -pass and -passlogfile are now per-output stream
+- volume measurement filter
+- Ut Video encoder
+- Microsoft Screen 2 decoder
+- Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP
+ instead of AV_CODEC_ID_TEXT
+- smartblur filter ported from MPlayer
+- CPiA decoder
+- decimate filter ported from MPlayer
+
+
+version 0.11:
+
+- Fixes: CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777,
+ CVE-2012-2779, CVE-2012-2782, CVE-2012-2783, CVE-2012-2784, CVE-2012-2785,
+ CVE-2012-2786, CVE-2012-2787, CVE-2012-2788, CVE-2012-2789, CVE-2012-2790,
+ CVE-2012-2791, CVE-2012-2792, CVE-2012-2793, CVE-2012-2794, CVE-2012-2795,
+ CVE-2012-2796, CVE-2012-2797, CVE-2012-2798, CVE-2012-2799, CVE-2012-2800,
+ CVE-2012-2801, CVE-2012-2802, CVE-2012-2803, CVE-2012-2804,
+- v408 Quicktime and Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder
+- setfield filter
+- CDXL demuxer and decoder
+- Apple ProRes encoder
+- ffprobe -count_packets and -count_frames options
+- Sun Rasterfile Encoder
+- ID3v2 attached pictures reading and writing
+- WMA Lossless decoder
+- bluray protocol
+- blackdetect filter
+- libutvideo encoder wrapper (--enable-libutvideo)
+- swapuv filter
+- bbox filter
+- XBM encoder and decoder
+- RealAudio Lossless decoder
+- ZeroCodec decoder
+- tile video filter
+- Metal Gear Solid: The Twin Snakes demuxer
+- OpenEXR image decoder
+- removelogo filter
+- drop support for ffmpeg without libavfilter
+- drawtext video filter: fontconfig support
+- ffmpeg -benchmark_all option
+- super2xsai filter ported from libmpcodecs
+- add libavresample audio conversion library for compatibility
+- MicroDVD decoder
+- Avid Meridien (AVUI) encoder and decoder
+- accept + prefix to -pix_fmt option to disable automatic conversions.
+- complete audio filtering in libavfilter and ffmpeg
+- add fps filter
+- vorbis parser
+- png parser
+- audio mix filter
+
+
+version 0.10:
+
+- Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936,
+ CVE-2011-3937, CVE-2011-3940, CVE-2011-3941, CVE-2011-3944,
+ CVE-2011-3945, CVE-2011-3946, CVE-2011-3947, CVE-2011-3949,
+ CVE-2011-3950, CVE-2011-3951, CVE-2011-3952
- v410 Quicktime Uncompressed 4:4:4 10-bit encoder and decoder
- SBaGen (SBG) binaural beats script demuxer
- OpenMG Audio muxer
@@ -13,15 +120,27 @@ version next:
- tinterlace video filter
- astreamsync audio filter
- amerge audio filter
+- ISMV (Smooth Streaming) muxer
+- GSM audio parser
+- SMJPEG muxer
+- XWD encoder and decoder
- Automatic thread count based on detection number of (available) CPU cores
- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
- ffprobe -show_error option
-- Avid 1:1 10-bit RGB Packer decoder
+- Avid 1:1 10-bit RGB Packer codec
- v308 Quicktime Uncompressed 4:4:4 encoder and decoder
- yuv4 libquicktime packed 4:2:0 encoder and decoder
- ffprobe -show_frames option
- silencedetect audio filter
- ffprobe -show_program_version, -show_library_versions, -show_versions options
+- rv34: frame-level multi-threading
+- optimized iMDCT transform on x86 using SSE for for mpegaudiodec
+- Improved PGS subtitle decoder
+- dumpgraph option to lavfi device
+- r210 and r10k encoders
+- ffwavesynth decoder
+- aviocat tool
+- ffeval tool
version 0.9:
@@ -727,7 +846,7 @@ version 0.4.5:
- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
- Windows porting of file converter
-- added MJPEG raw format (input/ouput)
+- added MJPEG raw format (input/output)
- added JPEG image format support (input/output)
View
5 Doxyfile
@@ -631,8 +631,7 @@ EXCLUDE_SYMLINKS = NO
# for example use the pattern */test/*
EXCLUDE_PATTERNS = *.git \
- *.d \
- avconv.c
+ *.d
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -1379,7 +1378,7 @@ PREDEFINED = "__attribute__(x)=" \
"DEF(x)=x ## _TMPL" \
HAVE_AV_CONFIG_H \
HAVE_MMX \
- HAVE_MMX2 \
+ HAVE_MMXEXT \
HAVE_AMD3DNOW \
"DECLARE_ALIGNED(a,t,n)=t n" \
"offsetof(x,y)=0x42"
View
65 LICENSE
@@ -1,5 +1,4 @@
FFmpeg:
--------
Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
@@ -14,14 +13,36 @@ configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
Specifically, the GPL parts of FFmpeg are
- libpostproc
+- libmpcodecs
- optional x86 optimizations in the files
libavcodec/x86/idct_mmx.c
+- libutvideo encoding/decoding wrappers in
+ libavcodec/libutvideo*.cpp
- the X11 grabber in libavdevice/x11grab.c
+- the swresample test app in
+ libswresample/swresample-test.c
+- the texi2pod.pl tool
+- the following filters in libavfilter:
+ - vf_blackframe.c
+ - vf_boxblur.c
+ - vf_colormatrix.c
+ - vf_cropdetect.c
+ - vf_delogo.c
+ - vf_hqdn3d.c
+ - vf_mp.c
+ - vf_super2xsai.c
+ - vf_tinterlace.c
+ - vf_yadif.c
+ - vsrc_mptestsrc.c
There are a handful of files under other licensing terms, namely:
-* The files libavcodec/jfdctfst.c, libavcodec/jfdctint.c, libavcodec/jrevdct.c
- are taken from libjpeg, see the top of the files for licensing details.
+* The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and
+ libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for
+ licensing details. Specifically note that you must credit the IJG in the
+ documentation accompanying your program if you only distribute executables.
+ You must also indicate any changes including additions and deletions to
+ those three files in the documentation.
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
the configure parameter --enable-version3 will activate this licensing option
@@ -29,18 +50,32 @@ for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
COPYING.GPLv3 to learn the exact legal terms that apply in this case.
-external libraries:
--------------------
+external libraries
+==================
-Some external libraries, e.g. libx264, are under GPL and can be used in
-conjunction with FFmpeg. They require --enable-gpl to be passed to configure
-as well.
+FFmpeg can be combined with a number of external libraries, which sometimes
+affect the licensing of binaries resulting from the combination.
-The OpenCORE external libraries are under the Apache License 2.0. That license
-is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of
-those licenses. So to combine the OpenCORE libraries with FFmpeg, the license
-version needs to be upgraded by passing --enable-version3 to configure.
+compatible libraries
+--------------------
-The nonfree external libraries libfaac and libaacplus can be hooked up in FFmpeg.
-You need to pass --enable-nonfree to configure to enable it. Employ this option
-with care as FFmpeg then becomes nonfree and unredistributable.
+The libcdio, libx264, libxavs and libxvid libraries are under GPL. When
+combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
+passing --enable-gpl to configure.
+
+The OpenCORE and VisualOn libraries are under the Apache License 2.0. That
+license is incompatible with the LGPL v2.1 and the GPL v2, but not with
+version 3 of those licenses. So to combine these libraries with FFmpeg, the
+license version needs to be upgraded by passing --enable-version3 to configure.
+
+incompatible libraries
+----------------------
+
+The Fraunhofer AAC library, FAAC and aacplus are under licenses which
+are incompatible with the GPLv2 and v3. We do not know for certain if their
+licenses are compatible with the LGPL.
+If you wish to enable these libraries, pass --enable-nonfree to configure.
+But note that if you enable any of these libraries the resulting binary will
+be under a complex license mix that is more restrictive than the LGPL and that
+may result in additional obligations. It is possible that these
+restrictions cause the resulting binary to be unredistributeable.
View
35 MAINTAINERS
@@ -4,7 +4,7 @@ FFmpeg maintainers
Below is a list of the people maintaining different parts of the
FFmpeg code.
-Please try to keep entries where you are the maintainer upto date!
+Please try to keep entries where you are the maintainer up to date!
Names in () mean that the maintainer currently has no time to maintain the code.
A CC after the name means that the maintainer prefers to be CC-ed on patches
@@ -87,6 +87,8 @@ Generic Parts:
bitstream.c, bitstream.h Michael Niedermayer
CABAC:
cabac.h, cabac.c Michael Niedermayer
+ codec names:
+ codec_names.sh Nicolas George
DSP utilities:
dsputils.c, dsputils.h Michael Niedermayer
entropy coding:
@@ -130,7 +132,9 @@ Codecs:
celp_filters.* Vitor Sessak
cinepak.c Roberto Togni
cljr Alex Beregszaszi
+ cllc.c Derek Buitenhuis
cook.c, cookdata.h Benjamin Larsson
+ cpia.c Stephan Hilb
crystalhd.c Philip Langdale
cscd.c Reimar Doeffinger
dca.c Kostya Shishkov, Benjamin Larsson
@@ -140,6 +144,7 @@ Codecs:
dv.c Roman Shaposhnik
eacmv*, eaidct*, eat* Peter Ross
ffv1.c Michael Niedermayer
+ ffwavesynth.c Nicolas George
flac* Justin Ruggles
flashsv* Benjamin Larsson
flicvideo.c Mike Melanson
@@ -156,10 +161,12 @@ Codecs:
indeo5* Kostya Shishkov
interplayvideo.c Mike Melanson
ivi* Kostya Shishkov
+ jacosub* Clément Bœsch
jpeg_ls.c Kostya Shishkov
jvdec.c Peter Ross
kmvc.c Kostya Shishkov
lcl*.c Roberto Togni, Reimar Doeffinger
+ libcelt_dec.c Nicolas George
libgsm.c Michel Bardiaux
libdirac* David Conrad
libopenjpeg.c Jaikrishnan Menon
@@ -167,6 +174,7 @@ Codecs:
libschroedinger* David Conrad
libspeexdec.c Justin Ruggles
libtheoraenc.c David Conrad
+ libutvideo* Derek Buitenhuis
libvorbis.c David Conrad
libxavs.c Stefan Gehrer
libx264.c Mans Rullgard, Jason Garrett-Glaser
@@ -223,6 +231,7 @@ Codecs:
vble.c Derek Buitenhuis
vc1* Kostya Shishkov
vcr1.c Michael Niedermayer
+ vda_h264_dec.c Xidorn Quan
vmnc.c Kostya Shishkov
vorbis_enc.c Oded Shimon
vorbis_dec.c Denes Balatoni, David Conrad
@@ -239,6 +248,7 @@ Codecs:
xan.c Mike Melanson
xl.c Kostya Shishkov
xvmc.c Ivan Kalvachev
+ zerocodec.c Derek Buitenhuis
zmbv* Kostya Shishkov
Hardware acceleration:
@@ -256,6 +266,7 @@ libavdevice
libavdevice/avdevice.h
+ iec61883.c Georg Lippitsch
libdc1394.c Roman Shaposhnik
v4l2.c Luca Abeni
vfwcap.c Ramiro Polla
@@ -264,10 +275,18 @@ libavdevice
libavfilter
===========
-Video filters:
- vsrc_mandelbrot.c Michael Niedermayer
+Generic parts:
+ graphdump.c Nicolas George
+
+Filters:
+ af_amerge.c Nicolas George
+ af_astreamsync.c Nicolas George
+ af_atempo.c Pavel Koshevoy
+ af_pan.c Nicolas George
vf_yadif.c Michael Niedermayer
+Sources:
+ vsrc_mandelbrot.c Michael Niedermayer
libavformat
===========
@@ -305,6 +324,7 @@ Muxers/Demuxers:
ipmovie.c Mike Melanson
img2.c Michael Niedermayer
iss.c Stefan Gehrer
+ jacosub* Clément Bœsch
jvdec.c Peter Ross
libmodplug.c Clément Bœsch
libnut.c Oded Shimon
@@ -325,6 +345,7 @@ Muxers/Demuxers:
msnwc_tcp.c Ramiro Polla
mtv.c Reynaldo H. Verdejo Pinochet
mxf* Baptiste Coudurier
+ mxfdec.c Tomas Härdin
nsvdec.c Francois Revol
nut.c Michael Niedermayer
nuv.c Reimar Doeffinger
@@ -344,6 +365,7 @@ Muxers/Demuxers:
rtpdec_asf.* Ronald S. Bultje
rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
rtsp.c Luca Barbato
+ sbgdec.c Nicolas George
sdp.c Martin Storsjo
segafilm.c Mike Melanson
siff.c Kostya Shishkov
@@ -360,6 +382,7 @@ Muxers/Demuxers:
wv.c Kostya Shishkov
Protocols:
+ bluray.c Petri Hintukainen
http.c Ronald S. Bultje
mms*.c Ronald S. Bultje
udp.c Luca Abeni
@@ -385,7 +408,8 @@ x86 Michael Niedermayer
Releases
========
-0.9 Michael Niedermayer
+0.11 Michael Niedermayer
+0.10 Michael Niedermayer
@@ -398,6 +422,7 @@ Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
+Bœsch Clément 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9
Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
@@ -407,6 +432,7 @@ Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
+Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
@@ -415,4 +441,5 @@ Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
Stefano Sabatini 9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B
+Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
Tomas Härdin D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD
View
59 Makefile
@@ -11,20 +11,20 @@ vpath %.texi $(SRC_PATH)
vpath %/fate_config.sh.template $(SRC_PATH)
PROGS-$(CONFIG_FFMPEG) += ffmpeg
-PROGS-$(CONFIG_AVCONV) += avconv
PROGS-$(CONFIG_FFPLAY) += ffplay
PROGS-$(CONFIG_FFPROBE) += ffprobe
PROGS-$(CONFIG_FFSERVER) += ffserver
-PROGS := $(PROGS-yes:%=%$(EXESUF))
+PROGS := $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
-OBJS = $(PROGS-yes:%=%.o) cmdutils.o
+OBJS = cmdutils.o
+OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
-HOSTPROGS := $(TESTTOOLS:%=tests/%)
+HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
TOOLS = qt-faststart trasher
TOOLS-$(CONFIG_ZLIB) += cws2fws
-BASENAMES = ffmpeg avconv ffplay ffprobe ffserver
+BASENAMES = ffmpeg ffplay ffprobe ffserver
ALLPROGS = $(BASENAMES:%=%$(PROGSSUF)$(EXESUF))
ALLPROGS_G = $(BASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
ALLMANPAGES = $(BASENAMES:%=%.1)
@@ -32,6 +32,7 @@ ALLMANPAGES = $(BASENAMES:%=%.1)
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
FFLIBS-$(CONFIG_AVFILTER) += avfilter
FFLIBS-$(CONFIG_AVFORMAT) += avformat
+FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
FFLIBS-$(CONFIG_AVCODEC) += avcodec
FFLIBS-$(CONFIG_POSTPROC) += postproc
FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
@@ -40,6 +41,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avutil
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
+EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile
SKIPHEADERS = cmdutils_common_opts.h
@@ -50,14 +52,14 @@ FF_DEP_LIBS := $(DEP_LIBS)
all: $(PROGS)
-$(PROGS): %$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
- $(CP) $< $@$(PROGSSUF)
- $(STRIP) $@$(PROGSSUF)
+$(PROGS): %$(EXESUF): %_g$(EXESUF)
+ $(CP) $< $@
+ $(STRIP) $@
$(TOOLS): %$(EXESUF): %.o
- $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
+ $(LD) $(LDFLAGS) $(LD_O) $< $(ELIBS)
-tools/cws2fws$(EXESUF): ELIBS = -lz
+tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
config.h: .config
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
@@ -65,9 +67,13 @@ config.h: .config
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null
-SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
- ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
- HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
+SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
+ ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
+ ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS NEON-OBJS \
+ MMI-OBJS ALTIVEC-OBJS VIS-OBJS \
+ MMX-OBJS YASM-OBJS \
+ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS \
+ OBJS HOSTOBJS TESTOBJS
define RESET
$(1) :=
@@ -78,17 +84,25 @@ define DOSUBDIR
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
SUBDIR := $(1)/
include $(SRC_PATH)/$(1)/Makefile
+-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
include $(SRC_PATH)/library.mak
endef
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
-ffplay.o: CFLAGS += $(SDL_CFLAGS)
-ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
-ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS)
+define DOPROG
+OBJS-$(1) += $(1).o
+$(1)$(PROGSSUF)_g$(EXESUF): $(OBJS-$(1))
+$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
+$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
+$(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
+-include $$(OBJS-$(1):.o=.d)
+endef
+
+$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
%$(PROGSSUF)_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
- $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
+ $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) cmdutils.o $(FF_EXTRALIBS)
OBJDIRS += tools
@@ -122,9 +136,10 @@ install-progs: install-progs-yes $(PROGS)
$(Q)mkdir -p "$(BINDIR)"
$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
-install-data: $(DATA_FILES)
- $(Q)mkdir -p "$(DATADIR)"
+install-data: $(DATA_FILES) $(EXAMPLES_FILES)
+ $(Q)mkdir -p "$(DATADIR)/examples"
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
+ $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
@@ -144,7 +159,7 @@ clean::
distclean::
$(RM) $(DISTCLEANSUFFIXES)
- $(RM) config.* .version version.h libavutil/avconfig.h
+ $(RM) config.* .version version.h libavutil/avconfig.h libavcodec/codec_names.h
config:
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
@@ -158,6 +173,8 @@ coverage-html: coverage.info
$(Q)genhtml -o $@ $<
$(Q)touch $@
+check: all alltools examples testprogs fate
+
include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/tests/Makefile
@@ -172,5 +189,5 @@ $(sort $(OBJDIRS)):
# so this saves some time on slow systems.
.SUFFIXES:
-.PHONY: all all-yes alltools *clean config examples install*
+.PHONY: all all-yes alltools check *clean config install*
.PHONY: testprogs uninstall*
View
8 README
@@ -4,9 +4,15 @@ FFmpeg README
1) Documentation
----------------
-* Read the documentation in the doc/ directory.
+* Read the documentation in the doc/ directory in git.
+ You can also view it online at http://ffmpeg.org/documentation.html
2) Licensing
------------
* See the LICENSE file.
+
+3) Build and Install
+--------------------
+
+* See the INSTALL file.
View
2  RELEASE
@@ -1 +1 @@
-0.9.1.git
+0.11.1.git
View
17 arch.mak
@@ -0,0 +1,17 @@
+OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
+OBJS-$(HAVE_ARMV6) += $(ARMV6-OBJS) $(ARMV6-OBJS-yes)
+OBJS-$(HAVE_ARMVFP) += $(ARMVFP-OBJS) $(ARMVFP-OBJS-yes)
+OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
+
+OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
+OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS) $(MIPSFPU-OBJS-yes)
+OBJS-$(HAVE_MIPS32R2) += $(MIPS32R2-OBJS) $(MIPS32R2-OBJS-yes)
+OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS) $(MIPSDSPR1-OBJS-yes)
+OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes)
+
+OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
+
+OBJS-$(HAVE_VIS) += $(VIS-OBJS) $(VIS-OBJS-yes)
+
+OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
+OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)
View
4,641 avconv.c
0 additions, 4,641 deletions not shown
View
801 cmdutils.c
@@ -32,11 +32,16 @@
#include "libavformat/avformat.h"
#include "libavfilter/avfilter.h"
#include "libavdevice/avdevice.h"
+#include "libavresample/avresample.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
+#if CONFIG_POSTPROC
#include "libpostproc/postprocess.h"
+#endif
+#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
+#include "libavutil/imgutils.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/eval.h"
@@ -52,6 +57,7 @@
#endif
struct SwsContext *sws_opts;
+SwrContext *swr_opts;
AVDictionary *format_opts, *codec_opts;
const int this_year = 2012;
@@ -60,10 +66,13 @@ static FILE *report_file;
void init_opts(void)
{
-#if CONFIG_SWSCALE
- sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
+
+ if(CONFIG_SWSCALE)
+ sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
NULL, NULL, NULL);
-#endif
+
+ if(CONFIG_SWRESAMPLE)
+ swr_opts = swr_alloc();
}
void uninit_opts(void)
@@ -72,6 +81,10 @@ void uninit_opts(void)
sws_freeContext(sws_opts);
sws_opts = NULL;
#endif
+
+ if(CONFIG_SWRESAMPLE)
+ swr_free(&swr_opts);
+
av_dict_free(&format_opts);
av_dict_free(&codec_opts);
}
@@ -128,8 +141,8 @@ int64_t parse_time_or_die(const char *context, const char *timestr,
return us;
}
-void show_help_options(const OptionDef *options, const char *msg, int mask,
- int value)
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags, int alt_flags)
{
const OptionDef *po;
int first;
@@ -137,26 +150,33 @@ void show_help_options(const OptionDef *options, const char *msg, int mask,
first = 1;
for (po = options; po->name != NULL; po++) {
char buf[64];
- if ((po->flags & mask) == value) {
- if (first) {
- printf("%s", msg);
- first = 0;
- }
- av_strlcpy(buf, po->name, sizeof(buf));
- if (po->flags & HAS_ARG) {
- av_strlcat(buf, " ", sizeof(buf));
- av_strlcat(buf, po->argname, sizeof(buf));
- }
- printf("-%-17s %s\n", buf, po->help);
+
+ if (((po->flags & req_flags) != req_flags) ||
+ (alt_flags && !(po->flags & alt_flags)) ||
+ (po->flags & rej_flags))
+ continue;
+
+ if (first) {
+ printf("%s\n", msg);
+ first = 0;
+ }
+ av_strlcpy(buf, po->name, sizeof(buf));
+ if (po->argname) {
+ av_strlcat(buf, " ", sizeof(buf));
+ av_strlcat(buf, po->argname, sizeof(buf));
}
+ printf("-%-17s %s\n", buf, po->help);
}
+ printf("\n");
}
void show_help_children(const AVClass *class, int flags)
{
const AVClass *child = NULL;
- av_opt_show2(&class, NULL, flags, 0);
- printf("\n");
+ if (class->option) {
+ av_opt_show2(&class, NULL, flags, 0);
+ printf("\n");
+ }
while (child = av_opt_child_class_next(class, child))
show_help_children(child, flags);
@@ -177,6 +197,7 @@ static const OptionDef *find_option(const OptionDef *po, const char *name)
#if defined(_WIN32) && !defined(__MINGW32CE__)
#include <windows.h>
+#include <shellapi.h>
/* Will be leaked on exit */
static char** win32_argv_utf8 = NULL;
static int win32_argc = 0;
@@ -248,14 +269,12 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */
po = find_option(options, opt + 2);
- if (!(po->name && (po->flags & OPT_BOOL)))
- goto unknown_opt;
- bool_val = 0;
+ if ((po->name && (po->flags & OPT_BOOL)))
+ bool_val = 0;
}
if (!po->name)
po = find_option(options, "default");
if (!po->name) {
-unknown_opt:
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL);
}
@@ -282,6 +301,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
+// av_freep(dst);
*(char **)dst = str;
} else if (po->flags & OPT_BOOL) {
*(int *)dst = bool_val;
@@ -296,8 +316,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
} else if (po->flags & OPT_DOUBLE) {
*(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
} else if (po->u.func_arg) {
- int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg)
- : po->u.func_arg(opt, arg);
+ int ret = po->u.func_arg(optctx, opt, arg);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Failed to set value '%s' for option '%s'\n", arg, opt);
@@ -340,11 +359,8 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
}
}
-/*
- * Return index of option opt in argv or 0 if not found.
- */
-static int locate_option(int argc, char **argv, const OptionDef *options,
- const char *optname)
+int locate_option(int argc, char **argv, const OptionDef *options,
+ const char *optname)
{
const OptionDef *po;
int i;
@@ -399,7 +415,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
if (!idx)
idx = locate_option(argc, argv, options, "v");
if (idx && argv[idx + 1])
- opt_loglevel("loglevel", argv[idx + 1]);
+ opt_loglevel(NULL, "loglevel", argv[idx + 1]);
idx = locate_option(argc, argv, options, "report");
if (idx || getenv("FFREPORT")) {
opt_report("report");
@@ -415,30 +431,30 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
}
}
-#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
-int opt_default(const char *opt, const char *arg)
+#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
+int opt_default(void *optctx, const char *opt, const char *arg)
{
- const AVOption *oc, *of, *os;
+ const AVOption *o;
char opt_stripped[128];
const char *p;
- const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc;
+ const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc, *swr_class;
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
- if ((oc = av_opt_find(&cc, opt_stripped, NULL, 0,
+ if ((o = av_opt_find(&cc, opt_stripped, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||
((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
- (oc = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
- av_dict_set(&codec_opts, opt, arg, FLAGS(oc));
- if ((of = av_opt_find(&fc, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
- av_dict_set(&format_opts, opt, arg, FLAGS(of));
+ (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
+ av_dict_set(&codec_opts, opt, arg, FLAGS);
+ else if ((o = av_opt_find(&fc, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
+ av_dict_set(&format_opts, opt, arg, FLAGS);
#if CONFIG_SWSCALE
sc = sws_get_class();
- if ((os = av_opt_find(&sc, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
+ if (!o && (o = av_opt_find(&sc, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
// XXX we only support sws_flags, not arbitrary sws options
int ret = av_opt_set(sws_opts, opt, arg, 0);
if (ret < 0) {
@@ -447,14 +463,25 @@ int opt_default(const char *opt, const char *arg)
}
}
#endif
+#if CONFIG_SWRESAMPLE
+ swr_class = swr_get_class();
+ if (!o && (o = av_opt_find(&swr_class, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
+ int ret = av_opt_set(swr_opts, opt, arg, 0);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
+ return ret;
+ }
+ }
+#endif
- if (oc || of || os)
+ if (o)
return 0;
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND;
}
-int opt_loglevel(const char *opt, const char *arg)
+int opt_loglevel(void *optctx, const char *opt, const char *arg)
{
const struct { const char *name; int level; } log_levels[] = {
{ "quiet" , AV_LOG_QUIET },
@@ -521,7 +548,7 @@ int opt_report(const char *opt)
return 0;
}
-int opt_max_alloc(const char *opt, const char *arg)
+int opt_max_alloc(void *optctx, const char *opt, const char *arg)
{
char *tail;
size_t max;
@@ -535,13 +562,25 @@ int opt_max_alloc(const char *opt, const char *arg)
return 0;
}
-int opt_codec_debug(const char *opt, const char *arg)
+int opt_cpuflags(void *optctx, const char *opt, const char *arg)
+{
+ int ret;
+ unsigned flags = av_get_cpu_flags();
+
+ if ((ret = av_parse_cpu_caps(&flags, arg)) < 0)
+ return ret;
+
+ av_force_cpu_flags(flags);
+ return 0;
+}
+
+int opt_codec_debug(void *optctx, const char *opt, const char *arg)
{
av_log_set_level(AV_LOG_DEBUG);
- return opt_default(opt, arg);
+ return opt_default(NULL, opt, arg);
}
-int opt_timelimit(const char *opt, const char *arg)
+int opt_timelimit(void *optctx, const char *opt, const char *arg)
{
#if HAVE_SETRLIMIT
int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
@@ -576,7 +615,8 @@ static int warned_cfg = 0;
const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \
- av_log(NULL, level, "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n",\
+ av_log(NULL, level, \
+ "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
indent, #libname, \
LIB##LIBNAME##_VERSION_MAJOR, \
LIB##LIBNAME##_VERSION_MINOR, \
@@ -605,9 +645,12 @@ static void print_all_libs_info(int flags, int level)
PRINT_LIB_INFO(avformat, AVFORMAT, flags, level);
PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level);
PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
+// PRINT_LIB_INFO(avresample, AVRESAMPLE, flags, level);
PRINT_LIB_INFO(swscale, SWSCALE, flags, level);
PRINT_LIB_INFO(swresample,SWRESAMPLE, flags, level);
+#if CONFIG_POSTPROC
PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
+#endif
}
static void print_program_info(int flags, int level)
@@ -619,8 +662,9 @@ static void print_program_info(int flags, int level)
av_log(NULL, level, " Copyright (c) %d-%d the FFmpeg developers",
program_birth_year, this_year);
av_log(NULL, level, "\n");
- av_log(NULL, level, "%sbuilt on %s %s with %s %s\n",
- indent, __DATE__, __TIME__, CC_TYPE, CC_VERSION);
+ av_log(NULL, level, "%sbuilt on %s %s with %s\n",
+ indent, __DATE__, __TIME__, CC_IDENT);
+
av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent);
}
@@ -635,14 +679,16 @@ void show_banner(int argc, char **argv, const OptionDef *options)
print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO);
}
-int opt_version(const char *opt, const char *arg) {
+int show_version(void *optctx, const char *opt, const char *arg)
+{
av_log_set_callback(log_callback_help);
print_program_info (0 , AV_LOG_INFO);
print_all_libs_info(SHOW_VERSION, AV_LOG_INFO);
+
return 0;
}
-int opt_license(const char *opt, const char *arg)
+int show_license(void *optctx, const char *opt, const char *arg)
{
printf(
#if CONFIG_NONFREE
@@ -709,10 +755,11 @@ int opt_license(const char *opt, const char *arg)
program_name, program_name, program_name
#endif
);
+
return 0;
}
-int opt_formats(const char *opt, const char *arg)
+int show_formats(void *optctx, const char *opt, const char *arg)
{
AVInputFormat *ifmt = NULL;
AVOutputFormat *ofmt = NULL;
@@ -760,85 +807,197 @@ int opt_formats(const char *opt, const char *arg)
return 0;
}
-int opt_codecs(const char *opt, const char *arg)
+#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
+ if (codec->field) { \
+ const type *p = c->field; \
+ \
+ printf(" Supported " list_name ":"); \
+ while (*p != term) { \
+ get_name(*p); \
+ printf(" %s", name); \
+ p++; \
+ } \
+ printf("\n"); \
+ } \
+
+static void print_codec(const AVCodec *c)
{
- AVCodec *p = NULL, *p2;
- const char *last_name;
+ int encoder = av_codec_is_encoder(c);
+
+ printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
+ c->long_name ? c->long_name : "");
+
+ if (c->type == AVMEDIA_TYPE_VIDEO) {
+ printf(" Threading capabilities: ");
+ switch (c->capabilities & (CODEC_CAP_FRAME_THREADS |
+ CODEC_CAP_SLICE_THREADS)) {
+ case CODEC_CAP_FRAME_THREADS |
+ CODEC_CAP_SLICE_THREADS: printf("frame and slice"); break;
+ case CODEC_CAP_FRAME_THREADS: printf("frame"); break;
+ case CODEC_CAP_SLICE_THREADS: printf("slice"); break;
+ default: printf("no"); break;
+ }
+ printf("\n");
+ }
+
+ if (c->supported_framerates) {
+ const AVRational *fps = c->supported_framerates;
+
+ printf(" Supported framerates:");
+ while (fps->num) {
+ printf(" %d/%d", fps->num, fps->den);
+ fps++;
+ }
+ printf("\n");
+ }
+ PRINT_CODEC_SUPPORTED(c, pix_fmts, enum PixelFormat, "pixel formats",
+ PIX_FMT_NONE, GET_PIX_FMT_NAME);
+ PRINT_CODEC_SUPPORTED(c, supported_samplerates, int, "sample rates", 0,
+ GET_SAMPLE_RATE_NAME);
+ PRINT_CODEC_SUPPORTED(c, sample_fmts, enum AVSampleFormat, "sample formats",
+ AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME);
+ PRINT_CODEC_SUPPORTED(c, channel_layouts, uint64_t, "channel layouts",
+ 0, GET_CH_LAYOUT_DESC);
+
+ if (c->priv_class) {
+ show_help_children(c->priv_class,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_DECODING_PARAM);
+ }
+}
+
+static char get_media_type_char(enum AVMediaType type)
+{
+ switch (type) {
+ case AVMEDIA_TYPE_VIDEO: return 'V';
+ case AVMEDIA_TYPE_AUDIO: return 'A';
+ case AVMEDIA_TYPE_DATA: return 'D';
+ case AVMEDIA_TYPE_SUBTITLE: return 'S';
+ case AVMEDIA_TYPE_ATTACHMENT:return 'T';
+ default: return '?';
+ }
+}
+
+static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
+ int encoder)
+{
+ while ((prev = av_codec_next(prev))) {
+ if (prev->id == id &&
+ (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
+ return prev;
+ }
+ return NULL;
+}
+
+static void print_codecs_for_id(enum AVCodecID id, int encoder)
+{
+ const AVCodec *codec = NULL;
+
+ printf(" (%s: ", encoder ? "encoders" : "decoders");
+
+ while ((codec = next_codec_for_id(id, codec, encoder)))
+ printf("%s ", codec->name);
+
+ printf(")");
+}
+
+int show_codecs(void *optctx, const char *opt, const char *arg)
+{
+ const AVCodecDescriptor *desc = NULL;
+
printf("Codecs:\n"
" D..... = Decoding supported\n"
" .E.... = Encoding supported\n"
" ..V... = Video codec\n"
" ..A... = Audio codec\n"
" ..S... = Subtitle codec\n"
- " ...S.. = Supports draw_horiz_band\n"
- " ....D. = Supports direct rendering method 1\n"
- " .....T = Supports weird frame truncation\n"
- " ------\n");
- last_name= "000";
- for (;;) {
- int decode = 0;
- int encode = 0;
- int cap = 0;
- const char *type_str;
-
- p2 = NULL;
- while ((p = av_codec_next(p))) {
- if ((p2 == NULL || strcmp(p->name, p2->name) < 0) &&
- strcmp(p->name, last_name) > 0) {
- p2 = p;
- decode = encode = cap = 0;
+ " ...I.. = Intra frame-only codec\n"
+ " ....L. = Lossy compression\n"
+ " .....S = Lossless compression\n"
+ " -------\n");
+ while ((desc = avcodec_descriptor_next(desc))) {
+ const AVCodec *codec = NULL;
+
+ printf(" ");
+ printf(avcodec_find_decoder(desc->id) ? "D" : ".");
+ printf(avcodec_find_encoder(desc->id) ? "E" : ".");
+
+ printf("%c", get_media_type_char(desc->type));
+ printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
+ printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
+ printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
+
+ printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
+
+ /* print decoders/encoders when there's more than one or their
+ * names are different from codec name */
+ while ((codec = next_codec_for_id(desc->id, codec, 0))) {
+ if (strcmp(codec->name, desc->name)) {
+ print_codecs_for_id(desc->id, 0);
+ break;
}
- if (p2 && strcmp(p->name, p2->name) == 0) {
- if (p->decode)
- decode = 1;
- if (p->encode)
- encode = 1;
- cap |= p->capabilities;
+ }
+ codec = NULL;
+ while ((codec = next_codec_for_id(desc->id, codec, 1))) {
+ if (strcmp(codec->name, desc->name)) {
+ print_codecs_for_id(desc->id, 1);
+ break;
}
}
- if (p2 == NULL)
- break;
- last_name = p2->name;
- switch (p2->type) {
- case AVMEDIA_TYPE_VIDEO:
- type_str = "V";
- break;
- case AVMEDIA_TYPE_AUDIO:
- type_str = "A";
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- type_str = "S";
- break;
- default:
- type_str = "?";
- break;
- }
- printf(" %s%s%s%s%s%s %-15s %s",
- decode ? "D" : (/* p2->decoder ? "d" : */ " "),
- encode ? "E" : " ",
- type_str,
- cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
- cap & CODEC_CAP_DR1 ? "D" : " ",
- cap & CODEC_CAP_TRUNCATED ? "T" : " ",
- p2->name,
- p2->long_name ? p2->long_name : "");
-#if 0
- if (p2->decoder && decode == 0)
- printf(" use %s for decoding", p2->decoder->name);
-#endif
printf("\n");
}
- printf("\n");
- printf("Note, the names of encoders and decoders do not always match, so there are\n"
- "several cases where the above table shows encoder only or decoder only entries\n"
- "even though both encoding and decoding are supported. For example, the h263\n"
- "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
- "worse.\n");
return 0;
}
-int opt_bsfs(const char *opt, const char *arg)
+static void print_codecs(int encoder)
+{
+ const AVCodecDescriptor *desc = NULL;
+
+ printf("%s:\n"
+ " V..... = Video\n"
+ " A..... = Audio\n"
+ " S..... = Subtitle\n"
+ " .F.... = Frame-level multithreading\n"
+ " ..S... = Slice-level multithreading\n"
+ " ...X.. = Codec is experimental\n"
+ " ....B. = Supports draw_horiz_band\n"
+ " .....D = Supports direct rendering method 1\n"
+ " ------\n",
+ encoder ? "Encoders" : "Decoders");
+ while ((desc = avcodec_descriptor_next(desc))) {
+ const AVCodec *codec = NULL;
+
+ while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
+ printf(" %c", get_media_type_char(desc->type));
+ printf((codec->capabilities & CODEC_CAP_FRAME_THREADS) ? "F" : ".");
+ printf((codec->capabilities & CODEC_CAP_SLICE_THREADS) ? "S" : ".");
+ printf((codec->capabilities & CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
+ printf((codec->capabilities & CODEC_CAP_DRAW_HORIZ_BAND)?"B" : ".");
+ printf((codec->capabilities & CODEC_CAP_DR1) ? "D" : ".");
+
+ printf(" %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
+ if (strcmp(codec->name, desc->name))
+ printf(" (codec %s)", desc->name);
+
+ printf("\n");
+ }
+ }
+}
+
+int show_decoders(void *optctx, const char *opt, const char *arg)
+{
+ print_codecs(0);
+ return 0;
+}
+
+int show_encoders(void *optctx, const char *opt, const char *arg)
+{
+ print_codecs(1);
+ return 0;
+}
+
+int show_bsfs(void *optctx, const char *opt, const char *arg)
{
AVBitStreamFilter *bsf = NULL;
@@ -849,38 +1008,54 @@ int opt_bsfs(const char *opt, const char *arg)
return 0;
}
-int opt_protocols(const char *opt, const char *arg)
+int show_protocols(void *optctx, const char *opt, const char *arg)
{
- URLProtocol *up=NULL;
+ void *opaque = NULL;
+ const char *name;
printf("Supported file protocols:\n"
- "I.. = Input supported\n"
- ".O. = Output supported\n"
- "..S = Seek supported\n"
- "FLAGS NAME\n"
- "----- \n");
- while((up = av_protocol_next(up)))
- printf("%c%c%c %s\n",
- up->url_read ? 'I' : '.',
- up->url_write ? 'O' : '.',
- up->url_seek ? 'S' : '.',
- up->name);
+ "Input:\n");
+ while ((name = avio_enum_protocols(&opaque, 0)))
+ printf("%s\n", name);
+ printf("Output:\n");
+ while ((name = avio_enum_protocols(&opaque, 1)))
+ printf("%s\n", name);
return 0;
}
-int opt_filters(const char *opt, const char *arg)
+int show_filters(void *optctx, const char *opt, const char *arg)
{
AVFilter av_unused(**filter) = NULL;
+ char descr[64], *descr_cur;
+ int i, j;
+ const AVFilterPad *pad;
printf("Filters:\n");
#if CONFIG_AVFILTER
- while ((filter = av_filter_next(filter)) && *filter)
- printf("%-16s %s\n", (*filter)->name, (*filter)->description);
+ while ((filter = av_filter_next(filter)) && *filter) {
+ descr_cur = descr;
+ for (i = 0; i < 2; i++) {
+ if (i) {
+ *(descr_cur++) = '-';
+ *(descr_cur++) = '>';
+ }
+ pad = i ? (*filter)->outputs : (*filter)->inputs;
+ for (j = 0; pad[j].name; j++) {
+ if (descr_cur >= descr + sizeof(descr) - 4)
+ break;
+ *(descr_cur++) = get_media_type_char(pad[j].type);
+ }
+ if (!j)
+ *(descr_cur++) = '|';
+ }
+ *descr_cur = 0;
+ printf("%-16s %-10s %s\n", (*filter)->name, descr, (*filter)->description);
+ }
#endif
return 0;
}
-int opt_pix_fmts(const char *opt, const char *arg)
+int show_pix_fmts(void *optctx, const char *opt, const char *arg)
{
enum PixelFormat pix_fmt;
@@ -915,7 +1090,36 @@ int opt_pix_fmts(const char *opt, const char *arg)
return 0;
}
-int show_sample_fmts(const char *opt, const char *arg)
+int show_layouts(void *optctx, const char *opt, const char *arg)
+{
+ int i = 0;
+ uint64_t layout, j;
+ const char *name, *descr;
+
+ printf("Individual channels:\n"
+ "NAME DESCRIPTION\n");
+ for (i = 0; i < 63; i++) {
+ name = av_get_channel_name((uint64_t)1 << i);
+ if (!name)
+ continue;
+ descr = av_get_channel_description((uint64_t)1 << i);
+ printf("%-12s%s\n", name, descr);
+ }
+ printf("\nStandard channel layouts:\n"
+ "NAME DECOMPOSITION\n");
+ for (i = 0; !av_get_standard_channel_layout(i, &layout, &name); i++) {
+ if (name) {
+ printf("%-12s", name);
+ for (j = 1; j; j <<= 1)
+ if ((layout & j))
+ printf("%s%s", (layout & (j - 1)) ? "+" : "", av_get_channel_name(j));
+ printf("\n");
+ }
+ }
+ return 0;
+}
+
+int show_sample_fmts(void *optctx, const char *opt, const char *arg)
{
int i;
char fmt_str[128];
@@ -924,6 +1128,120 @@ int show_sample_fmts(const char *opt, const char *arg)
return 0;
}
+static void show_help_codec(const char *name, int encoder)
+{
+ const AVCodecDescriptor *desc;
+ const AVCodec *codec;
+
+ if (!name) {
+ av_log(NULL, AV_LOG_ERROR, "No codec name specified.\n");
+ return;
+ }
+
+ codec = encoder ? avcodec_find_encoder_by_name(name) :
+ avcodec_find_decoder_by_name(name);
+
+ if (codec)
+ print_codec(codec);
+ else if ((desc = avcodec_descriptor_get_by_name(name))) {
+ int printed = 0;
+
+ while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
+ printed = 1;
+ print_codec(codec);
+ }
+
+ if (!printed) {
+ av_log(NULL, AV_LOG_ERROR, "Codec '%s' is known to FFmpeg, "
+ "but no %s for it are available. FFmpeg might need to be "
+ "recompiled with additional external libraries.\n",
+ name, encoder ? "encoders" : "decoders");
+ }
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Codec '%s' is not recognized by FFmpeg.\n",
+ name);
+ }
+}
+
+static void show_help_demuxer(const char *name)
+{
+ const AVInputFormat *fmt = av_find_input_format(name);
+
+ if (!fmt) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
+ return;
+ }
+
+ printf("Demuxer %s [%s]:\n", fmt->name, fmt->long_name);
+
+ if (fmt->extensions)
+ printf(" Common extensions: %s.\n", fmt->extensions);
+
+ if (fmt->priv_class)
+ show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
+}
+
+static void show_help_muxer(const char *name)
+{
+ const AVCodecDescriptor *desc;
+ const AVOutputFormat *fmt = av_guess_format(name, NULL, NULL);
+
+ if (!fmt) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
+ return;
+ }
+
+ printf("Muxer %s [%s]:\n", fmt->name, fmt->long_name);
+
+ if (fmt->extensions)
+ printf(" Common extensions: %s.\n", fmt->extensions);
+ if (fmt->mime_type)
+ printf(" Mime type: %s.\n", fmt->mime_type);
+ if (fmt->video_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->video_codec))) {
+ printf(" Default video codec: %s.\n", desc->name);
+ }
+ if (fmt->audio_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->audio_codec))) {
+ printf(" Default audio codec: %s.\n", desc->name);
+ }
+ if (fmt->subtitle_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->subtitle_codec))) {
+ printf(" Default subtitle codec: %s.\n", desc->name);
+ }
+
+ if (fmt->priv_class)
+ show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM);
+}
+
+int show_help(void *optctx, const char *opt, const char *arg)
+{
+ char *topic, *par;
+ av_log_set_callback(log_callback_help);
+
+ topic = av_strdup(arg ? arg : "");
+ par = strchr(topic, '=');
+ if (par)
+ *par++ = 0;
+
+ if (!*topic) {
+ show_help_default(topic, par);
+ } else if (!strcmp(topic, "decoder")) {
+ show_help_codec(par, 0);
+ } else if (!strcmp(topic, "encoder")) {
+ show_help_codec(par, 1);
+ } else if (!strcmp(topic, "demuxer")) {
+ show_help_demuxer(par);
+ } else if (!strcmp(topic, "muxer")) {
+ show_help_muxer(par);
+ } else {
+ show_help_default(topic, par);
+ }
+
+ av_freep(&topic);
+ return 0;
+}
+
int read_yesno(void)
{
int c = getchar();
@@ -1012,7 +1330,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
if (!f && codec_name) {
snprintf(filename, filename_size,
"%s%s/%s-%s.ffpreset",
- base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
+ base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
preset_name);
f = fopen(filename, "r");
}
@@ -1024,60 +1342,14 @@ FILE *get_preset_file(char *filename, size_t filename_size,
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{
- if (*spec <= '9' && *spec >= '0') /* opt:index */
- return strtol(spec, NULL, 0) == st->index;
- else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
- *spec == 't') { /* opt:[vasdt] */
- enum AVMediaType type;
-
- switch (*spec++) {
- case 'v': type = AVMEDIA_TYPE_VIDEO; break;
- case 'a': type = AVMEDIA_TYPE_AUDIO; break;
- case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
- case 'd': type = AVMEDIA_TYPE_DATA; break;
- case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
- default: abort(); // never reached, silence warning
- }
- if (type != st->codec->codec_type)
- return 0;
- if (*spec++ == ':') { /* possibly followed by :index */
- int i, index = strtol(spec, NULL, 0);
- for (i = 0; i < s->nb_streams; i++)
- if (s->streams[i]->codec->codec_type == type && index-- == 0)
- return i == st->index;
- return 0;
- }
- return 1;
- } else if (*spec == 'p' && *(spec + 1) == ':') {
- int prog_id, i, j;
- char *endptr;
- spec += 2;
- prog_id = strtol(spec, &endptr, 0);
- for (i = 0; i < s->nb_programs; i++) {
- if (s->programs[i]->id != prog_id)
- continue;
-
- if (*endptr++ == ':') {
- int stream_idx = strtol(endptr, NULL, 0);
- return stream_idx >= 0 &&
- stream_idx < s->programs[i]->nb_stream_indexes &&
- st->index == s->programs[i]->stream_index[stream_idx];
- }
-
- for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)
- if (st->index == s->programs[i]->stream_index[j])
- return 1;
- }
- return 0;
- } else if (!*spec) /* empty specifier, matches everything */
- return 1;
-
- av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
- return AVERROR(EINVAL);
+ int ret = avformat_match_stream_specifier(s, st, spec);
+ if (ret < 0)
+ av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
+ return ret;
}
-AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
- AVFormatContext *s, AVStream *st)
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec)
{
AVDictionary *ret = NULL;
AVDictionaryEntry *t = NULL;
@@ -1087,6 +1359,9 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
const AVClass *cc = avcodec_get_class();
if (!codec)
+ codec = s->oformat ? avcodec_find_encoder(codec_id)
+ : avcodec_find_decoder(codec_id);
+ if (!codec)
return NULL;
switch (codec->type) {
@@ -1146,8 +1421,8 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
return NULL;
}
for (i = 0; i < s->nb_streams; i++)
- opts[i] = filter_codec_opts(codec_opts, avcodec_find_decoder(s->streams[i]->codec->codec_id),
- s, s->streams[i]);
+ opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
+ s, s->streams[i], NULL);
return opts;
}
@@ -1169,3 +1444,149 @@ void *grow_array(void *array, int elem_size, int *size, int new_size)
}
return array;
}
+
+static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)
+{
+ FrameBuffer *buf = av_mallocz(sizeof(*buf));
+ int i, ret;
+ const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
+ int h_chroma_shift, v_chroma_shift;
+ int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
+ int w = s->width, h = s->height;
+
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ avcodec_align_dimensions(s, &w, &h);
+
+ if (!(s->flags & CODEC_FLAG_EMU_EDGE)) {
+ w += 2*edge;
+ h += 2*edge;
+ }
+
+ if ((ret = av_image_alloc(buf->base, buf->linesize, w, h,
+ s->pix_fmt, 32)) < 0) {
+ av_freep(&buf);
+ av_log(s, AV_LOG_ERROR, "alloc_buffer: av_image_alloc() failed\n");
+ return ret;
+ }
+ /* XXX this shouldn't be needed, but some tests break without this line
+ * those decoders are buggy and need to be fixed.
+ * the following tests fail:
+ * cdgraphics, ansi, aasc, fraps-v1, qtrle-1bit
+ */
+ memset(buf->base[0], 128, ret);
+
+ avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
+ for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
+ const int h_shift = i==0 ? 0 : h_chroma_shift;
+ const int v_shift = i==0 ? 0 : v_chroma_shift;
+ if ((s->flags & CODEC_FLAG_EMU_EDGE) || !buf->linesize[i] || !buf->base[i])
+ buf->data[i] = buf->base[i];
+ else
+ buf->data[i] = buf->base[i] +
+ FFALIGN((buf->linesize[i]*edge >> v_shift) +
+ (pixel_size*edge >> h_shift), 32);
+ }
+ buf->w = s->width;
+ buf->h = s->height;
+ buf->pix_fmt = s->pix_fmt;
+ buf->pool = pool;
+
+ *pbuf = buf;
+ return 0;
+}
+
+int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
+{
+ FrameBuffer **pool = s->opaque;
+ FrameBuffer *buf;
+ int ret, i;
+
+ if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0) {
+ av_log(s, AV_LOG_ERROR, "codec_get_buffer: image parameters invalid\n");
+ return -1;
+ }
+
+ if (!*pool && (ret = alloc_buffer(pool, s, pool)) < 0)
+ return ret;
+
+ buf = *pool;
+ *pool = buf->next;
+ buf->next = NULL;
+ if (buf->w != s->width || buf->h != s->height || buf->pix_fmt != s->pix_fmt) {
+ av_freep(&buf->base[0]);
+ av_free(buf);
+ if ((ret = alloc_buffer(pool, s, &buf)) < 0)
+ return ret;
+ }
+ av_assert0(!buf->refcount);
+ buf->refcount++;
+
+ frame->opaque = buf;
+ frame->type = FF_BUFFER_TYPE_USER;
+ frame->extended_data = frame->data;
+ frame->pkt_pts = s->pkt ? s->pkt->pts : AV_NOPTS_VALUE;
+ frame->width = buf->w;
+ frame->height = buf->h;
+ frame->format = buf->pix_fmt;
+ frame->sample_aspect_ratio = s->sample_aspect_ratio;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
+ frame->base[i] = buf->base[i]; // XXX h264.c uses base though it shouldn't
+ frame->data[i] = buf->data[i];
+ frame->linesize[i] = buf->linesize[i];
+ }
+
+ return 0;
+}
+
+static void unref_buffer(FrameBuffer *buf)
+{
+ FrameBuffer **pool = buf->pool;
+
+ av_assert0(buf->refcount > 0);
+ buf->refcount--;
+ if (!buf->refcount) {
+ FrameBuffer *tmp;
+ for(tmp= *pool; tmp; tmp= tmp->next)
+ av_assert1(tmp != buf);
+
+ buf->next = *pool;
+ *pool = buf;
+ }
+}
+
+void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
+{
+ FrameBuffer *buf = frame->opaque;
+ int i;
+
+ if(frame->type!=FF_BUFFER_TYPE_USER) {
+ avcodec_default_release_buffer(s, frame);
+ return;
+ }
+
+ for (i = 0; i < FF_ARRAY_ELEMS(frame->data); i++)
+ frame->data[i] = NULL;
+
+ unref_buffer(buf);
+}
+
+void filter_release_buffer(AVFilterBuffer *fb)
+{
+ FrameBuffer *buf = fb->priv;
+ av_free(fb);
+ unref_buffer(buf);
+}
+
+void free_buffer_pool(FrameBuffer **pool)
+{
+ FrameBuffer *buf = *pool;
+ while (buf) {
+ *pool = buf->next;
+ av_freep(&buf->base[0]);
+ av_free(buf);
+ buf = *pool;
+ }
+}
View
168 cmdutils.h
@@ -51,6 +51,7 @@ extern const int this_year;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts;
+extern struct SwrContext *swr_opts;
extern AVDictionary *format_opts, *codec_opts;
/**
@@ -74,23 +75,25 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
* Fallback for options that are not explicitly handled, these will be
* parsed through AVOptions.
*/
-int opt_default(const char *opt, const char *arg);
+int opt_default(void *optctx, const char *opt, const char *arg);
/**
* Set the libav* libraries log level.
*/
-int opt_loglevel(const char *opt, const char *arg);
+int opt_loglevel(void *optctx, const char *opt, const char *arg);
int opt_report(const char *opt);
-int opt_max_alloc(const char *opt, const char *arg);
+int opt_max_alloc(void *optctx, const char *opt, const char *arg);
-int opt_codec_debug(const char *opt, const char *arg);
+int opt_cpuflags(void *optctx, const char *opt, const char *arg);
+
+int opt_codec_debug(void *optctx, const char *opt, const char *arg);
/**
* Limit the execution time.
*/
-int opt_timelimit(const char *opt, const char *arg);
+int opt_timelimit(void *optctx, const char *opt, const char *arg);
/**
* Parse a string and return its corresponding value as a double.
@@ -105,7 +108,8 @@ int opt_timelimit(const char *opt, const char *arg);
* @param min the minimum valid accepted value
* @param max the maximum valid accepted value
*/
-double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
+double parse_number_or_die(const char *context, const char *numstr, int type,
+ double min, double max);
/**
* Parse a string specifying a time and return its corresponding
@@ -121,7 +125,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
*
* @see parse_date()
*/
-int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
+int64_t parse_time_or_die(const char *context, const char *timestr,
+ int is_duration);
typedef struct SpecifierOpt {
char *specifier; /**< stream/chapter/program/... specifier */
@@ -143,14 +148,14 @@ typedef struct {
#define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020
-#define OPT_GRAB 0x0040
#define OPT_INT 0x0080
#define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200
#define OPT_INT64 0x0400
#define OPT_EXIT 0x0800
#define OPT_DATA 0x1000
-#define OPT_FUNC2 0x2000
+#define OPT_PERFILE 0x2000 /* the option is per-file (currently ffmpeg-only).
+ implied by OPT_OFFSET or OPT_SPEC */
#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
#define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt.
Implies OPT_OFFSET. Next element after the offset is
@@ -159,15 +164,24 @@ typedef struct {
#define OPT_DOUBLE 0x20000
union {
void *dst_ptr;
- int (*func_arg)(const char *, const char *);
- int (*func2_arg)(void *, const char *, const char *);
+ int (*func_arg)(void *, const char *, const char *);
size_t off;
} u;
const char *help;
const char *argname;
} OptionDef;
-void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
+/**
+ * Print help for all options matching specified flags.
+ *
+ * @param options a list of options
+ * @param msg title of this group. Only printed if at least one option matches.
+ * @param req_flags print only options which have all those flags set.
+ * @param rej_flags don't print options which have any of those flags set.
+ * @param alt_flags print only options that have at least one of those flags set
+ */
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags, int alt_flags);
/**
* Show help for all options with given flags in class and all its
@@ -176,6 +190,17 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
void show_help_children(const AVClass *class, int flags);
/**
+ * Per-avtool specific help handler. Implemented in each
+ * avtool, called by show_help().
+ */
+void show_help_default(const char *opt, const char *arg);
+
+/**
+ * Generic -h handler common to all avtools.
+ */
+int show_help(void *optctx, const char *opt, const char *arg);
+
+/**
* Parse the command line arguments.
*
* @param optctx an opaque options context
@@ -193,7 +218,8 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
*
* @return on success 1 if arg was consumed, 0 otherwise; negative number on error
*/
-int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options);
+int parse_option(void *optctx, const char *opt, const char *arg,
+ const OptionDef *options);
/**
* Find the '-loglevel' option in the command line args and apply it.
@@ -201,6 +227,12 @@ int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef
void parse_loglevel(int argc, char **argv, const OptionDef *options);
/**
+ * Return index of option opt in argv or 0 if not found.
+ */
+int locate_option(int argc, char **argv, const OptionDef *options,
+ const char *optname);
+
+/**
* Check if the given stream matches a stream specifier.
*
* @param s Corresponding format context.
@@ -219,9 +251,12 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
*
* @param s Corresponding format context.
* @param st A stream from s for which the options should be filtered.
+ * @param codec The particular codec for which the options should be filtered.
+ * If null, the default one is looked up according to the codec id.
* @return a pointer to the created dictionary
*/
-AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st);
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec);
/**
* Setup AVCodecContext options for avformat_find_stream_info().
@@ -234,7 +269,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatCont
* @return pointer to the created array of dictionaries, NULL if it
* cannot be created
*/
-AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts);
+AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
+ AVDictionary *codec_opts);
/**
* Print an error message to stderr, indicating filename and a human
@@ -260,62 +296,81 @@ void show_banner(int argc, char **argv, const OptionDef *options);
* libraries.
* This option processing function does not utilize the arguments.
*/
-int opt_version(const char *opt, const char *arg);
+int show_version(void *optctx, const char *opt, const char *arg);
/**
* Print the license of the program to stdout. The license depends on
* the license of the libraries compiled into the program.
* This option processing function does not utilize the arguments.
*/
-int opt_license(const char *opt, const char *arg);
+int show_license(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the formats supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_formats(const char *opt, const char *arg);
+int show_formats(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the codecs supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_codecs(const char *opt, const char *arg);
+int show_codecs(void *optctx, const char *opt, const char *arg);
+
+/**
+ * Print a listing containing all the decoders supported by the
+ * program.
+ */
+int show_decoders(void *optctx, const char *opt, const char *arg);
+
+/**
+ * Print a listing containing all the encoders supported by the
+ * program.
+ */
+int show_encoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_filters(const char *opt, const char *arg);
+int show_filters(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the bit stream filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_bsfs(const char *opt, const char *arg);
+int show_bsfs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the protocols supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_protocols(const char *opt, const char *arg);
+int show_protocols(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the pixel formats supported by the
* program.
* This option processing function does not utilize the arguments.
*/
-int opt_pix_fmts(const char *opt, const char *arg);
+int show_pix_fmts(void *optctx, const char *opt, const char *arg);
+
+/**
+ * Print a listing containing all the standard channel layouts supported by
+ * the program.
+ * This option processing function does not utilize the arguments.
+ */
+int show_layouts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the sample formats supported by the
* program.
*/
-int show_sample_fmts(const char *opt, const char *arg);
+int show_sample_fmts(void *optctx, const char *opt, const char *arg);
/**
* Return a positive value if a line read from standard input
@@ -343,7 +398,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
* at configuration time or in a "ffpresets" folder along the executable
* on win32, in that order. If no such file is found and
* codec_name is defined, then search for a file named
- * codec_name-preset_name.ffpreset in the above-mentioned directories.
+ * codec_name-preset_name.avpreset in the above-mentioned directories.
*
* @param filename buffer where the name of the found filename is written
* @param filename_size size in bytes of the filename buffer
@@ -359,7 +414,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
* Do all the necessary cleanup and abort.
* This function is implemented in the avtools, not cmdutils.
*/
-void exit_program(int ret);
+av_noreturn void exit_program(int ret);
/**
* Realloc array to hold new_size elements of elem_size.
@@ -371,4 +426,65 @@ void exit_program(int ret);
*/
void *grow_array(void *array, int elem_size, int *size, int new_size);
+typedef struct FrameBuffer {
+ uint8_t *base[4];
+ uint8_t *data[4];
+ int linesize[4];
+
+ int h, w;
+ enum PixelFormat pix_fmt;
+
+ int refcount;
+ struct FrameBuffer **pool; ///< head of the buffer pool
+ struct FrameBuffer *next;
+} FrameBuffer;
+
+/**
+ * Get a frame from the pool. This is intended to be used as a callback for
+ * AVCodecContext.get_buffer.
+ *
+ * @param s codec context. s->opaque must be a pointer to the head of the
+ * buffer pool.
+ * @param frame frame->opaque will be set to point to the FrameBuffer
+ * containing the frame data.
+ */
+int codec_get_buffer(AVCodecContext *s, AVFrame *frame);
+
+/**
+ * A callback to be used for AVCodecContext.release_buffer along with
+ * codec_get_buffer().
+ */
+void codec_release_buffer(AVCodecContext *s, AVFrame *frame);
+
+/**
+ * A callback to be used for AVFilterBuffer.free.
+ * @param fb buffer to free. fb->priv must be a pointer to the FrameBuffer
+ * containing the buffer data.
+ */
+void filter_release_buffer(AVFilterBuffer *fb);
+
+/**
+ * Free all the buffers in the pool. This must be called after all the
+ * buffers have been released.
+ */
+void free_buffer_pool(FrameBuffer **pool);
+
+#define GET_PIX_FMT_NAME(pix_fmt)\
+ const char *name = av_get_pix_fmt_name(pix_fmt);
+
+#define GET_SAMPLE_FMT_NAME(sample_fmt)\
+ const char *name = av_get_sample_fmt_name(sample_fmt)
+
+#define GET_SAMPLE_RATE_NAME(rate)\
+ char name[16];\
+ snprintf(name, sizeof(name), "%d", rate);
+
+#define GET_CH_LAYOUT_NAME(ch_layout)\
+ char name[16];\
+ snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
+
+#define GET_CH_LAYOUT_DESC(ch_layout)\
+ char name[128];\
+ av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
+
#endif /* CMDUTILS_H */
View
39 cmdutils_common_opts.h
@@ -1,18 +1,23 @@
- { "L", OPT_EXIT, {(void*)opt_license}, "show license" },
- { "h", OPT_EXIT, {(void*)opt_help}, "show help" },
- { "?", OPT_EXIT, {(void*)opt_help}, "show help" },
- { "help", OPT_EXIT, {(void*)opt_help}, "show help" },
- { "-help", OPT_EXIT, {(void*)opt_help}, "show help" },
- { "version", OPT_EXIT, {(void*)opt_version}, "show version" },
- { "formats" , OPT_EXIT, {(void*)opt_formats }, "show available formats" },
- { "codecs" , OPT_EXIT, {(void*)opt_codecs }, "show available codecs" },
- { "bsfs" , OPT_EXIT, {(void*)opt_bsfs }, "show available bit stream filters" },
- { "protocols", OPT_EXIT, {(void*)opt_protocols}, "show available protocols" },
- { "filters", OPT_EXIT, {(void*)opt_filters }, "show available filters" },
- { "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" },
+ { "L" , OPT_EXIT, {.func_arg = show_license}, "show license" },
+ { "h" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "?" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
+ { "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
+ { "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
+ { "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
+ { "encoders" , OPT_EXIT, {.func_arg = show_encoders }, "show available encoders" },
+ { "bsfs" , OPT_EXIT, {.func_arg = show_bsfs }, "show available bit stream filters" },
+ { "protocols" , OPT_EXIT, {.func_arg = show_protocols}, "show available protocols" },
+ { "filters" , OPT_EXIT, {.func_arg = show_filters }, "show available filters" },
+ { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
+ { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
- { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
- { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
- { "debug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" },